1
heshaofeng
2026-01-13 1866b69e8f67e382a0a75268d63e6418c8ae02e7
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -2463,7 +2463,7 @@
                    Barcodes barcodes = new Barcodes
                    {
                        Barcode = item.Barcode,
                        Qty = item.BarcodeQty,
                        Qty = item.OrderQuantity,
                        SupplyCode = item?.SupplyCode ?? "",
                        BatchNo = item?.BatchNo ?? "",
                        Unit = item?.Unit ?? ""
@@ -2535,7 +2535,7 @@
                Barcodes barcodes = new Barcodes
                {
                    Barcode = matchedDetail.Barcode,
                    Qty = matchedDetail.BarcodeQty,
                    Qty = matchedDetail.OrderQuantity,
                    SupplyCode = matchedDetail?.SupplyCode ?? "",
                    BatchNo = matchedDetail?.BatchNo ?? "",
                    Unit = matchedDetail?.Unit ?? ""
@@ -2691,6 +2691,15 @@
                    _inboundOrderService.Db.Updateable(updateInboundOrders.Values.ToList()).ExecuteCommand();
                }
                // 7. å¾ªçŽ¯åˆ†ç»„ç»“æžœï¼Œè°ƒç”¨MES回传方法(按入库单分组回传)
                foreach (var kvp in orderIdBarCodeDict)
                {
                    int orderId = kvp.Key;
                    List<string> barCodeList = kvp.Value;
                    //入库回传MES
                    NoStockOutBatchInOrderFeedbackToMes(orderId, barCodeList);
                }
                //只对出库条码的出库单明细进行计算回传
                List<Dt_OutboundOrderDetail> outboundOrderDetail = outboundOrder.Details
                .Where(x => !string.IsNullOrWhiteSpace(x.documentsNO)
@@ -2700,9 +2709,9 @@
                foreach (var item in outboundOrderDetail)
                {
                    item.LockQuantity = item.NoStockOutQty;
                    item.OverOutQuantity = item.NoStockOutQty;
                    item.CurrentDeliveryQty = item.OverOutQuantity;
                    item.LockQuantity += item.NoStockOutQty;
                    item.OverOutQuantity += item.NoStockOutQty;
                    item.CurrentDeliveryQty = item.NoStockOutQty;
                    //添加回传MES参数
                    List<Barcodes> barcodesList = new List<Barcodes>();
                    List<Barcodes> documentsNOList = new List<Barcodes>();
@@ -2737,8 +2746,8 @@
                        TaskNum = 0,
                        ChangeType = (int)StockChangeTypeEnum.Inbound,
                        ChangeQuantity = -item.NoStockOutQty,
                        BeforeQuantity = item.OrderQuantity - item.OverOutQuantity-item.MoveQty,
                        AfterQuantity = item.OrderQuantity - item.OverOutQuantity - item.MoveQty - item.NoStockOutQty,
                        BeforeQuantity = item.OrderQuantity,
                        AfterQuantity = item.OrderQuantity - item.OverOutQuantity,
                        SupplyCode = item.SupplyCode ?? "",
                        WarehouseCode = item.WarehouseCode ?? "",
                        Remark = $"虚拟出库"
@@ -2757,18 +2766,14 @@
                if (CheckOutboundOrderCompleted(outboundOrder.OrderNo))
                {
                    outboundOrder.OrderStatus = OutOrderStatusEnum.出库完成.ObjToInt();
                    _outboundOrderService.UpdateData(outboundOrder);
                }
                _unitOfWorkManage.CommitTran();
                // 7. å¾ªçŽ¯åˆ†ç»„ç»“æžœï¼Œè°ƒç”¨MES回传方法(按入库单分组回传)
                foreach (var kvp in orderIdBarCodeDict)
                {
                    int orderId = kvp.Key;
                    List<string> barCodeList = kvp.Value;
                    //入库回传MES
                    NoStockOutBatchInOrderFeedbackToMes(orderId, barCodeList);
                }
                else
                {
                    outboundOrder.OrderStatus = OutOrderStatusEnum.出库中.ObjToInt();
                }
                _outboundOrderService.UpdateData(outboundOrder);
                _unitOfWorkManage.CommitTran();
                //出库回传MES
                _feedbackMesService.OutboundFeedback(outboundOrder.OrderNo);
@@ -2844,12 +2849,16 @@
                    if (response != null && response.IsSuccess)
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                            .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            .Where(it => it.OrderId == inboundOrder.Id && barCodeList.Contains(it.Barcode)).ExecuteCommand();
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                            .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                    }
                    else
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
                            .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            .Where(it => it.OrderId == inboundOrder.Id && barCodeList.Contains(it.Barcode)).ExecuteCommand();
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus =2})
                            .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                        return content.Error("回传MES失败");
                    }
                }
@@ -2877,13 +2886,13 @@
                    if (response != null && response.IsSuccess)
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                            .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            .Where(it => it.OrderId == inboundOrder.Id && barCodeList.Contains(it.Barcode)).ExecuteCommand();
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                            .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                    }
                    else
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }).Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }).Where(it => it.OrderId == inboundOrder.Id && barCodeList.Contains(it.Barcode)).ExecuteCommand();
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2 })
                            .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                        return content.Error("回传MES失败");