pan
2025-11-18 e9feb28be7d4417b24bd53a77332846e2cbab734
提交
已修改6个文件
449 ■■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/AllocateEnum/BusinessTypeEnum.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs 190 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs 181 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue
@@ -1068,12 +1068,15 @@
        if (res.status) {
          this.$message.success('拆包成功');
          this.showSplitDialog = false;
              this.splitLoading = false;
          this.resetSplitForm();
          this.loadData();
        } else {
               this.splitLoading = false;
          this.$message.error(res.message || '拆包失败');
        }
      } catch (error) {
             this.splitLoading = false;
        this.$message.error('拆包失败');
      }
    },
@@ -1121,12 +1124,15 @@
        if (res.status) {
          this.$message.success('撤销拆包成功');
          this.showRevertSplitDialog = false;
           this.revertSplitLoading = false;
          this.revertSplitForm.originalBarcode = '';
          this.loadData();
        } else {
         this.revertSplitLoading = false;
          this.$message.error(res.message || '撤销拆包失败');
        }
      } catch (error) {
         this.revertSplitLoading = false;
        this.$message.error('撤销拆包失败');
      }
    },
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/AllocateEnum/BusinessTypeEnum.cs
@@ -12,4 +12,6 @@
        æ™ºä»“调外部仓库=2,
        å¤–部仓库调智仓=3
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -177,6 +177,12 @@
                if (lockInfo.PalletCode != palletCode)
                    throw new Exception($"条码{barcode}不属于托盘{palletCode}");
                var outorderdetail = _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().First(x => x.Id == lockInfo.OrderDetailId);
                if (outorderdetail != null && lockInfo.AssignQuantity > outorderdetail.OrderQuantity)
                {
                    throw new Exception($"条码{barcode}的出库数量大于订单的数量");
                }
                var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                        .Where(x => x.Barcode == barcode && x.StockId == lockInfo.StockId)
                        .FirstAsync();
@@ -248,10 +254,15 @@
        private async Task CheckAndUpdateOrderStatus(string orderNo)
        {
            var orderDetails = _stockInfoDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
                      .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id) // å…³è”条件:父表 Id = å­è¡¨ OrderId
                      .Where((o, item) => item.OrderNo == orderNo) // è¿‡æ»¤çˆ¶è¡¨ OrderNo
                      .Select((o, item) => o) // åªè¿”回子表数据
                      .ToList();
            var orderDetails = await _stockInfoDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
                .Where(x => x.OrderId == orderNo.ObjToInt())
                .ToListAsync();
            //var orderDetails = await _stockInfoDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
            //    .Where(x => x.OrderId == orderNo.ObjToInt())
            //    .ToListAsync();
            bool allCompleted = true;
            foreach (var detail in orderDetails)
@@ -269,6 +280,8 @@
                    .SetColumns(x => x.OrderStatus == 2) // å·²å®Œæˆ
                    .Where(x => x.OrderNo == orderNo)
                    .ExecuteCommandAsync();
                //回传MES
            }
        }
@@ -276,165 +289,18 @@
        /// <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>();
@@ -447,6 +313,21 @@
                {
                    return WebResponseContent.Instance.Error("未找到对应的任务信息");
                }
                //  æ£€æŸ¥æ‰˜ç›˜ä¸Šæ˜¯å¦æœ‰å…¶ä»–非出库货物(库存货物)
                var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                    .Where(it => it.StockId == stockinfo.Id &&( it.Status == StockStatusEmun.入库确认.ObjToInt()  || it.Status == StockStatusEmun.入库完成.ObjToInt()))
                    .Where(it => it.OutboundQuantity == 0 || it.OutboundQuantity < it.StockQuantity) // æœªå®Œå…¨å‡ºåº“çš„
                    .ToListAsync();
                //  å¦‚果没有需要回库的货物(既无未分拣出库货物,也无其他库存货物)
                if (!remainingLocks.Any() && !palletStockGoods.Any())
                {
                    //是否自动回库,把之前出库的任务删除,然后组个空盘入库。
                    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);
@@ -687,11 +568,11 @@
                var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                       .Where(x => x.Barcode == barcode && x.StockId == outStockInfo.StockId)
                       .FirstAsync();
                stockDetail.StockQuantity += outStockInfo.AssignQuantity;
                stockDetail.OutboundQuantity += outStockInfo.AssignQuantity;
                await _stockInfoDetailService.Db.Updateable(stockDetail).ExecuteCommandAsync();
                // è¿˜åŽŸå‡ºåº“å•æ˜Žç»†
                var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
@@ -699,6 +580,7 @@
                    .FirstAsync();
                orderDetail.OverOutQuantity -= outStockInfo.AssignQuantity;
                orderDetail.PickedQty = 0;
                await _outboundOrderDetailService.Db.Updateable(orderDetail).ExecuteCommandAsync();
                // åˆ é™¤æ‹£é€‰åŽ†å²
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs
@@ -84,7 +84,7 @@
                    SupplyCode = stockDetail.SupplyCode,
                    WarehouseCode = stockDetail.WarehouseCode,
                    BarcodeQty = stockDetail.BarcodeQty,
                    BarcodeUnit = stockDetail.Barcode,
                    BarcodeUnit = stockDetail.BarcodeUnit,
                    BusinessType = stockDetail.BusinessType,
                    Unit = stockDetail.Unit,
                    StockId = lockInfo.StockId,
@@ -170,48 +170,180 @@
            }
        }
        // æ’¤é”€æ‹†åŒ…
        //public async Task<WebResponseContent> RevertSplitPackage(string originalBarcode)
        //{
        //    try
        //    {
        //        _unitOfWorkManage.BeginTran();
        //        // 1. æŸ¥æ‰¾æœ€è¿‘的未撤销拆包记录
        //        var splitRecord = await Db.Queryable<Dt_SplitPackageRecord>()
        //                .Where(x => x.OriginalBarcode == originalBarcode && !x.IsReverted)
        //                .OrderByDescending(x => x.SplitTime)
        //                .FirstAsync();
        //        if (splitRecord == null)
        //            return WebResponseContent.Instance.Error("未找到可撤销的拆包记录");
        //        // 2. æ£€æŸ¥æ–°æ¡ç æ˜¯å¦å·²æ‹£é€‰
        //        var newLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
        //            .Where(x => x.CurrentBarcode == splitRecord.NewBarcode)
        //            .FirstAsync();
        //        if (newLockInfo?.Status ==6) // å‡è®¾çŠ¶æ€2表示已拣选
        //            return WebResponseContent.Instance.Error("新条码已拣选,无法撤销拆包");
        //        // 3. èŽ·å–åŽŸæ¡ç çš„é”å®šä¿¡æ¯
        //        var originalLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
        //            .Where(x => x.CurrentBarcode == originalBarcode)
        //            .FirstAsync();
        //        if (originalLockInfo == null)
        //            return WebResponseContent.Instance.Error("未找到原条码锁定信息");
        //        originalLockInfo.AssignQuantity  += splitRecord.RemainQuantity;
        //       // originalLockInfo.Status = (int)OutLockStockStatusEnum.出库中;
        //        originalLockInfo.IsSplitted = 0; // æ ‡è®°ä¸ºæœªæ‹†åŒ…
        //        await _outStockLockInfoService.Db.Updateable(originalLockInfo).ExecuteCommandAsync();
        //        // 5. è¿˜åŽŸåŽŸæ¡ç åº“å­˜è®°å½•
        //        var originalStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
        //            .Where(x => x.Barcode == originalBarcode && x.StockId == splitRecord.StockId)
        //            .FirstAsync();
        //        if (originalStockDetail != null)
        //        {
        //            // å°†æ‹†å‡ºçš„æ•°é‡åŠ å›žåˆ°åŽŸæ¡ç åº“å­˜
        //            originalStockDetail.StockQuantity += splitRecord.RemainQuantity;
        //            originalStockDetail.OutboundQuantity += splitRecord.RemainQuantity;
        //            await _stockInfoDetailService.Db.Updateable(originalStockDetail).ExecuteCommandAsync();
        //        }
        //        // 6. åˆ é™¤æ–°æ¡ç çš„锁定信息
        //        if (newLockInfo != null)
        //        {
        //            await _outStockLockInfoService.Db.Deleteable<Dt_OutStockLockInfo>()
        //                .Where(x => x.CurrentBarcode == splitRecord.NewBarcode)
        //                .ExecuteCommandAsync();
        //        }
        //        // 7. åˆ é™¤æ–°æ¡ç çš„库存记录
        //        var newStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
        //            .Where(x => x.Barcode == splitRecord.NewBarcode)
        //            .FirstAsync();
        //        if (newStockDetail != null)
        //        {
        //            await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>()
        //                .Where(x => x.Barcode == splitRecord.NewBarcode)
        //                .ExecuteCommandAsync();
        //        }
        //        // 8. æ›´æ–°æ‹†åŒ…记录为已撤销
        //        splitRecord.IsReverted = true;
        //        await Db.Updateable(splitRecord).ExecuteCommandAsync();
        //        _unitOfWorkManage.CommitTran();
        //        return WebResponseContent.Instance.OK($"撤销拆包成功,还原数量:{splitRecord.SplitQty}");
        //    }
        //    catch (Exception ex)
        //    {
        //        _unitOfWorkManage.RollbackTran();
        //        return WebResponseContent.Instance.Error($"撤销拆包失败:{ex.Message}");
        //    }
        //}
        public async Task<WebResponseContent> RevertSplitPackage(string originalBarcode)
        {
            try
            {
                _unitOfWorkManage.BeginTran();
                // æŸ¥æ‰¾æœ€è¿‘的未撤销拆包记录
                var splitPackage = await Db.Queryable<Dt_SplitPackageRecord>()
                // 1. æŸ¥æ‰¾æ‰€æœ‰æœªæ’¤é”€çš„æ‹†åŒ…记录
                var splitRecords = await Db.Queryable<Dt_SplitPackageRecord>()
                        .Where(x => x.OriginalBarcode == originalBarcode && !x.IsReverted)
                        .OrderByDescending(x => x.CreateDate)
                        .FirstAsync();
                        .OrderBy(x => x.SplitTime) // æŒ‰æ—¶é—´æ­£åºï¼Œä»Žæœ€æ—©å¼€å§‹æ’¤é”€
                        .ToListAsync();
                if (splitPackage == null)
                    return WebResponseContent.Instance.Error("未找到拆包记录");
                if (splitRecords == null || !splitRecords.Any())
                    return WebResponseContent.Instance.Error("未找到可撤销的拆包记录");
                // æ£€æŸ¥æ–°æ¡ç æ˜¯å¦å·²æ‹£é€‰
                var newOutStockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                    .Where(x => x.CurrentBarcode == splitPackage.NewBarcode)
                    .FirstAsync();
                // 2. æ£€æŸ¥æ‰€æœ‰æ–°æ¡ç æ˜¯å¦å·²æ‹£é€‰
                var newBarcodes = splitRecords.Select(x => x.NewBarcode).ToList();
                var newLockInfos = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                    .Where(x => newBarcodes.Contains(x.CurrentBarcode))
                    .ToListAsync();
                if (newOutStockInfo.Status == 2)
                    return WebResponseContent.Instance.Error("新条码已拣选,无法撤销拆包");
                var pickedBarcodes = newLockInfos.Where(x => x.Status == 2).Select(x => x.CurrentBarcode).ToList();
                if (pickedBarcodes.Any())
                    return WebResponseContent.Instance.Error($"以下条码已拣选,无法撤销:{string.Join(",", pickedBarcodes)}");
                // è¿˜åŽŸåŽŸå‡ºåº“è¯¦æƒ…æ•°é‡
                var originalOutStockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                // 3. èŽ·å–åŽŸæ¡ç ä¿¡æ¯
                var originalLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                    .Where(x => x.CurrentBarcode == originalBarcode)
                    .FirstAsync();
                originalOutStockInfo.AssignQuantity += splitPackage.SplitQty;
                await _outStockLockInfoService.Db.Updateable(originalOutStockInfo).ExecuteCommandAsync();
                if (originalLockInfo == null)
                    return WebResponseContent.Instance.Error("未找到原条码锁定信息");
                // åˆ é™¤æ–°å‡ºåº“详情记录
                var originalStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                    .Where(x => x.Barcode == originalBarcode && x.StockId == originalLockInfo.StockId)
                    .FirstAsync();
                // 4. èŽ·å–æ‰€æœ‰æ–°æ¡ç çš„åº“å­˜è®°å½•
                var newStockDetails = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                    .Where(x => newBarcodes.Contains(x.Barcode))
                    .ToListAsync();
                // 5. è®¡ç®—总还原数量
                decimal totalRevertQty = newStockDetails.Sum(x => x.StockQuantity);
                // 6. è¿˜åŽŸåŽŸæ¡ç åº“å­˜è®°å½•
                if (originalStockDetail != null)
                {
                    // åŽŸæ¡ç å½“å‰æ•°é‡åŠ ä¸Šæ‰€æœ‰æ–°æ¡ç çš„æ•°é‡
                    originalStockDetail.StockQuantity += totalRevertQty;
                    originalStockDetail.OutboundQuantity += totalRevertQty;
                    await _stockInfoDetailService.Db.Updateable(originalStockDetail).ExecuteCommandAsync();
                }
                // 7. è¿˜åŽŸåŽŸæ¡ç é”å®šä¿¡æ¯
                decimal totalAssignQty = newLockInfos.Sum(x => x.AssignQuantity);
                originalLockInfo.AssignQuantity += totalAssignQty;
                if (originalLockInfo.OrderQuantity < originalLockInfo.AssignQuantity)
                {
                    originalLockInfo.AssignQuantity=originalLockInfo.OrderQuantity;
                }
                originalLockInfo.Status = (int)OutLockStockStatusEnum.出库中;
                originalLockInfo.IsSplitted = 0;
                await _outStockLockInfoService.Db.Updateable(originalLockInfo).ExecuteCommandAsync();
                // 8. åˆ é™¤æ‰€æœ‰æ–°æ¡ç çš„锁定信息
                await _outStockLockInfoService.Db.Deleteable<Dt_OutStockLockInfo>()
                    .Where(x => x.CurrentBarcode == splitPackage.NewBarcode)
                    .Where(x => newBarcodes.Contains(x.CurrentBarcode))
                    .ExecuteCommandAsync();
                // æ ‡è®°æ‹†åŒ…记录为已撤销
                splitPackage.IsReverted = true;
                await Db.Updateable(splitPackage).ExecuteCommandAsync();
                // 9. åˆ é™¤æ‰€æœ‰æ–°æ¡ç çš„库存记录
                await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>()
                    .Where(x => newBarcodes.Contains(x.Barcode))
                    .ExecuteCommandAsync();
                // 10. æ ‡è®°æ‰€æœ‰æ‹†åŒ…记录为已撤销
                foreach (var record in splitRecords)
                {
                    record.IsReverted = true;
                }
                await Db.Updateable(splitRecords).ExecuteCommandAsync();
                _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK("撤销拆包成功");
                return WebResponseContent.Instance.OK($"撤销拆包成功,共还原{splitRecords.Count}次拆包,总数量:{totalRevertQty}");
            }
            catch (Exception ex)
@@ -220,7 +352,6 @@
                return WebResponseContent.Instance.Error($"撤销拆包失败:{ex.Message}");
            }
        }
        // èŽ·å–æ‹†åŒ…ä¿¡æ¯
        public async Task<WebResponseContent> GetSplitPackageInfo(string orderNo, string palletCode, string barcode)
        {
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -16,6 +16,7 @@
#endregion << ç‰ˆ æœ¬ æ³¨ é‡Š >>
using AutoMapper;
using Dm.filter;
using MailKit.Search;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
@@ -307,18 +308,25 @@
            _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();
            var stockids = outloks.Select(x => x.StockId).ToList();
            _stockService.StockInfoService.Db.Updateable<Dt_StockInfo>()
                                  .SetColumns(it => new Dt_StockInfo
                                  {
                                      StockStatus = StockStatusEmun.出库锁定.ObjToInt()
                                  })
                                  .Where(it => stockids.Contains(it.Id))
                                  .ExecuteCommand();
            //_stockRepository.Db.Updateable<Dt_StockInfo>()
            //  .SetColumns(it => new Dt_StockInfo { StockStatus = StockStatusEmun.})
            //  .Where(it => locationCodes.Contains(it.LocationCode))
            //  .ExecuteCommand();
            _stockService.StockInfoDetailService.Db.Updateable<Dt_StockInfoDetail>()
                                  .SetColumns(it => new Dt_StockInfoDetail
                                  {
                                      Status = StockStatusEmun.出库锁定.ObjToInt()
                                  })
                                  .Where(it => stockids.Contains( it.StockId))
                                  .ExecuteCommand();
            return WebResponseContent.Instance.OK();
@@ -378,10 +386,48 @@
            }
        }
        public  WebResponseContent InPickTaskCompleted(Dt_Task task)
        public WebResponseContent InPickTaskCompleted(Dt_Task task)
        {
            _logger.LogInformation($"TaskService  InPickTaskCompleted: {task.TaskNum}");
            //查库存
            Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == task.PalletCode).First();
            if (stockInfo == null)
            {
                return WebResponseContent.Instance.Error($"未找到托盘对应的组盘信息");
            }
            if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt())
            {
                return WebResponseContent.Instance.Error($"未找到该托盘库存明细信息");
            }
            //查货位
            Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
            if (locationInfo == null)
            {
                return WebResponseContent.Instance.Error($"未找到对应的终点货位信息");
            }
            stockInfo.LocationCode = task.TargetAddress;
            stockInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
            stockInfo.Details.ForEach(x =>
            {
                x.Status = StockStatusEmun.入库完成.ObjToInt();
            });
            _stockService.StockInfoService.Repository.UpdateData(stockInfo);
            _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
            if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt())
            {
                locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
            }
            else
            {
                locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
            }
            _locationInfoService.Repository.UpdateData(locationInfo);
            task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
            BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
            return WebResponseContent.Instance.OK();
        }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -159,7 +159,7 @@
                        (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound,
                        (int)OutOrderTypeEnum.Allocate => TaskTypeEnum.OutAllocate,
                        (int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality,
                        _ => new TaskTypeEnum()
                        _ =>   TaskTypeEnum.Outbound
                    };
                    tasks = GetTasks(result.Item1, typeEnum, outStation);
                    tasks.ForEach(x =>