From abff6261e5e74ff16a844f4739f84d49b6133000 Mon Sep 17 00:00:00 2001
From: xxyy <cathay_xy@163.com>
Date: 星期六, 15 二月 2025 13:01:02 +0800
Subject: [PATCH] 新增分容空框出库功能及代码结构优化

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs                          |    5 ++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs    |    6 ---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs                     |   35 +++++++++++++++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs            |   40 ++++++++++++++++++++
 5 files changed, 81 insertions(+), 7 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs
index 7cffc7a..2e03823 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs
@@ -76,5 +76,10 @@
         /// 闈欑疆NG鍏ュ簱绔欏彴
         /// </summary>
         public const string JZNGInBoundStation = "JZNGInBoundStation";
+
+        /// <summary>
+        /// 鍒嗗绌烘鍏ュ簱鏀逛负鐩存帴鍑哄簱
+        /// </summary>
+        public const string SetEmptyOutbyInToOutAsync = "SetEmptyOutbyInToOutAsync";
     }
 }
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
index 6e9638b..2b93a15 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -16,6 +16,7 @@
 using System.Drawing;
 using WIDESEAWCS_ITaskInfoService;
 using Mapster;
+using AngleSharp.Io;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -85,6 +86,40 @@
                     return content.Error("褰撳墠鎵樼洏瀛樺湪浠诲姟");
                 }
 
+                if (stationManager.stationType == 7)
+                {
+                    var Station = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea);
+                    var runTask = await BaseDal.QueryFirstAsync(x => x.SourceAddress == Station.stationChildCode && x.TaskState == (int)TaskInStatusEnum.InNew && x.TaskType == (int)TaskInboundTypeEnum.InTray);
+                    if (runTask != null)
+                    {
+                        runTask.TargetAddress = stationManager.stationLocation;
+                        runTask.NextAddress = stationManager.stationChildCode;
+                        runTask.Grade = 3;
+                        runTask.TaskType = (int)TaskOutboundTypeEnum.InToOut;
+
+                        var config1 = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                        var wmsBase1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+                        var requestTask1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.SetEmptyOutbyInToOutAsync)?.ConfigValue;
+                        if (wmsBase1 == null || requestTask1 == null)
+                        {
+                            throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                        }
+                        var wmsIpAddrss1 = wmsBase1 + requestTask1;
+
+                        var result1 = await HttpHelper.PostAsync(wmsIpAddrss1, new { palletCode = runTask.PalletCode, EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = stationManager.stationChildCode }.ToJsonString());
+                        content = JsonConvert.DeserializeObject<WebResponseContent>(result1);
+                        if (content.Status)
+                        {
+                            await BaseDal.UpdateDataAsync(runTask);
+                            return content.OK("鎴愬姛");
+                        }
+                        else
+                            ConsoleHelper.WriteErrorLine(content.Message);
+                    }
+                    else
+                        ConsoleHelper.WriteErrorLine("鏈壘鍒扮┖鎵樼洏鍏ュ簱浠诲姟");
+                }
+
                 var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                 var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
                 var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestInTask)?.ConfigValue;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
index d7d719e..294c816 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -271,7 +271,7 @@
             {
                 var needBarcode = _needBarcodeRepository.QueryFirst(x => x.toArea == stationManager.stationChildCode);
 
-                if (needBarcode.inLineNum <= needBarcode.cacheNum)
+                if (needBarcode.inLineNum < needBarcode.cacheNum)
                 {
                     var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                     var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
index 8e4d073..1b17388 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
@@ -51,10 +51,6 @@
         {
             try
             {
-                // speStackerCrane.GetStackerCraneStatus<StackerCraneAutoStatus>();
-                // speStackerCrane.GetStackerCraneStatus<StackerCraneWorkStatus>();
-                // speStackerCrane.GetStackerCraneStatus<StackerCraneStatus>();
-
                 CommonStackerStationCrane commonStackerCrane = (CommonStackerStationCrane)context.JobDetail.JobDataMap.Get("JobParams");
                 if (commonStackerCrane != null)
                 {
@@ -81,8 +77,6 @@
                                     bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                     if (sendFlag)
                                     {
-                                        //commonStackerCrane.LastTaskType = task.TaskType;
-                                        //_taskService.UpdateTaskStatusToNext(task.TaskNum);
                                         StringBuilder builder = new StringBuilder();
                                         builder.AppendLine();
                                         builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満鐘舵�侊細銆恵commonStackerCrane.StackerCraneStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index 3feb10b..0653533 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -1,4 +1,5 @@
 锘縰sing Masuit.Tools;
+using WIDESEA_Common;
 using WIDESEA_Common.CustomModels;
 
 //using WIDESEA_Common.CustomModels;
@@ -1153,4 +1154,43 @@
     }
 
     #endregion
+
+    #region 鍒嗗绌烘鍏ュ簱鏀逛负鐩存帴鍑哄簱
+    public async Task<WebResponseContent> SetEmptyOutbyInToOutAsync(RequestTaskDto request)
+    {
+        WebResponseContent content = new WebResponseContent();
+        var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == request.PalletCode && x.CurrentAddress == request.Position);
+        if (!task.IsNullOrEmpty())
+        {
+            var fromStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == request.Position);
+            var toStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 7 && x.productLine == fromStation.productLine && x.stationArea == fromStation.stationArea);
+            if (!toStation.IsNullOrEmpty())
+            {
+                task.TargetAddress = toStation.stationLocation;
+                task.NextAddress = toStation.stationChildCode;
+                task.Grade = 3;
+                task.TaskType = (int)TaskOutboundTypeEnum.InToOut;
+
+                var location = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress);
+                location.LocationStatus = (int)LocationEnum.Free;
+
+                await _locationRepository.UpdateDataAsync(location);
+                await BaseDal.UpdateDataAsync(task);
+                return content.OK("鎴愬姛");
+            }
+            else
+            {
+                ConsoleHelper.WriteErrorLine("鍒嗗绌烘鍏ュ簱鏀逛负鐩存帴鍑哄簱:鏈壘鍒板搴旂珯鍙�");
+                content.Error("鏈壘鍒板搴旂珯鍙�");
+            }
+        }
+        else
+        {
+            ConsoleHelper.WriteErrorLine("鍒嗗绌烘鍏ュ簱鏀逛负鐩存帴鍑哄簱:鏈壘鍒颁换鍔�");
+            content.Error("鏈壘鍒颁换鍔�");
+        }
+        return content;
+    }
+
+    #endregion
 }
\ No newline at end of file

--
Gitblit v1.9.3