pan
2025-11-20 246622a6e9c2563bd21d627c21c6012017f0f04e
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -157,7 +157,7 @@
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public WebResponseContent InboundTaskCompleted(Dt_Task task)
        public async Task<WebResponseContent> InboundTaskCompleted(Dt_Task task)
        {
            decimal beforeQuantity = 0;
@@ -248,42 +248,60 @@
            {
                foreach (var inboundOrder in inboundOrders)
                {
                    if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                    if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt())//调拨入库
                    {
                        var feedmodel = new FeedbackInboundRequestModel
                    }
                    else if (inboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt()) //重检入库
                    {
                    }
                    else
                    {
                        if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                        {
                            reqCode = Guid.NewGuid().ToString(),
                            reqTime = DateTime.Now.ToString(),
                            business_type = inboundOrder.BusinessType,
                            factoryArea = inboundOrder.FactoryArea,
                            operationType = 1,
                            Operator = inboundOrder.Operator,
                            orderNo = inboundOrder.UpperOrderNo,
                            status = inboundOrder.OrderStatus,
                            details = new List<FeedbackInboundDetailsModel>()
                            var feedmodel = new FeedbackInboundRequestModel
                            {
                                reqCode = Guid.NewGuid().ToString(),
                                reqTime = DateTime.Now.ToString(),
                                business_type = inboundOrder.BusinessType,
                                factoryArea = inboundOrder.FactoryArea,
                                operationType = 1,
                                Operator = inboundOrder.Operator,
                                orderNo = inboundOrder.UpperOrderNo,
                                status = inboundOrder.OrderStatus,
                                details = new List<FeedbackInboundDetailsModel>()
                        };
                            };
                        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,
                               qty=group.Sum(x=>x.BarcodeQty),
                               // warehouseCode= "1072",
                               unit = group.Key.BarcodeUnit,
                               barcodes = group.Select(row => new FeedbackBarcodesModel
                            var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
                               .Select(group => new FeedbackInboundDetailsModel
                               {
                                   barcode = row.Barcode,
                                   qty = row.BarcodeQty
                               }).ToList()
                           }).ToList();
                        feedmodel.details = groupedData;
                                   materialCode = group.Key.MaterielCode,
                                   supplyCode = group.Key.SupplyCode,
                                   batchNo = group.Key.BatchNo,
                                   lineNo = group.Key.lineNo,
                                   warehouseCode = group.Key.WarehouseCode,
                                   qty = group.Sum(x => x.BarcodeQty),
                                   // warehouseCode= "1072",
                                   unit = group.Key.BarcodeUnit,
                                   barcodes = group.Select(row => new FeedbackBarcodesModel
                                   {
                                       barcode = row.Barcode,
                                       qty = row.BarcodeQty
                                   }).ToList()
                               }).ToList();
                            feedmodel.details = groupedData;
                        _invokeMESService.FeedbackInbound(feedmodel);
                            var result = await _invokeMESService.FeedbackInbound(feedmodel);
                            if (result != null && result.code == 200)
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            }
                        }
                    }
                }
@@ -311,7 +329,7 @@
            var outloks = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.TaskNum == task.TaskNum).ToList();
            var stockids = outloks.Select(x => x.StockId).ToList();
            _stockService.StockInfoService.Db.Updateable<Dt_StockInfo>()
                                  .SetColumns(it => new Dt_StockInfo
                                  {
@@ -325,9 +343,9 @@
                                  {
                                      Status = StockStatusEmun.出库锁定.ObjToInt()
                                  })
                                  .Where(it => stockids.Contains( it.StockId))
                                  .Where(it => stockids.Contains(it.StockId))
                                  .ExecuteCommand();
            return WebResponseContent.Instance.OK();
@@ -401,6 +419,17 @@
                return WebResponseContent.Instance.Error($"未找到该托盘库存明细信息");
            }
            // èŽ·å–æ‰€æœ‰å›žåº“ä¸­çš„å‡ºåº“é”å®šè®°å½•
            var returnLocks = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                .Where(it => it.OrderNo == task.OrderNo && it.PalletCode == task.PalletCode && it.Status == (int)OutLockStockStatusEnum.回库中)
                .ToList();
            // æ›´æ–°å‡ºåº“锁定记录状态为回库完成
            foreach (var lockInfo in returnLocks)
            {
                lockInfo.Status = (int)OutLockStockStatusEnum.已回库;
            }
            _outStockLockInfoService.Db.Updateable(returnLocks).ExecuteCommand();
            //查货位
            Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
            if (locationInfo == null)