From 092971a8ba7848f024427694c642959d0fbc8599 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期四, 08 五月 2025 15:56:09 +0800 Subject: [PATCH] 1 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs" index eb0d255..e15310b 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs" @@ -87,7 +87,7 @@ if (!content.Status) throw new Exception(content.Message); } - + BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); Db.Ado.CommitTran(); content = WebResponseContent.Instance.OK(); @@ -111,13 +111,13 @@ { 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($"瀛樺湪宸茬粍鐩樺伐鍗曪紝宸插厛瑙g洏"); - } + //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($"瀛樺湪宸茬粍鐩樺伐鍗曪紝宸插厛瑙g洏"); + //} content = base.UpdateData(saveModel); } catch (Exception ex) @@ -132,19 +132,19 @@ 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) { @@ -177,7 +177,7 @@ 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); } -- Gitblit v1.9.3