From a34059e688e947a2ea079a0646872f1a21089940 Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期一, 22 九月 2025 14:47:00 +0800 Subject: [PATCH] 1 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/Dt_WheelsStockService.cs | 76 +++++++++++++++++++++++++++++++++++-- 1 files changed, 71 insertions(+), 5 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/Dt_WheelsStockService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/Dt_WheelsStockService.cs" index e44767e..b8978e9 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/Dt_WheelsStockService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/Dt_WheelsStockService.cs" @@ -15,6 +15,9 @@ using Autofac.Core; using NetTaste; using AngleSharp.Io; +using WIDESEA_IRepository; +using WIDESEA_Core.Const; +using WIDESEA_IServices; namespace WIDESEA_StorageBasicService; @@ -23,11 +26,13 @@ private readonly IDt_WheelsStock_htyRepository _WheelsStock_HtyRepository; private readonly IDt_SelectionStandardsRepository _SelectionStandardsRepository; private readonly IToZYService _toZYService; - public Dt_WheelsStockService(IDt_WheelsStockRepository BaseDal, IDt_WheelsStock_htyRepository WheelsStock_HtyRepository, IDt_SelectionStandardsRepository selectionStandardsRepository, IToZYService toZYService) : base(BaseDal) + private readonly ISys_ConfigService _sys_ConfigService; + public Dt_WheelsStockService(IDt_WheelsStockRepository BaseDal, IDt_WheelsStock_htyRepository WheelsStock_HtyRepository, IDt_SelectionStandardsRepository selectionStandardsRepository, IToZYService toZYService, ISys_ConfigService ISys_ConfigService) : base(BaseDal) { _SelectionStandardsRepository = selectionStandardsRepository; _WheelsStock_HtyRepository = WheelsStock_HtyRepository; _toZYService = toZYService; + _sys_ConfigService = ISys_ConfigService; } /// <summary> @@ -64,12 +69,13 @@ } } - public Dt_WheelsStock GetSelectionWheelsStock(List<Dt_WheelsStock> WheelsList, Dt_SelectionStandards selectionStandards, Dt_CZInfo_mes CZInfo_Mes, string wheelsPosition, string newOrOld) + public Dt_WheelsStock GetSelectionWheelsStock(List<Dt_WheelsStock> WheelsList, Dt_SelectionStandards selectionStandards, Dt_CZInfo_mes CZInfo_Mes, string wheelsPosition, string newOrOld,int xuanpeicount) { //杩囩泩閲忎笂闄� decimal selectionUpperValue = selectionStandards.upperValue; //杩囩泩閲忎笅闄� decimal selectionLowerValue = selectionStandards.lowerValue; + string level = string.Empty; if ("left".Equals(wheelsPosition)) //鍖归厤宸﹁疆搴ц疆瀛� @@ -125,7 +131,16 @@ ).ToList(); } } - return WheelsList.OrderBy(x => x.CreateDate).FirstOrDefault(); + + if (newOrOld == "1" && xuanpeicount==2) + { + return WheelsList.OrderBy(x => decimal.Parse(x.Wheels_ygljz)).FirstOrDefault(); + } + else + { + return WheelsList.OrderBy(x => x.CreateDate).FirstOrDefault(); + + } } @@ -259,21 +274,72 @@ //鑾峰彇杞﹀瀷 List<string> Wheels_CarTypeList = stockInfos.Select(x => x.Wheels_CarType).Distinct().ToList(); + List<WheelGroupInfo> groupedData = new List<WheelGroupInfo>(); foreach (var CarType in Wheels_CarTypeList) { - content.Data = stockInfos.Where(x => x.Wheels_CarType == CarType).GroupBy(w => w.Wheels_ldxh) - .Select(typeGroup => new + var kd = stockInfos.Where(x => x.Wheels_CarType == CarType).GroupBy(w => w.Wheels_ldxh) + .Select(typeGroup => new WheelGroupInfo { Wheels_CarType = CarType, //杞﹀瀷 Wheels_ldxh = typeGroup.Key, Count = typeGroup.Count(), }).ToList(); + + groupedData.AddRange(kd); } + content.Data = groupedData; return content; } + public class WheelGroupInfo + { + public string Wheels_CarType { get; set; } + public string Wheels_ldxh { get; set; } + public int Count { get; set; } + + } + + public WebResponseContent UpdateInventoryStatue() + { + WebResponseContent content = new WebResponseContent(); + try + { + + List<Dt_WheelsStock> groupedData = new List<Dt_WheelsStock>(); + + var hourpara = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_Parameters, SysConfigConst.InventoryMarket); + int hour = hourpara.ConfigValue.ObjToInt(); //鑾峰彇璁剧疆鐨勯鏈熸椂闂� + + List<Dt_WheelsStock> WheelsList = BaseDal.QueryData(); //鑾峰彇鍏ㄩ儴杞﹁疆淇℃伅 + + foreach (var item in WheelsList) + { + TimeSpan timeDifference = DateTime.Today - item.CreateDate.Date; + item.Wheels_DateDet = (int)timeDifference.TotalDays; + + if (item.Wheels_DateDet >= hour) + { + item.Wheels_Statue = 1; + } + else + { + item.Wheels_Statue = 0; + } + groupedData.Add(item); + } + + BaseDal.UpdateData(groupedData); + + return content.OK(); + } + catch (Exception ex) + { + return content.Error(ex.Message); + throw; + } + } } \ No newline at end of file -- Gitblit v1.9.3