| | |
| | | { |
| | | if (businessType == BusinessTypeEnum.å¤é¨ä»åºè°æºä») |
| | | { |
| | | allocateOrder.OrderType = InOrderTypeEnum.Allocat.ObjToInt(); |
| | | allocateOrder.OrderType = InOrderTypeEnum.AllocatInbound.ObjToInt(); |
| | | var inboundOrders = ConvertToInboundOrders(allocateOrder); |
| | | await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1); |
| | | } |
| | |
| | | { |
| | | if (businessType == BusinessTypeEnum.æºä»è°å¤é¨ä»åº) |
| | | { |
| | | allocateOrder.OrderType = InOrderTypeEnum.Allocat.ObjToInt(); |
| | | allocateOrder.OrderType = InOrderTypeEnum.AllocatOutbound.ObjToInt(); |
| | | } |
| | | else if (businessType == BusinessTypeEnum.æºä»è°æºä») |
| | | { |
| | |
| | | |
| | | public List<Dt_InboundOrder> ConvertToInboundOrders(Dt_AllocateOrder allocateOrder) |
| | | { |
| | | var distinctDetails = allocateOrder.Details |
| | | .GroupBy(d => d.Barcode) |
| | | .Select(g => g.First()) |
| | | .ToList(); |
| | | |
| | | return new List<Dt_InboundOrder>() |
| | | { |
| | | new Dt_InboundOrder(){ |
| | |
| | | IsBatch=allocateOrder.IsBatch, |
| | | FactoryArea=allocateOrder.FactoryArea, |
| | | Remark=allocateOrder.Remark, |
| | | Details=allocateOrder.Details.Select(detail=>new Dt_InboundOrderDetail |
| | | Details=distinctDetails.Select(detail=>new Dt_InboundOrderDetail |
| | | { |
| | | OrderId= detail.OrderId, |
| | | OrderId= 0, |
| | | MaterielCode=detail.MaterielCode, |
| | | MaterielName="", |
| | | BatchNo=detail.BatchNo, |
| | |
| | | OrderDetailStatus=detail.OrderDetailStatus, |
| | | Unit=detail.Unit, |
| | | RowNo=0, |
| | | lineNo=detail.LineNo, |
| | | SupplyCode=detail.SupplyCode, |
| | | WarehouseCode=detail.WarehouseCode, |
| | | Barcode=detail.Barcode, |
| | |
| | | |
| | | public Dt_OutboundOrder ConvertToOutboundOrders(Dt_AllocateOrder allocateOrder) |
| | | { |
| | | |
| | | var distinctDetails = allocateOrder.Details |
| | | .GroupBy(d => string.IsNullOrEmpty(d.Barcode) |
| | | ? $"{d.MaterielCode}_{d.BatchNo}_{d.SupplyCode}_{d.WarehouseCode}" |
| | | : d.Barcode) |
| | | .Select(g => new |
| | | { |
| | | Detail = g.First(), |
| | | //æ±æ»åç»å
çæ°é |
| | | Qty = g.Sum(x => x.BarcodeQty ?? x.OrderQuantity) |
| | | }).ToList(); |
| | | |
| | | return new Dt_OutboundOrder() |
| | | { |
| | | WarehouseId = allocateOrder.WarehouseId, |
| | |
| | | Remark = allocateOrder.Remark, |
| | | DepartmentCode = "", |
| | | DepartmentName = "", |
| | | Details = allocateOrder.Details.Select(detail => new Dt_OutboundOrderDetail |
| | | Details = distinctDetails.Select(item => new Dt_OutboundOrderDetail |
| | | { |
| | | OrderId = detail.OrderId, |
| | | MaterielCode = detail.MaterielCode, |
| | | OrderId = 0, |
| | | MaterielCode = item.Detail.MaterielCode, |
| | | MaterielName = "", |
| | | BatchNo = detail.BatchNo, |
| | | OrderQuantity = detail.OrderQuantity, |
| | | BatchNo = item.Detail.BatchNo, |
| | | OrderQuantity = item.Detail.OrderQuantity, |
| | | BarcodeQty = (decimal)item.Detail.BarcodeQty, |
| | | BarcodeUnit = item.Detail.BarcodeUnit, |
| | | LockQuantity = 0, |
| | | lineNo = item.Detail.LineNo, |
| | | OverOutQuantity = 0, |
| | | OrderDetailStatus = detail.OrderDetailStatus, |
| | | Unit = detail.Unit, |
| | | OrderDetailStatus = item.Detail.OrderDetailStatus, |
| | | Unit = item.Detail.Unit, |
| | | RowNo = 0, |
| | | SupplyCode = detail.SupplyCode, |
| | | WarehouseCode = detail.WarehouseCode, |
| | | SupplyCode = item.Detail.SupplyCode, |
| | | WarehouseCode = item.Detail.WarehouseCode, |
| | | |
| | | }).ToList() |
| | | }; |