From e97a0f31c187e25d9b2480b6e144648239dae80d Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期一, 28 七月 2025 09:00:06 +0800 Subject: [PATCH] 1 --- HnSx/Devices/PlcConfig | 6 HnSx/RunTime/Code/变量数据库.cs | 66 ++++++++++++++++ HnSx/Variable/变量数据库.json | 70 +++++++++++++++++ HnSx/RunTime/Lib/VarDB.dll | 0 HnSx/Net/Conn.json | 2 HnSx/HnSx.json | 2 HnSx/RunTime/Lib/Device.dll | 0 HnSx/Scripts/Script.json | 6 HnSx/Devices/设备通信.json | 2 HnSx/Build/Project/代码/VS自定义类/AutoThread.cs | 69 ++++++++++++++++ 10 files changed, 209 insertions(+), 14 deletions(-) diff --git "a/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" index a4d73a5..a4f6721 100644 --- "a/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" +++ "b/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" @@ -121,10 +121,39 @@ public void ThreadSettingInit(Tag tag) { List<Task> tasks = new List<Task>(); - //tasks.Add(GetTask(sa2008, tag, 3000)); - Task.WaitAll(tasks.ToArray()); + tasks.Add(GetTask(wmsPrint, tag, 3000)); + + //GZ.Modular.Redis.WriteGroupEntity group = new GZ.Modular.Redis.WriteGroupEntity(); + //group.groupName = "PLC1.ssx2Xplc"; + //group.queueStatus = 1; + //group.queueTime = DateTime.Now; + + //group.writeList = new List<GZ.Modular.Redis.ParamData>(); + //GZ.Modular.Redis.ParamData barcodeData = new GZ.Modular.Redis.ParamData(); + //barcodeData.paramName = "PLC1.Param4"; + //barcodeData.paramValue = Tag.PLC1.Param4 + 1 + ""; + + //GZ.Modular.Redis.ParamData sendData = new GZ.Modular.Redis.ParamData(); + //sendData.paramName = "PLC1.Param5"; + //sendData.paramValue = Tag.PLC1.Param5 + 2 + ""; + + //group.writeList.Add(barcodeData); + //group.writeList.Add(sendData); + //Conn.榛樿Redis.SetQueue(group, "PLC1Queue", "PLC1.Param1_LAST", "1") ? "--鎴愬姛" : "--澶辫触"; + + + + + + Task.WaitAll(tasks.ToArray()); } + + private void wmsPrint(Tag tag) + { + HttpServer.apiHelper.WebGet($"http://{"test1.wmsdev.net:18980"}/expcenter/WebSocketPrintAction?sysType=OT01&QS01=YANGYZ&QS02={"鏃堕棿鎴�}&QS04=P4EL67LRIWWDCMP7C&clsid=export_header&method=printByWebSocket&origin=http%3A%2F%2Ftest1.wmsdev.net%3A18980&organizationId=FLUX&warehouseId=FLUXWH01&printServer=YYZ&printerName=LocalPrinter&copies=1&functionId=A2002&tableId=BAS_LOCATION&exportCode=YYZ_CN&itemObj=%0A%7B%0A++++%22bizOrgId%22%3A+%22FLUX%22%2C%0A++++%22CHECK.locationId%22%3A+%22001-001-01-01%22%2C%0A++++%22bizWarehouseId%22%3A+%22FLUXWH01%22%0A%7D%0A%0A"); + } + private Task GetTask(Action<Tag> action, Tag tag, int i = 2500) { var task = Task.Run(() => @@ -1523,8 +1552,42 @@ if (stream != null) stream.Close(); if (rsp != null) rsp.Close(); } - } + public string WebGet(string url) + { + //using (var client = new HttpClient()) { + // //璇锋眰缁撴灉 + // string result = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result; + + // Console.WriteLine(result); + // return result; + + //} + //Console.WriteLine(url); + WebRequest request = WebRequest.Create(url); + request.Timeout = 6000; + request.Method = "GET"; + + try + { + WebResponse response = request.GetResponse(); + Stream dataStream = response.GetResponseStream(); + StreamReader reader = new StreamReader(dataStream); + string responseFromServer = reader.ReadToEnd(); + + reader.Close(); + dataStream.Close(); + response.Close(); + Console.WriteLine(responseFromServer); + return responseFromServer; + } + catch (Exception ex) + { + LogHelper.Error($"WebGet Error:{ex.Message}", ex); + return ""; + } + } + #endregion [鑷畾涔夌被][20250325095622918][HttpHelper] } public class Clloc diff --git a/HnSx/Devices/PlcConfig b/HnSx/Devices/PlcConfig index 7bf32da..fd9e451 100644 --- a/HnSx/Devices/PlcConfig +++ b/HnSx/Devices/PlcConfig @@ -15,7 +15,7 @@ "AddrType": "", "Length": 1, "Desc": "", - "Trigger": false, + "Trigger": true, "Reserve1": "", "Reserve2": "", "Reserve3": "" @@ -47,12 +47,12 @@ "Comm": "S7Net", "IP": "127.0.0.1:102[0,1]", "RedisQueueName": "PLC1Queue", - "IsSimulate": false, + "IsSimulate": true, "Reserve1": "", "Reserve2": "", "Reserve3": "" } ], "CreationTime": "2025-07-01 10:23:43", - "LastWriteTime": "2025-07-04 09:09:38" + "LastWriteTime": "2025-07-21 11:21:28" } \ No newline at end of file diff --git "a/HnSx/Devices/\350\256\276\345\244\207\351\200\232\344\277\241.json" "b/HnSx/Devices/\350\256\276\345\244\207\351\200\232\344\277\241.json" index fa3733a..4a98428 100644 --- "a/HnSx/Devices/\350\256\276\345\244\207\351\200\232\344\277\241.json" +++ "b/HnSx/Devices/\350\256\276\345\244\207\351\200\232\344\277\241.json" @@ -2,5 +2,5 @@ "ProjectSn": "", "DeviceList": [], "CreationTime": "2025-07-01 10:23:37", - "LastWriteTime": "2025-07-04 09:09:41" + "LastWriteTime": "2025-07-21 11:21:31" } \ No newline at end of file diff --git a/HnSx/HnSx.json b/HnSx/HnSx.json index 7408336..7c0d2be 100644 --- a/HnSx/HnSx.json +++ b/HnSx/HnSx.json @@ -9,5 +9,5 @@ "DevelopVersion": "1.0.6.0", "Encode": "1bKKzS3nmbstyerHBqNS0Q==", "CreationTime": "0001-01-01 00:00:00", - "LastWriteTime": "2025-07-21 09:08:19" + "LastWriteTime": "2025-07-21 11:22:24" } \ No newline at end of file diff --git a/HnSx/Net/Conn.json b/HnSx/Net/Conn.json index d9be6ec..92332b3 100644 --- a/HnSx/Net/Conn.json +++ b/HnSx/Net/Conn.json @@ -173,5 +173,5 @@ ], "Globals": [], "CreationTime": "2025-07-01 10:23:39", - "LastWriteTime": "2025-07-04 11:18:35" + "LastWriteTime": "2025-07-21 11:22:24" } \ No newline at end of file diff --git "a/HnSx/RunTime/Code/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.cs" "b/HnSx/RunTime/Code/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.cs" index 6bca3c1..96286ad 100644 --- "a/HnSx/RunTime/Code/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.cs" +++ "b/HnSx/RunTime/Code/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.cs" @@ -73,6 +73,56 @@ #endregion #region 鍙橀噺缁�+ private TagGroup1 _Group1 = new TagGroup1(); + public TagGroup1 Group1 { get { return _Group1; } set { _Group1=value; RaisePropertyChanged("Group1"); } } + #endregion + + #region 鍐呴儴绫�+ public class TagGroup1 : System.ComponentModel.INotifyPropertyChanged + { + #region 鍙橀噺 + private System.UInt16 _Param3_LAST; + public System.UInt16 Param3_LAST + { + get + { + return _Param3_LAST; + } + set + { + _Param3_LAST = value; + RaisePropertyChanged("Param3_LAST"); + } + } + private System.UInt16 _Param3; + public System.UInt16 Param3 + { + get + { + return _Param3; + } + set + { + _Param3 = value; + RaisePropertyChanged("Param3"); + } + } + private System.UInt16 _Param4; + public System.UInt16 Param4 + { + get + { + return _Param4; + } + set + { + _Param4 = value; + RaisePropertyChanged("Param4"); + } + } + #endregion + + #region 鍙橀噺缁� #endregion #region 鍐呴儴绫�@@ -92,4 +142,20 @@ #endregion } + + #endregion + + #region 灞炴�鍙樻洿 + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + public void RaisePropertyChanged(string propertyName) + { + System.ComponentModel.PropertyChangedEventHandler handler = PropertyChanged; + if (handler != null) + { + handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + #endregion + } + } diff --git a/HnSx/RunTime/Lib/Device.dll b/HnSx/RunTime/Lib/Device.dll index b87d5ce..df8fbb0 100644 --- a/HnSx/RunTime/Lib/Device.dll +++ b/HnSx/RunTime/Lib/Device.dll Binary files differ diff --git a/HnSx/RunTime/Lib/VarDB.dll b/HnSx/RunTime/Lib/VarDB.dll index c7d77fa..77da47c 100644 --- a/HnSx/RunTime/Lib/VarDB.dll +++ b/HnSx/RunTime/Lib/VarDB.dll Binary files differ diff --git a/HnSx/Scripts/Script.json b/HnSx/Scripts/Script.json index 2a77c50..8f5ef1e 100644 --- a/HnSx/Scripts/Script.json +++ b/HnSx/Scripts/Script.json @@ -92,8 +92,8 @@ "ID": "20250704145122680", "Name": "楂橀�鎵爜鍒嗘嫞妯″潡", "Desc": "1", - "Content": "AutoThread.InvokeMethod(AutoThread.Instance, \"ThreadwebSoc\");", - "ContentCopy": "AutoThread.InvokeMethod(AutoThread.Instance, \"ThreadwebSoc\");", + "Content": "AutoThread.InvokeMethod(AutoThread.Instance, \"ThreadwebSoc\");\r\n", + "ContentCopy": "AutoThread.InvokeMethod(AutoThread.Instance, \"ThreadwebSoc\");\r\n", "ParentID": "20250701102338326", "Children": [], "Type": "Program", @@ -192,6 +192,6 @@ } ], "CreationTime": "2025-07-01 10:23:38", - "LastWriteTime": "2025-07-21 10:11:26", + "LastWriteTime": "2025-07-21 11:16:15", "HasSaved": true } \ No newline at end of file diff --git "a/HnSx/Variable/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.json" "b/HnSx/Variable/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.json" index cf6a2a7..8de1fe0 100644 --- "a/HnSx/Variable/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.json" +++ "b/HnSx/Variable/\345\217\230\351\207\217\346\225\260\346\215\256\345\272\223.json" @@ -9,10 +9,76 @@ "ParentFullName": "", "FullName": "Tag", "Vars": [], - "Children": [] + "Children": [ + { + "ID": "20250721112111161", + "Name": "Group1", + "Desc": "", + "ParentID": "20250701102337900", + "ParentFullName": "Tag", + "FullName": "Tag.Group1", + "Vars": [ + { + "ID": "20250721112117949", + "Name": "Param3_LAST", + "Desc": "", + "Type": "System.UInt16", + "ShortType": "", + "MinVal": "", + "MaxVal": "", + "DefaultVal": "", + "MapDevice": "PLC1", + "MapParam": "Param3_LAST", + "Map": "PLC1.Param3_LAST", + "Queue": "PLC1Queue", + "Converter": "", + "GroupID": "20250721112111161", + "GroupFullName": "Tag.Group1", + "FullName": "Tag.Group1.Param3_LAST" + }, + { + "ID": "20250721112117933", + "Name": "Param3", + "Desc": "", + "Type": "System.UInt16", + "ShortType": "", + "MinVal": "", + "MaxVal": "", + "DefaultVal": "", + "MapDevice": "PLC1", + "MapParam": "Param3", + "Map": "PLC1.Param3", + "Queue": "PLC1Queue", + "Converter": "", + "GroupID": "20250721112111161", + "GroupFullName": "Tag.Group1", + "FullName": "Tag.Group1.Param3" + }, + { + "ID": "20250721112117918", + "Name": "Param4", + "Desc": "", + "Type": "System.UInt16", + "ShortType": "", + "MinVal": "", + "MaxVal": "", + "DefaultVal": "", + "MapDevice": "PLC1", + "MapParam": "Param4", + "Map": "PLC1.Param4", + "Queue": "PLC1Queue", + "Converter": "", + "GroupID": "20250721112111161", + "GroupFullName": "Tag.Group1", + "FullName": "Tag.Group1.Param4" + } + ], + "Children": [] + } + ] }, "CreationTime": "2025-07-01 10:23:37", - "LastWriteTime": "0001-01-01 00:00:00", + "LastWriteTime": "2025-07-21 11:21:21", "Sample": { "ID": "", "Name": "Tag", -- Gitblit v1.9.1