You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
|
|
using System.Text.Json;
|
|
using OMS.NET.Common;
|
|
using OMS.NET.DbClass;
|
|
|
|
namespace OMS.NET.Instructs
|
|
{
|
|
public class SelectEndElementInstruct : Instruct
|
|
{
|
|
public SelectEndElementInstruct()
|
|
{
|
|
Type = "broadcast";
|
|
Class = "selectEndElement";
|
|
}
|
|
|
|
public override Task Handler(string wsid)
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
if (!GlobalArea.LoginCheckByID(wsid)) return;//登录检查,不通过则直接退出
|
|
if (Data?.GetType() != typeof(JsonElement)) return;//Data 非空和JsonElement类型检查
|
|
try
|
|
{
|
|
long id = Data.GetInt64();
|
|
string conveyor = GlobalArea.GetLoginEmailByID(wsid);
|
|
if (GlobalArea.IsElementExit(id))//已存在activedata项
|
|
{
|
|
ActiveDataElement activeDataElement = GlobalArea.GetActiveDataElement(id)!;
|
|
if (activeDataElement.Select?.Email == conveyor)
|
|
{
|
|
activeDataElement.Select = null;
|
|
string time = GlobalArea.GetCurrentTime();
|
|
ResponseOrBroadcastInstructs.Add(new SelectEndElementInstruct()
|
|
{
|
|
IsBroadcast = true,
|
|
Conveyor = conveyor,
|
|
Time = time,
|
|
Data = id
|
|
});
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
GlobalArea.Log.Warn($"处理{this.Class}广播指令出错:" + ex.Message);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |