From b447a2b0dafdaf7e460ca4a73727c81fe820a1ff Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期四, 19 六月 2025 18:51:29 +0800 Subject: [PATCH] 1 --- 2025年6月12日/AuxAllWCS/Build/Project/代码/自定义类.cs | 7 2025年6月12日/AuxAllWCS/Build/Project/AuxAllWCS.csproj | 1 2025年6月12日/AuxAllWCS/Build/Project/代码/ViewModel.cs | 721 +++++++++++++++++++++-------------------- 2025年6月12日/AuxAllWCS/Dlls/GZ.Modular.Redis.dll | 0 2025年6月12日/AuxAllWCS/Dlls/GZ.Device.PLC.dll | 0 2025年6月12日/AuxAllWCS/Build/Project/代码/界面事件.cs | 186 +++++++--- 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs | 102 ++++++ 7 files changed, 612 insertions(+), 405 deletions(-) diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" index c3ecb0b..2466075 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" @@ -198,6 +198,7 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Compile Include="浠g爜\VS鑷畾涔夌被\AutoThread.cs" /> <Compile Include="鐣岄潰\View1.xaml.cs"> <DependentUpon>View1.xaml</DependentUpon> <SubType>Code</SubType> diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" new file mode 100644 index 0000000..c8078c6 --- /dev/null +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" @@ -0,0 +1,102 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace GZ.Projects.AuxAllWCS +{ + public partial class AutoThread + { + + private static AutoThread _instance; + + // 绉佹湁鏋勯�鍑芥暟闃叉澶栭儴瀹炰緥鍖�+ private AutoThread() { } + + public static AutoThread Instance + { + get + { + if (_instance == null) + { + _instance = new AutoThread(); + } + return _instance; + } + } + + // 绾跨▼瀹夊叏鐨勫鎵樼紦瀛�+ private static readonly ConcurrentDictionary<string, Delegate> _methodCache = new ConcurrentDictionary<string, Delegate>(); + + // 鏂规硶鎵ц鍣�+ public static object InvokeMethod(object instance, string methodName, params object[] args) + { + var cacheKey = $"{instance.GetType().FullName}_{methodName}"; + + if (!_methodCache.TryGetValue(cacheKey, out var methodDelegate)) + { + // 鑾峰彇鏂规硶淇℃伅 + var methodInfo = instance.GetType().GetMethod( + methodName, + BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + + if (methodInfo == null) + throw new MissingMethodException($"Method {methodName} not found"); + + // 鍒涘缓濮旀墭骞剁紦瀛�+ methodDelegate = Delegate.CreateDelegate( + GetDelegateType(methodInfo), + instance, + methodInfo); + + _methodCache.TryAdd(cacheKey, methodDelegate); + } + + // 鎵ц濮旀墭 + return methodDelegate.DynamicInvoke(args); + } + + // 鏍规嵁鏂规硶绛惧悕鐢熸垚瀵瑰簲鐨勫鎵樼被鍨�+ private static Type GetDelegateType(MethodInfo methodInfo) + { + var parameterTypes = methodInfo.GetParameters() + .Select(p => p.ParameterType) + .ToList(); + + if (methodInfo.ReturnType == typeof(void)) + { + return System.Linq.Expressions.Expression.GetActionType(parameterTypes.ToArray()); + } + else + { + parameterTypes.Add(methodInfo.ReturnType); + return System.Linq.Expressions.Expression.GetFuncType(parameterTypes.ToArray()); + } + } + + + + + + public void ThreadSettingInit(Tag tag, Action action) + { + Console.WriteLine("鍒濆鍖栭厤缃�绾跨▼ run " + tag.Global.SettingsOver); + if (tag.Global.SettingsOver == 0) + { + action?.Invoke(); + tag.Global.SettingsOver = 1; + } + else if (Settings.deviceInfos.Count == 0) + { + tag.Global.SettingsOver = 0; + } + } + + + } +} 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..1e0dcbc 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" @@ -31,27 +31,27 @@ 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 +60,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 +111,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 +176,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 +219,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); @@ -244,7 +247,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 +279,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 +307,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 +326,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 +336,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 +366,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 +486,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 +495,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 - } -} - + diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs" index 723b294..42a03ab 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs" @@ -29,6 +29,7 @@ using GZ.DB.IRepository.OIDATABASE; using GZ.DB.Entity.OIDATABASE; using GZ.Modular.Redis; +using System.Security.Cryptography; namespace GZ.Projects.AuxAllWCS { /// <summary> @@ -78,15 +79,26 @@ try { #region [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝 - if (Tag.Global.SettingsOver == 0) - { - SettingInit(); - Tag.Global.SettingsOver = 1; - } - else if (Settings.deviceInfos.Count == 0) - { - Tag.Global.SettingsOver = 0; - } + //LogHelper.Info("1111 +" + DateTime.Now); + //((Type)typeof(Utils)).GetMethod("ThreadSettingInit").Invoke(new Utils(), null); + //LogHelper.Info("2222 +" + DateTime.Now); + //((Type)typeof(Utils)).GetMethod("ThreadSettingInit").Invoke(new Utils(), new object[] { }); + //LogHelper.Info("3333 +" + DateTime.Now); + Action myDelegate = () => SettingInit(); + AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", new object[] { tag, myDelegate }); + //LogHelper.Info("4444 +" + DateTime.Now); + //AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", null); + //LogHelper.Info("4444 +" + DateTime.Now); + + //if (Tag.Global.SettingsOver == 0) + //{ + // SettingInit(); + // Tag.Global.SettingsOver = 1; + //} + //else if (Settings.deviceInfos.Count == 0) + //{ + // Tag.Global.SettingsOver = 0; + //} #endregion [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝 } @@ -691,6 +703,32 @@ } ExitJudgeStack.TryPop(out int exitJudgeVal); }); + + System.Threading.Tasks.Task.Factory.StartNew(() => + { + System.Threading.Thread.CurrentThread.IsBackground = true; + ExitJudgeStack.Push(0); + //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+ while (true) + { + if (IsExitApp) { break; } + try + { + #region [鑴氭湰][20250610002647095][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R] + LogHelper.Info($"娴嬭瘯绾跨▼杩愯鐘舵�鏃ュ織銆嬨�銆嬨�銆�); + #endregion [鑴氭湰][20250610002647095][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R] + } + catch (Exception ex) + { + Conn.榛樿鏃ュ織.Error(ex.ToString()); + } + finally + { + System.Threading.Thread.Sleep(3000); + } + } + ExitJudgeStack.TryPop(out int exitJudgeVal); + }); /// <summary> /// 绋嬪簭鐗囨:浠诲姟涓嬪彂 /// 鎻忚堪: @@ -702,43 +740,58 @@ //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠� while (true) { - if (IsExitApp) { break; } + //if (IsExitApp) { break; } + LogHelper.Info("浠诲姟涓嬪彂 while 杩涘叆"); try { + LogHelper.Info("浠诲姟涓嬪彂 try 1 杩涘叆"); #region [鑴氭湰][20250325085542733][涓氬姟閫昏緫.浠诲姟涓嬪彂] + ITaskRepository taskservice = new TaskRepository(); - var tklist = taskservice.FindList(x => x.S_B_STATE == "鏈墽琛� && x.S_WORK_MODE == "AGV"); - if (tklist.Any()) - foreach (var tk in tklist.GroupBy(item => - { - var ticks = item.T_CREATE.Ticks; - return new DateTime(ticks - ticks % (10 * TimeSpan.TicksPerMinute)); - }).OrderBy(x => x.Key)) - { - var ts = tk.OrderByDescending(x => x.N_PRIORITY).ToList(); - foreach (var t in ts) - { - var b = false; - b = RunTask(t); - - if (b) - { - t.S_B_STATE = "宸叉帹閫�; - taskservice.Update(t); - } - } - break; - } - //foreach (var tk in tklist.GroupBy(item => - //{ - // var ticks = item.T_CREATE.Ticks; - // return new DateTime(ticks - ticks % (10 * TimeSpan.TicksPerMinute)); - //}).OrderBy(x => x.Key)) - //if (tklist.Any()) - //{ - try { + LogHelper.Info("浠诲姟涓嬪彂 ARG 浠诲姟 杩涘叆"); + #region AGV浠诲姟涓嬪彂銆�+ + var tklist = taskservice.FindList(x => x.S_B_STATE == "鏈墽琛� && x.S_WORK_MODE == "AGV"); + if (tklist.Any()) + foreach (var tk in tklist.GroupBy(item => + { + var ticks = item.T_CREATE.Ticks; + return new DateTime(ticks - ticks % (10 * TimeSpan.TicksPerMinute)); + }).OrderBy(x => x.Key)) + { + var ts = tk.OrderByDescending(x => x.N_PRIORITY).ToList(); + foreach (var t in ts) + { + var b = false; + b = RunTask(t); + + if (b) + { + t.S_B_STATE = "宸叉帹閫�; + taskservice.Update(t); + } + } + break; + } + //foreach (var tk in tklist.GroupBy(item => + //{ + // var ticks = item.T_CREATE.Ticks; + // return new DateTime(ticks - ticks % (10 * TimeSpan.TicksPerMinute)); + //}).OrderBy(x => x.Key)) + //if (tklist.Any()) + //{ + + #endregion + } + catch (Exception ex) + { + LogHelper.Info(ex.Message + ex.StackTrace); + } + try + { + LogHelper.Info("浠诲姟涓嬪彂 Rgv 浠诲姟 杩涘叆"); #region Rgv LogHelper.Info($"鏌ョ湅RGV 鐢甸噺锛氥�{tag.RGV.R褰撳墠鐢甸噺}銆�鍏呯數鐘舵�锛氥�{tag.RGV.R鍏呯數鐘舵�}銆�鏁呴殰浠g爜锛氥�{tag.RGV.RgvrunError}銆�); @@ -862,7 +915,7 @@ } ///1 鏈夎揣 灏� 鍙栥� 1 娌¤揣 灏� 鍗歌揣锛�閮芥湁璐� 灏�鍗歌揣銆�閮芥病璐�灏�鍗�- tklist = taskservice.FindList(x => x.S_B_STATE == "鏈墽琛� && x.S_WORK_MODE == "RGV").OrderBy(x => x.T_CREATE).ToList(); + var tklist = taskservice.FindList(x => x.S_B_STATE == "鏈墽琛� && x.S_WORK_MODE == "RGV").OrderBy(x => x.T_CREATE).ToList(); if (task1 != null && task1.S_B_STATE != "瀹屾垚") //1鏈変换鍔� { if (task2 != null && task2.S_B_STATE != "瀹屾垚")// 1 鏈変换鍔� 2 鏈変换鍔°� @@ -873,8 +926,14 @@ tag.RGV.taskno1 = Convert.ToUInt32(task1.S_TASK_NO.Substring(4)); tag.RGV.task1do = Convert.ToUInt16(task1.S_END_LOC); System.Threading.Thread.Sleep(750); + //RedisHelper.Add($"RGV.bit1taskOver_LAST", "0", out string msg); + //tag.RGV.taskend = 125; + //Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue"); + + LogHelper.Info($"{task1.S_TASK_NO}> bit1taskOver_LAST 鍐�0"); RedisHelper.Add($"RGV.bit1taskOver_LAST", "0", out string msg); - tag.RGV.taskend = 125; + LogHelper.Info($"{task1.S_TASK_NO}> end 鍐�125"); + Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false); } else //1鏈変换鍔� 2 娌′换鍔°� { @@ -899,8 +958,10 @@ taskservice.Update(t2); creT2 = true; System.Threading.Thread.Sleep(750); + LogHelper.Info($"{t2.S_TASK_NO}> bit2taskOver_LAST 鍐�0"); RedisHelper.Add($"RGV.bit2taskOver_LAST", "0", out string msg); - tag.RGV.taskend = 125; + LogHelper.Info($"{t2.S_TASK_NO}> end 鍐�125"); + Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false); } } else if (RightSide.Contains(task1.S_START_LOC)) @@ -918,8 +979,10 @@ taskservice.Update(t2); creT2 = true; System.Threading.Thread.Sleep(750); + LogHelper.Info($"{t2.S_TASK_NO}> bit2taskOver_LAST 鍐�125"); RedisHelper.Add($"RGV.bit2taskOver_LAST", "0", out string msg); - tag.RGV.taskend = 125; + LogHelper.Info($"{t2.S_TASK_NO}> end 鍐�125"); + Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false); } } //else //1 鐩存帴鍗歌揣銆� @@ -931,8 +994,10 @@ tag.RGV.taskno1 = Convert.ToUInt32(task1.S_TASK_NO.Substring(4)); tag.RGV.task1do = Convert.ToUInt16(task1.S_END_LOC); System.Threading.Thread.Sleep(750); + LogHelper.Info($"{task1.S_TASK_NO}> bit1taskOver_LAST 鍐�0"); RedisHelper.Add($"RGV.bit1taskOver_LAST", "0", out string msg); - tag.RGV.taskend = 125; + LogHelper.Info($"{task1.S_TASK_NO}> taskend 鍐�0"); + Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false); } } } @@ -947,8 +1012,11 @@ tag.RGV.taskno2 = Convert.ToUInt32(task2.S_TASK_NO.Substring(4)); tag.RGV.task2do = Convert.ToUInt16(task2.S_END_LOC); System.Threading.Thread.Sleep(750); + LogHelper.Info($"{task2.S_TASK_NO}> bit2taskOver_LAST 鍐�0"); RedisHelper.Add($"RGV.bit2taskOver_LAST", "0", out string msg); - tag.RGV.taskend = 125; + //tag.RGV.taskend = 125; + LogHelper.Info($"{task2.S_TASK_NO}> taskend 鍐�25"); + Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false); } else //1mei 浠诲姟 2 娌′换鍔°� { @@ -970,22 +1038,25 @@ tag.RGV.taskno1 = tno; LogHelper.Info($"{e1017first.S_TASK_NO}>寮�鍐欏叆 task1do>>{e1017first.S_START_LOC}銆�); tag.RGV.task1do = Convert.ToUInt16(e1017first.S_START_LOC); - LogHelper.Info($"{e1017first.S_TASK_NO}> taskend 125"); + LogHelper.Info($"{e1017first.S_TASK_NO}> 鏇存柊浠诲姟銆�); e1017first.S_B_STATE = "宸叉帹閫�; taskservice.Update(e1017first); System.Threading.Thread.Sleep(750); + LogHelper.Info($"{e1017first.S_TASK_NO}> bit1taskOver_LAST 鍐�"); RedisHelper.Add($"RGV.bit1taskOver_LAST", "0", out string msg); - tag.RGV.taskend = 125; + LogHelper.Info($"{e1017first.S_TASK_NO}> taskend 鍐�25"); + //tag.RGV.taskend=125 + Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false); + } } } - + LogHelper.Info($"rgv 澶勭悊瀹屾垚銆倀askend 125"); #endregion } catch (Exception ex) { - LogHelper.Error(ex.Message, ex); - //throw ex; + LogHelper.Info(ex.Message + ex.StackTrace); } #endregion [鑴氭湰][20250325085542733][涓氬姟閫昏緫.浠诲姟涓嬪彂] } @@ -1260,6 +1331,17 @@ } System.Threading.Thread.Sleep(2000); } + + foreach (var item in new string[] { "1004", "1012", "1006", "1014", "1026", "1017" }) + { + var R5 = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽"), typeof(System.UInt16)); + var R5绌洪棽_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽_LAST"), typeof(System.UInt16)); + if (R5 != 5 && R5绌洪棽_LAST == 1) + { + RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "0", out string msg); + //Conn.榛樿Redis.SetValue($"S{item}Read.R5绌洪棽_LAST", "0", $"S{item}ReadQueue"); + } + } #endregion [鑴氭湰][20250616094224396][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1020绌烘涓嬬嚎] } catch (Exception ex) @@ -1462,7 +1544,7 @@ } else if (ssx == "1003") { - tag.FNK2.D2210 = 1; + tag.FNK1.D2210 = 1; //tag.SF涓嬫枡浣�RArrive1003_LAST = 1; RedisHelper.Add($"FNK1003051113.RArrive1003_LAST", "1", out string msg); diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\350\207\252\345\256\232\344\271\211\347\261\273.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\350\207\252\345\256\232\344\271\211\347\261\273.cs" index 6c0f02d..dc18472 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\350\207\252\345\256\232\344\271\211\347\261\273.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\350\207\252\345\256\232\344\271\211\347\261\273.cs" @@ -28,6 +28,7 @@ using GZ.DB.Repository.OIDATABASE; using GZ.DB.IRepository.OIDATABASE; using GZ.DB.Entity.OIDATABASE; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace GZ.Projects.AuxAllWCS { public class Settings @@ -656,6 +657,12 @@ { #region [鑷畾涔夌被][20250417094750211][Utils] + + public void ThreadSettingInit() + { + Console.WriteLine("Utils ThreadSettingInit "); + + } #endregion [鑷畾涔夌被][20250417094750211][Utils] } public class ToWMSMES diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Device.PLC.dll" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Device.PLC.dll" index 6c406dc..cb9ebec 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Device.PLC.dll" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Device.PLC.dll" Binary files differ diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Modular.Redis.dll" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Modular.Redis.dll" index 7a9f7ae..f7f1ee7 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Modular.Redis.dll" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Dlls/GZ.Modular.Redis.dll" Binary files differ -- Gitblit v1.9.1