From 5c272c606bdf2da3577dbaa5f48d0ee163f1e7d2 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 26 三月 2026 10:35:24 +0800
Subject: [PATCH] 纸张淋膜半成品入库逻辑优化

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 106 insertions(+), 7 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs"
index 342c059..56634a7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs"
@@ -18,11 +18,13 @@
 using AutoMapper;
 using Microsoft.AspNetCore.Mvc.ApiExplorer;
 using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using SqlSugar;
 using System.Reflection.Emit;
 using System.Threading.Tasks;
 using WIDESEA_Common.CommonEnum;
 using WIDESEA_Common.LocationEnum;
+using WIDESEA_Common.MaterielEnum;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
@@ -35,6 +37,7 @@
 using WIDESEA_DTO;
 using WIDESEA_DTO.ERP;
 using WIDESEA_DTO.Inbound;
+using WIDESEA_DTO.Outbound;
 using WIDESEA_DTO.Stock;
 using WIDESEA_DTO.Task;
 using WIDESEA_External.ERPService;
@@ -133,6 +136,28 @@
             }
         }
         /// <summary>
+        /// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS
+        /// </summary>
+        /// <returns></returns>
+        public List<string> ExistRoadwaysError()
+        {
+            try
+            {
+                string url = AppSettings.Get("WCS");
+                if (string.IsNullOrEmpty(url))
+                {
+                    return null;
+                }
+                string response = HttpHelper.Get($"{url}/api/Task/ExistRoadwaysError");
+
+                return JsonConvert.DeserializeObject<List<string>>(response) ?? throw new Exception("杩斿洖閿欒");
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+        /// <summary>
         /// 鏀捐揣瀹屾垚
         /// </summary>
         /// <param name="code"></param>
@@ -169,13 +194,24 @@
                     {
                         return content;
                     }
-                    List<int> ints = _outboundRepository.OutSGOrderDetailRepository.QueryData(x=>x.Id>outDetailId).Select(x=>x.Id).ToList();
-                    int[] reseponse= new int[ints.Count];
-                    for (int i = 0; i < ints.Count; i++)
-                    {
-                        reseponse[i] = ints[i];
-                    }
-                    content.Message = CreateSGOutboundTasks(reseponse).Message;
+                    //鑾峰彇鎵�鏈夌殑鍑哄簱璇︽儏鍒ゆ柇鏄惁婊¤冻鍑哄簱閲忓皬浜�5涓囦笖灏忎簬17鍗�
+                    //List<Dt_OutStockLockInfo> outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x=>x.OrderType==OutOrderTypeEnum.OutSGPick.ObjToInt() && x.Status<OutLockStockStatusEnum.鍏抽棴.ObjToInt());
+                    //decimal sumAssignQty = outStockLockInfos.Sum(x => x.AssignQuantity);
+                    //int outCount= outStockLockInfos.Select(x=>x.PalletCode).Distinct().Count();
+                    //if (sumAssignQty < AppSettings.Get("OutSGLength").ObjToInt() && outCount < AppSettings.Get("OutSGCount").ObjToInt())
+                    //{
+                        List<int> ints = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => x.Id > outDetailId).Select(x => x.Id).ToList();
+                        int[] reseponse = new int[ints.Count];
+                        for (int i = 0; i < ints.Count; i++)
+                        {
+                            reseponse[i] = ints[i];
+                        }
+                        content.Message = CreateSGOutboundTasks(reseponse).Message;
+                    //}
+                    //else
+                    //{
+                    //    return content.Error($"褰撳墠鍑哄簱閲忥細{sumAssignQty},褰撳墠鍑哄簱鍗锋暟锛歿outCount},涓嶆弧瓒冲皬浜�5涓囦笖灏忎簬17鍗峰嚭搴撴潯浠�");
+                    //}
                 }
 
             }
@@ -185,5 +221,68 @@
             }
             return content;
         }
+        
+        /// <summary>
+        /// 鍚敤
+        /// </summary>
+        /// <returns></returns>
+        public WebResponseContent EnableStatus(int[] keys)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<Dt_Task> tasks = BaseDal.QueryData(x => x.TaskType < TaskTypeEnum.Inbound.ObjToInt());
+                List<Dt_AGVStationInfo> stationInfos = _basicRepository.AGVStationInfoRepository.QueryData(x => keys.Contains(x.Id));
+                foreach (var station in stationInfos)
+                {
+                    Dt_Task? taskOld = tasks.FirstOrDefault(x => x.TargetAddress == station.AGVStationCode);
+                    if (taskOld!=null)
+                    {
+                        content.Message+= $"{station.AGVStationCode}鍑哄簱{taskOld.TaskNum}浠诲姟鎵ц涓�;";
+                        continue;
+                    }
+                    if (station.StationArea==StationAreaEnum.涓�妤兼殏瀛樻灦.ToString())
+                    {
+                        Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x=>x.LocationCode==station.AGVStationCode);
+                        if (stockInfo!=null)
+                        {
+                            content.Message += $"{station.AGVStationCode}{stockInfo.PalletCode}搴撳瓨缁戝畾;";
+                            continue;
+                        }
+                    }
+                    station.IsOccupied = WhetherEnum.False.ObjToInt();
+                }
+                _basicRepository.AGVStationInfoRepository.UpdateData(stationInfos);
+                content.OK(content.Message.IsNullOrEmpty() ? "鎴愬姛" : $"閮ㄥ垎鎴愬姛鍚敤!{content.Message}鏃犳硶鍚敤");
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+        /// <summary>
+        /// 绂佺敤
+        /// </summary>
+        /// <returns></returns>
+        public WebResponseContent DisableStatus(int[] keys)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<Dt_AGVStationInfo> stationInfos = _basicRepository.AGVStationInfoRepository.QueryData(x => keys.Contains(x.Id));
+                stationInfos.ForEach(x =>
+                {
+                    x.IsOccupied = WhetherEnum.True.ObjToInt();
+                });
+                _basicRepository.AGVStationInfoRepository.UpdateData(stationInfos);
+                content.OK("鎴愬姛");
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }

--
Gitblit v1.9.3