|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using OMS.NET.Common;
|
|
|
|
|
|
|
|
|
|
namespace OMS.NET.Instructs
|
|
|
|
|
{
|
|
|
|
|
@ -18,8 +19,30 @@ namespace OMS.NET.Instructs
|
|
|
|
|
if (Data?.GetType() != typeof(JsonElement)) return;//Data 非空和JsonElement类型检查
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//string conveyor = GlobalArea.GetLoginEmailByID(wsid);
|
|
|
|
|
|
|
|
|
|
long id = Data.GetProperty("id").GetInt64();
|
|
|
|
|
string name = Data.GetProperty("name").GetString();
|
|
|
|
|
if (GlobalArea.IsLayerNameRepeat(name)) throw new Exception("存在名称重复");
|
|
|
|
|
LayerData layerData = GlobalArea.GetLayerDataByLayerId(id) ?? throw new Exception($"未找到MapLayer {id}");
|
|
|
|
|
layerData.Structure!.AsArray().RemoveAt(0);
|
|
|
|
|
layerData.Structure!.AsArray().Insert(0, name);
|
|
|
|
|
layerData.UpdateToDb();
|
|
|
|
|
|
|
|
|
|
string conveyor = GlobalArea.GetLoginEmailByID(wsid);
|
|
|
|
|
string time = GlobalArea.GetCurrentTime();
|
|
|
|
|
ResponseOrBroadcastInstructs.Add(new Instruct()
|
|
|
|
|
{
|
|
|
|
|
IsBroadcast = true,
|
|
|
|
|
Type = "broadcast",
|
|
|
|
|
Class = "renameLayer",
|
|
|
|
|
Conveyor = conveyor,
|
|
|
|
|
Time = time,
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
id = id,
|
|
|
|
|
name = name,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|