From b1c2dd1869a51b8f0e4acb9ddeb148f796db147f Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期三, 25 六月 2025 19:10:58 +0800 Subject: [PATCH] 1 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/Dt_WheelsStockService.cs | 62 +++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 3 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..6a3ac42 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> @@ -259,21 +264,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