| | |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | } |
| | | |
| | | |
| | | BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | Db.Ado.CommitTran(); |
| | | content = WebResponseContent.Instance.OK(); |
| | |
| | | { |
| | | if (saveModel.DetailData == null || saveModel.DetailData.Count == 0) throw new Exception($"å
¥åºåæç»ä¸è½ä¸ºç©º"); |
| | | List<InboundOrderDetailAddDTO> inboundOrderDetail = saveModel.DetailData.DicToIEnumerable<InboundOrderDetailAddDTO>(); |
| | | if (inboundOrderDetail.FirstOrDefault(x => x.OrderDetailStatus > 0) != null) throw new Exception($"订åå·²å¼å§ç»çå
¥åº"); |
| | | var inboundOrderDetails = _inboundOrderDetailService.Db.Queryable<Dt_InboundOrderDetail>().Where(x => saveModel.DelKeys.Contains(x.Id)).ToList(); |
| | | if (inboundOrderDetails.Count > 0) |
| | | { |
| | | if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) != null) |
| | | throw new Exception($"åå¨å·²ç»çå·¥åï¼å·²å
è§£ç"); |
| | | } |
| | | //if (inboundOrderDetail.FirstOrDefault(x => x.OrderDetailStatus > 0) != null) throw new Exception($"订åå·²å¼å§ç»çå
¥åº"); |
| | | //var inboundOrderDetails = _inboundOrderDetailService.Db.Queryable<Dt_InboundOrderDetail>().Where(x => saveModel.DelKeys.Contains(x.Id)).ToList(); |
| | | //if (inboundOrderDetails.Count > 0) |
| | | //{ |
| | | // if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) != null) |
| | | // throw new Exception($"åå¨å·²ç»çå·¥åï¼å·²å
è§£ç"); |
| | | //} |
| | | content = base.UpdateData(saveModel); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var inboundOrders = BaseDal.QueryData(x => keys.Contains(x.Id)); |
| | | if (inboundOrders.FirstOrDefault(x => x.OrderStatus != InboundStatusEnum.æªå¼å§.ObjToInt()) != null) |
| | | throw new Exception($"å
¥åºååå¨ç»çå
¥åºä¿¡æ¯"); |
| | | foreach (var inboundOrder in inboundOrders) |
| | | //var inboundOrders = BaseDal.QueryData(x => keys.Contains(x.Id)); |
| | | var inboundOrders = BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).Where(x => keys.Contains(x.Id)).ToList(); |
| | | if (inboundOrders.Count < 1) throw new Exception("æªæ¾å°å
¥åºå"); |
| | | List<Dt_InboundOrderDetail> orderDetails = new List<Dt_InboundOrderDetail>(); |
| | | foreach (var item in inboundOrders) |
| | | { |
| | | var inboundOrderDetails = BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == inboundOrder.OrderNo).Details; |
| | | if (inboundOrderDetails != null || inboundOrderDetails.Count > 0) |
| | | { |
| | | if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) != null) |
| | | throw new Exception($"å
¥åºåã{inboundOrder.OrderNo}ãåå¨ç»çå
¥åºä¿¡æ¯"); |
| | | } |
| | | if (item.Details.Where(x => x.ReceiptQuantity != x.OverInQuantity).Any()) |
| | | throw new Exception("å卿ªå
¥åºå®ææç"); |
| | | orderDetails.AddRange(item.Details); |
| | | item.Details = null; |
| | | } |
| | | content = base.DeleteData(keys); |
| | | BaseDal.DeleteAndMoveIntoHty(inboundOrders, OperateType.人工å é¤); |
| | | content.Status = _inboundOrderDetailService.Repository.DeleteAndMoveIntoHty(orderDetails, OperateType.人工å é¤); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return (false, "æç©æä¿¡æ¯æªå½å
¥ï¼è¯·å½å
¥ç©æä¿¡æ¯", inboundOrderAddDTO); |
| | | } |
| | | |
| | | if (BaseDal.QueryFirst(x => x.UpperOrderNo == inboundOrderAddDTO.UpperOrderNo && !string.IsNullOrEmpty(x.UpperOrderNo)) != null) |
| | | if (BaseDal.QueryFirst(x => x.OrderNo == inboundOrderAddDTO.orderNo && !string.IsNullOrEmpty(x.OrderNo)) != null) |
| | | { |
| | | return (false, "忮已åå¨", inboundOrderAddDTO); |
| | | } |