1
huanghongfeng
11 小时以前 b1c2dd1869a51b8f0e4acb9ddeb148f796db147f
ÏîÄ¿´úÂë/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;
        }
    }
}