| | |
| | | using Autofac.Core; |
| | | using NetTaste; |
| | | using AngleSharp.Io; |
| | | using WIDESEA_IRepository; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_IServices; |
| | | |
| | | namespace WIDESEA_StorageBasicService; |
| | | |
| | |
| | | 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> |
| | |
| | | |
| | | //è·å车å |
| | | 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; |
| | | } |
| | | } |
| | | } |