From 261ec6b250b3aea2d26e629203c7d699747c27ea Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 03 二月 2026 17:02:04 +0800
Subject: [PATCH] 空托回流区分叠盘或直接回立库

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs |   98 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 67 insertions(+), 31 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index a441c4b..b916eef 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -982,6 +982,19 @@
                     {
                         agvstation.IsOccupied = WhetherEnum.False.ObjToInt();
                     }
+                    //鍙犵洏浠诲姟鍗曠嫭瀹屾垚
+                    if (task.TaskType==TaskTypeEnum.EmptyStackPlate.ObjToInt())
+                    {
+                        task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+                        _unitOfWorkManage.BeginTran();
+                        if (agvstation != null)
+                        {
+                            _basicRepository.AGVStationInfoRepository.UpdateData(agvstation);
+                        }
+                        BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.浜哄伐瀹屾垚 : WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚);
+                        _unitOfWorkManage.CommitTran();
+                        return content.OK();
+                    }
                     Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x=>x.proStockInfoDetails).First();
                     if (proStockInfo != null && proStockInfo.StockStatus == StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt())
                     {
@@ -1226,7 +1239,7 @@
         /// <summary>
         /// 鎴愬搧绌烘墭鍥炲簱
         /// </summary>
-        public WebResponseContent EmptyBackTask(string barCode, string startPoint)
+        public WebResponseContent EmptyBackTask(string barCode, string startPoint,int target)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -1253,41 +1266,64 @@
                 {
                     return content.Error($"鎵樼洏{barCode}浠诲姟宸插瓨鍦�");
                 }
-                Dt_ProStockInfo proStockInfoOld = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode);
-                if (proStockInfoOld!=null)
+                Dt_Task newTask = null;
+                Dt_ProStockInfo proStockInfo = null;
+                if (target==WhetherEnum.False.ObjToInt())//鍙犵洏绌烘墭浠诲姟
                 {
-                    return content.Error($"鎵樼洏{barCode}宸插瓨鍦�");
+                    newTask = new Dt_Task()
+                    {
+                        CurrentAddress = startPoint,
+                        Grade = 0,
+                        NextAddress = "",
+                        PalletCode = barCode,
+                        Roadway = agvstation.AGVStationCode.StartsWith("PNT_1") ? "StackPlate1": "StackPlate2",
+                        SourceAddress = startPoint,
+                        TargetAddress = "",
+                        TaskType = TaskTypeEnum.EmptyStackPlate.ObjToInt(),
+                        TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                        WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
+                        PalletType = 1
+                    };
                 }
-                //鍒嗛厤宸烽亾
-                string roadWay=AssignCPRoadwayNo();
-                
-                Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo()
+                else //绔嬪簱绌烘墭浠诲姟
                 {
-                    PalletCode=barCode,
-                    ProStockAttribute=ProStockAttributeEnum.绌烘墭.ObjToInt(),
-                    PalletType=1,
-                    LocationCode="",
-                    WarehouseId= WarehouseEnum.LLDFL.ObjToInt(),
-                    StockStatus=StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()
-                }; 
-
-                Dt_Task newTask = new Dt_Task()
-                {
-                    CurrentAddress = startPoint,
-                    Grade = 0,
-                    NextAddress = "",
-                    PalletCode = barCode,
-                    Roadway = roadWay,
-                    SourceAddress = startPoint,
-                    TargetAddress = "",
-                    TaskType = TaskTypeEnum.EmptyProductBack.ObjToInt(),
-                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
-                    WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
-                    PalletType = 1
-                };
+                    Dt_ProStockInfo proStockInfoOld = _stockRepository.ProStockInfoRepository.QueryFirst(x => x.PalletCode == barCode);
+                    if (proStockInfoOld != null)
+                    {
+                        return content.Error($"鎵樼洏{barCode}宸插瓨鍦�");
+                    }
+                    //鍒嗛厤宸烽亾
+                    string roadWay = AssignCPRoadwayNo();
+                    proStockInfo = new Dt_ProStockInfo()
+                    {
+                        PalletCode = barCode,
+                        ProStockAttribute = ProStockAttributeEnum.绌烘墭.ObjToInt(),
+                        PalletType = 1,
+                        LocationCode = "",
+                        WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
+                        StockStatus = StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()
+                    };
+                    newTask = new Dt_Task()
+                    {
+                        CurrentAddress = startPoint,
+                        Grade = 0,
+                        NextAddress = "",
+                        PalletCode = barCode,
+                        Roadway = roadWay,
+                        SourceAddress = startPoint,
+                        TargetAddress = "",
+                        TaskType = TaskTypeEnum.EmptyProductBack.ObjToInt(),
+                        TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                        WarehouseId = WarehouseEnum.LLDFL.ObjToInt(),
+                        PalletType = 1
+                    };
+                }
                 _unitOfWorkManage.BeginTran();
                 int taskId = BaseDal.AddData(newTask);
-                _stockRepository.ProStockInfoRepository.AddData(proStockInfo);
+                if (proStockInfo!=null)
+                {
+                    _stockRepository.ProStockInfoRepository.AddData(proStockInfo);
+                }
                 newTask.TaskId = taskId;
                 _unitOfWorkManage.CommitTran();
                 //鎺ㄩ�佷换鍔�

--
Gitblit v1.9.3