From b466b3135cd7f3b08f570efda0ffb691daff5270 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 05 十二月 2025 18:15:16 +0800
Subject: [PATCH] 一期输送线代码及AGV请求等

---
 项目代码/WCSServices/WIDESEAWCS_Tasks/一期线体/ConveyorLineJob1.cs |   71 ++++++++++++++++++++++++++++++++---
 1 files changed, 64 insertions(+), 7 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
index 35a4301..e821c77 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Components.Routing;
 using Newtonsoft.Json;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using Quartz;
 using System;
 using System.Collections.Generic;
@@ -9,6 +10,7 @@
 using System.Linq;
 using System.Reflection.Metadata;
 using System.Text;
+using System.Text.Unicode;
 using System.Threading.Tasks;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.Helper;
@@ -54,7 +56,16 @@
             _routerService = routerService;
             _routerExtension = routerExtension;
         }
-
+        /*
+        1鍙蜂綅鍑哄簱鍙e厑璁告斁绠�        0
+        1鍙蜂綅鏀剧瀹屾垚淇″彿          21
+        6鍙蜂綅鎷i�変綅鏂欑鍒拌揪        1
+        6鍙蜂綅鎷i�変綅鏂欑鏉$爜        2
+        6鍙蜂綅鎷i�変綅鏂欑娴佸姩        22
+        8鍙蜂綅鍏ュ簱鍙e厑璁稿彇绠�        11
+        8鍙蜂綅鍏ュ簱鍙f枡绠辨潯鐮�        12
+        8鍙蜂綅鏈哄櫒浜哄彇绠卞畬鎴�        23
+        */
         public Task Execute(IJobExecutionContext context)
         {
             try
@@ -65,13 +76,59 @@
                     OtherDevice device = (OtherDevice)value;
                     List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                     
-                    foreach (var item in stationMangers)
+                    foreach (var station in stationMangers)
                     {
-                        byte[] bytesPut = device.Communicator.Read("22", 1);
-                       ;
-                        device.Communicator.Write("22", new byte[] { 2, 0 });
-                        byte[] bytesPuted = device.Communicator.Read("22",1);
-                        device.Communicator.Write("22", new byte[] { 0, 0 });
+                        if (station.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt())
+                        {
+
+                            //鎷i�夌敵璇�
+                            short pickArrived = device.Communicator.Read<short>("1");
+                            if (pickArrived == 256)
+                            {
+                                byte[] bytesPick = device.Communicator.Read("2", 5);
+                                string pickBarCode = Encoding.UTF8.GetString(bytesPick).Replace("\0", "").Replace("\\0", "");
+                                //涓婃姤WMS鏂欑鍒拌揪
+                                if (pickBarCode.IsNotEmptyOrNull())
+                                {
+                                    WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, pickBarCode);
+                                    if (content.Status)
+                                    {
+                                        WriteInfo(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶ユ垚鍔焮pickBarCode}");
+                                    }
+                                    else
+                                    {
+                                        WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶MS閿欒{pickBarCode}锛屼俊鎭瘂content.Message}");
+                                    }
+                                }
+                                else
+                                {
+                                    WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂负{pickArrived}鏉$爜涓虹┖鍊�");
+                                }
+                            }
+                        }
+                        else
+                        {
+                            //鍏ュ簱鐢宠
+                            short InTake = device.Communicator.Read<short>("11");
+                            byte[] bytesIn = device.Communicator.Read("12", 5);
+                            string InBarCode = Encoding.UTF8.GetString(bytesIn).Replace("\0", "").Replace("\\0", "");
+                            if (InTake==256 && InBarCode.IsNotEmptyOrNull())
+                            {
+                                //鐢宠鍏ュ簱浠诲姟
+                                Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == InBarCode && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.TaskState != TaskStatusEnum.CL_Executing.ObjToInt());
+                                if (task != null) continue;
+
+                                WebResponseContent content = _taskService.RequestInTask(station.StationCode, InBarCode);
+                                if (content.Status)
+                                {
+                                    WriteInfo(device.DeviceCode, $"绔欏彴{station.StationCode}鏂欑{InBarCode}鐢宠鍏ュ簱鎴愬姛");
+                                }
+                                else
+                                {
+                                    WriteError(device.DeviceCode, $"绔欏彴{station.StationCode}鏂欑{InBarCode}鐢宠鍏ュ簱浠诲姟閿欒锛屼俊鎭瘂content.Message}");
+                                }
+                            }
+                        }
                     }
                 }
             }

--
Gitblit v1.9.3