| | |
| | | return BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == inboundOrderNo); ; |
| | | } |
| | | |
| | | public WebResponseContent MaterielGroup(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var palletCode = saveModel.MainData["palletCode"].ToString(); |
| | | if (string.IsNullOrEmpty(palletCode)) throw new Exception("æçå·ä¸å¯ä¸ºç©º"); |
| | | var orderNo = saveModel.MainData["orderNo"].ToString(); |
| | | if (string.IsNullOrEmpty(orderNo)) throw new Exception("åå·ä¸å¯ä¸ºç©º"); |
| | | var batchNo = saveModel.MainData["batchNo"].ToString(); |
| | | if (string.IsNullOrEmpty(batchNo)) throw new Exception("æ¹å·ä¸å¯ä¸ºç©º"); |
| | | //var StationCode = saveModel.MainData["address"].ToString(); |
| | | //if (string.IsNullOrEmpty(StationCode)) throw new Exception("å°åä¸å¯ä¸ºç©º"); |
| | | |
| | | //Dt_RoadwayInfo roadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.InStationCode == StationCode) ?? throw new Exception("æªæ¾å°è¯¥å
¥åºç«å°ï¼è¯·æ£æ¥åºç¡é
置信æ¯!"); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode); |
| | | if (stockInfo != null) throw new Exception($"æçã{palletCode}ãå·²åå¨åºåä¿¡æ¯"); |
| | | stockInfo = new Dt_StockInfo(); |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | Dt_InboundOrder? inboundOrder = GetInboundOrder(orderNo); |
| | | if (inboundOrder == null) throw new Exception($"æªæ¾å°åå·ä¸ºã{orderNo}ãçå
¥åºå"); |
| | | Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.Where(x => x.BatchNo == batchNo).FirstOrDefault(); |
| | | if (inboundOrderDetail == null) throw new Exception($"åå·ã{orderNo}ãçå
¥åºåæªæ¾å°æ¹å·ã{batchNo}ã"); |
| | | if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1) throw new Exception($"åå·ã{orderNo}ãçæ¹å·ã{batchNo}ãå¯ç»çæ°éä¸è¶³"); |
| | | |
| | | #region å¤çå
¥åºå |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | inboundOrderDetail.ReceiptQuantity++; |
| | | inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); |
| | | #endregion |
| | | |
| | | #region æ·»å åºå |
| | | if (stockInfo.Id == 0) |
| | | { |
| | | stockInfo.PalletCode = palletCode; |
| | | stockInfo.StockStatus = StockStatusEmun.ç»çæå.ObjToInt(); |
| | | stockInfo.Creater = "System"; |
| | | stockInfo.Remark = "人工ç»çå
¥åº"; |
| | | } |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | Status = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | OrderNo = inboundOrder.OrderNo, |
| | | StockId = stockInfo.Id != 0 ? stockInfo.Id : 0, |
| | | MaterielName = inboundOrderDetail.MaterielName, |
| | | MaterielCode = inboundOrderDetail.MaterielCode, |
| | | BatchNo = inboundOrderDetail.BatchNo, |
| | | StockQuantity = 1, |
| | | SerialNumber = "", |
| | | Creater = "System" |
| | | }; |
| | | stockInfo.Details.Add(stockInfoDetail); |
| | | #endregion |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.UpdateData(inboundOrder); |
| | | _inboundOrderDetailService.UpdateData(inboundOrderDetail); |
| | | _stockService.StockInfoService.AddMaterielGroup(stockInfo); |
| | | Db.Ado.CommitTran(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent QueryOrderDetailInfo(int pageNo, string orderNo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | Dt_InboundOrder inboundOrder = GetInboundOrder(orderNo); |
| | | List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details; |
| | | content.OK(data: inboundOrderDetails); |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// ç»ç |
| | | /// </summary> |