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/Build/Project/代码/VS自定义类/AutoThread.cs | 69 +++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 3 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 -- Gitblit v1.9.1