From 82e5d2df096e55f1142106657668b87c8cfedda3 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期一, 23 六月 2025 09:09:01 +0800 Subject: [PATCH] aux --- 2025年6月12日/AuxAllWCS/Build/Project/代码/ViewModel.cs | 726 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 369 insertions(+), 357 deletions(-) diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs" index 9013fa8..4a728c5 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/ViewModel.cs" @@ -28,30 +28,29 @@ using GZ.DB.Repository.OIDATABASE; using GZ.DB.IRepository.OIDATABASE; using GZ.DB.Entity.OIDATABASE; -using GZ.Modular.Redis; namespace GZ.Projects.AuxAllWCS { - public partial class ViewModel : System.ComponentModel.INotifyPropertyChanged - { - #region 绉佹湁鍙橀噺 - //闆嗘垚浜掕仈 - private Conn Conn = new Conn(); - //璁惧閫氫俊 - private Device Device = new Device(); - //鍙橀噺鏁版嵁搴�- private Tag tag = new Tag(); - public Tag Tag - { - get { return tag; } - set { tag = value; RaisePropertyChanged(nameof(Tag)); } - } - //绠�寲PLC - public EasyPLC EasyPLC = new EasyPLC(); - #endregion - - #region 鏋勯�鍑芥暟 - private static ViewModel _ViewModel = null; - private static List<object> _Windows = new List<object>(); + public partial class ViewModel : System.ComponentModel.INotifyPropertyChanged + { + #region 绉佹湁鍙橀噺 + //闆嗘垚浜掕仈 + private Conn Conn = new Conn(); + //璁惧閫氫俊 + private Device Device = new Device(); + //鍙橀噺鏁版嵁搴�+ private Tag tag = new Tag(); + public Tag Tag + { + get { return tag; } + set { tag = value; RaisePropertyChanged(nameof(Tag)); } + } + //绠�寲PLC + public EasyPLC EasyPLC = new EasyPLC(); + #endregion + + #region 鏋勯�鍑芥暟 + private static ViewModel _ViewModel = null; + private static List<object> _Windows = new List<object>(); public static ViewModel CreateInstance(object obj, Type type) { if (_ViewModel == null) @@ -60,47 +59,49 @@ } if (!_Windows.Contains(obj)) { - _Windows.Add(obj); + _Windows.Add(obj); } return _ViewModel; } - public ViewModel() - { - - } - #endregion - - #region 鑷畾涔夋寚浠�-public void Method1(System.Int32 param1) -{ - #region [鑷畾涔夋寚浠[20250323111354905][Method1] - - #endregion [鑷畾涔夋寚浠[20250323111354905][Method1] -} -public void SettingInit() -{ - #region [鑷畾涔夋寚浠[20250323144605974][SettingInit] -try -{ - var jsonFile = System.AppDomain.CurrentDomain.BaseDirectory + "/Static/config.json"; - using (System.IO.StreamReader file = System.IO.File.OpenText(jsonFile)) - { - using (JsonTextReader reader = new JsonTextReader(file)) + public ViewModel() { - JObject o = (JObject)JToken.ReadFrom(reader); - foreach (Newtonsoft.Json.Linq.JProperty keyValue in o.Properties()) + + } + #endregion + + #region 鑷畾涔夋寚浠�+ public void Method1(System.Int32 param1) + { + #region [鑷畾涔夋寚浠[20250323111354905][Method1] + + #endregion [鑷畾涔夋寚浠[20250323111354905][Method1] + } + public void SettingInit() + { + #region [鑷畾涔夋寚浠[20250323144605974][SettingInit] + try { - Console.WriteLine(keyValue.Name); - if (keyValue.Name == "HostToAgvServerUrl") + var jsonFile = System.AppDomain.CurrentDomain.BaseDirectory + "/Static/config.json"; + using (System.IO.StreamReader file = System.IO.File.OpenText(jsonFile)) { - Settings.HostToAgvServerUrl = keyValue.Value.ToString(); - } - if (keyValue.Name == "deviceInfo") { - Settings.deviceInfos = JsonConvert.DeserializeObject<List<deviceInfo>>(keyValue.Value.ToString()); - } - if (keyValue.Name == "HKbaseUrl") { - Settings.HKbaseUrl = keyValue.Value.ToString(); - } + using (JsonTextReader reader = new JsonTextReader(file)) + { + JObject o = (JObject)JToken.ReadFrom(reader); + foreach (Newtonsoft.Json.Linq.JProperty keyValue in o.Properties()) + { + Console.WriteLine(keyValue.Name); + if (keyValue.Name == "HostToAgvServerUrl") + { + Settings.HostToAgvServerUrl = keyValue.Value.ToString(); + } + if (keyValue.Name == "deviceInfo") + { + Settings.deviceInfos = JsonConvert.DeserializeObject<List<deviceInfo>>(keyValue.Value.ToString()); + } + if (keyValue.Name == "HKbaseUrl") + { + Settings.HKbaseUrl = keyValue.Value.ToString(); + } if (keyValue.Name == "MESbaseUrl") { Settings.MESbaseUrl = keyValue.Value.ToString(); @@ -109,22 +110,22 @@ { Settings.WMSbaseUrl = keyValue.Value.ToString(); } + } + } + } + //if(!Settings.FirstG) + //LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 瀹屾垚"); } + catch (Exception ex) + { + LogHelper.Error("鍔犺浇閰嶇疆鏂囦欢澶辫触锛� + ex.Message, ex); + } + #endregion [鑷畾涔夋寚浠[20250323144605974][SettingInit] } - } - //if(!Settings.FirstG) - //LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 瀹屾垚"); -} -catch (Exception ex) -{ - LogHelper.Error("鍔犺浇閰嶇疆鏂囦欢澶辫触锛� + ex.Message, ex); -} - #endregion [鑷畾涔夋寚浠[20250323144605974][SettingInit] -} -public void OperateHKTaskStatus(System.Object param1) -{ - #region [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus] -HaiKangOrderInfo model = (HaiKangOrderInfo)param1; + public void OperateHKTaskStatus(System.Object param1) + { + #region [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus] + HaiKangOrderInfo model = (HaiKangOrderInfo)param1; if (string.IsNullOrEmpty(model.taskCode)) return; // 鏌ヨ浠诲姟锛氭牴鎹换鍔″彿 @@ -174,16 +175,17 @@ { if (device.deviceName.Contains("缁村笇灏旀姄鑷�)) { //鍗歌揣杩涜娓呯┖锛岃Е鍙戞壂鐮�- var inde = device.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0; - string V = inde ? "R05" : "R06"; - Conn.榛樿Redis.SetValue(device.deviceName + "." + V, "true", device.deviceName + "Queue"); - TcpServer.TrayIps.Remove(device.deviceNo[inde ? 0 : 1]); + var inde = device.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0; + string V = inde ? "R05" : "R06"; + Conn.榛樿Redis.SetValue(device.deviceName + "." + V, "true", device.deviceName + "Queue"); + TcpServer.TrayIps.Remove(device.deviceNo[inde ? 0 : 1]); } } - else if(device.deviceType == 2){ - var inde = device.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0; - string V = inde? "D1224" : "D1225"; - Conn.榛樿Redis.SetValue(device.deviceName + "." + V, "0", device.deviceName + "Queue"); + else if (device.deviceType == 2) + { + var inde = device.location.ToList().FindIndex(x => x == wcsTask.S_START_LOC) == 0; + string V = inde ? "D1224" : "D1225"; + Conn.榛樿Redis.SetValue(device.deviceName + "." + V, "0", device.deviceName + "Queue"); } } //LocationHelper.UnLockLoc(wcsTask.S_START_LOC); @@ -216,7 +218,7 @@ endLoc.N_CURRENT_NUM = 1; endLoc.T_MODIFY = DateTime.Now; MainMissionService.Update(wcsTask); - if(Settings.deviceInfos.Find(x=>x.deviceType==2 && (/*x.location.Contains(wcsTask.S_END_LOC)||*/x.deviceNo.Contains(wcsTask.S_END_LOC)))!=null) + if (Settings.deviceInfos.Find(x => x.deviceType == 2 && (/*x.location.Contains(wcsTask.S_END_LOC)||*/x.deviceNo.Contains(wcsTask.S_END_LOC))) != null) locrep.Update(endLoc); //locContainerRepository2.Insert(llls); @@ -234,9 +236,7 @@ //string V = inde ? "R05" : "R06"; //Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "true", device2.deviceName + "Queue"); string V2 = inde ? "R10_LAST" : "R11_LAST"; - //Conn.榛樿Redis.SetValue(device2.deviceName + "." + V2, "true", device2.deviceName + "Queue"); - - RedisHelper.Add(device2.deviceName + "." + V2, "true", out string msg1); + Conn.榛樿Redis.SetValue(device2.deviceName + "." + V2, "true", device2.deviceName + "Queue"); TcpServer.TrayIps.Remove(device2.deviceNo[inde ? 0 : 1]); } } @@ -244,7 +244,7 @@ if (device2.deviceName.Contains("Js鎹烽『")) { var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0; - string V = inde? "D1224" : "D1225"; + string V = inde ? "D1224" : "D1225"; Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "1", device2.deviceName + "Queue"); var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new @@ -276,13 +276,14 @@ var tare = taskActRepository.FindList(x => x.S_TASK_NO == wcsTask.S_TASK_NO); if (tare.Any()) { - if(tare.Find(x=>x.S_ACTION_CODE=="outbin")==null) + if (tare.Find(x => x.S_ACTION_CODE == "outbin") == null) { startloc.S_LOCK_STATE = "鏃�; endLoc.S_LOCK_STATE = "鏃�; locrep.Update(startloc); locrep.Update(endLoc); - }else if (tare.Find(x => x.S_ACTION_CODE == "end") == null) + } + else if (tare.Find(x => x.S_ACTION_CODE == "end") == null) { endLoc.S_LOCK_STATE = "鏃�; locrep.Update(endLoc); @@ -303,16 +304,16 @@ if (!string.IsNullOrEmpty(wcsTask.S_SRC_NO)) { var mestask = MainMissionService.FindEntity(x => x.S_TASK_NO == wcsTask.S_SRC_NO); - if (mestask!=null&&bobe) + if (mestask != null && bobe) { - if ( model.method != "end") + if (model.method != "end") { - if (mestask.S_START_LOC == wcsTask.S_START_LOC&&mestask.S_B_STATE == "MES") - Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new - { - reqCode = wcsTask.S_SRC_NO, - model.method - })); + if (mestask.S_START_LOC == wcsTask.S_START_LOC && mestask.S_B_STATE == "MES") + Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new + { + reqCode = wcsTask.S_SRC_NO, + model.method + })); } else { @@ -322,7 +323,7 @@ mestask.N_PRIORITY = -88; MainMissionService.Update(mestask); } - else if(mestask.S_B_STATE == "MES") + else if (mestask.S_B_STATE == "MES") { var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new { @@ -332,21 +333,22 @@ } } - }else if(mestask!=null && model.method== "cancel") + } + else if (mestask != null && model.method == "cancel") { - if(mestask.S_B_STATE == "MES") - Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new - { - reqCode = wcsTask.S_SRC_NO, - model.method - })); + if (mestask.S_B_STATE == "MES") + Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", JsonConvert.SerializeObject(new + { + reqCode = wcsTask.S_SRC_NO, + model.method + })); LogHelper.Info($"{wcsTask.S_SRC_NO}-{wcsTask.S_TASK_NO} 涓�樁娈靛彇娑堬紝閲嶇疆鐐癸紝绾跨▼澶勭悊銆�); mestask.N_PRIORITY = -1; mestask.S_B_STATE = "MES_鍙栨秷"; MainMissionService.Update(mestask); } } - TaskProcess.AddActionRecord(model.taskCode, model.method, model.eqpCode, model.data,wcsTask.S_START_LOC,wcsTask.S_END_LOC); + TaskProcess.AddActionRecord(model.taskCode, model.method, model.eqpCode, model.data, wcsTask.S_START_LOC, wcsTask.S_END_LOC); //璋冪敤绗笁鏂规帴鍙o紙濡傛灉鏈夛級TaskProcess.ReportStatus } else @@ -361,95 +363,97 @@ { LogHelper.Info($"褰撳墠浠诲姟鍙蜂换鍔′笉瀛樺湪{model.taskCode}", "agv鏉弶浜や簰鏃ュ織"); } - #endregion [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus] -} -public GZ.DB.Entity.OIDATABASE.TaskEntity Begin(GZ.DB.Entity.OIDATABASE.TaskEntity task) -{ - #region [鑷畾涔夋寚浠[20250324170811305][Begin] - if (task.S_B_STATE.Trim() == "宸叉帹閫�) { - task.S_B_STATE = "鎵ц涓�; - task.T_START_TIME = DateTime.Now; - } - return task; - #endregion [鑷畾涔夋寚浠[20250324170811305][Begin] -} -public GZ.DB.Entity.OIDATABASE.TaskEntity End(GZ.DB.Entity.OIDATABASE.TaskEntity task) -{ - #region [鑷畾涔夋寚浠[20250324170922920][End] - if (task != null) { - task.S_B_STATE = "瀹屾垚"; - task.T_END_TIME = DateTime.Now; - } - return task; - #endregion [鑷畾涔夋寚浠[20250324170922920][End] -} -public GZ.DB.Entity.OIDATABASE.TaskEntity UpdateStatus(GZ.DB.Entity.OIDATABASE.TaskEntity task, System.String status) -{ - #region [鑷畾涔夋寚浠[20250324171118766][UpdateStatus] -task.S_B_STATE = status; -return task; - #endregion [鑷畾涔夋寚浠[20250324171118766][UpdateStatus] -} -public void RunafterMac(System.Object dev, System.Boolean blen) -{ - #region [鑷畾涔夋寚浠[20250325085905222][RunafterMac] -var device = (deviceInfo)dev; -if (device.areaPriy.Any() && device.deviceNo.Any()) -{ - LocRepository locRepository = new LocRepository(); - LocContainerRepository locContainerRepository = new LocContainerRepository(); - ContainerRepository containerRepository = new ContainerRepository(); - LocEntity startLoc = null; - string Sign = device.deviceType == 1 ? "F" : "E"; - foreach (var sloc in device.deviceNo) - { - ContainerEntity c = null; - var Startloc = locRepository.FindEntity(x => x.S_LOC_CODE == sloc); - if (Startloc != null && Startloc.N_CURRENT_NUM == 1 && Startloc.S_LOCK_STATE == "鏃�) - { - var cntr = locContainerRepository.FindEntity(x => x.S_LOC_CODE == sloc); - if (cntr != null) - { - c = containerRepository.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE); - if (c != null && c.S_TYPE == Sign) - { - startLoc = Startloc; - } - } + #endregion [鑷畾涔夋寚浠[20250324165239206][OperateHKTaskStatus] } - - if (startLoc != null) + public GZ.DB.Entity.OIDATABASE.TaskEntity Begin(GZ.DB.Entity.OIDATABASE.TaskEntity task) { - foreach (var dn in device.areaPriy) + #region [鑷畾涔夋寚浠[20250324170811305][Begin] + if (task.S_B_STATE.Trim() == "宸叉帹閫�) { - LocEntity endLoc = null; - var di = Settings.deviceInfos.Find(x => x.deviceName == dn); - if (di != null) + task.S_B_STATE = "鎵ц涓�; + task.T_START_TIME = DateTime.Now; + } + return task; + #endregion [鑷畾涔夋寚浠[20250324170811305][Begin] + } + public GZ.DB.Entity.OIDATABASE.TaskEntity End(GZ.DB.Entity.OIDATABASE.TaskEntity task) + { + #region [鑷畾涔夋寚浠[20250324170922920][End] + if (task != null) + { + task.S_B_STATE = "瀹屾垚"; + task.T_END_TIME = DateTime.Now; + } + return task; + #endregion [鑷畾涔夋寚浠[20250324170922920][End] + } + public GZ.DB.Entity.OIDATABASE.TaskEntity UpdateStatus(GZ.DB.Entity.OIDATABASE.TaskEntity task, System.String status) + { + #region [鑷畾涔夋寚浠[20250324171118766][UpdateStatus] + task.S_B_STATE = status; + return task; + #endregion [鑷畾涔夋寚浠[20250324171118766][UpdateStatus] + } + public void RunafterMac(System.Object dev, System.Boolean blen) + { + #region [鑷畾涔夋寚浠[20250325085905222][RunafterMac] + var device = (deviceInfo)dev; + if (device.areaPriy.Any() && device.deviceNo.Any()) + { + LocRepository locRepository = new LocRepository(); + LocContainerRepository locContainerRepository = new LocContainerRepository(); + ContainerRepository containerRepository = new ContainerRepository(); + LocEntity startLoc = null; + string Sign = device.deviceType == 1 ? "F" : "E"; + foreach (var sloc in device.deviceNo) { - foreach (var ssloc in di.deviceNo) + ContainerEntity c = null; + var Startloc = locRepository.FindEntity(x => x.S_LOC_CODE == sloc); + if (Startloc != null && Startloc.N_CURRENT_NUM == 1 && Startloc.S_LOCK_STATE == "鏃�) { - var endloc = locRepository.FindEntity(x => x.S_LOC_CODE == ssloc); - if (endloc != null && endloc.N_CURRENT_NUM == 0 && endloc.S_LOCK_STATE == "鏃�) + var cntr = locContainerRepository.FindEntity(x => x.S_LOC_CODE == sloc); + if (cntr != null) { - endLoc = endloc; - break; + c = containerRepository.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE); + if (c != null && c.S_TYPE == Sign) + { + startLoc = Startloc; + } } } - if (endLoc != null) + + if (startLoc != null) { - TaskProcess.CreateTask("", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, $"鎵樼洏娴佽浆-{Sign}", 5, new List<string> { c.S_CODE }); - break; + foreach (var dn in device.areaPriy) + { + LocEntity endLoc = null; + var di = Settings.deviceInfos.Find(x => x.deviceName == dn); + if (di != null) + { + foreach (var ssloc in di.deviceNo) + { + var endloc = locRepository.FindEntity(x => x.S_LOC_CODE == ssloc); + if (endloc != null && endloc.N_CURRENT_NUM == 0 && endloc.S_LOCK_STATE == "鏃�) + { + endLoc = endloc; + break; + } + } + if (endLoc != null) + { + TaskProcess.CreateTask("", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, $"鎵樼洏娴佽浆-{Sign}", 5, new List<string> { c.S_CODE }); + break; + } + } + } } } } + #endregion [鑷畾涔夋寚浠[20250325085905222][RunafterMac] } - } -} - #endregion [鑷畾涔夋寚浠[20250325085905222][RunafterMac] -} -public System.Boolean RunTask(GZ.DB.Entity.OIDATABASE.TaskEntity task) -{ - #region [鑷畾涔夋寚浠[20250325092323531][RunTask] + public System.Boolean RunTask(GZ.DB.Entity.OIDATABASE.TaskEntity task) + { + #region [鑷畾涔夋寚浠[20250325092323531][RunTask] ILocRepository locrep = new LocRepository(); var startloc = locrep.FindEntity(x => x.S_LOC_CODE == task.S_START_LOC); @@ -479,8 +483,8 @@ //璋冪涓夋柟鎺ュ彛 var model = new HaiKangOrderInfo { - reqCode=task.S_TASK_NO.Trim(), - reqTime=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + reqCode = task.S_TASK_NO.Trim(), + reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), taskCode = task.S_TASK_NO.Trim(), ctnrCode = task.S_CNTRS, taskTyp = task.S_INDEX, @@ -488,199 +492,207 @@ }; return CreateOrder(model); - #endregion [鑷畾涔夋寚浠[20250325092323531][RunTask] -} -public System.Boolean CreateOrder(System.Object m) -{ - #region [鑷畾涔夋寚浠[20250325095053549][CreateOrder] -var model = (HaiKangOrderInfo)m; + #endregion [鑷畾涔夋寚浠[20250325092323531][RunTask] + } + public System.Boolean CreateOrder(System.Object m) + { + #region [鑷畾涔夋寚浠[20250325095053549][CreateOrder] + var model = (HaiKangOrderInfo)m; var msg = ""; var result = false; var request = JsonConvert.SerializeObject(model); var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/genAgvSchedulingTask", request); msg = $"[haikang-CreateOrder] request={request} response={response}"; - + LogHelper.Info(msg); - if (response != "") { - try { + if (response != "") + { + try + { var dataResult = JsonConvert.DeserializeObject<HKResult>(response); - if (dataResult.code == "0") { + if (dataResult.code == "0") + { result = true; } } - catch (Exception ex) { + catch (Exception ex) + { Console.WriteLine(ex.Message); - LogHelper.Info(msg,"娴峰悍"); + LogHelper.Info(msg, "娴峰悍"); } } - else { + else + { msg = "[haikang-CreateOrder]鍒涘缓璁㈠崟澶辫触"; Console.WriteLine(msg); } - LogHelper.Info(msg,"娴峰悍"); + LogHelper.Info(msg, "娴峰悍"); return result; - #endregion [鑷畾涔夋寚浠[20250325095053549][CreateOrder] -} -public void TaskisOk(GZ.DB.Entity.OIDATABASE.TaskEntity task) -{ - #region [鑷畾涔夋寚浠[20250325100336909][TaskisOk] -// 杞﹁締鍙栨斁鐢宠銆�- if ("鍙栬揣鐢宠" != "") - { - var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_START_LOC)); - if (device1 != null) - { - var left = device1.location.ToList().FindIndex(x => x == task.S_START_LOC) == 0; - if (device1.deviceType == 1) - { - if (device1.deviceName.Contains("缁村笇灏旀姄鑷�)) - { - if ("IN_BEFORE" == "IN_BEFORE"|| "out_BEFORE" == "out_BEFORE") - { - string V = left ? "R01" : "R03"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("IN_after" == "IN_after"|| "out_after" == "out_after") - { - string V = left ? "R02" : "R04"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - } - else if(device1.deviceName.Contains("Js鎹烽『")) - { - if ("IN_BEFORE" == "IN_BEFORE") - { - string V = left ? "M0" : "M1"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("out_BEFORE" == "out_BEFORE") - { - //string V = left ? "R01" : "R03"; - //Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("IN_after" == "IN_after") - { - string V = left ? "M2" : "M3"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("out_after" == "out_after") - { - string V = left ? "M6" : "M7"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - } - } - } - } - if ("鏀捐揣鐢宠" != "") - { - var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_END_LOC)); - if (device1 != null) - { - var left = device1.location.ToList().FindIndex(x => x == task.S_END_LOC) == 0; - if (device1.deviceType == 1) - { - if (device1.deviceName.Contains("缁村笇灏旀姄鑷�)) - { - if ("IN_BEFORE" == "IN_BEFORE" || "out_BEFORE" == "out_BEFORE") - { - string V = left ? "R01" : "R03"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("IN_after" == "IN_after" || "out_after" == "out_after") - { - string V = left ? "R02" : "R04"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - } - else if (device1.deviceName.Contains("Js鎹烽『")) - { - if ("IN_BEFORE" == "IN_BEFORE") - { - string V = left ? "M0" : "M1"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("out_BEFORE" == "out_BEFORE") - { - string V = left ? "M4" : "M5"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("IN_after" == "IN_after") - { - string V = left ? "M2" : "M3"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - if ("out_after" == "out_after") - { - string V = left ? "M6" : "M7"; - Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); - } - } - } - } - } - #endregion [鑷畾涔夋寚浠[20250325100336909][TaskisOk] -} -public System.Boolean continueTask(System.Object m) -{ - #region [鑷畾涔夋寚浠[20250325100607380][continueTask] -var model = (HaiKangOrderInfo)m; -bool result = false; -string msg = ""; -var request = JsonConvert.SerializeObject(model); -var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request); -msg = $"[haikang-CancelOrder] request={request};response={response}"; -Console.WriteLine(msg); -if (response != "") -{ - var dataResult = JsonConvert.DeserializeObject<HKResult>(response); - if (dataResult.code == "0") - { - result = true; + #endregion [鑷畾涔夋寚浠[20250325095053549][CreateOrder] + } + public void TaskisOk(GZ.DB.Entity.OIDATABASE.TaskEntity task) + { + #region [鑷畾涔夋寚浠[20250325100336909][TaskisOk] + // 杞﹁締鍙栨斁鐢宠銆�+ if ("鍙栬揣鐢宠" != "") + { + var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_START_LOC)); + if (device1 != null) + { + var left = device1.location.ToList().FindIndex(x => x == task.S_START_LOC) == 0; + if (device1.deviceType == 1) + { + if (device1.deviceName.Contains("缁村笇灏旀姄鑷�)) + { + if ("IN_BEFORE" == "IN_BEFORE" || "out_BEFORE" == "out_BEFORE") + { + string V = left ? "R01" : "R03"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("IN_after" == "IN_after" || "out_after" == "out_after") + { + string V = left ? "R02" : "R04"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + } + else if (device1.deviceName.Contains("Js鎹烽『")) + { + if ("IN_BEFORE" == "IN_BEFORE") + { + string V = left ? "M0" : "M1"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("out_BEFORE" == "out_BEFORE") + { + //string V = left ? "R01" : "R03"; + //Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("IN_after" == "IN_after") + { + string V = left ? "M2" : "M3"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("out_after" == "out_after") + { + string V = left ? "M6" : "M7"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + } + } + } + } + if ("鏀捐揣鐢宠" != "") + { + var device1 = Settings.deviceInfos.Find(x => x.location.Contains(task.S_END_LOC)); + if (device1 != null) + { + var left = device1.location.ToList().FindIndex(x => x == task.S_END_LOC) == 0; + if (device1.deviceType == 1) + { + if (device1.deviceName.Contains("缁村笇灏旀姄鑷�)) + { + if ("IN_BEFORE" == "IN_BEFORE" || "out_BEFORE" == "out_BEFORE") + { + string V = left ? "R01" : "R03"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("IN_after" == "IN_after" || "out_after" == "out_after") + { + string V = left ? "R02" : "R04"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + } + else if (device1.deviceName.Contains("Js鎹烽『")) + { + if ("IN_BEFORE" == "IN_BEFORE") + { + string V = left ? "M0" : "M1"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("out_BEFORE" == "out_BEFORE") + { + string V = left ? "M4" : "M5"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("IN_after" == "IN_after") + { + string V = left ? "M2" : "M3"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + if ("out_after" == "out_after") + { + string V = left ? "M6" : "M7"; + Conn.榛樿Redis.SetValue(device1.deviceName + "." + V, "true", device1.deviceName + "Queue"); + } + } + } + } + } + #endregion [鑷畾涔夋寚浠[20250325100336909][TaskisOk] + } + public System.Boolean continueTask(System.Object m) + { + #region [鑷畾涔夋寚浠[20250325100607380][continueTask] + var model = (HaiKangOrderInfo)m; + bool result = false; + string msg = ""; + var request = JsonConvert.SerializeObject(model); + var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request); + msg = $"[haikang-CancelOrder] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") + { + var dataResult = JsonConvert.DeserializeObject<HKResult>(response); + if (dataResult.code == "0") + { + result = true; + } + } + else + { + msg = "[haikang-CancelOrder]鑾峰彇浠诲姟鐘舵�澶辫触"; + Console.WriteLine(msg); + } + LogHelper.Info(msg, "娴峰悍"); + return result; + #endregion [鑷畾涔夋寚浠[20250325100607380][continueTask] + } + public System.Boolean CancelOrder(System.Object m) + { + #region [鑷畾涔夋寚浠[20250325100705351][CancelOrder] + var model = (HaiKangOrderInfo)m; + bool result = false; + string msg = ""; + var request = JsonConvert.SerializeObject(model); + var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request); + msg = $"[haikang-CancelOrder] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") + { + var dataResult = JsonConvert.DeserializeObject<HKResult>(response); + if (dataResult.code == "0") + { + result = true; + } + } + else + { + msg = "[haikang-CancelOrder]鍙栨秷璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + LogHelper.Info(msg, "娴峰悍"); + return result; + #endregion [鑷畾涔夋寚浠[20250325100705351][CancelOrder] + } + public System.String GetSerialNumber(System.String snType, System.String prefix) + { + #region [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber] + int result = 0; + return ""; + #endregion [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber] + } + #endregion } } -else -{ - msg = "[haikang-CancelOrder]鑾峰彇浠诲姟鐘舵�澶辫触"; - Console.WriteLine(msg); -} -LogHelper.Info(msg, "娴峰悍"); -return result; - #endregion [鑷畾涔夋寚浠[20250325100607380][continueTask] -} -public System.Boolean CancelOrder(System.Object m) -{ - #region [鑷畾涔夋寚浠[20250325100705351][CancelOrder] -var model = (HaiKangOrderInfo)m; -bool result = false; -string msg = ""; -var request = JsonConvert.SerializeObject(model); -var response = Settings.apiHelper.Post(Settings.HKbaseUrl + "rcms/services/rest/hikRpcService/continueTask", request); -msg = $"[haikang-CancelOrder] request={request};response={response}"; -Console.WriteLine(msg); -if (response != "") { - var dataResult = JsonConvert.DeserializeObject<HKResult>(response); - if (dataResult.code == "0") { - result = true; - } -} -else { - msg = "[haikang-CancelOrder]鍙栨秷璁㈠崟澶辫触"; - Console.WriteLine(msg); -} -LogHelper.Info(msg, "娴峰悍"); -return result; - #endregion [鑷畾涔夋寚浠[20250325100705351][CancelOrder] -} -public System.String GetSerialNumber(System.String snType, System.String prefix) -{ - #region [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber] -int result = 0; -return ""; - #endregion [鑷畾涔夋寚浠[20250325131530407][GetSerialNumber] -} - #endregion - } -} - + -- Gitblit v1.9.1