|
|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using OMS.NET.Common;
|
|
|
|
|
using OMS.NET.DbClass;
|
|
|
|
|
|
|
|
|
|
namespace OMS.NET.Instructs
|
|
|
|
|
{
|
|
|
|
|
@ -6,6 +8,7 @@ namespace OMS.NET.Instructs
|
|
|
|
|
{
|
|
|
|
|
public DeleteElementInstruct()
|
|
|
|
|
{
|
|
|
|
|
Type = "broadcast";
|
|
|
|
|
Class = "deleteElement";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -15,17 +18,91 @@ namespace OMS.NET.Instructs
|
|
|
|
|
{
|
|
|
|
|
if (!GlobalArea.LoginCheckByID(wsid)) return;//登录检查不通过则直接退出
|
|
|
|
|
if (Data?.GetType() != typeof(JsonElement)) return;//Data 非空和JsonElement类型检查
|
|
|
|
|
string conveyor = GlobalArea.GetLoginEmailByID(wsid);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string conveyor = GlobalArea.GetLoginEmailByID(wsid);
|
|
|
|
|
//解析id和tmpId
|
|
|
|
|
long id = Data.GetProperty("id").GetInt64();
|
|
|
|
|
string tmpId = Data.GetProperty("tmpId").GetString();
|
|
|
|
|
//需要先实现activeData相关
|
|
|
|
|
MapData mapData = MapData.Get(id) ?? throw new Exception($"Element{id}不存在");
|
|
|
|
|
mapData.Phase = 2;
|
|
|
|
|
int row = MapData.Update(mapData);
|
|
|
|
|
if (row == -1) throw new Exception("数据库修改失败");
|
|
|
|
|
if (GlobalArea.IsElementExit(id))
|
|
|
|
|
{
|
|
|
|
|
GlobalArea.RemoveActiveDataElement(id);
|
|
|
|
|
ResponseOrBroadcastInstructs.Add(new Instruct()
|
|
|
|
|
{
|
|
|
|
|
IsBroadcast = true,
|
|
|
|
|
Type = "broadcast",
|
|
|
|
|
Class = "pickSelectEndElements",
|
|
|
|
|
Conveyor = conveyor,
|
|
|
|
|
Time = GlobalArea.GetCurrentTime(),
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
id = id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
ResponseOrBroadcastInstructs.Add(new Instruct()
|
|
|
|
|
{
|
|
|
|
|
IsResponse = true,
|
|
|
|
|
Type = "send_correct",
|
|
|
|
|
Class = "delete",
|
|
|
|
|
Conveyor = conveyor,
|
|
|
|
|
Time = GlobalArea.GetCurrentTime(),
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
rid = id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
ResponseOrBroadcastInstructs.Add(new Instruct()
|
|
|
|
|
{
|
|
|
|
|
IsBroadcast = true,
|
|
|
|
|
Type = "broadcast",
|
|
|
|
|
Class = "deleteElement",
|
|
|
|
|
Conveyor = conveyor,
|
|
|
|
|
Time = GlobalArea.GetCurrentTime(),
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
id = id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
LayerData layer = GlobalArea.GetLayerDataByTemplateId(tmpId)!;
|
|
|
|
|
layer.DeleteElement(id);
|
|
|
|
|
ResponseOrBroadcastInstructs.Add(new Instruct()
|
|
|
|
|
{
|
|
|
|
|
IsBroadcast = true,
|
|
|
|
|
Type = "broadcast",
|
|
|
|
|
Class = "updateLayerData",
|
|
|
|
|
Conveyor = conveyor,
|
|
|
|
|
Time = GlobalArea.GetCurrentTime(),
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
id = layer.LayerId,
|
|
|
|
|
members = layer.Members!.ToString(),
|
|
|
|
|
structure = layer.Structure!.ToString(),
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GlobalArea.Log.Warn($"处理{Class}广播指令出错:" + ex.Message);
|
|
|
|
|
//ResponseOrBroadcastInstructs.Clear();
|
|
|
|
|
ResponseOrBroadcastInstructs.Add(new Instruct()
|
|
|
|
|
{
|
|
|
|
|
IsResponse = true,
|
|
|
|
|
Type = "send_error",
|
|
|
|
|
Class = "delete",
|
|
|
|
|
Conveyor = conveyor,
|
|
|
|
|
Time = GlobalArea.GetCurrentTime(),
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
source = Data,
|
|
|
|
|
message = ex.Message
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|