From a9a3f943efb083de8ed88b293897886b3ef612a2 Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期一, 11 八月 2025 17:37:09 +0800 Subject: [PATCH] 功能增添优化 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 75 ++++++++++++++++++++++++++++++++----- 1 files changed, 65 insertions(+), 10 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" index 8eaeef9..2721213 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" @@ -4,6 +4,7 @@ using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; +using Org.BouncyCastle.Asn1.Ocsp; using SqlSugar; using System; using System.Collections; @@ -76,6 +77,42 @@ _invokeERPService = invokeERPService; _warehouseService = warehouseService; _palletTypeInfoRepository = palletTypeInfoRepository; + } + + public override PageGridData<Dt_InboundOrder> GetPageData(PageDataOptions options) + { + PageGridData<Dt_InboundOrder> pageGridData = base.GetPageData(options); + + ISugarQueryable<Dt_InboundOrder> sugarQueryable1 = BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details); + if (!string.IsNullOrEmpty(options.Wheres)) + { + + List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); + int totalCount = 0; + if (searchParametersList.Count > 0) + { + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_InboundOrderDetail.MaterielCode).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable1 = sugarQueryable1.Where(x => x.Details.Any(v => v.MaterielCode.Contains(searchParameters.Value))); + List<Dt_InboundOrder> dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount); + return new PageGridData<Dt_InboundOrder>(totalCount, dataList); + } + } + + { + SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_InboundOrderDetail.BatchNo).FirstLetterToLower()); + if (searchParameters != null) + { + sugarQueryable1 = sugarQueryable1.Where(x => x.Details.Any(v => v.BatchNo.Contains(searchParameters.Value))); + List<Dt_InboundOrder> dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount); + return new PageGridData<Dt_InboundOrder>(totalCount, dataList); + } + } + } + } + return pageGridData; } public override object GetDetailPage(PageDataOptions pageData) { @@ -864,11 +901,17 @@ stockInfoDetails.Add(stockInfoDetail); - notGroupDetail.ReceiptQuantity += model.Quantity; - if (notGroupDetail.ReceiptQuantity>notGroupDetail.OrderQuantity) + decimal decimalReceiptQuantity = Convert.ToDecimal(notGroupDetail.ReceiptQuantity); + decimal decimalModelQuantity = Convert.ToDecimal(model.Quantity); + decimal decimalOrderQuantity = Convert.ToDecimal(notGroupDetail.OrderQuantity); + decimalReceiptQuantity += decimalModelQuantity; + // 妫�鏌ユ槸鍚﹁秴鍑鸿鍗曟暟閲� + if (decimalReceiptQuantity > decimalOrderQuantity) { - return WebResponseContent.Instance.Error($"缁勭洏鏁伴噺婧㈠嚭{notGroupDetail.ReceiptQuantity - notGroupDetail.OrderQuantity}"); + return WebResponseContent.Instance.Error($"缁勭洏鏁伴噺婧㈠嚭{decimalReceiptQuantity - decimalOrderQuantity}"); } + // 杞洖float绫诲瀷瀛樺偍锛屼絾姣旇緝鍜岃绠楅兘浣跨敤decimal瀹屾垚 + notGroupDetail.ReceiptQuantity = Convert.ToSingle(decimalReceiptQuantity); if (notGroupDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) { notGroupDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); @@ -906,7 +949,15 @@ WebResponseContent content = new WebResponseContent(); try { - string SerNum = materielBoxCode.Substring(0, materielBoxCode.LastIndexOf("SC:")-1); + string SerNum = ""; + if (materielBoxCode.LastIndexOf("SC:")<0) + { + SerNum = materielBoxCode; + } + else + { + SerNum = materielBoxCode.Substring(0, materielBoxCode.LastIndexOf("SC:") - 1); + } MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, SerNum); //楠岃瘉鍒ゆ柇鏃堕棿鏍煎紡 WebResponseContent IsValidContent = IsValidMCDates(new List<MatSerNumAnalysisModel>() { model }); @@ -914,7 +965,11 @@ { return content.Error(IsValidContent.Message); } - string result = materielBoxCode.Substring(materielBoxCode.LastIndexOf("SC:") + 3); + string result = ""; + if (materielBoxCode.LastIndexOf("SC:") > 0) + { + result = materielBoxCode.Substring(materielBoxCode.LastIndexOf("SC:") + 3); + } //鑾峰彇鍏ュ簱鍗曟槑缁� Dt_InboundOrderDetail inboundOrderDetail = _inboundRepository.InboundOrderDetailRepository.QueryFirst(x=>x.BatchNo== model.LotNo && x.MaterielCode== model.MaterielCode); if (inboundOrderDetail == null) @@ -962,8 +1017,8 @@ PalletCode = model.LotNo, StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), WarehouseId = inboundOrder.WarehouseId, - PalletType = GetPalletTypeGMOrPP(warehouse, result.Split("*")[0]), - StockLength = result.Split("*")[0].ObjToInt(), + PalletType = GetPalletTypeGMOrPP(warehouse, result.IsNullOrEmpty() ? "" : result.Split("*")[0]), + StockLength = result.IsNullOrEmpty() ? 0 : result.Split("*")[0].ObjToInt(), Details = new List<Dt_StockInfoDetail>() }; } @@ -1052,8 +1107,8 @@ PalletCode = model.LotNo, StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), WarehouseId = warehouse.WarehouseId, - PalletType = GetPalletTypeGMOrPP(warehouse, request.Split("*")[0]), - StockLength = request.Split("*")[0].ObjToInt(), + PalletType = GetPalletTypeGMOrPP(warehouse, request.IsNullOrEmpty() ?"":request.Split("*")[0]), + StockLength = request.IsNullOrEmpty()?0:request.Split("*")[0].ObjToInt(), Details = new List<Dt_StockInfoDetail>() }; } @@ -1098,7 +1153,7 @@ if (warehouse.WarehouseCode == WarehouseEnum.HA152.ToString()) { - if (boxWidth.ObjToInt() <= 690 && boxWidth.ObjToInt()>=515) + if (boxWidth.ObjToInt() <= 690 && boxWidth.ObjToInt()>=520) { return 15; } -- Gitblit v1.9.3