1
huangxiaoqiang
2025-06-03 d9e3eada0323b99e812d7fcd26c6f07e042079ec
CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1086,11 +1086,11 @@
                .ToList().Select(x => x.DeviceCode).ToList();
            var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
                .Where(x => x.ProductionLine == station.productLine)
                .WhereIF(!station.Roadway.Contains("JZSC"), x => x.ProductionLine == station.productLine)
                .Where(x => x.AreaCode == areaCode && x.IsFull == false)
                .Includes(x=>x.StockInfoDetails)
                .Includes(x => x.StockInfoDetails)
                .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "空托盘"))
                .Includes(x=>x.LocationInfo)
                .Includes(x => x.LocationInfo)
                .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
                .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 过滤条件
                .OrderBy(x => x.CreateDate) // 排序
@@ -1115,7 +1115,7 @@
    {
        return new Dt_Task
        {
            Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 2 : 1),
            Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC")|| stockInfo.LocationInfo.RoadwayNo.Contains("JZSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") || stockInfo.LocationInfo.RoadwayNo.Contains("JZSC") ? 2 : 1),
            Roadway = stockInfo.LocationInfo.RoadwayNo,
            TargetAddress = position,
            Dispatchertime = DateTime.Now,
@@ -1678,7 +1678,6 @@
    /// 获取任务信息
    /// </summary>
    /// <returns></returns>
    ///
    public WebResponseContent GetTaskInfo()
    {
        WebResponseContent content = new WebResponseContent();
@@ -1740,10 +1739,12 @@
    /// 获取货位状态
    /// </summary>
    /// <returns></returns>
    public WebResponseContent GetStockQuantity() {
    public WebResponseContent GetStockQuantity()
    {
        WebResponseContent content = new WebResponseContent();
        try {
            var location= _locationRepository.Db.Queryable<DtLocationInfo>().ToList();
        try
        {
            var location = _locationRepository.Db.Queryable<DtLocationInfo>().ToList();
            return content.OK(data: location);
@@ -1756,11 +1757,29 @@
    public WebResponseContent Getproductionvolume()
    {
        WebResponseContent content = new WebResponseContent();
        try {
        try
        {
            var now = DateTime.Now;
            var startOfDay = new DateTime(now.Year, now.Month, now.Day);
            var endOfDay1 = startOfDay.AddDays(-7);
            var taskHty= _task_HtyRepository.Db.Queryable<Dt_Task_Hty>().Where(it=>it.CreateDate> endOfDay1).ToList();
            var taskHty = _task_HtyRepository.Db.Queryable<Dt_Task_Hty>().Where(it => it.CreateDate > endOfDay1).ToList();
            return content.OK(data: taskHty);
        }
        catch (Exception ex)
        {
            return content.Error(ex.Message);
        }
    }
    public WebResponseContent Getoutput()
    {
        WebResponseContent content = new WebResponseContent();
        try
        {
            var now = DateTime.Now;
            var firstDayOfYear = new DateTime(now.Year, 1, 1);
            var taskHty = _task_HtyRepository.Db.Queryable<Dt_Task_Hty>().Where(it => it.CreateDate > firstDayOfYear&&it.TaskType==100).ToList();
            return content.OK(data: taskHty);
        }
        catch (Exception ex)
@@ -1771,15 +1790,15 @@
    }
    #endregion
        #endregion 外部接口方法
    #endregion 外部接口方法
        #region 内部调用方法
    #region 内部调用方法
        /// <summary>
        /// 创建一个新的任务
        /// </summary>
        /// <param name="model">任务模型</param>
        /// <returns>创建的任务</returns>
    /// <summary>
    /// 创建一个新的任务
    /// </summary>
    /// <param name="model">任务模型</param>
    /// <returns>创建的任务</returns>
    public async Task<Dt_Task> Create(Dt_Task model)
    {
        return await BaseDal.Create(model);