xxyy
2025-02-12 975da83f1ef2098bf97d85c256e80632e157be6f
优化库存任务管理与出库任务处理

对库存任务管理、任务创建与出库处理进行了多方面的优化。包括字段格式与绑定修正、分页排序逻辑更新、库存信息查询性能优化、错误处理与日志增强、任务创建与出库任务处理方法新增及修复,提升了系统的灵活性与稳定性。
已修改7个文件
149 ■■■■■ 文件已修改
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -1,12 +1,9 @@
using AutoMapper;
using HslCommunication;
using Mapster;
using Microsoft.AspNetCore.Components.Routing;
using Newtonsoft.Json;
using Oracle.ManagedDataAccess.Types;
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
@@ -21,13 +18,9 @@
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_TaskInfo_HtyRepository;
using WIDESEAWCS_TaskInfoRepository;
namespace WIDESEAWCS_TaskInfoService
{
@@ -515,13 +508,11 @@
                        _taskHtyRepository.AddData(task_Hty);
                    }
                    if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
                    {
                        content = StackCraneTaskCompleted(task.TaskNum);
                        return content;
                    }
                }
                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                {
@@ -577,7 +568,6 @@
                            content = StackCraneTaskCompleted(task.TaskNum);
                            return content;
                        }
                        task.ModifyDate = DateTime.Now;
                        task.Modifier = "System";
@@ -893,6 +883,7 @@
            }
            return wcsBasez + address;
        }
        #region 重写方法
        public override WebResponseContent DeleteData(object[] key)
@@ -907,6 +898,6 @@
            return base.DeleteData(key);
        }
        
        #endregion
        #endregion 重写方法
    }
}
Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx
@@ -127,8 +127,8 @@
        //修改颜色
        if (column.field == 'roadwayNo') {
          column.formatter = (row) => {
            console.log("🚀 ~ this.columns.forEach ~ row:", row)
            return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>'
            // return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>'
            return  row?.locationInfo?.roadwayNo
          }
        }
        //格式化日期
Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue
@@ -42,12 +42,14 @@
        const searchFormOptions = ref([
            [
                { "title": "托盘条码", "field": "palletCode", type: "text" },
                { "title": "生产产线", "field": "productionLine", type: "text" },
                { "title": "生产产线", "field": "productionLine", type: "select", dataKey: "ProductionLine", data: [] },
                { "title": "库区", "field": "areaCode", type: "select", dataKey: "AreaType", data: [] },
                { "title": "库存类型", "field": "isFull", type: "select", dataKey: "isFull", data: [] },
            ],[
                { "title": "库位号", "field": "locationCode", type: "text" },
                // { "title": "巷道", "field": "roadwayNo", type: "text" },
                { "title": "巷道", "field": "roadwayNo", type: "text" },
                { "title": "货位状态", "field": "locationStatus", type: "select", dataKey: "LocationState", data: [] },
                { "title": "出库时间", "field": "outboundTime", type: "datetime"},
            ]
        ]);
        const columns = ref(
@@ -60,7 +62,7 @@
            { field: 'locationStatus', title: '货位状态', type: 'int', width: 60, align: 'left', bind: { key: "LocationState", data: [] } },
            { field: 'specialParameterDuration', title: '工艺时长', type: 'string', width: 60, align: 'left', sort: true },
            { field: 'outboundTime', title: '应出库时间', type: 'string', width: 110, align: 'left', sort: true  },
            { field: 'productionLine', title: '生产产线', type: 'string', width: 60, align: 'left',  },
            { field: 'productionLine', title: '生产产线', type: 'string', width: 60, align: 'left', bind: { key: "ProductionLine", data: [] }  },
            { field: 'areaCode', title: '库区', type: 'string', width: 60, align: 'left', bind: { key: "AreaType", data: [] } },
            { field: 'remark', title: '电芯数量', type: 'string', width: 60, align: 'left',  },
            { field: 'creater', title: '创建人', type: 'string', sort: true, width: 110, align: 'left', hidden: true },
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs
@@ -31,7 +31,7 @@
        public ISqlSugarClient Db => BaseDal.Db;
        private PropertyInfo[] _propertyInfo { get; set; } = null;
        private PropertyInfo[] TProperties
        public PropertyInfo[] TProperties
        {
            get
            {
@@ -172,7 +172,7 @@
        /// <param name="pageData"></param>
        /// <param name="propertyInfo"></param>
        /// <returns></returns>
        private Dictionary<string, OrderByType> GetPageDataSort(PageDataOptions pageData, PropertyInfo[] propertyInfo)
        public Dictionary<string, OrderByType> GetPageDataSort(PageDataOptions pageData, PropertyInfo[] propertyInfo)
        {
            if (!string.IsNullOrEmpty(pageData.Sort))
            {
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs
@@ -1,7 +1,11 @@

using AngleSharp.Dom;
using Mapster;
using WIDESEA_Core.HttpContextUser;
using WIDESEA_Core.Seed;
using Masuit.Tools;
using SqlSugar;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq.Expressions;
using WIDESEA_Core;
namespace WIDESEA_StorageBasicService;
@@ -18,15 +22,59 @@
    /// <returns></returns>
    public override PageGridData<DtStockInfo> GetPageData(PageDataOptions options)
    {
        var data = base.GetPageData(options);
        foreach (var item in data.Rows)
        string wheres = ValidatePageOptions(options);
        //获取排序字段
        Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
        List<OrderByModel> orderByModels = new List<OrderByModel>();
        foreach (var item in orderbyDic)
        {
            if (item.IsFull)
                item.Remark = item.StockInfoDetails.Count().ToString();
            else
                item.Remark = "0";
            OrderByModel orderByModel = new()
            {
                FieldName = item.Key,
                OrderByType = item.Value
            };
            orderByModels.Add(orderByModel);
        }
        return data;
        int totalCount = 0;
        List<SearchParameters> searchParametersList = new List<SearchParameters>();
        if (!string.IsNullOrEmpty(options.Wheres))
        {
            try
            {
                searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
                options.Filter = searchParametersList;
            }
            catch { }
        }
        Expression<Func<DtStockInfo, bool>> locationStatus = null;
        Expression<Func<DtStockInfo, bool>> roadwayNo = null;
        foreach (var item in searchParametersList)
        {
            if (item.Name.Contains("locationStatus"))
            {
                locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value);
            }
            else if (item.Name.Contains("roadwayNo"))
            {
                roadwayNo = x => x.LocationInfo.RoadwayNo.Contains(item.Value);
            }
        }
        var data = BaseDal.Db.Queryable<DtStockInfo>().IncludesAllFirstLayer().WhereIF(!wheres.IsNullOrEmpty(), wheres).WhereIF(locationStatus != null, locationStatus).WhereIF(roadwayNo != null, roadwayNo).OrderBy(orderByModels).ToPageList(options.Page, options.Rows, ref totalCount);
        new PageGridData<DtStockInfo>(totalCount, data);
        return new PageGridData<DtStockInfo>(totalCount, data);
        //var data = base.GetPageData(options);
        //foreach (var item in data.Rows)
        //{
        //    if (item.IsFull)
        //        item.Remark = item.StockInfoDetails.Count().ToString();
        //    else
        //        item.Remark = "0";
        //}
        //return data;
    }
    /// <summary>
@@ -38,7 +86,6 @@
    {
        try
        {
            List<DtStockInfo_Hty> stockInfos = new List<DtStockInfo_Hty>();
            List<DtLocationInfo> locationInfos = new List<DtLocationInfo>();
            foreach (var item in keys)
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -1,18 +1,10 @@
using Castle.Components.DictionaryAdapter.Xml;
using log4net.Core;
using Masuit.Tools;
using System.CodeDom;
using System.Threading.Tasks;
using WIDESEA_Common;
using Masuit.Tools;
using WIDESEA_Common.CustomModels;
//using WIDESEA_Common.CustomModels;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.Const;
using WIDESEA_DTO.MOM;
using WIDESEA_DTO.WMS;
using WIDESEA_StorageTaskRepository;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
@@ -123,7 +115,6 @@
        {
            throw new Exception(ex.Message);
        }
    }
    /// <summary>
@@ -407,7 +398,7 @@
            ////// 调用GetProcessResponseAsync方法,获取工艺响应
            ////var processResponse = await GetProcessResponseAsync(process, input.Position);
            var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
            #endregion
            #endregion 入库任务
        }
        var task = new Dt_Task
@@ -439,11 +430,12 @@
        return task;
    }
    #endregion 入库任务
    #endregion 请求任务入库
    #region 库位分配
    #region 获取货位
    /// <summary>
    ///
    /// </summary>
@@ -477,9 +469,11 @@
            return null;
        }
    }
    #endregion 获取货位
    #region 异常口入库获取库位
    private async Task<DtLocationInfo> RequestLocationByAbnormal(RequestTaskDto requestTask, bool isCheckRequest = false)
    {
        try
@@ -507,7 +501,8 @@
            return null;
        }
    }
    #endregion
    #endregion 异常口入库获取库位
    #endregion 库位分配
@@ -530,6 +525,7 @@
    #endregion 请求任务入库
    #region 创建空框出库任务
    public async Task<Dt_Task> CreateEmptyOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager)
    {
        try
@@ -571,6 +567,7 @@
            throw new Exception(ex.Message);
        }
    }
    #endregion
    #region 直接出库任务完成
@@ -594,9 +591,11 @@
            return content.Error(ex.Message);
        }
    }
    #endregion
    #region 异常口任务检测
    /// <summary>
    /// 异常排出口入库校验  所有异常交给WCS做原地址NG处理 
    /// </summary>
@@ -735,9 +734,11 @@
            throw new Exception(ex.Message);
        }
    }
    #endregion
    #region 移库任务事务
    private async Task<bool> ExecuteTransaction(DtStockInfo stock, Dt_Task_Hty taskHty, DtLocationInfo fromLocation, DtLocationInfo toLocation, int taskId)
    {
        _unitOfWorkManage.BeginTran();
@@ -780,6 +781,7 @@
    #endregion MyRegion
    #region 检测高温库是否有可出库库存
    public WebResponseContent StockCheckingAsync()
    {
        WebResponseContent webResponseContent = new WebResponseContent();
@@ -864,6 +866,7 @@
    #endregion 检测高温库是否有可出库库存
    #region 常温补空托盘至分容
    public async Task<WebResponseContent> GetFROutTrayToCW(RequestTaskDto taskDTO)
    {
        WebResponseContent content = new WebResponseContent();
@@ -927,7 +930,6 @@
        ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta);
        var stackers = station.Roadway.Split(',').ToList();
        var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>()
            .Where(x => x.DeviceStatus == "1")
            .Where(x => stackers.Contains(x.DeviceCode))
@@ -953,6 +955,13 @@
    #endregion
    #region  常温3出库至包装
    /// <summary>
    /// 常温3出库至包装
    /// </summary>
    /// <param name="json"></param>
    /// <returns></returns>
    public async Task<WebResponseContent> RequestOutTaskToBZAsync(RequestTaskDto json)
    {
        WebResponseContent content = new WebResponseContent();
@@ -1014,9 +1023,10 @@
        }
    }
    #endregion
    #region 火警出库
    public WebResponseContent EmergencyTask(object obj)
    {
        WebResponseContent content = new WebResponseContent();
@@ -1062,7 +1072,6 @@
            {
                throw new Exception("已添加火警出库任务");
            }
            int taskNum = BaseDal.GetTaskNo().Result;
            Dt_Task task = new Dt_Task
@@ -1126,7 +1135,6 @@
            LogFactory.GetLog("DTS火警出库").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("DTS火警出库").Info(true, obj.ToJsonString());
            return content.OK();
        }
        catch (Exception ex)
        {
@@ -1135,5 +1143,6 @@
            return content.Error(ex.Message);
        }
    }
    #endregion
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs
@@ -1,4 +1,5 @@
using Masuit.Tools;
using SqlSugar;
using WIDESEA_Core.Const;
using WIDESEA_DTO.MOM;
using WIDESEA_DTO.WMS;
@@ -70,8 +71,11 @@
        }
        // TODO 判断在途数量
        var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count;
        if (count <= 10)
        var needBarcode  = await SqlSugarHelper.DbWCS.Queryable<dt_needBarcode>().FirstAsync(x => x.productLine == input.ProductionLine);
        var needCount = needBarcode.inLineNum;
        //var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count;
        if (needCount < 2)
        {
            // 送至包装
            List<string> strings = stationManagers.Where(x => x.stationType == 0).Select(x => x.Roadway).ToList();