| | |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | |
| | | private readonly IRepository<Dt_LocationInfo> _locationInfoRepository; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; |
| | | private readonly IRepository<Dt_OutboundOrder> _outboundOrderRepository; |
| | | public IRepository<Dt_InboundOrder> Repository => BaseDal; |
| | | |
| | | public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService, IBasicService basicService, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository) : base(BaseDal) |
| | | public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService, IBasicService basicService, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_OutboundOrder> outboundOrderRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _basicService = basicService; |
| | | _locationInfoRepository = locationInfoRepository; |
| | | _allocateOrderRepository = allocateOrderRepository; |
| | | _outboundOrderRepository = outboundOrderRepository; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType) |
| | |
| | | { |
| | | // è¯å«ä¸ºæçå· |
| | | palletCode = code; |
| | | var task =_taskRepository.Db.Queryable<Dt_Task>().Where(t => t.PalletCode == palletCode).ToList(); |
| | | if(task!=null && task.Any()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æçå· {palletCode} å卿ªå®æçä»»å¡ï¼æ æ³æ¤é"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | sugarQueryable1 = sugarQueryable1.Where(x => x.OrderType.Equals(searchParameters.Value.ToString())); |
| | | } |
| | | |
| | | var detailMaterielCode = searchParametersList.FirstOrDefault(x => x.Name == "materielCode"); |
| | | if(detailMaterielCode!=null && !string.IsNullOrEmpty(detailMaterielCode.Value?.ToString())) |
| | | { |
| | | string materielCode = detailMaterielCode.Value.ToString().Trim(); |
| | | sugarQueryable1 = sugarQueryable1.Where(x => x.Details.Any(d => d.MaterielCode.Contains(materielCode))); |
| | | |
| | | } |
| | | |
| | | //var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount); |
| | | //return new PageGridData<Dt_InboundOrder>(totalCount, dataList); |
| | | } |
| | |
| | | foreach (var orderNo in orderNos) |
| | | { |
| | | var inbound = _inboundOrderRepository.QueryFirst(x => x.InboundOrderNo == orderNo); |
| | | if(inbound == null) |
| | | var outbound = _outboundOrderRepository.QueryFirst(x=>x.OrderNo == orderNo); |
| | | |
| | | if (inbound != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è¯¥åæ®ä¸åå¨ï¼æ æ³è¿è¡å
³é"); |
| | | if (inbound.OrderStatus != (int)InOrderStatusEnum.æªå¼å§ && inbound.OrderStatus != (int)InOrderStatusEnum.å
¥åºä¸) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è¯¥åæ®ç¶æä¸å¯ä»¥å
³é"); |
| | | } |
| | | inbound.OrderStatus = (int)InOrderStatusEnum.æå¨å
³é; |
| | | inbound.Operator = App.User.UserName; |
| | | _inboundOrderRepository.UpdateData(inbound); |
| | | |
| | | var inboundItems = _inboundOrderDetailRepository.QueryData(x => x.OrderId == inbound.Id); |
| | | if(inboundItems.FirstOrDefault().OrderDetailStatus == (int)OrderDetailStatusEnum.New) |
| | | { |
| | | foreach (var item in inboundItems) |
| | | { |
| | | item.OrderDetailStatus = (int)InOrderStatusEnum.æå¨å
³é; |
| | | item.Modifier = App.User.UserName; |
| | | BaseDal.Db.Updateable<Dt_InboundOrderDetail>(item).ExecuteCommand(); |
| | | } |
| | | } |
| | | } |
| | | if (inbound.OrderStatus != (int)InOrderStatusEnum.æªå¼å§ && inbound.OrderStatus != (int)InOrderStatusEnum.å
¥åºä¸) |
| | | else if (outbound != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è¯¥åæ®ç¶æä¸å¯ä»¥å
³é"); |
| | | if(outbound.OrderStatus !=(int)OutOrderStatusEnum.æªå¼å§ && outbound.OrderStatus != (int)OutOrderStatusEnum.åºåºä¸) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è¯¥åæ®ç¶æä¸å¯ä»¥å
³é"); |
| | | } |
| | | outbound.OrderStatus = (int)OutOrderStatusEnum.å
³é; |
| | | outbound.Operator = App.User.UserName; |
| | | _outboundOrderRepository.UpdateData(outbound); |
| | | |
| | | var outboundItems = BaseDal.Db.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == outbound.Id).ToList(); |
| | | if(outboundItems.FirstOrDefault().OrderDetailStatus == (int)OrderDetailStatusEnum.New) |
| | | foreach(var item in outboundItems) |
| | | { |
| | | item.OrderDetailStatus = (int)OutOrderStatusEnum.å
³é; |
| | | item.Modifier = App.User.UserName; |
| | | BaseDal.Db.Updateable<Dt_OutboundOrderDetail>(item).ExecuteCommand(); |
| | | } |
| | | } |
| | | inbound.OrderStatus = (int)InOrderStatusEnum.æå¨å
³é; |
| | | _inboundOrderRepository.UpdateData(inbound); |
| | | |
| | | } |
| | | return WebResponseContent.Instance.OK($"åæ®å
³éæå"); |
| | | } |