From 18d2f40bbf40469b033de6f07ca8a8e3bc191132 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期六, 26 四月 2025 19:21:40 +0800 Subject: [PATCH] 优化代码 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs | 61 ++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 1 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" index 666b495..de9c018 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" @@ -1,9 +1,14 @@ -锘縰sing System; +锘�//using SqlSugar.Extensions; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_Core.BaseServices; +using WIDESEA_Core.Enums; +using WIDESEA_Core.Helper; +using WIDESEA_DTO.Stock; using WIDESEA_IStockRepository; using WIDESEA_IStockService; using WIDESEA_Model.Models; @@ -21,5 +26,59 @@ { return BaseDal.QueryFirst(x => SerialNumbers.Contains(x.SerialNumber)) != null; } + /// <summary> + /// 鏍规嵁鎵规鍙峰拰鍗曟嵁鍙疯幏鍙栧簱瀛樻槑缁嗕俊鎭� + /// </summary> + /// <param name="OrderNo">璁㈠崟鍙�</param> + /// <param name="BatchNo">鎵规鍙�</param> + /// <returns></returns> + public Dt_StockInfoDetail? Get_StockInfoDetail(string OrderNo, string BatchNo = null) + { + Dt_StockInfoDetail? stockInfoDetail = null; + if (BatchNo != null) + { + stockInfoDetail = BaseDal.QueryData(x => x.OrderNo == OrderNo && x.BatchNo.Contains(BatchNo) && (x.Status == StockStatusEmun.鍏ュ簱涓�.ObjToInt() || x.Status == StockStatusEmun.宸插叆搴�.ObjToInt())).OrderByDescending(x => x.ModifyDate).FirstOrDefault(); + } + else + { + stockInfoDetail = BaseDal.QueryData(x => x.OrderNo == OrderNo && (x.Status == StockStatusEmun.鍏ュ簱涓�.ObjToInt() || x.Status == StockStatusEmun.宸插叆搴�.ObjToInt())).OrderByDescending(x => x.ModifyDate).FirstOrDefault(); + } + return stockInfoDetail; + } + /// <summary> + /// 鑾峰彇鎸囧畾搴撳瓨 + /// </summary> + /// <param name="stockSelectViews"></param> + /// <returns></returns> + public List<Dt_StockInfoDetail> GetStockInfosByBatchNoCodes(List<StockSelectViewDTO> stockSelectViews) + { + List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); + foreach (var item in stockSelectViews) + { + var stockSelectView = BaseDal.QueryData(x => x.BatchNo == item.BatchNo && x.MaterielCode == item.MaterielCode); + if (stockSelectView.Count > 0) stockInfoDetails.AddRange(stockSelectView); + } + return stockInfoDetails; + } + public List<Dt_StockInfoDetail> GetStockInfosByBatchNoCodes() + { + List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); + + return stockInfoDetails; + } + + public List<Dt_StockInfoDetail> Get_StockInfoDetails(string OrderNo, string BatchNo = null) + { + List<Dt_StockInfoDetail> stockInfoDetails = null; + if (BatchNo != null) + { + stockInfoDetails = BaseDal.QueryData(x => x.OrderNo == OrderNo && x.BatchNo == BatchNo && (x.Status == StockStatusEmun.鍏ュ簱涓�.ObjToInt() || x.Status == StockStatusEmun.宸插叆搴�.ObjToInt())); + } + else + { + stockInfoDetails = BaseDal.QueryData(x => x.OrderNo == OrderNo && (x.Status == StockStatusEmun.鍏ュ簱涓�.ObjToInt() || x.Status == StockStatusEmun.宸插叆搴�.ObjToInt())); + } + return stockInfoDetails; + } } } -- Gitblit v1.9.3