dengjunjie
2025-01-16 452132d37fd32cc7f39ed5f70328cd3de1fd4732
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -214,16 +214,15 @@
                #endregion
                Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
                if (inboundOrder == null)
                {
                    return WebResponseContent.Instance.Error($"瀵瑰簲鍏ュ簱鍗曚笉瀛樺湪");
                }
                //鏌ヨ鍘熷畬鎴愮殑鍏ュ簱鏄庣粏鏁伴噺
                int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                Dt_InboundOrderDetail? inboundOrderDetail = null;
                List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
                if (stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
                {
                    if (inboundOrder == null)
                    {
                        return WebResponseContent.Instance.Error($"瀵瑰簲鍏ュ簱鍗曚笉瀛樺湪");
                    }
                    //鏌ヨ鍘熷畬鎴愮殑鍏ュ簱鏄庣粏鏁伴噺
                    int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                    inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == stockInfo.Details.FirstOrDefault()?.InboundOrderRowNo);
                    foreach (var item in stockInfo.Details)
                    {
@@ -249,16 +248,15 @@
                            inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
                            overCount += 1;
                        }
                        else if(inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                        else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                        {
                            inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt();
                        }
                        detailModels.Add(detailModel);
                    }
                    if (inboundOrder.Details.Count == overCount)
                    {
                        inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
                    }
                }
                if (inboundOrder.Details.Count == overCount)
                {
                    inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
                }
                if ((stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
@@ -292,20 +290,14 @@
                _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted);
                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum);
                if (inboundOrder != null)
                _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
                if (inboundOrderDetail != null)
                {
                    _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
                    if (inboundOrderDetail!=null)
                    {
                        _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail);
                    }
                    _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail);
                }
                _unitOfWorkManage.CommitTran();
                if (stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() && inboundOrder.OrderStatus== InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
                {
                    List<Dt_StockInfoDetail> stockInfoDetails = _stockRepository.StockInfoDetailRepository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo);
                    _inboundOrderService.FeedbackInboundOrder(inboundOrder, stockInfoDetails);
                }
                if (inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
                    _inboundOrderService.FeedbackInboundOrder(inboundOrder);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)