From f5df33d51a8555d709a4e8369fa98ce70759ddfc Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期一, 17 十一月 2025 13:39:17 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs                      |   22 +
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs |    8 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs                     |   12 
 项目代码/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue                                       |   20 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs                   |  471 ++++++++++++++++++++++++++++++++++++++++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs                 |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/ESSApiService.cs                               |    5 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs                                      |    9 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs            |    4 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs                            |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs                              |   57 ++++
 11 files changed, 552 insertions(+), 60 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
index a1be799..3b78f02 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
@@ -30,7 +30,7 @@
           <el-button type="info" @click="openRevertSplitDialog">鎾ら攢鎷嗗寘</el-button>
       
           <el-button type="primary" @click="openBatchReturnDialog">鍥炲簱</el-button>
-          <el-button type="danger" @click="handleDirectOutbound">鐩存帴鍑哄簱</el-button> 
+          <!-- <el-button type="danger" @click="handleDirectOutbound">鐩存帴鍑哄簱</el-button>  -->
 
         </div>
       </el-card>
@@ -42,7 +42,7 @@
         <div class="summary-info">
           <el-tag type="warning">鏈嫞閫夋潯鏁�: {{summary.unpickedCount}}</el-tag>
           <el-tag type="danger">鏈嫞閫夋暟閲�: {{summary.unpickedQuantity}}</el-tag>
-          <el-tag type="success">宸叉嫞閫夋潯鏁�: {{summary.pickedCount}}</el-tag>
+    <!--       <el-tag type="success">宸叉嫞閫夋潯鏁�: {{summary.pickedCount}}</el-tag> -->
           <el-tag type="info">鎵樼洏鐘舵��: {{palletStatus}}</el-tag>
         </div>
       </el-card>
@@ -552,7 +552,7 @@
       }
     },
 
-    // 鎵归噺鍥炲簱鎵樼洏鐮佹壂鐮�
+    // 鍥炲簱鎵樼洏鐮佹壂鐮�
     onBatchReturnPalletScan() {
       if (!this.batchReturnForm.palletCode) return;
       
@@ -564,7 +564,7 @@
       }
     },
 
-    // 鎵归噺鍥炲簱纭
+    // 鍥炲簱纭
     async handleBatchReturnConfirm() {
       // 琛ㄥ崟楠岃瘉
       if (this.$refs.batchReturnFormRef) {
@@ -587,25 +587,25 @@
       }
     },
     
-    // 鎻愪氦鎵归噺鍥炲簱璇锋眰
+    // 鎻愪氦鍥炲簱璇锋眰
     async submitBatchReturn() {
       this.batchReturnLoading = true;
       
       try {
-        const res = await this.http.post('/api/OutboundPicking/batch-return-to-stock', {
+        const res = await this.http.post('/api/OutboundPicking/return-to-stock', {
           orderNo: this.batchReturnForm.orderNo,
           palletCode: this.batchReturnForm.palletCode
         });
         
         if (res.status) {
-          this.$message.success('鎵归噺鍥炲簱鎴愬姛');
+          this.$message.success('鍥炲簱鎴愬姛');
           this.showBatchReturnDialog = false;
           this.loadData();
         } else {
-          this.$message.error(res.message || '鎵归噺鍥炲簱澶辫触');
+          this.$message.error(res.message || '鍥炲簱澶辫触');
         }
       } catch (error) {
-        this.$message.error('鎵归噺鍥炲簱澶辫触');
+        this.$message.error('鍥炲簱澶辫触');
       } finally {
         this.batchReturnLoading = false;
       }
@@ -979,7 +979,7 @@
           barcode: this.returnForm.barcode
         });
         
-        if (res.success) {
+        if (res.status) {
           this.$message.success('鍥炲簱鎴愬姛');
           this.showReturnDialog = false;
           this.resetReturnForm();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/ESSApiService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/ESSApiService.cs"
index 56cecfd..8d1861a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/ESSApiService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/ESSApiService.cs"
@@ -35,6 +35,11 @@
                 var result = await PostAsync<MoveContainerRequest, ApiResponse<string>>(url, request);
                 if (result != null && result.Code == 0)
                 {
+                    //{"code":0,"msg":"success","data":{"107":"TASK_ALREADY_EXIST"}}
+                    if (result.Data.Contains("TASK_ALREADY_EXIST"))
+                    {
+                        return false;
+                    }
                     return true;
                 }
                 return false;
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs"
index 4b0b5f8..03e71c3 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs"
@@ -72,4 +72,13 @@
         public int PalletType { get; set; }
 
     }
+
+
+    public class GenerateOutboundTasksDto
+    {
+        public string outboundPlatform { get; set; }
+
+        public int[] taskIds { get; set; }
+
+    }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs"
index 9a34fb3..5e9808f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs"
@@ -30,5 +30,7 @@
    
         Task<List<Dt_OutStockLockInfo>> GetUnpickedList(string orderNo, string palletCode);
         Task<WebResponseContent> ValidateBarcode(string barcode);
+
+        Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason);
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
index 7dc0d95..1d84bf7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
@@ -44,7 +44,7 @@
 
         Task<WebResponseContent> TaskCompleted(string taskNum);
 
-        Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys);
+        Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys, string outStation);
  
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs"
index 06a4835..159cba4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs"
@@ -1,6 +1,7 @@
 锘縰sing Dm.filter;
 using MailKit.Search;
 using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -10,10 +11,12 @@
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Core.Helper;
+using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.Outbound;
 using WIDESEA_IBasicService;
 using WIDESEA_IOutboundService;
@@ -39,9 +42,26 @@
         private readonly IOutboundOrderService _outboundOrderService;
         private readonly ISplitPackageService _splitPackageService;
         private readonly IRepository<Dt_Task> _taskRepository;
+        private readonly IESSApiService _eSSApiService;
 
 
-        public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository) : base(BaseDal)
+        private readonly ILogger<OutboundPickingService> _logger;
+
+        private Dictionary<string, string> stations = new Dictionary<string, string>
+        {
+            {"2-1","2-9" },
+            {"3-1","3-9" },
+
+        };
+
+        private Dictionary<string, string> movestations = new Dictionary<string, string>
+        {
+            {"2-1","2-5" },
+            {"3-1","3-5" },
+
+        };
+
+        public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _stockInfoService = stockInfoService;
@@ -53,6 +73,8 @@
             _splitPackageService = splitPackageService;
             _outboundOrderService = outboundOrderService;
             _taskRepository = taskRepository;
+            _eSSApiService = eSSApiService;
+            _logger = logger;
         }
 
 
@@ -224,9 +246,29 @@
                   .FirstAsync();
 
                 if (lockInfo == null)
-                    throw new Exception($"鏉$爜{barcode}涓嶅睘浜庢墭鐩榹palletCode}鎴栦笉瀛樺湪寰呭垎鎷h褰�");
+                {
+                    var splitBarcode = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
+                   .Where(it => it.NewBarcode == barcode && it.Status == 1)
+                   .FirstAsync();
 
+                    if (splitBarcode != null)
+                    {
+                        // 閫氳繃鎷嗗寘鏉$爜璁板綍鎵惧埌瀵瑰簲鐨勫嚭搴撻攣瀹氳褰�
+                        lockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+                            .Where(it => it.ParentLockId == splitBarcode.OutStockLockInfoId)
+                            .FirstAsync();
 
+                        if (lockInfo == null)
+                            throw new Exception($"鏈壘鍒版媶鍖呮潯鐮亄barcode}瀵瑰簲鐨勫嚭搴撻攣瀹氳褰�");
+                    }
+                    else
+                    {
+                        throw new Exception($"鏉$爜{barcode}涓嶅睘浜庢墭鐩榹palletCode}鎴栦笉瀛樺湪寰呭垎鎷h褰�");
+                    }
+
+                }
+                if (lockInfo.PalletCode != palletCode)
+                    throw new Exception($"鏉$爜{barcode}涓嶅睘浜庢墭鐩榹palletCode}");
 
                 var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                         .Where(x => x.Barcode == barcode && x.StockId == lockInfo.StockId)
@@ -247,13 +289,22 @@
                 lockInfo.Status = (int)OutLockStockStatusEnum.鎷i�夊畬鎴�;
                 await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
+                var splitBarcodeRecord = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
+               .Where(it => it.NewBarcode == barcode)
+               .FirstAsync();
+
+                if (splitBarcodeRecord != null)
+                {
+                    splitBarcodeRecord.Status = 2;
+                    await _splitPackageService.Db.Updateable(splitBarcodeRecord).ExecuteCommandAsync();
+                }
 
                 await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
                .SetColumns(it => it.PickedQty == it.PickedQty + actualQty)
                .Where(it => it.Id == lockInfo.OrderDetailId)
                .ExecuteCommandAsync();
 
-                
+
                 await CheckAndUpdateOrderStatus(orderNo);
 
                 //鏌ヨ浠诲姟琛� 
@@ -313,6 +364,395 @@
                     .ExecuteCommandAsync();
             }
         }
+
+
+        /// <summary>
+        /// 鍥炲簱鎿嶄綔  
+        /// </summary>
+        //public async Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason)
+        //{
+        //    try
+        //    {
+        //        // 1. 鑾峰彇鎵�鏈夋湭鍒嗘嫞鐨勫嚭搴撻攣瀹氳褰曪紝鍖呮嫭鎷嗗寘浜х敓鐨勮褰�
+        //        var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+        //            .Where(it => it.OrderNo == orderNo && it.Status == 1)
+        //            .ToListAsync();
+
+        //        if (!remainingLocks.Any())
+        //        {
+        //            return WebResponseContent.Instance.Error("娌℃湁闇�瑕佸洖搴撶殑鍓╀綑璐х墿");
+        //        }
+        //        var tasks = new List<Dt_Task>();
+        //        // 鎸夋墭鐩樺垎缁�
+        //        var palletGroups = remainingLocks.GroupBy(x => x.PalletCode);
+        //        //鏌ヨ浠诲姟琛� 
+        //        var task = _taskRepository.QueryData(x => x.TaskNum == remainingLocks.First().TaskNum).FirstOrDefault();
+        //        foreach (var group in palletGroups)
+        //        {
+        //            if (group.Key == palletCode)
+        //            {
+        //                var totalReturnQty = group.Sum(x => x.AssignQuantity - x.PickedQty);
+
+        //                if (totalReturnQty <= 0) continue;
+
+        //                // 鍒嗛厤鏂拌揣浣�
+        //                var newLocation = _locationInfoService.AssignLocation();
+
+        //                // 鏇存柊鍑哄簱閿佸畾璁板綍鐘舵��
+        //                var lockIds = group.Where(x => x.PalletCode == palletCode).Select(x => x.Id).ToList();
+        //                await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>()
+        //                    .SetColumns(it => new Dt_OutStockLockInfo { Status = OutLockStockStatusEnum.鍥炲簱涓�.ObjToInt() })
+        //                    .Where(it => lockIds.Contains(it.Id))
+        //                    .ExecuteCommandAsync();
+
+        //                // 鏇存柊鎷嗗寘鏉$爜璁板綍鐘舵��
+        //                var splitBarcodes = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
+        //                    .Where(it => lockIds.Contains(it.OutStockLockInfoId))
+        //                    .ToListAsync();
+
+        //                foreach (var splitBarcode in splitBarcodes)
+        //                {
+        //                    splitBarcode.Status = 3;
+        //                    await _splitPackageService.Db.Updateable(splitBarcode).ExecuteCommandAsync();
+        //                }
+
+        //                foreach (var lockInfo in group)
+        //                {
+        //                    if (lockInfo.PalletCode == palletCode)
+        //                    {
+        //                        decimal returnQty = lockInfo.AssignQuantity - lockInfo.PickedQty;
+
+        //                        // 妫�鏌ュ簱瀛樿褰曟槸鍚﹀瓨鍦�
+        //                        var existingStock = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+        //                            .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId)
+        //                            .FirstAsync();
+
+        //                        if (existingStock != null)
+        //                        {
+        //                            // 搴撳瓨璁板綍瀛樺湪锛屾仮澶嶉攣瀹氭暟閲�
+        //                            await _stockInfoDetailService.Db.Updateable<Dt_StockInfoDetail>()
+        //                                .SetColumns(it => new Dt_StockInfoDetail
+        //                                {
+        //                                    OutboundQuantity = it.OutboundQuantity - returnQty
+        //                                })
+        //                                .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId)
+        //                                .ExecuteCommandAsync();
+        //                        }
+        //                        else
+        //                        {
+        //                            // 搴撳瓨璁板綍涓嶅瓨鍦紙鍙兘鏄媶鍖呬骇鐢熺殑鏂版潯鐮侊級锛屽垱寤烘柊鐨勫簱瀛樿褰�
+        //                            var newStockDetail = new Dt_StockInfoDetail
+        //                            {
+        //                                StockId = lockInfo.StockId,
+        //                                MaterielCode = lockInfo.MaterielCode,
+        //                                OrderNo = lockInfo.OrderNo,
+        //                                BatchNo = lockInfo.BatchNo,
+        //                                StockQuantity = returnQty, // 瀹為檯搴撳瓨鏁伴噺
+        //                                OutboundQuantity = 0, // 鍥炲簱鍚庝笉鍐嶉攣瀹�
+        //                                Barcode = lockInfo.CurrentBarcode,
+        //                                InboundOrderRowNo = "0",
+        //                                Status = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
+
+        //                            };
+        //                            await _stockInfoDetailService.Db.Insertable(newStockDetail).ExecuteCommandAsync();
+        //                        }
+        //                    }
+        //                }
+
+
+        //                Dt_Task newtask = new()
+        //                {
+        //                    CurrentAddress = stations[task.TargetAddress],
+        //                    Grade = 0,
+        //                    PalletCode = palletCode,
+        //                    NextAddress = "",
+        //                    OrderNo= task.OrderNo,
+        //                    Roadway = newLocation.RoadwayNo,
+        //                    SourceAddress = stations[task.TargetAddress],
+        //                    TargetAddress = newLocation.LocationCode,
+        //                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
+        //                    TaskType = TaskTypeEnum.InPick.ObjToInt(),
+        //                    // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+        //                    PalletType = task.PalletType,
+        //                    WarehouseId = task.WarehouseId,
+        //                };
+        //                tasks.Add(newtask);
+
+        //            }
+        //        }
+        //        try
+        //        {
+        //            await _taskRepository.Db.Insertable(tasks).ExecuteCommandAsync();
+        //            //鍒犻櫎 鍑哄簱鐨�  task
+
+
+        //            //缁� ess  娴佸姩淇″彿  鍜屽垱寤轰换鍔�
+
+
+        //        }
+        //        catch (Exception ex)
+        //        {
+
+        //        }
+
+
+
+
+        //        return WebResponseContent.Instance.OK();
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        return WebResponseContent.Instance.Error($"鍥炲簱鎿嶄綔澶辫触: {ex.Message}");
+        //    }
+        //}
+
+        public async Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason)
+        {
+            try
+            {
+                // 1. 鑾峰彇鎵�鏈夋湭鍒嗘嫞鐨勫嚭搴撻攣瀹氳褰曪紝鍖呮嫭鎷嗗寘浜х敓鐨勮褰�
+                var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+                    .Where(it => it.OrderNo == orderNo && it.Status == 1)
+                    .ToListAsync();
+
+                var stockinfo = _stockInfoService.Db.Queryable<Dt_StockInfo>().First(x => x.PalletCode == palletCode);
+
+                // 2. 妫�鏌ユ墭鐩樹笂鏄惁鏈夊叾浠栭潪鍑哄簱璐х墿锛堝簱瀛樿揣鐗╋級
+                var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+                    .Where(it => it.StockId == stockinfo.Id && it.Status == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+                    .Where(it => it.OutboundQuantity == 0 || it.OutboundQuantity < it.StockQuantity) // 鏈畬鍏ㄥ嚭搴撶殑
+                    .ToListAsync();
+
+                // 3. 濡傛灉娌℃湁闇�瑕佸洖搴撶殑璐х墿锛堟棦鏃犳湭鍒嗘嫞鍑哄簱璐х墿锛屼篃鏃犲叾浠栧簱瀛樿揣鐗╋級
+                if (!remainingLocks.Any() && !palletStockGoods.Any())
+                {
+                    return WebResponseContent.Instance.Error("娌℃湁闇�瑕佸洖搴撶殑鍓╀綑璐х墿");
+                }
+
+                var tasks = new List<Dt_Task>();
+
+                // 鏌ヨ浠诲姟琛�
+                var task = remainingLocks.Any()
+                    ? _taskRepository.QueryData(x => x.TaskNum == remainingLocks.First().TaskNum).FirstOrDefault()
+                    : _taskRepository.QueryData(x => x.PalletCode == palletCode).FirstOrDefault();
+
+                if (task == null)
+                {
+                    return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑浠诲姟淇℃伅");
+                }
+                var firstlocation = _locationInfoService.Db.Queryable<Dt_LocationInfo>().First(x => x.LocationCode == task.SourceAddress);
+                decimal totalReturnQty = 0;
+                var hasRemainingLocks = remainingLocks.Any(x => x.PalletCode == palletCode);
+
+                // 鎯呭喌1锛氬鐞嗘湭鍒嗘嫞鐨勫嚭搴撻攣瀹氳褰�
+                if (hasRemainingLocks)
+                {
+                    var palletLocks = remainingLocks.Where(x => x.PalletCode == palletCode).ToList();
+                    totalReturnQty = palletLocks.Sum(x => x.AssignQuantity - x.PickedQty);
+
+                    if (totalReturnQty > 0)
+                    {
+                        // 鍒嗛厤鏂拌揣浣�
+                        var newLocation = _locationInfoService.AssignLocation(firstlocation.LocationType);
+
+                        // 鏇存柊鍑哄簱閿佸畾璁板綍鐘舵��
+                        var lockIds = palletLocks.Select(x => x.Id).ToList();
+                        await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>()
+                            .SetColumns(it => new Dt_OutStockLockInfo { Status = OutLockStockStatusEnum.鍥炲簱涓�.ObjToInt() })
+                            .Where(it => lockIds.Contains(it.Id))
+                            .ExecuteCommandAsync();
+
+                        // 鏇存柊鎷嗗寘鏉$爜璁板綍鐘舵��
+                        var splitBarcodes = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
+                            .Where(it => lockIds.Contains(it.OutStockLockInfoId))
+                            .ToListAsync();
+
+                        foreach (var splitBarcode in splitBarcodes)
+                        {
+                            splitBarcode.Status = 3;
+                            await _splitPackageService.Db.Updateable(splitBarcode).ExecuteCommandAsync();
+                        }
+
+                        // 澶勭悊搴撳瓨璁板綍
+                        foreach (var lockInfo in palletLocks)
+                        {
+                            decimal returnQty = lockInfo.AssignQuantity - lockInfo.PickedQty;
+
+                            // 妫�鏌ュ簱瀛樿褰曟槸鍚﹀瓨鍦�
+                            var existingStock = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+                                .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId)
+                                .FirstAsync();
+
+                            if (existingStock != null)
+                            {
+                                // 搴撳瓨璁板綍瀛樺湪锛屾仮澶嶉攣瀹氭暟閲�
+                                await _stockInfoDetailService.Db.Updateable<Dt_StockInfoDetail>()
+                                    .SetColumns(it => new Dt_StockInfoDetail
+                                    {
+                                        OutboundQuantity = it.OutboundQuantity - returnQty
+                                    })
+                                    .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId)
+                                    .ExecuteCommandAsync();
+                            }
+                            else
+                            {
+                                // 搴撳瓨璁板綍涓嶅瓨鍦紙鍙兘鏄媶鍖呬骇鐢熺殑鏂版潯鐮侊級锛屽垱寤烘柊鐨勫簱瀛樿褰�
+                                var newStockDetail = new Dt_StockInfoDetail
+                                {
+                                    StockId = lockInfo.StockId,
+                                    MaterielCode = lockInfo.MaterielCode,
+                                    OrderNo = lockInfo.OrderNo,
+                                    BatchNo = lockInfo.BatchNo,
+                                    StockQuantity = returnQty,
+                                    OutboundQuantity = 0,
+                                    Barcode = lockInfo.CurrentBarcode,
+                                    InboundOrderRowNo = "0",
+                                    Status = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
+
+                                };
+                                await _stockInfoDetailService.Db.Insertable(newStockDetail).ExecuteCommandAsync();
+                            }
+                        }
+
+                        // 鍒涘缓鍥炲簱浠诲姟
+                        CreateReturnTask(tasks, task, palletCode, newLocation);
+                    }
+                }
+
+                // 鎯呭喌2锛氬嚭搴撹揣鐗╁凡鍒嗘嫞瀹岋紝浣嗘墭鐩樹笂杩樻湁鍏朵粬搴撳瓨璐х墿闇�瑕佸洖搴�
+                if (!hasRemainingLocks && palletStockGoods.Any())
+                {
+                    // 鍒嗛厤鏂拌揣浣�
+                    var newLocation = _locationInfoService.AssignLocation(firstlocation.LocationType);
+
+                    // 鍒涘缓鍥炲簱浠诲姟
+                    CreateReturnTask(tasks, task, palletCode, newLocation);
+
+                    totalReturnQty = palletStockGoods.Sum(x => x.StockQuantity - x.OutboundQuantity);
+                }
+
+                // 淇濆瓨浠诲姟
+                if (tasks.Any())
+                {
+                    try
+                    {
+                        await _taskRepository.Db.Insertable(tasks).ExecuteCommandAsync();
+
+                        // 缁� ESS 娴佸姩淇″彿鍜屽垱寤轰换鍔�
+                        try
+                        {
+                            var result = await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest
+                            {
+                                slotCode = movestations[task.TargetAddress],
+                                containerCode = palletCode
+                            });
+                            if (result)
+                            {
+                                TaskModel esstask = new TaskModel()
+                                {
+                                    taskType = "putaway",
+                                    taskGroupCode = "",
+                                    groupPriority = 0,
+                                    tasks = new List<TasksType>
+                                    {
+                                        new()
+                                        {
+                                            taskCode = tasks.First().TaskNum.ToString(),
+                                            taskPriority = 0,
+                                            taskDescribe = new TaskDescribeType {
+                                                containerCode = palletCode,
+                                                containerType = "CT_KUBOT_STANDARD",
+                                                fromLocationCode = stations.GetValueOrDefault(task.TargetAddress) ?? "",
+                                                toStationCode = "",
+                                                toLocationCode = tasks.First().TargetAddress,
+                                                deadline = 0, storageTag = ""
+                                            }
+                                        }
+                                    }
+                                };
+                              
+
+                                var resulttask = await _eSSApiService.CreateTaskAsync(esstask);
+
+                                _logger.LogInformation("ReturnRemaining 鍒涘缓浠诲姟杩斿洖:  " + resulttask);
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            _logger.LogInformation("ReturnRemaining 鍒涘缓浠诲姟杩斿洖 catch err:  " + ex.Message);
+
+                        }
+                
+
+                        return WebResponseContent.Instance.OK($"鍥炲簱鎿嶄綔鎴愬姛锛屽叡鍥炲簱鏁伴噺锛歿totalReturnQty}");
+                    }
+                    catch (Exception ex)
+                    {
+                        return WebResponseContent.Instance.Error($"鍒涘缓鍥炲簱浠诲姟澶辫触: {ex.Message}");
+                    }
+                }
+
+                return WebResponseContent.Instance.Error("鏈垱寤轰换浣曞洖搴撲换鍔�");
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error($"鍥炲簱鎿嶄綔澶辫触: {ex.Message}");
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓鍥炲簱浠诲姟
+        /// </summary>
+        private void CreateReturnTask(List<Dt_Task> tasks, Dt_Task originalTask, string palletCode, Dt_LocationInfo newLocation)
+        {
+            Dt_Task newTask = new()
+            {
+                CurrentAddress = stations[originalTask.TargetAddress],
+                Grade = 0,
+                PalletCode = palletCode,
+                NextAddress = "",
+                OrderNo = originalTask.OrderNo,
+                Roadway = newLocation.RoadwayNo,
+                SourceAddress = stations[originalTask.TargetAddress],
+                TargetAddress = newLocation.LocationCode,
+                TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                TaskType = TaskTypeEnum.InPick.ObjToInt(),
+                PalletType = originalTask.PalletType,
+                WarehouseId = originalTask.WarehouseId,
+
+            };
+            tasks.Add(newTask);
+        }
+
+        /// <summary>
+        /// 妫�鏌ユ墭鐩樻槸鍚﹂渶瑕佸洖搴撶殑杈呭姪鏂规硶
+        /// </summary>
+        public async Task<bool> CheckPalletNeedReturn(string orderNo, string palletCode)
+        {
+            // 1. 妫�鏌ユ槸鍚︽湁鏈垎鎷g殑鍑哄簱璁板綍
+            var hasUnpickedLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+                .Where(it => it.OrderNo == orderNo && it.PalletCode == palletCode && it.Status == 1)
+                .AnyAsync();
+
+            if (hasUnpickedLocks)
+                return true;
+
+            // 2. 妫�鏌ュ嚭搴撴槸鍚﹀凡瀹屾垚浣嗘墭鐩樿繕鏈夊簱瀛樿揣鐗�
+            var outboundFinished = !await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+                .Where(it => it.PalletCode == palletCode && it.Status == 1)
+                .AnyAsync();
+
+            var stockinfo = _stockInfoService.Db.Queryable<Dt_StockInfo>().First(x => x.PalletCode == palletCode);
+
+
+            var hasRemainingGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+                .Where(it => it.StockId == stockinfo.Id && it.Status == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+                .Where(it => it.OutboundQuantity == 0 || it.OutboundQuantity < it.StockQuantity)
+                .AnyAsync();
+
+            return outboundFinished && hasRemainingGoods;
+        }
+
         // 鍙栨秷鎷i�夊姛鑳�
         public async Task<WebResponseContent> CancelPicking(string orderNo, string palletCode, string barcode)
         {
@@ -394,36 +834,17 @@
             var list = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                 .Where(x => x.OrderNo == orderNo &&
                            x.PalletCode == palletCode &&
-                           x.Status == 2)
+                           x.Status == 6)
                 .ToListAsync();
             return list;
         }
-
-        public async Task<object> GetPickingSummary(string orderNo, string palletCode)
-        {
-            var summary = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
-                .Where(x => x.OrderNo == orderNo &&
-                           x.PalletCode == palletCode && x.Status == 1)
-                .GroupBy(x => new { x.PalletCode, x.MaterielCode })
-                .Select(x => new
-                {
-                    PalletCode = x.PalletCode,
-                    MaterielCode = x.MaterielCode,
-                    UnpickedCount = SqlFunc.AggregateCount(x.Id),
-                    UnpickedQuantity = SqlFunc.AggregateSum(x.AssignQuantity) - SqlFunc.AggregateSum(x.PickedQty)
-                })
-                .FirstAsync();
-
-            return summary;
-        }
-
         // 鑾峰彇鎷i�夋眹鎬�
         public async Task<object> GetPickingSummary(ConfirmPickingDto dto)
         {
             var picked = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
              .WhereIF(!string.IsNullOrEmpty(dto.OrderNo), x => x.OrderNo == dto.OrderNo)
              .WhereIF(!string.IsNullOrEmpty(dto.PalletCode), x => x.PalletCode == dto.PalletCode)
-             .Where(x => x.Status == 2)
+             .Where(x => x.Status == 6)
              .GroupBy(x => new { x.PalletCode, x.MaterielCode })
              .Select(x => new SummaryPickingDto
              {
@@ -673,7 +1094,7 @@
                     {
                         orderDetail.OverOutQuantity = item.TotalQuantity;
                         orderDetail.LockQuantity = 0;
-                        orderDetail.OrderDetailStatus = (int)OrderDetailStatusEnum.Over;                      
+                        orderDetail.OrderDetailStatus = (int)OrderDetailStatusEnum.Over;
                         await _outboundOrderDetailService.Db.Updateable(orderDetail).ExecuteCommandAsync();
                     }
                 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
index a7686c9..7635616 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
@@ -62,14 +62,32 @@
                     return WebResponseContent.Instance.Error($"鎷嗗寘鏁伴噺涓嶈兘澶т簬鍓╀綑閿佸畾鏁伴噺锛屽墿浣欙細{remainingLockQuantity}");
 
                 var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
-               .Where(x => x.Barcode == request.OriginalBarcode)
+               .Where(x => x.Barcode == request.OriginalBarcode && x.StockId == lockInfo.StockId)
                .FirstAsync();
+                if (stockDetail == null)
+                    throw new Exception($"鏈壘鍒版潯鐮亄request.OriginalBarcode}瀵瑰簲鐨勫簱瀛樿褰�");
 
                 var seq = await _dailySequenceService.GetNextSequenceAsync();
                 // 3. 鐢熸垚鏂版潯鐮�
                 string newBarcode = "WSLOT" + DateTime.Now.ToString("yyyyMMdd") + seq.ToString()?.PadLeft(5, '0');
 
                 decimal remainingQty = remainingLockQuantity - request.SplitQuantity;
+
+                // 涓烘媶鍖呬骇鐢熺殑鏂版潯鐮佸垱寤哄簱瀛樿褰�
+                var newStockDetail = new Dt_StockInfoDetail
+                {                    
+                    StockId = lockInfo.StockId,
+                    MaterielCode = lockInfo.MaterielCode,
+                    OrderNo = lockInfo.OrderNo,
+                    BatchNo = lockInfo.BatchNo,
+                    StockQuantity = remainingQty,
+                    OutboundQuantity = remainingQty, // 閿佸畾鍏ㄩ儴鏁伴噺
+                    Barcode = newBarcode,
+                    InboundOrderRowNo = stockDetail.InboundOrderRowNo,
+                  
+                };
+                await _outStockLockInfoService.Db.Insertable(newStockDetail).ExecuteCommandAsync();
+
                 // 4. 鍒涘缓鏂扮殑鍑哄簱閿佸畾淇℃伅锛堟柊鏉$爜锛�
                 var newLockInfo = new Dt_OutStockLockInfo
                 {
@@ -99,7 +117,7 @@
                 await _outStockLockInfoService.Db.Insertable(newLockInfo).ExecuteCommandAsync();
 
                 // 5. 鏇存柊鍘熼攣瀹氫俊鎭殑鍒嗛厤鏁伴噺锛堝噺灏戞媶鍖呮暟閲忥級
-                lockInfo.AssignQuantity -= request.SplitQuantity;
+                lockInfo.AssignQuantity = request.SplitQuantity;
                 await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
                 // 6. 璁板綍鎷嗗寘鍘嗗彶锛堢敤浜庤拷韪級
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 596284c..7d96932 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -108,7 +108,7 @@
             _outStockLockInfoService = outStockLockInfoService;
         }
 
- 
+
         /// <summary>
         /// 
         /// </summary>
@@ -260,15 +260,15 @@
 
                         };
 
-                        var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode})
+                        var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
                            .Select(group => new FeedbackInboundDetailsModel
                            {
                                materialCode = group.Key.MaterielCode,
                                supplyCode = group.Key.SupplyCode,
                                batchNo = group.Key.BatchNo,
                                lineNo = group.Key.lineNo,
-                               warehouseCode = group.Key.WarehouseCode ,
-                              // warehouseCode= "1072",
+                               warehouseCode = group.Key.WarehouseCode,
+                               // warehouseCode= "1072",
                                unit = group.Key.BarcodeUnit,
                                barcodes = group.Select(row => new FeedbackBarcodesModel
                                {
@@ -277,20 +277,51 @@
                                }).ToList()
                            }).ToList();
                         feedmodel.details = groupedData;
-                        
+
                         _invokeMESService.FeedbackInbound(feedmodel);
                     }
 
                 }
             }
-            catch (Exception ex) {
+            catch (Exception ex)
+            {
                 _logger.LogInformation("InboundTaskCompleted 鍥炲啓MES澶辫触:  " + ex.Message);
             }
 
             return WebResponseContent.Instance.OK();
         }
 
+        public WebResponseContent OutboundTaskCompleted(Dt_Task task)
+        {
+            _logger.LogInformation($"TaskService  OutboundTaskCompleted: {task.TaskNum}");
+            //鏌ヨ揣浣�
+            Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+            if (locationInfo == null)
+            {
+                return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
+            }
+            locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+            _locationInfoService.Repository.UpdateData(locationInfo);
 
+            var outloks = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.TaskNum == task.TaskNum).ToList();
+            outloks.ForEach(o =>
+            {
+                o.Status = OutLockStockStatusEnum.宸插嚭搴�.ObjToInt();
+            });
+            _outStockLockInfoService.Db.Updateable(outloks).ExecuteCommand();
+
+            var locationCodes = outloks.Select(it => it.LocationCode).Distinct().ToList();
+
+            //_stockRepository.Db.Updateable<Dt_StockInfo>()
+            //  .SetColumns(it => new Dt_StockInfo { StockStatus = StockStatusEmun.})
+            //  .Where(it => locationCodes.Contains(it.LocationCode))
+            //  .ExecuteCommand();
+
+
+            return WebResponseContent.Instance.OK();
+
+
+        }
         public async Task<WebResponseContent> InEmptyTaskCompleted(Dt_Task task)
         {
 
@@ -344,14 +375,20 @@
             }
         }
 
+        public  WebResponseContent InPickTaskCompleted(Dt_Task task)
+        {
+            _logger.LogInformation($"TaskService  InPickTaskCompleted: {task.TaskNum}");
 
+
+            return WebResponseContent.Instance.OK();
+        }
 
         public async Task<WebResponseContent> OutEmptyTaskCompleted(Dt_Task task)
         {
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode  ).First();
+                Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode).First();
                 if (stockInfo == null)
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑搴撳瓨淇℃伅");
@@ -363,7 +400,7 @@
                     return content.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
                 }
 
-               
+
                 int beforeStatus = locationInfo.LocationStatus;
 
                 locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
@@ -389,7 +426,7 @@
 
 
 
-      
+
         /// <summary>
         /// 鍥炲簱瀹屾垚鍥炶皟 
         public async Task<WebResponseContent> BackToStockComplete(Dt_Task task)
@@ -471,7 +508,7 @@
 
                 //  鏇存柊浠诲姟鐘舵�佷负宸插畬鎴�
                 task.TaskStatus = (int)TaskStatusEnum.Finish;
-             
+
                 await Db.Updateable(task).ExecuteCommandAsync();
 
                 _unitOfWorkManage.CommitTran();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 868259e..61daea9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -131,7 +131,7 @@
         /// <param name="stockSelectViews"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int[] keys)
+        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int[] keys, string outStation)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
             List<Dt_OutboundOrderDetail> outboundOrderDetails = _outboundOrderDetailService.Repository.QueryData(x => keys.Contains(x.Id));
@@ -161,7 +161,7 @@
                         (int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality,
                         _ => new TaskTypeEnum()
                     };
-                    tasks = GetTasks(result.Item1, typeEnum);
+                    tasks = GetTasks(result.Item1, typeEnum, outStation);
                     tasks.ForEach(x =>
                     {
                         x.OrderNo = outboundOrder.OrderNo;
@@ -304,7 +304,7 @@
         /// </summary>
         /// <param name="stockInfos"></param>
         /// <returns></returns>
-        public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType)
+        public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType, string outStation)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
             List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode));
@@ -325,7 +325,7 @@
                             NextAddress = "",
                             Roadway = locationInfo.RoadwayNo,
                             SourceAddress = stockInfo.LocationCode,
-                            TargetAddress = "",
+                            TargetAddress = outStation,
                             TaskStatus = TaskStatusEnum.New.ObjToInt(),
                             TaskType = taskType.ObjToInt(),
                             // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -353,7 +353,7 @@
         /// </summary>
         /// <param name="keys">鍑哄簱鍗曟槑缁嗕富閿�</param>
         /// <returns></returns>
-        public async Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys)
+        public async Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys,string outStation) 
         {
             try
             {
@@ -364,7 +364,7 @@
                 List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
                 List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
 
-                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(keys);
+                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(keys,outStation);
                 if (result.Item2 != null && result.Item2.Count > 0)
                 {
                     stockInfos.AddRange(result.Item2);
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
index a0d02a9..0acdabf 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.AspNetCore.Http;
+锘縰sing Autofac.Core;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseController;
@@ -92,10 +93,9 @@
 
 
         [HttpPost("return-to-stock")]
-        public async Task<WebResponseContent> ReturnToStock( )
+        public async Task<WebResponseContent> ReturnToStock([FromBody] ConfirmPickingDto dto)
         {
-            var data= "";
-            return WebResponseContent.Instance.OK("", data);
+            return await Service.ReturnRemaining(dto.OrderNo, dto.PalletCode, "");
         }
 
         [HttpPost("direct-outbound")]
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
index e38c9d5..4612fbc 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
@@ -42,9 +42,9 @@
         /// <param name="keys"></param>
         /// <returns></returns>
         [HttpPost, HttpGet, Route("GenerateOutboundTasks"), AllowAnonymous]
-        public async Task<WebResponseContent> GenerateOutboundTasks([FromBody] int[] keys)
+        public async Task<WebResponseContent> GenerateOutboundTasks([FromBody] GenerateOutboundTasksDto data)
         {
-            return await Service.GenerateOutboundTasksAsync(keys);
+            return await Service.GenerateOutboundTasksAsync(data.taskIds,data.outboundPlatform);
         }
 
     }

--
Gitblit v1.9.3