pan
2025-12-02 62b5e514154820ed41f0093c29e35b07224a2ba9
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs
@@ -269,7 +269,7 @@
                                        };
                                        var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode })
                                        var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode })
                                           .Select(group => new AllocateDtoDetail
                                           {
                                               MaterialCode = group.Key.MaterielCode,
@@ -428,7 +428,7 @@
                {
                    // èŽ·å–è¯¥æ˜Žç»†å¯¹åº”çš„æ¡ç ä¿¡æ¯ï¼ˆä»Žé”å®šè®°å½•ï¼‰
                    var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                        .Where(x => x.OrderNo == orderNo && detailids.Contains(x.OrderDetailId) &&
                        .Where(x => x.OrderNo == orderNo && detail.Id == x.OrderDetailId &&
                                   x.Status == (int)OutLockStockStatusEnum.拣选完成)
                        .ToListAsync();
                    var detailModel = new FeedbackOutboundDetailsModel
@@ -439,32 +439,30 @@
                        qty = detail.BarcodeQty, // ä½¿ç”¨è®¢å•明细的已出库数量
                        currentDeliveryQty = detail.BarcodeQty,
                        unit = detail.BarcodeUnit,
                        barcodes =  new List<WIDESEA_DTO.Outbound.BarcodesModel> ()
                        barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
                    };
                    if (detailLocks.Any(x => x.BarcodeUnit != x.Unit))
                    foreach (var item in detailLocks)
                    {
                        foreach (var item in detailLocks)
                        var barmodel = new WIDESEA_DTO.Outbound.BarcodesModel
                        {
                            var barmodel = new WIDESEA_DTO.Outbound.BarcodesModel
                            {
                                barcode = item.CurrentBarcode,
                                supplyCode = item.SupplyCode,
                                batchNo = item.BatchNo,
                                unit = item.BarcodeUnit,
                                qty = item.BarcodeQty // æ¡ç çº§åˆ«çš„æ•°é‡ä»ç”¨é”å®šè®°å½•
                            };
                            if (item.BarcodeUnit != item.Unit)
                            {
                                var issueoStockResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.BarcodeQty, item.Unit,item.BarcodeUnit);
                                barmodel.unit = issueoStockResult.Unit;
                                barmodel.qty = issueoStockResult.Quantity;
                            }
                            detailModel.qty = barmodel.qty;
                            detailModel.currentDeliveryQty = barmodel.qty;
                            detailModel.barcodes.Add(barmodel);
                            barcode = item.CurrentBarcode,
                            supplyCode = item.SupplyCode,
                            batchNo = item.BatchNo,
                            unit = item.BarcodeUnit,
                            qty = item.BarcodeQty // æ¡ç çº§åˆ«çš„æ•°é‡ä»ç”¨é”å®šè®°å½•
                        };
                        if (item.BarcodeUnit != item.Unit)
                        {
                            var issueoStockResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.BarcodeQty, item.Unit, item.BarcodeUnit);
                            barmodel.unit = issueoStockResult.Unit;
                            barmodel.qty = issueoStockResult.Quantity;
                        }
                    }
                        detailModel.qty += barmodel.qty;
                        detailModel.currentDeliveryQty += barmodel.qty;
                        detailModel.barcodes.Add(barmodel);
                    }
                    feedmodel.details.Add(detailModel);
                }
@@ -494,7 +492,7 @@
                              .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id)
                              .Where((o, item) => item.OrderNo == orderNo && item.ReturnToMESStatus != 1)
                              .Select((o, item) => o)
                              .ToListAsync();
                              .ToListAsync();
                        var secallCompleted = true;
                        foreach (var detail in orderDetails.Where(x => x.ReturnToMESStatus == 0).ToList())
                        {
@@ -598,25 +596,27 @@
                                       x.Status == (int)OutLockStockStatusEnum.拣选完成)
                            .ToListAsync();
                        var detailModel = new FeedbackOutboundDetailsModel
                        {
                            materialCode = detail.MaterielCode,
                            lineNo = detail.lineNo, // æ³¨æ„ï¼šè¿™é‡Œå¯èƒ½éœ€è¦è°ƒæ•´å­—段名
                            warehouseCode = detail.WarehouseCode,
                            qty = detail.BarcodeQty,
                            currentDeliveryQty = detail.BarcodeQty,
                            unit = detail.BarcodeUnit,
                            barcodes = detailLocks.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
                            {
                                barcode = lockInfo.CurrentBarcode,
                                supplyCode = lockInfo.SupplyCode,
                                batchNo = lockInfo.BatchNo,
                                unit = lockInfo.BarcodeUnit,
                                qty = lockInfo.BarcodeQty // æ¡ç çº§åˆ«çš„æ•°é‡ä»ç”¨é”å®šè®°å½•
                            }).ToList()
                        };
                        feedmodel.details.Add(detailModel);
                        var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode,item.lineNo, item.BarcodeUnit, item.WarehouseCode })
                                 .Select(group =>new FeedbackOutboundDetailsModel
                                  {
                                      materialCode = group.Key.MaterielCode,
                                      lineNo = group.Key.lineNo, // æ³¨æ„ï¼šè¿™é‡Œå¯èƒ½éœ€è¦è°ƒæ•´å­—段名
                                      warehouseCode = group.Key.WarehouseCode,
                                      qty = group.Sum(x => x.BarcodeQty),
                                      currentDeliveryQty = group.Sum(x => x.BarcodeQty),
                                      unit = group.Key.BarcodeUnit,
                                      barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
                                      {
                                          barcode = lockInfo.CurrentBarcode,
                                          supplyCode = lockInfo.SupplyCode,
                                          batchNo = lockInfo.BatchNo,
                                          unit = lockInfo.BarcodeUnit,
                                          qty = lockInfo.BarcodeQty // æ¡ç çº§åˆ«çš„æ•°é‡ä»ç”¨é”å®šè®°å½•
                                      }).ToList()
                                  }).ToList();
                        feedmodel.details.AddRange(groupdata);
                    }
                    var result = await FeedbackOutbound(feedmodel);