| | |
| | | public IOutboundOrderRepository Repository => BaseDal; |
| | | private readonly IInvokeERPService _invokeERPService; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | private readonly IOutboundOrderRepository _outboundOrderRepository; |
| | | |
| | | public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper,IUnitOfWorkManage unitOfWorkManage, IBasicService basicService, IOutboundOrderDetailRepository outboundOrderDetailRepository, IStockInfoService stockInfoService, |
| | | IStockInfoRepository stockInfoRepository, IInvokeERPService invokeERPService, IOutStockLockInfoService outStockLockInfoService) : base(BaseDal) |
| | | IStockInfoRepository stockInfoRepository, IInvokeERPService invokeERPService, IOutStockLockInfoService outStockLockInfoService, |
| | | IOutboundOrderRepository outboundOrderRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _invokeERPService = invokeERPService; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _outboundOrderRepository = outboundOrderRepository; |
| | | } |
| | | |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | if (saveModel.MainData.TryGetValue(nameof(Dt_OutboundOrder.UpperOrderNo).FirstLetterToLower(), out object? upperOrderNo) && upperOrderNo != null && !string.IsNullOrEmpty(upperOrderNo.ToString())) |
| | | { |
| | | Dt_OutboundOrder outboundOrder = BaseDal.QueryFirst(x => x.UpperOrderNo == upperOrderNo.ToString() && x.WarehouseId == Convert.ToInt32(saveModel.MainData[nameof(Dt_OutboundOrder.WarehouseId).FirstLetterToLower()])); |
| | | if (outboundOrder != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"{upperOrderNo}颿åå·å·²åå¨"); |
| | | } |
| | | } |
| | | saveModel.DetailData[0].Add("orderDetailStatus", OrderDetailStatusEnum.New.ObjToInt()); |
| | | return base.AddData(saveModel); |
| | | } |
| | | public WebResponseContent ReceiveOutOrder(ErpOutOrderDTO model) |
| | | { |
| | | try |
| | |
| | | MaterielName = materielInfo.MaterielName, |
| | | OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(), |
| | | OrderQuantity = model.Qty, |
| | | Unit=materielInfo.MaterielUnit |
| | | }; |
| | | Dt_OutboundOrder outboundOrder = new Dt_OutboundOrder() |
| | | { |
| | |
| | | ERPIssueModel issueModel = new ERPIssueModel(); |
| | | List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); |
| | | List<Dt_OutStockLockInfo> _OutStockLockInfos=new List<Dt_OutStockLockInfo>(); |
| | | int overCount = outboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count(); |
| | | if (outboundOrder.Details.Count == overCount) |
| | | { |
| | | outboundOrder.OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | _outboundOrderRepository.UpdateData(outboundOrder); |
| | | } |
| | | if (outboundOrder==null) |
| | | { |
| | | return WebResponseContent.Instance.Error("åºåºåä¸åå¨"); |
| | | } |
| | | if (outboundOrder.CreateType == OrderCreateTypeEnum.CreateInSystem.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | //æµè¯æ¶åºç»ERP䏿¥åºåºå®æ |
| | | if (outStockLockInfos.Count<=0 || outStockLockInfos==null) |
| | | if (warehouse.WarehouseCode==WarehouseEnum.HA64.ToString()) |
| | | { |
| | | stockInfos = TestOutStocksUpdate(warehouse).Data as List<Dt_StockInfo> ?? new List<Dt_StockInfo>(); |
| | | List<ERPPickItemModel> eRPOutPick =new List<ERPPickItemModel>(); |
| | |
| | | { |
| | | Lotno = item.BatchNo, |
| | | Qty = item.AssignQuantity.ObjToInt().ToString(), |
| | | Location = item.LocationCode |
| | | Location = warehouse.WarehouseCode |
| | | }; |
| | | //è·ååºåºåæç» |
| | | Dt_OutboundOrderDetail outboundOrderDetail = outboundOrder.Details.FirstOrDefault(x => x.Id == item.OrderDetailId); |
| | |
| | | Qty = pickItemModel.Qty, |
| | | Dataitem = new List<ERPPickItemModel> { pickItemModel } |
| | | }; |
| | | item.Status= OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | if (item.OrderQuantity==item.AssignQuantity) |
| | | { |
| | | item.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | eRPPickModels.Add(pickModel); |
| | | _OutStockLockInfos.Add(item); |
| | | } |