| | |
| | | |
| | | |
| | | Dt_StockInfo? stockInfo = _stockService.StockInfoService.GetStockByPalletCode(materielGroupDTO.PalletCode); |
| | | //if (stockInfo != null) throw new Exception($"æçå·ã{materielGroupDTO.PalletCode}ãå·²åå¨"); |
| | | |
| | | (bool, string, object?) result = CheckMaterielGroupParam(materielGroupDTO, matSerialNumberDTOs, materielInfos, materielCodes, inboundOrder, stockInfo); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | |
| | | List<Dt_StockInfoDetail> stockInfoDetails = _mapper.Map<List<Dt_StockInfoDetail>>(matSerialNumberDTOs); |
| | | stockInfoDetails.ForEach(x => |
| | | { |
| | | x.Status = 0; |
| | | //x.Status = 0; |
| | | x.Status = StockStatusEmun.ç»çæå.ObjToInt(); |
| | | x.OrderNo = inboundOrder.OrderNo; |
| | | x.MaterielName = materielInfos.FirstOrDefault(v => v.MaterielCode == x.MaterielCode)?.MaterielName ?? ""; |
| | | x.StockId = stockInfo.Id != 0 ? stockInfo.Id : 0; |
| | |
| | | for (int i = 0; i < materielCodes.Count; i++) |
| | | { |
| | | decimal stockQuantity = stockInfoDetails.Where(x => x.MaterielCode == materielCodes[i]).Sum(x => x.StockQuantity); |
| | | inboundOrderDetails.AddRange(_inboundOrderDetailService.UpdateReceiptQuantity(inboundOrder.Details.Where(x => x.MaterielCode == materielCodes[i]).ToList(), stockQuantity)); |
| | | List<Dt_InboundOrderDetail> orderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCodes[i]).ToList(); |
| | | if (orderDetails.Count > 0) |
| | | { |
| | | var OrderQuantity = orderDetails.Sum(x => x.OrderQuantity); |
| | | if (OrderQuantity < stockQuantity) throw new Exception("ç»çæ°éè¶
åºåæ®æ°é"); |
| | | inboundOrderDetails.AddRange(_inboundOrderDetailService.UpdateReceiptQuantity(orderDetails, stockQuantity)); |
| | | } |
| | | } |
| | | List<int> updateDetailIds = inboundOrderDetails.Select(x => x.Id).ToList(); |
| | | if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null && inboundOrder.Details.FirstOrDefault(x => !updateDetailIds.Contains(x.Id) && x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null) |
| | | { |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(inboundOrder, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | for (int i = 0; i < inboundOrderDetails.Count; i++) |
| | | { |
| | | _inboundOrderDetailService.Repository.DeleteAndMoveIntoHty(inboundOrderDetails[i], App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | } |
| | | } |
| | | else if (inboundOrder.OrderStatus == InboundStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | |
| | | return (true, "æå", materielGroupDTO); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PDAå页æ¥è¯¢æ°æ® |
| | | /// </summary> |
| | | /// <param name="pageNo">页ç </param> |
| | | /// <param name="orderNo">订åå·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent QueryOrderInfo(int pageNo, string orderNo) |
| | | { |
| | | if (string.IsNullOrEmpty(orderNo)) |