From 426848306ad9233db96e4b3fc68a881c15f0b0b0 Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期五, 22 十一月 2024 13:43:53 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/JianShanLiKu --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 120 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 67 insertions(+), 53 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" index 9f36bdd..61d27cd 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" @@ -21,6 +21,7 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using Quartz; +using SqlSugar; using StackExchange.Profiling.Internal; using System; using System.Collections.Generic; @@ -71,14 +72,24 @@ CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); if ( conveyorLine != null ) { - if(conveyorLine.DeviceCode == "1002") + WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode + "杩愯鏃ュ織锛屽紑濮嬫椂闂�" + DateTime.Now, "Job鏃ュ織杩愯"); + if (conveyorLine.DeviceCode == "1002") { RequestInbound(conveyorLine); //涓�妤糃,B鍖轰笟鍔� } - + /*if (conveyorLine.DeviceCode == "1003") + { + _taskService.RequestWMSTask3("FK240711D2",1, "R02-002-027-011-01"); + }*/ + if (conveyorLine.DeviceCode == "1004") + { + RequestInbound3(conveyorLine); //涓�妤糃,B鍖轰笟鍔� + } + } + WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode+"杩愯鏃ュ織锛岀粨鏉熸椂闂�"+DateTime.Now, "Job鏃ュ織杩愯"); //RequestInNextAddress(conveyorLine); @@ -110,14 +121,14 @@ public void RequestInbound2(CommonConveyorLine conveyorLine) { //椤舵ゼ妤艰緭閫佺嚎鍒ゆ柇 - HandleEvent(conveyorLine, "PLC_WCS_D._05_PLC_EVENT", "PLC_WCS_D._05_PLC_LPN", "WCS_PLC_D._05_WCS_TO"); //鍒ゆ柇鍏ュ簱宸烽亾 + //HandleEvent(conveyorLine, "PLC_WCS_D._05_PLC_EVENT", "PLC_WCS_D._05_PLC_LPN", "WCS_PLC_D._05_WCS_TO"); //鍒ゆ柇鍏ュ簱宸烽亾 + //ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._01_PLC_EVENT", "PLC_WCS_D._01_PLC_LPN", "R02-003-027-011-01", "WCS_PLC_D._05_WCS_TO");// 澶勭悊 1宸烽亾 绔欏彴浜嬩欢鍏ョ┖ + //ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._03_PLC_EVENT", "PLC_WCS_D._03_PLC_LPN", "R01-003-041-011-01", "WCS_PLC_D._05_WCS_TO");// 澶勭悊 2宸烽亾 绔欏彴浜嬩欢 鍏ョ┖ - ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._01_PLC_EVENT", "PLC_WCS_D._01_PLC_LPN", "R02-003-027-011-01", "WCS_PLC_D._05_WCS_TO");// 澶勭悊 1宸烽亾 绔欏彴浜嬩欢鍏ョ┖ - ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._03_PLC_EVENT", "PLC_WCS_D._03_PLC_LPN", "R01-003-041-011-01", "WCS_PLC_D._05_WCS_TO");// 澶勭悊 2宸烽亾 绔欏彴浜嬩欢 鍏ョ┖ + ConveyorLineInFinish(conveyorLine, "R02-002-027-011-01"); //鍐欏叆杈撻�佺嚎鍘诲悜 - CheckForEmptyPallet2(conveyorLine, "PLC_WCS_D._02_PLC_EVENT", "PLC_WCS_D._02_PLC_LPN", "PLC_WCS_D._02_PLC_PUT", "R02-002-027-011-01"); //鍘熸潗鏂欏嚭搴� 璇诲彇鏉$爜閫夊簱鍖哄嚭搴� - CheckForEmptyPallet2(conveyorLine, "PLC_WCS_D._04_PLC_EVENT", "PLC_WCS_D._04_PLC_LPN", "PLC_WCS_D._04_PLC_PUT", "R01-002-041-011-01"); //鍘熸潗鏂欏嚭搴� 璇诲彇鏉$爜閫夊簱鍖哄嚭搴� - //ConveyorLineInFinish(conveyorLine); //鐢ㄤ簬鍐欏叆杈撻�佺嚎鏉$爜淇℃伅锛屾殏鏃舵湭鐢� + //CheckForEmptyPallet2(conveyorLine, "PLC_WCS_D._02_PLC_EVENT", "PLC_WCS_D._02_PLC_LPN", "PLC_WCS_D._02_PLC_PUT", "R02-002-027-011-01"); //鍘熸潗鏂欏嚭搴� 璇诲彇鏉$爜閫夊簱鍖哄嚭搴� + //CheckForEmptyPallet2(conveyorLine, "PLC_WCS_D._04_PLC_EVENT", "PLC_WCS_D._04_PLC_LPN", "PLC_WCS_D._04_PLC_PUT", "R01-002-041-011-01"); //鍘熸潗鏂欏嚭搴� 璇诲彇鏉$爜閫夊簱鍖哄嚭搴� } public void RequestInbound3(CommonConveyorLine conveyorLine) @@ -140,10 +151,10 @@ Dt_Task task = _taskService.IngStackerCraneTask2(conveyorLine.DeviceCode); if(task != null && task.TaskType==(int)TaskOutboundTypeEnum.Outbound) { - byte PalletType = 2; - if (task.TargetAddress == "R02-002-027-001-01" || task.TargetAddress == "R01-002-041-001-01") + byte PLCtypeTo = 1; + if (task.TargetAddress == "R02-002-027-011-01") { - PalletType = 1; + PLCtypeTo = 2; } DeviceProDTO? deviceProDTO3 = GetDeviceProDTO(conveyorLine, SCAddress, "W_PalletBarcode"); //鍐欏叆鏉$爜 DeviceProDTO? deviceProDTO4 = GetDeviceProDTO(conveyorLine, SCAddress, "W_PalletLayers"); //灞傛暟 @@ -151,7 +162,7 @@ DeviceProDTO? deviceProDTO6 = GetDeviceProDTO(conveyorLine, SCAddress, "W_Destination"); //绫诲瀷 if (deviceProDTO3 != null && deviceProDTO4 != null && deviceProDTO5 != null && deviceProDTO6 != null) { - if (SetLinestring(conveyorLine, deviceProDTO3.DeviceProDataBlock, task.PalletCode) && SetLine(conveyorLine, deviceProDTO4.DeviceProDataBlock, (byte)task.PalletCodequantity) && SetLine(conveyorLine, deviceProDTO5.DeviceProDataBlock, PalletType) && SetLine(conveyorLine, deviceProDTO6.DeviceProDataBlock, (byte)task.PLCTo)) + if (SetLinestring(conveyorLine, deviceProDTO3.DeviceProDataBlock, task.PalletCode) && SetLine(conveyorLine, deviceProDTO4.DeviceProDataBlock, (byte)task.PalletCodequantity) && SetLine(conveyorLine, deviceProDTO5.DeviceProDataBlock, PLCtypeTo) && SetLine(conveyorLine, deviceProDTO6.DeviceProDataBlock, (byte)task.PLCTo)) { LogSignalStatus($"鍐欏叆鏀捐揣瀹屾垚淇℃伅锛屾墭鐩樻潯鐮侊紝灞傛暟锛岀被鍨嬩俊鎭垚鍔�", deviceProDTO2.DeviceChildCode); @@ -243,53 +254,56 @@ //鏂扮殑宸烽亾鍒ゆ柇 private void HandleEvent2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag) { - try + byte events = conveyorLine.Communicator.Read<byte>(eventTag); // 璇诲彇浜嬩欢 + if (events == 1) { - byte events = conveyorLine.Communicator.Read<byte>(eventTag); // 璇诲彇浜嬩欢 - if (events == 1) + string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); // 璇诲彇鏉$爜 + if (barcode != "1" || barcode != "0") { - string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // 璇诲彇鏉$爜 - if (barcode != "1" || barcode != "0") + WebResponseContent content = _taskService.ToPlatform(barcode); + if(content != null) { - WebResponseContent content = _taskService.ToPlatform(barcode); - if ((int)content.Data == 1) + if (content.Status) { - if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") + if(content.Data != null) { - // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満 - bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //鍐欏叆鍘诲悜涓洪暱宸烽亾 - if (result) + if (content.Data.ToString() == "1") { - WriteLog.GetLog("PLC鏃ュ織").Write($"鏉$爜{barcode}锛屽啓鍏ュ幓鍚戯細1", "鍘诲悜"); + if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "") + { + // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満 + bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //鍐欏叆鍘诲悜涓洪暱宸烽亾 + if (result) + { + WriteLog.GetLog("PLC鏃ュ織").Write($"鏉$爜{barcode}锛屽啓鍏ュ幓鍚戯細1", "鍘诲悜"); + } + } + } + else if (content.Data.ToString() == "3") + { + + if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") + { + // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満 + bool result = conveyorLine.Communicator.Write(writeTag, (byte)3); //鍐欏叆鍘诲悜涓虹煭宸烽亾 + if (result) + { + WriteLog.GetLog("PLC鏃ュ織").Write($"鏉$爜{barcode},鍐欏叆鍘诲悜锛�3", "鍘诲悜"); + } + } } } - }else if ((int)content.Data == 3) - { - - if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "") - { - // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満 - bool result = conveyorLine.Communicator.Write(writeTag, (byte)3); //鍐欏叆鍘诲悜涓虹煭宸烽亾 - if (result) - { - WriteLog.GetLog("PLC鏃ュ織").Write($"鏉$爜{barcode},鍐欏叆鍘诲悜锛�3", "鍘诲悜"); - } - } - } - }else if (barcode == "1") - { - bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //绌烘墭鍘诲悜 - if (result) - { - WriteLog.GetLog("PLC鏃ュ織").Write("绌烘墭鍏ュ簱锛屽啓鍏ュ幓鍚戯細1", "鍘诲悜"); } } } - } - catch (Exception ex) - { - - throw; + else if (barcode == "1") + { + bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //绌烘墭鍘诲悜 + if (result) + { + WriteLog.GetLog("PLC鏃ュ織").Write("绌烘墭鍏ュ簱锛屽啓鍏ュ幓鍚戯細1", "鍘诲悜"); + } + } } } @@ -362,23 +376,23 @@ if (eventStatus == 1) { WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"璇诲彇鍒拌緭閫佺嚎鐢宠鍏ュ簱淇℃伅EVENT涓猴細{eventStatus}锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅"); - string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); - if(barcode == "1") + string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); + /*if(barcode == "1") { string currentTime = DateTime.Now.ToString("HHmmss"); barcode = "KTP" + currentTime; - } + }*/ if (barcode != null) { bool result = conveyorLine.Communicator.Write(writeTag, (byte)0); - if(taskCode== "R01-003-042-001-01") + /*if(taskCode== "R01-003-042-001-01") { if ((_taskService.ToPlatform(barcode)).Status) { WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"缁勭洏鎴愬姛锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅"); } - } + }*/ // 鎷垮彇鎵樼洏鏉$爜鐢宠鍏ュ簱淇℃伅 WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // 鐢宠鍏ュ簱锛岀敓鎴愬爢鍨涙満浠诲姟 if (content !=null) -- Gitblit v1.9.3