From b9f8212946fde1af1216b972996c32b8c8ed6363 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期三, 27 十一月 2024 10:07:34 +0800
Subject: [PATCH] Revert "Stop tracking D:\widesea\尖山立库\JianShanLiKu\代码管理\WCS\WIDESEAWCS_Server\WIDESEAWCS_BasicInfoRepository\bin"

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |  130 +++++++++++++++++++++++++++++++-----------
 1 files changed, 95 insertions(+), 35 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 61d27cd..30d06bd 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"
@@ -20,6 +20,7 @@
 using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using OfficeOpenXml.Packaging.Ionic.Zip;
 using Quartz;
 using SqlSugar;
 using StackExchange.Profiling.Internal;
@@ -66,21 +67,21 @@
 
         public Task Execute(IJobExecutionContext context)
         {
-            
+
             try
             {
                 CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
-                if ( conveyorLine != null )
+                if (conveyorLine != null)
                 {
                     WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode + "杩愯鏃ュ織锛屽紑濮嬫椂闂�" + DateTime.Now, "Job鏃ュ織杩愯");
                     if (conveyorLine.DeviceCode == "1002")
                     {
                         RequestInbound(conveyorLine);   //涓�妤糃,B鍖轰笟鍔�
                     }
-                    /*if (conveyorLine.DeviceCode == "1003")
+                    if (conveyorLine.DeviceCode == "1003")
                     {
-                        _taskService.RequestWMSTask3("FK240711D2",1, "R02-002-027-011-01");
-                    }*/
+                        RequestInbound2(conveyorLine);
+                    }
                     if (conveyorLine.DeviceCode == "1004")
                     {
                         RequestInbound3(conveyorLine);   //涓�妤糃,B鍖轰笟鍔�
@@ -89,7 +90,7 @@
 
 
                 }
-                WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode+"杩愯鏃ュ織锛岀粨鏉熸椂闂�"+DateTime.Now, "Job鏃ュ織杩愯");
+                WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode + "杩愯鏃ュ織锛岀粨鏉熸椂闂�" + DateTime.Now, "Job鏃ュ織杩愯");
                 //RequestInNextAddress(conveyorLine);
 
 
@@ -112,8 +113,6 @@
             HandleEvent2(conveyorLine, "PLC_WCS_C._02_PLC_EVENT", "PLC_WCS_C._02_PLC_LPN", "WCS_PLC_C._02_WCS_TO");  //鍒ゆ柇宸烽亾
             CheckForEmptyPallet(conveyorLine, "PLC_WCS_B._02_PLC_EVENT", "PLC_WCS_B._02_PLC_LPN", "PLC_WCS_B._02_PLC_PUT", "R02-002-027-001-01"); //鍒ゆ柇鏄惁鍙栫┖鎵樺嚭搴�
             CheckForEmptyPallet(conveyorLine, "PLC_WCS_C._01_PLC_EVENT", "PLC_WCS_C._01_PLC_LPN", "PLC_WCS_C._01_PLC_PUT", "R01-002-041-001-01"); //鍒ゆ柇鏄惁鍙栫┖鎵樺嚭搴�
-
-
             ProcessConveyorEvent(conveyorLine, "PLC_WCS_B._01_PLC_EVENT", "PLC_WCS_B._01_PLC_LPN", "R02-003-027-001-01", "WCS_PLC_B._03_WCS_TO");// 澶勭悊 B 
             ProcessConveyorEvent(conveyorLine, "PLC_WCS_C._03_PLC_EVENT", "PLC_WCS_C._03_PLC_LPN", "R01-003-041-001-01", "WCS_PLC_C._02_WCS_TO");// 澶勭悊 C
         }
@@ -121,11 +120,11 @@
         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");  //鍒ゆ柇鍏ュ簱宸烽亾
-            //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"); //鍐欏叆杈撻�佺嚎鍘诲悜
+            ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._01_PLC_EVENT", "PLC_WCS_D._01_PLC_LPN", "R01-003-041-011-01", "WCS_PLC_D._01_WCS_TO");// 澶勭悊 1宸烽亾 绔欏彴浜嬩欢鍏ョ┖
+            ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._03_PLC_EVENT", "PLC_WCS_D._03_PLC_LPN", "R02-003-027-011-01", "WCS_PLC_D._03_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"); //鍘熸潗鏂欏嚭搴�    璇诲彇鏉$爜閫夊簱鍖哄嚭搴�
@@ -135,21 +134,19 @@
         {
             ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._02_PLC_EVENT", "PLC_WCS_A._02_PLC_LPN", "R01-002-043-001-01", "WCS_PLC_A._02_WCS_TO");// 澶勭悊 A21 绔欏彴浜嬩欢鍏ュ簱
 
-            //ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._03_PLC_EVENT", "PLC_WCS_A._03_PLC_LPN", "R01-002-042-001-01", "WCS_PLC_A._03_WCS_TO");// 澶勭悊 A22 绔欏彴浜嬩欢 鍏ユ枡
-            
-            //ConveyorLineInFinish(conveyorLine,"R01-002-044-001-01"); //鐢ㄤ簬鍐欏叆杈撻�佺嚎鏉$爜淇℃伅锛岀敤浜庡嚭搴�
+            ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._03_PLC_EVENT", "PLC_WCS_A._03_PLC_LPN", "R01-002-042-001-01", "WCS_PLC_A._03_WCS_TO");// 澶勭悊 A22 绔欏彴浜嬩欢 鍏ユ枡
         }
 
-        public void ConveyorLineInFinish(CommonConveyorLine conveyorLine,string SCAddress)
+        public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, string SCAddress)
         {
-            DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine,SCAddress, "R_StackerCraneLowered");    //璇诲彇杈撻�佺嚎 鈥滃爢鍨涙満鏀句笅鈥� 淇″彿
-            if ( deviceProDTO2 != null )
+            DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, SCAddress, "R_StackerCraneLowered");    //璇诲彇杈撻�佺嚎 鈥滃爢鍨涙満鏀句笅鈥� 淇″彿
+            if (deviceProDTO2 != null)
             {
                 byte strsd = GetLine(conveyorLine, deviceProDTO2.DeviceChildCode);
                 if (strsd == 1)
                 {
                     Dt_Task task = _taskService.IngStackerCraneTask2(conveyorLine.DeviceCode);
-                    if(task != null && task.TaskType==(int)TaskOutboundTypeEnum.Outbound)
+                    if (task != null && task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
                     {
                         byte PLCtypeTo = 1;
                         if (task.TargetAddress == "R02-002-027-011-01")
@@ -182,7 +179,7 @@
                     }
                 }
             }
-           
+
         }
         //鑾峰彇杈撻�佺嚎瀹炰緥
         public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine, string SCAddress, string Interactivet)
@@ -197,7 +194,7 @@
         /// <param name="eventTag"></param>
         /// <param name="barcodeTag"></param>
         /// <param name="writeTag"></param>
-        private void HandleEvent(CommonConveyorLine conveyorLine,string eventTag, string barcodeTag, string writeTag)
+        private void HandleEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag)
         {
             try
             {
@@ -205,11 +202,11 @@
                 if (events == 1)
                 {
                     string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // 璇诲彇鏉$爜
-                    if(barcode != "1" || barcode != "0")    
+                    if (barcode != "1" || barcode != "0")
                     {
                         if ((_taskService.ToPlatform(barcode)).Status)
                         {
-                            if(conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN")=="")
+                            if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "")
                             {
                                 // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満
                                 bool result = conveyorLine.Communicator.Write(writeTag, (byte)3);   //鍘熸潗鏂欏幓鍚�
@@ -261,11 +258,11 @@
                 if (barcode != "1" || barcode != "0")
                 {
                     WebResponseContent content = _taskService.ToPlatform(barcode);
-                    if(content != null)
+                    if (content != null)
                     {
                         if (content.Status)
                         {
-                            if(content.Data != null)
+                            if (content.Data != null)
                             {
                                 if (content.Data.ToString() == "1")
                                 {
@@ -282,7 +279,7 @@
                                 else if (content.Data.ToString() == "3")
                                 {
 
-                                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") 
+                                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "")
                                     {
                                         // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満
                                         bool result = conveyorLine.Communicator.Write(writeTag, (byte)3);   //鍐欏叆鍘诲悜涓虹煭宸烽亾
@@ -306,9 +303,9 @@
                 }
             }
         }
-        
+
         //鐢ㄤ簬鍒ゆ柇鏄惁琛ョ┖鎵� A鍖�
-        private void CheckForEmptyPallet(CommonConveyorLine conveyorLine,string eventTag, string barcodeTag,string plcput,string Loc)
+        private void CheckForEmptyPallet(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc)
         {
 
             try
@@ -317,11 +314,11 @@
                 if (events == 1)        //1涓虹┖锛�0涓烘湁
                 {
                     string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // 璇诲彇鏉$爜
-                    if(barcode == "")
+                    if (barcode == "")
                     {
                         WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"璇诲彇鍒板嚭搴撳彛琛ョ┖鎵樹俊鍙凤細{events}", "闇�瑕佺┖鎵�");
                         // 鐢熸垚鍫嗗灈鏈哄彇绌烘墭浠诲姟
-                        byte plcputts = conveyorLine.Communicator.Read<byte>(plcput);   
+                        byte plcputts = conveyorLine.Communicator.Read<byte>(plcput);
                         if (plcputts != 1)
                         {
                             if ((_taskService.RequestWMSTask2("", Loc)).Status)
@@ -355,7 +352,7 @@
                     WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"璇诲彇鍒板師鏉愭枡鍑哄簱淇℃伅锛屾潯鐮佷俊鎭細{barcode}", "鍘熸潗鏂欏嚭搴�");
 
                     byte outCount = conveyorLine.Communicator.Read<byte>(plcput);
-                    if ((_taskService.RequestWMSTask3(barcode, outCount,Loc)).Status)
+                    if ((_taskService.RequestWMSTask3(barcode, outCount, Loc)).Status)
                     {
                         //鍐欏叆杈撻�佺嚎娓呴櫎淇℃伅
                         WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"宸茬敓鎴愬師鏉愭枡鍑哄簱浠诲姟锛屾潯鐮佷俊鎭細{barcode}", "鍘熸潗鏂欏嚭搴�");
@@ -366,11 +363,11 @@
                     }
                 }
             }
-            
+
         }
 
         //鐢ㄤ簬鍒ゆ柇鍏ュ簱绔欏彴
-        private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode,string writeTag)
+        private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode, string writeTag)
         {
             byte eventStatus = conveyorLine.Communicator.Read<byte>(eventTag);
             if (eventStatus == 1)
@@ -395,7 +392,7 @@
                     }*/
                     // 鎷垮彇鎵樼洏鏉$爜鐢宠鍏ュ簱淇℃伅
                     WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // 鐢宠鍏ュ簱锛岀敓鎴愬爢鍨涙満浠诲姟
-                    if (content !=null)
+                    if (content != null)
                     {
                         if (content.Status)
                         {
@@ -412,6 +409,69 @@
                     WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"璇诲彇鍒拌緭閫佺嚎淇℃伅涓虹┖锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅");
                 }
             }
+            else if (eventStatus == 6)
+            {
+                if (taskCode == "R02-003-027-011-01")
+                {
+                    WebResponseContent content = _taskService.RequestWMSTask4();
+                    if (content != null)
+                    {
+                        if (content.Status)
+                        {
+                            if (content.Data != null)
+                            {
+                                if (content.Data.ToString() == "1")
+                                {
+                                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_D._01_PLC_LPN") == "")
+                                    {
+                                        if (conveyorLine.Communicator.Write(writeTag, (byte)1))
+                                        {
+                                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆鎴愬姛锛屽幓鍚戯細1锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
+                                        }
+                                        else
+                                        {
+                                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆澶辫触锛屽幓鍚戯細1锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
+                                        }
+                                    }
+                                }
+                                else if (content.Data.ToString() == "3")
+                                {
+
+                                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_D._03_PLC_LPN") == "")
+                                    {
+                                        if (conveyorLine.Communicator.Write(writeTag, (byte)3))
+                                        {
+                                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆鎴愬姛锛屽幓鍚戯細3锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
+                                        }
+                                        else
+                                        {
+                                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆澶辫触锛屽幓鍚戯細3锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                }
+                else if (taskCode == "R01-003-041-011-01")
+                {
+                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_D._03_PLC_LPN") == "")
+                    {
+                        if (conveyorLine.Communicator.Write(writeTag, (byte)1))
+                        {
+                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆鎴愬姛锛屽幓鍚戯細1锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
+                        }
+                        else
+                        {
+                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆澶辫触锛屽幓鍚戯細1锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
+                        }
+                    }
+                    
+                }
+
+
+            }
         }
         public bool SetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock, byte Pali)
         {
@@ -421,7 +481,7 @@
         {
             return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali);
         }
-        
+
         public byte GetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock)
         {
             return conveyorLine.Communicator.Read<byte>(DeviceProDataBlock);

--
Gitblit v1.9.3