From 829eabf256e29392ca63f6da48829dba3b075dfe Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期五, 24 一月 2025 08:59:53 +0800
Subject: [PATCH] 资料,优化程序

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |  291 +++++++++++++++++++++++++---------------------------------
 1 files changed, 126 insertions(+), 165 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 f3ef36f..a8377c2 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"
@@ -73,7 +73,6 @@
                 CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                 if (conveyorLine != null)
                 {
-                    WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode + "杩愯鏃ュ織锛屽紑濮嬫椂闂�" + DateTime.Now, "Job鏃ュ織杩愯");
                     if (conveyorLine.DeviceCode == "1002")
                     {
                         RequestInbound(conveyorLine);   //涓�妤糃,B鍖轰笟鍔�
@@ -84,20 +83,17 @@
                     }
                     if (conveyorLine.DeviceCode == "1004")
                     {
-                        RequestInbound3(conveyorLine);   //涓�妤糃,B鍖轰笟鍔�
+                        RequestInbound3(conveyorLine);   
                     }
 
 
 
                 }
                 WriteLog.GetLog("Job鏃ュ織杩愯").Write(conveyorLine.DeviceCode + "杩愯鏃ュ織锛岀粨鏉熸椂闂�" + DateTime.Now, "Job鏃ュ織杩愯");
-                //RequestInNextAddress(conveyorLine);
-
-
             }
             catch (Exception ex)
             {
-                //Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+                WriteLog.Write_Log("杈撻�佺嚎浜や簰", "閿欒淇℃伅", "閿欒", new { 淇℃伅 = ex.Message });
             }
             finally
             {
@@ -109,8 +105,8 @@
         public void RequestInbound(CommonConveyorLine conveyorLine)
         {
             //1妤艰緭閫佺嚎鍒ゆ柇
-            HandleEvent2(conveyorLine, "PLC_WCS_B._03_PLC_EVENT", "PLC_WCS_B._03_PLC_LPN", "WCS_PLC_B._03_WCS_TO");  //鍒ゆ柇宸烽亾
-            HandleEvent2(conveyorLine, "PLC_WCS_C._02_PLC_EVENT", "PLC_WCS_C._02_PLC_LPN", "WCS_PLC_C._02_WCS_TO");  //鍒ゆ柇宸烽亾
+            HandleEvent2(conveyorLine, "PLC_WCS_B._03_PLC_EVENT", "PLC_WCS_B._03_PLC_LPN", "WCS_PLC_B._03_WCS_TO","鍘熸潗鏂欐壂鐮佺珯鍙�");  //鍒ゆ柇宸烽亾
+            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 
@@ -123,11 +119,6 @@
 
             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"); //鍘熸潗鏂欏嚭搴�    璇诲彇鏉$爜閫夊簱鍖哄嚭搴�
         }
 
         public void RequestInbound3(CommonConveyorLine conveyorLine)
@@ -249,70 +240,67 @@
         }
 
         //鏂扮殑宸烽亾鍒ゆ柇
-        private void HandleEvent2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag)
+        private void HandleEvent2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag,string Platform)
         {
             byte events = conveyorLine.Communicator.Read<byte>(eventTag); // 璇诲彇浜嬩欢
-            if (events == 1)
+            string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); // 璇诲彇鏉$爜
+            if (events == 1 && barcode !="NoRead" && barcode !="" && barcode != null)
             {
-                string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); // 璇诲彇鏉$爜
-                if (barcode != "1" || barcode != "0")
+                WebResponseContent content = _taskService.ToPlatform(barcode);
+                if (content != null)
                 {
-                    WebResponseContent content = _taskService.ToPlatform(barcode);
-                    if (content != null)
+                    if (content.Status)
                     {
-                        if (content.Status)
+                        if (content.Data != null)
                         {
-                            if (content.Data != null)
+                            if (content.Data.ToString() == "1")
                             {
-                                if (content.Data.ToString() == "1")
+                                if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "")
                                 {
-                                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "")
+                                    // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満
+                                    bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //鍐欏叆鍘诲悜涓洪暱宸烽亾
+                                    if (result)
                                     {
-                                        // 鍐欏叆鍘诲悜2鍙峰爢鍨涙満
-                                        bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //鍐欏叆鍘诲悜涓洪暱宸烽亾
-                                        if (result)
-                                        {
-                                            WriteLog.GetLog("PLC鏃ュ織").Write($"鏉$爜{barcode}锛屽啓鍏ュ幓鍚戯細1", "鍘诲悜");
-                                        }
-                                    }
-                                    else
-                                    {
-                                        WriteLog.GetLog("PLC鏃ュ織").Write($"鍘熷洜锛氬綋鍓嶉渶鍐欏叆鍘诲悜锛�1锛屼絾璇诲彇杈撻�佺嚎鈥滃爢鍨涙満鍙栬揣绔欏彴鈥濇湁鏉$爜锛屼笉鍙啓鍏�", "鍘诲悜澶辫触淇℃伅");
+                                        wcs_PLCto01(Platform + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"鏉$爜{barcode},鍐欏叆鍘诲悜锛�1");
                                     }
                                 }
-                                else if (content.Data.ToString() == "3")
+                                else
                                 {
-
-                                    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
-                                    {
-                                        WriteLog.GetLog("PLC鏃ュ織").Write($"鍘熷洜锛氬綋鍓嶉渶鍐欏叆鍘诲悜锛�3锛屼絾璇诲彇杈撻�佺嚎鈥滃爢鍨涙満鍙栬揣绔欏彴鈥濇湁鏉$爜锛屼笉鍙啓鍏�", "鍘诲悜澶辫触淇℃伅");
-                                    }
+                                    wcs_PLCto01(Platform + "锛氶敊璇俊鎭�", "閿欒", $"鏉$爜锛歿barcode}锛屽師鍥狅細褰撳墠闇�鍐欏叆鍘诲悜锛�1锛屼絾璇诲彇杈撻�佺嚎鈥滃爢鍨涙満鍙栬揣绔欏彴鈥濇湁鏉$爜锛屼笉鍙啓鍏ュ幓鍚�");
                                 }
                             }
-                        }
-                        else
-                        {
-                            WriteLog.GetLog("PLC鏃ュ織").Write($"澶辫触淇℃伅锛歿content.Message}", "鍘诲悜澶辫触淇℃伅");
+                            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)
+                                    {
+                                        wcs_PLCto01(Platform + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"鏉$爜{barcode},鍐欏叆鍘诲悜锛�3");
+                                    }
+                                }
+                                else
+                                {
+                                    wcs_PLCto01(Platform + "锛氶敊璇俊鎭�", "閿欒", $"鏉$爜锛歿barcode}锛屽師鍥狅細褰撳墠闇�鍐欏叆鍘诲悜锛�3锛屼絾璇诲彇杈撻�佺嚎鈥滃爢鍨涙満鍙栬揣绔欏彴鈥濇湁鏉$爜锛屼笉鍙啓鍏ュ幓鍚�");
+                                }
+                            }
+                            else
+                            {
+                                wcs_PLCto01(Platform + "锛氶敊璇俊鎭�", "閿欒", $"鏉$爜锛歿barcode}锛岀敵璇峰叆搴撳け璐ワ細鏈幏鍙栧埌鍘诲悜");
+                            }
                         }
                     }
-                }
-                else if (barcode == "1")
-                {
-                    bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //绌烘墭鍘诲悜
-                    if (result)
+                    else
                     {
-                        WriteLog.GetLog("PLC鏃ュ織").Write("绌烘墭鍏ュ簱锛屽啓鍏ュ幓鍚戯細1", "鍘诲悜");
+                        wcs_PLCto01(Platform + "锛氶敊璇俊鎭�", "閿欒", $"鏉$爜锛歿barcode}锛岀敵璇峰叆搴撳け璐ワ細{content.Message}");
                     }
                 }
+            }
+            else
+            {
+                wcs_PLCto01(Platform+"锛氶敊璇俊鎭�", "閿欒", $"璇诲彇鍒拌緭閫佺嚎,鐢宠锛歿events},鏉$爜锛歿barcode}");
             }
         }
 
@@ -320,63 +308,26 @@
         private void CheckForEmptyPallet(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc)
         {
 
-            try
-            {
-                Byte events = conveyorLine.Communicator.Read<Byte>(eventTag);  // 璇诲彇浜嬩欢
-                if (events == 1)        //1涓虹┖锛�0涓烘湁
-                {
-                    string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // 璇诲彇鏉$爜
-                    if (barcode == "")
-                    {
-                        WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"璇诲彇鍒板嚭搴撳彛琛ョ┖鎵樹俊鍙凤細{events}", "闇�瑕佺┖鎵�");
-                        // 鐢熸垚鍫嗗灈鏈哄彇绌烘墭浠诲姟
-                        byte plcputts = conveyorLine.Communicator.Read<byte>(plcput);
-                        if (plcputts != 1)
-                        {
-                            if ((_taskService.RequestWMSTask2("", Loc)).Status)
-                            {
-                                WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"宸茬敓鎴愮┖鎵樺嚭搴撲换鍔★細{events}", "闇�瑕佺┖鎵�");
-                            }
-                            else
-                            {
-                                WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"鏈敓鎴愮┖鎵樺嚭搴撲换鍔★細{events}", "闇�瑕佺┖鎵�");
-                            }
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-
-                throw;
-            }
-        }
-
-        //鐢ㄤ簬鍒ゆ柇鏄惁鍑虹┖鎵� D鍖�
-        private void CheckForEmptyPallet2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc)
-        {
             Byte events = conveyorLine.Communicator.Read<Byte>(eventTag);  // 璇诲彇浜嬩欢
             if (events == 1)        //1涓虹┖锛�0涓烘湁
             {
-                string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // 璇诲彇鏉$爜
-                if (barcode != "1" || barcode != "0")
+                WebResponseContent content = _taskService.RequestWMSTask2("", Loc);
+                // 鐢熸垚鍫嗗灈鏈哄彇绌烘墭浠诲姟
+                if (content.Status)
                 {
-                    WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"璇诲彇鍒板師鏉愭枡鍑哄簱淇℃伅锛屾潯鐮佷俊鎭細{barcode}", "鍘熸潗鏂欏嚭搴�");
-
-                    byte outCount = conveyorLine.Communicator.Read<byte>(plcput);
-                    if ((_taskService.RequestWMSTask3(barcode, outCount, Loc)).Status)
-                    {
-                        //鍐欏叆杈撻�佺嚎娓呴櫎淇℃伅
-                        WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"宸茬敓鎴愬師鏉愭枡鍑哄簱浠诲姟锛屾潯鐮佷俊鎭細{barcode}", "鍘熸潗鏂欏嚭搴�");
-                    }
-                    else
-                    {
-                        WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"鏈敓鎴愬師鏉愭枡鍑哄簱浠诲姟锛屾潯鐮佷俊鎭細{barcode}", "鍘熸潗鏂欏嚭搴�");
-                    }
+                    wcs_PLCto02(Loc + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"宸茬敓鎴愮┖鎵樺嚭搴撲换鍔�");
+                }
+                else
+                {
+                    wcs_PLCto02(Loc + "锛氶敊璇俊鎭�", "閿欒", $"鏈敓鎴愮┖鎵樺嚭搴撲换鍔★紝閿欒淇℃伅锛歿content.Message}");
                 }
             }
-
+            else
+            {
+                wcs_PLCto02(Loc + "锛氶敊璇俊鎭�", "閿欒", $"璇诲彇鍒拌緭閫佺嚎,鐢宠锛歿events}");
+            }
         }
+
 
         //鐢ㄤ簬鍒ゆ柇鍏ュ簱绔欏彴
         private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode, string writeTag)
@@ -384,41 +335,31 @@
             byte eventStatus = conveyorLine.Communicator.Read<byte>(eventTag);
             if (eventStatus == 1)
             {
-                WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"璇诲彇鍒拌緭閫佺嚎鐢宠鍏ュ簱淇℃伅EVENT涓猴細{eventStatus}锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅");
                 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 ((_taskService.ToPlatform(barcode)).Status)
-                        {
-                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"缁勭洏鎴愬姛锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅");
-                        }
-                    }*/
-                    // 鎷垮彇鎵樼洏鏉$爜鐢宠鍏ュ簱淇℃伅
+                    wcs_PLCto03("鍘诲悜娓呴櫎", "鎴愬姛", $"鍦板潃锛歿writeTag}锛屽幓鍚戞竻闄や负锛�0");
                     WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // 鐢宠鍏ュ簱锛岀敓鎴愬爢鍨涙満浠诲姟
                     if (content != null)
                     {
                         if (content.Status)
                         {
-                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鐢宠鍏ュ簱鎴愬姛锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅");
+                            wcs_PLCto03(taskCode + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"鏉$爜锛歿barcode}锛岀敵璇峰叆搴撴垚鍔�");
                         }
                         else
                         {
-                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鐢宠鍏ュ簱澶辫触锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅");
+                            wcs_PLCto03(taskCode+ "锛氶敊璇俊鎭�", "閿欒", $"鏉$爜锛歿barcode}锛岀敵璇峰叆搴撳け璐ワ紝閿欒淇℃伅锛歿content.Message}");
                         }
+                    }
+                    else
+                    {
+                        wcs_PLCto03(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鏉$爜锛歿barcode}锛岀敵璇峰叆搴撳け璐ワ紝閿欒淇℃伅content杩斿洖鍊间负绌�");
                     }
                 }
                 else
                 {
-                    WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"璇诲彇鍒拌緭閫佺嚎淇℃伅涓虹┖锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绔欏彴淇℃伅");
+                    wcs_PLCto03(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"璇诲彇鍒拌緭閫佺嚎淇℃伅涓虹┖");
                 }
             }
             else if (eventStatus == 6)
@@ -428,61 +369,59 @@
                     WebResponseContent content = _taskService.RequestWMSTask4();
                     if (content != null)
                     {
-                        if (content.Status)
+                        if(content.Status && content.Data != null)
                         {
-                            if (content.Data != null)
+                            if (content.Data.ToString() == "1")
                             {
-                                if (content.Data.ToString() == "1")
+                                if (conveyorLine.Communicator.Write(writeTag, (byte)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}", "绌烘墭鍏ュ簱鍘诲悜");
-                                        }
-                                    }
+                                    wcs_PLCto04(taskCode + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"鍐欏叆鎴愬姛锛屽幓鍚戯細1");
                                 }
-                                else if (content.Data.ToString() == "3")
+                                else
                                 {
-
-                                    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}", "绌烘墭鍏ュ簱鍘诲悜");
-                                        }
-                                    }
+                                    wcs_PLCto04(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鍐欏叆澶辫触锛屽幓鍚戯細1");
                                 }
                             }
+                            else if (content.Data.ToString() == "3")
+                            {
+
+                                if (conveyorLine.Communicator.Write(writeTag, (byte)3))
+                                {
+                                    wcs_PLCto04(taskCode + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"鍐欏叆鎴愬姛锛屽幓鍚戯細3");
+                                }
+                                else
+                                {
+                                    wcs_PLCto04(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鍐欏叆澶辫触锛屽幓鍚戯細3");
+                                }
+                            }
+                            else
+                            {
+                                wcs_PLCto04(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鏈壘鍒板啓鍏ュ幓鍚�");
+                            }
                         }
+                        else
+                        {
+                            wcs_PLCto04(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鐢宠鍏ュ簱澶辫触锛岄敊璇俊鎭細{content.Message}");
+                        }
+                    }
+                    else
+                    {
+                        wcs_PLCto04(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鐢宠鍏ュ簱澶辫触锛岄敊璇俊鎭細content杩斿洖鍊间负绌�");
                     }
 
                 }
                 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))
                     {
-                        if (conveyorLine.Communicator.Write(writeTag, (byte)1))
-                        {
-                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆鎴愬姛锛屽幓鍚戯細1锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
-                        }
-                        else
-                        {
-                            WriteLog.GetLog("PLC鍏ュ簱绔欏彴鏃ュ織").Write($"鍐欏叆澶辫触锛屽幓鍚戯細1锛岀珯鍙扮紪鍙蜂负锛歿taskCode}", "绌烘墭鍏ュ簱鍘诲悜");
-                        }
+                        wcs_PLCto04(taskCode + "锛氭垚鍔熶俊鎭�", "鎴愬姛", $"鍐欏叆澶辫触锛屽幓鍚戯細1");
                     }
-                    
+                    else
+                    {
+                        wcs_PLCto04(taskCode + "锛氶敊璇俊鎭�", "閿欒", $"鍐欏叆澶辫触锛屽幓鍚戯細1");
+                    }
+
                 }
-
-
             }
         }
         public bool SetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock, byte Pali)
@@ -502,5 +441,27 @@
         {
             WriteLog.GetLog("鍫嗗灈鏈轰笌plc浜や簰淇″彿").Write($"绔欏彴缂栧彿锛歿sourceAddress},淇℃伅锛歿message}", $"{sourceAddress}");
         }
+
+
+
+
+        public void wcs_PLCto01(string SCLLinStack, string Logtype, string Magessadd)
+        {
+            WriteLog.Write_Log("涓�妤兼壂鐮佺珯鍙�", SCLLinStack, Logtype, new { 淇℃伅 = Magessadd });
+        }
+
+        public void wcs_PLCto02(string SCLLinStack, string Logtype, string Magessadd)
+        {
+            WriteLog.Write_Log("涓�妤艰ˉ绌烘墭", SCLLinStack, Logtype, new { 淇℃伅 = Magessadd });
+        }
+        public void wcs_PLCto03(string SCLLinStack, string Logtype, string Magessadd)
+        {
+            WriteLog.Write_Log("鍏ュ簱绔欏彴", SCLLinStack, Logtype, new { 淇℃伅 = Magessadd });
+        }
+        public void wcs_PLCto04(string SCLLinStack, string Logtype, string Magessadd)
+        {
+            WriteLog.Write_Log("椤舵ゼ绌烘墭鍥炲簱", SCLLinStack, Logtype, new { 淇℃伅 = Magessadd });
+        }
+
     }
 }

--
Gitblit v1.9.3