| | |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder; |
| | | private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository) |
| | | private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | InboundOrderDetailService = inboundOrderDetailService; |
| | |
| | | _locationInfoService = locationInfoService; |
| | | _takeStockOrder = takeStockOrder; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _allocateOrderRepository = allocateOrderRepository; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto) |
| | | public async Task<WebResponseContent> |
| | | GroupPallet(GroupPalletDto palletDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | return content.Error($"å½åååºä¸ä¸è´"); |
| | | } |
| | | |
| | | if(inboundOrder.BusinessType != "11"&& inboundOrder.Details.FirstOrDefault().WarehouseCode != palletDto.WarehouseType) |
| | | if(inboundOrder.BusinessType != "11") |
| | | { |
| | | return content.Error($"该æ¡ç æå±ä»åºä¸º{inboundOrder.Details.FirstOrDefault().WarehouseCode}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | var warehouseType = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().Where(x => (x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode)&& x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()).Select(x => x.WarehouseCode).First(); |
| | | |
| | | if (string.IsNullOrEmpty(warehouseType)) |
| | | { |
| | | return content.Error($"æªæ¥è¯¢å°æ¡ç [{palletDto.Barcode}]对åºçä»åºä¿¡æ¯ï¼ä¸å
许ç»ç"); |
| | | } |
| | | |
| | | if (!warehouseType.Equals(palletDto.WarehouseType)) |
| | | { |
| | | return content.Error($"该æ¡ç æå±ä»åºä¸º{warehouseType}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å
许ç»ç"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); |
| | | |
| | |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = Convert.ToInt32(palletDto.locationType) }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | //else |
| | | //{ |
| | | // var allowStatus = new[] |
| | | // { |
| | | // (int)StockStatusEmun.ç»çæå, |
| | | // (int)StockStatusEmun.æºä»å
¥æºä»ç»çæå, |
| | | // (int)StockStatusEmun.æå¨ç»çæå |
| | | // }; |
| | | |
| | | // if (!allowStatus.Contains(stockInfo.StockStatus)) |
| | | // { |
| | | // return content.Error($"该æç{stockInfo.PalletCode}ç¶æä¸å
许ç»ç"); |
| | | // } |
| | | //} |
| | | |
| | | if (inboundOrder.BusinessType != MESDocumentType.PurchaseInbound.ToString() && stockInfo != null && stockInfo.Details.Count > 0 && stockInfo.Details.FirstOrDefault()?.WarehouseCode != palletDto.WarehouseType) |
| | | { |
| | |
| | | if (inboundOrder.BusinessType == "11" && inboundOrder.IsTestMaterials == 1 && palletDto.WarehouseType != "1076" && palletDto.WarehouseType != "5057") |
| | | { |
| | | return content.Error($"è¯¥åæ®ä¸ºè¯äº§ç©æï¼éè¦å
¥åºå°è¯äº§ä»ï¼è¯·éæ°æ ¹æ®ååºéæ©è¯äº§ä»åºè¿è¡ç»çå
¥åº"); |
| | | } |
| | | if (inboundOrder.IsTestMaterials == 0 && (palletDto.WarehouseType == "1076" || palletDto.WarehouseType == "5057")) |
| | | { |
| | | return content.Error($"è¯¥åæ®ä¸ºéè¯äº§ç©æï¼ä¸è½å
¥å°è¯äº§ä»ï¼è¯·éæ°æ ¹æ®ä»åºè¿è¡ç»çå
¥åº"); |
| | | } |
| | | if (!_locationInfoService.QueryLocationCount(Convert.ToInt32(palletDto.locationType))) |
| | | { |
| | |
| | | { |
| | | return content.Error($"æªæ¾å°è¯¥æ¡ç {palletDto.Barcode}éè°å
¥æºä»çä¿¡æ¯"); |
| | | } |
| | | |
| | | if(allocateMaterialInfo.WarehouseCode != palletDto.WarehouseType) |
| | | { |
| | | return content.Error($"该æ¡ç è°å
¥ä»åºä¸º{allocateMaterialInfo.WarehouseCode},ä¸éæ©ç{palletDto.WarehouseType}ä»åºä¸ä¸è´"); |
| | | } |
| | | stockInfo.Details.Add(new Dt_StockInfoDetail |
| | | { |
| | | StockId = stockInfo == null ? 0 : stockInfo.Id, |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | Dt_InboundOrder inboundOrder = null; |
| | | var allocateOrder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.Id == id).First(); |
| | | if (allocateOrder != null) |
| | | { |
| | | inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == allocateOrder.OrderNo).First(); |
| | | if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | return content = WebResponseContent.Instance.OK($"è¯¥åæ®å±äºä¸åæ¹èªå¨åä¼ ï¼ä¸å¯æå¨åæ¹åä¼ "); |
| | | } |
| | | }else |
| | | { |
| | | inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | .Where(x => x.Id == id) |
| | | .First(); |
| | | if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | return content = WebResponseContent.Instance.OK($"è¯¥åæ®å±äºä¸åæ¹èªå¨åä¼ ï¼ä¸å¯æå¨åæ¹åä¼ "); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2); |
| | | foreach (var item in returnRecords) |
| | |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 3; |
| | | } |
| | | else |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 0; |
| | | } |
| | | } |
| | | else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0) |
| | | { |
| | |
| | | inboundOrder.ReturnToMESStatus = 2; |
| | | } |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | } |
| | | |
| | | var response = responseModel(inboundOrder, 3, null, allocatefeedmodel); |
| | |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id && inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 3 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | |
| | | _stockInfoRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail |
| | | { |
| | |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 4 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | return content.Error("åä¼ MES失败"); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1)) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 1; |
| | | } |
| | | else if(inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 3; |
| | | } |
| | | else |
| | | { |
| | | inboundOrder.ReturnToMESStatus = 0; |
| | | } |
| | | } |
| | | else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0) |
| | | { |
| | |
| | | inboundOrder.ReturnToMESStatus = 2; |
| | | } |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); |
| | | } |
| | | var response = responseModel(inboundOrder, 3, feedmodel); |
| | | |
| | |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if(inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if(inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 3}) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | |
| | | _stockInfoRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail |
| | | { |
| | |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºä¸.ObjToInt()) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 4 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 0 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | return content.Error("åä¼ MES失败"); |
| | | } |
| | | } |