优化库存任务管理与出库任务处理
对库存任务管理、任务创建与出库处理进行了多方面的优化。包括字段格式与绑定修正、分页排序逻辑更新、库存信息查询性能优化、错误处理与日志增强、任务创建与出库任务处理方法新增及修复,提升了系统的灵活性与稳定性。
| | |
| | | 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; |
| | |
| | | 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 |
| | | { |
| | |
| | | _taskHtyRepository.AddData(task_Hty); |
| | | } |
| | | |
| | | |
| | | if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) |
| | | { |
| | | content = StackCraneTaskCompleted(task.TaskNum); |
| | | return content; |
| | | } |
| | | |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | |
| | | content = StackCraneTaskCompleted(task.TaskNum); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | |
| | | } |
| | | return wcsBasez + address; |
| | | } |
| | | |
| | | #region 重写方法 |
| | | |
| | | public override WebResponseContent DeleteData(object[] key) |
| | |
| | | } |
| | | return base.DeleteData(key); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion 重写方法 |
| | | } |
| | | } |
| | |
| | | //修改颜色 |
| | | 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 |
| | | } |
| | | } |
| | | //格式化日期 |
| | |
| | | [ |
| | | { "title": "托盘条码", "field": "palletCode", type: "text" }, |
| | | { "title": "生产产线", "field": "productionLine", type: "text" }, |
| | | { "title": "应出库时间", "field": "outboundTime", type: "datetime"}, |
| | | { "title": "应出库时间", "field": "outboundTime", type: "datetime" }, |
| | | // { "title": "组盘类型", "field": "groupType", type: "select", dataKey: "GroupType", data: [] }, |
| | | ] |
| | | ]); |
| | |
| | | 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( |
| | | [{ field: 'id', title: '库存ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' }, |
| | | { field: 'locationCode', title: '库位', type: 'string', width: 100, align: 'left', }, |
| | | { field: 'locationCode', title: '库位', type: 'string', width: 100, align: 'left', }, |
| | | { field: 'palletCode', title: '托盘条码', type: 'string', width: 110, align: 'left', }, |
| | | { field: 'isFull', title: '库存类型', type: 'bool', width: 80, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '空盘'},{ key: true, value: '实盘'}] }, }, |
| | | { field: 'linedProcessFeedbackTime', title: '工艺开始时间', type: 'string', width: 110, align: 'left',}, |
| | | { field: 'roadwayNo', title: '巷道', type: 'string', width: 60, align: 'left', sort: true }, |
| | | { field: 'isFull', title: '库存类型', type: 'bool', width: 80, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '空盘' }, { key: true, value: '实盘' }] }, }, |
| | | { field: 'linedProcessFeedbackTime', title: '工艺开始时间', type: 'string', width: 110, align: 'left', }, |
| | | { field: 'roadwayNo', title: '巷道', type: 'string', width: 60, align: 'left', sort: true }, |
| | | { 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: 'outboundTime', title: '应出库时间', type: 'string', width: 110, align: 'left', sort: true }, |
| | | { 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: 'remark', title: '电芯数量', type: 'string', width: 60, align: 'left', }, |
| | | { field: 'creater', title: '创建人', type: 'string', sort: true, width: 110, align: 'left', hidden: true }, |
| | | { field: 'createDate', title: '创建时间', type: 'datetime', sort: true, width: 150, align: 'left', }, |
| | | { field: 'createDate', title: '创建时间', type: 'datetime', sort: true, width: 150, align: 'left', }, |
| | | { field: 'modifier', title: '最后修改人', type: 'string', sort: true, width: 100, hidden: true, align: 'left' }, |
| | | // { field: 'modifyDate', title: '最后修改时间', type: 'datetime', sort: true, width: 150, align: 'left', sort: true }, |
| | | ] |
| | |
| | | public ISqlSugarClient Db => BaseDal.Db; |
| | | |
| | | private PropertyInfo[] _propertyInfo { get; set; } = null; |
| | | private PropertyInfo[] TProperties |
| | | public PropertyInfo[] TProperties |
| | | { |
| | | get |
| | | { |
| | |
| | | /// <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)) |
| | | { |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | /// <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> |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | List<DtStockInfo_Hty> stockInfos = new List<DtStockInfo_Hty>(); |
| | | List<DtLocationInfo> locationInfos = new List<DtLocationInfo>(); |
| | | foreach (var item in keys) |
| | |
| | | } |
| | | |
| | | // 根据传入库存类型获取不同巷道的库存 |
| | | public async Task<Dictionary<string, int>> GetLocationByStockType(bool stockType,string areaCode) |
| | | public async Task<Dictionary<string, int>> GetLocationByStockType(bool stockType, string areaCode) |
| | | { |
| | | var stockInfos = await BaseDal.Db.Queryable<DtStockInfo>().Where(x => x.IsFull == stockType && x.AreaCode == areaCode) |
| | | .Includes(x => x.LocationInfo).ToListAsync(); |
| | |
| | | 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; |
| | | |
| | |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | ////// 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | ////var processResponse = await GetProcessResponseAsync(process, input.Position); |
| | | var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing); |
| | | #endregion |
| | | #endregion 入库任务 |
| | | } |
| | | |
| | | var task = new Dt_Task |
| | |
| | | return task; |
| | | } |
| | | |
| | | #endregion 入库任务 |
| | | #endregion 请求任务入库 |
| | | |
| | | #region 库位分配 |
| | | |
| | | #region 获取货位 |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | #endregion 获取货位 |
| | | |
| | | #region 异常口入库获取库位 |
| | | |
| | | private async Task<DtLocationInfo> RequestLocationByAbnormal(RequestTaskDto requestTask, bool isCheckRequest = false) |
| | | { |
| | | try |
| | |
| | | return null; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion 异常口入库获取库位 |
| | | |
| | | #endregion 库位分配 |
| | | |
| | |
| | | #endregion 请求任务入库 |
| | | |
| | | #region 创建空框出库任务 |
| | | |
| | | public async Task<Dt_Task> CreateEmptyOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager) |
| | | { |
| | | try |
| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 直接出库任务完成 |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 异常口任务检测 |
| | | |
| | | /// <summary> |
| | | /// 异常排出口入库校验 所有异常交给WCS做原地址NG处理 |
| | | /// 异常排出口入库校验 所有异常交给WCS做原地址NG处理 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <param name="stationManager"></param> |
| | |
| | | // 调用GetTrayCellStatusAsync方法,获取整盘电芯 |
| | | WebResponseContent content = await GetTrayCellStatusAsync(trayCells); |
| | | // 如果状态为false,则返回content |
| | | if (!content.Status) //获取整盘电芯数据, 如异常 使用空框类型入库 |
| | | if (!content.Status) //获取整盘电芯数据, 如异常 使用空框类型入库 |
| | | { |
| | | ConsoleHelper.WriteErrorLine(content.Message); |
| | | throw new Exception("MOM整盘电芯属性获取异常"); |
| | |
| | | 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(); |
| | |
| | | #endregion MyRegion |
| | | |
| | | #region 检测高温库是否有可出库库存 |
| | | |
| | | public WebResponseContent StockCheckingAsync() |
| | | { |
| | | WebResponseContent webResponseContent = new WebResponseContent(); |
| | |
| | | #endregion 检测高温库是否有可出库库存 |
| | | |
| | | #region 常温补空托盘至分容 |
| | | |
| | | public async Task<WebResponseContent> GetFROutTrayToCW(RequestTaskDto taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | 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)) |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 常温3出库至包装 |
| | | |
| | | /// <summary> |
| | | /// 常温3出库至包装 |
| | | /// </summary> |
| | | /// <param name="json"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> RequestOutTaskToBZAsync(RequestTaskDto json) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 火警出库 |
| | | |
| | | public WebResponseContent EmergencyTask(object obj) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | { |
| | | throw new Exception("已添加火警出库任务"); |
| | | } |
| | | |
| | | |
| | | int taskNum = BaseDal.GetTaskNo().Result; |
| | | Dt_Task task = new Dt_Task |
| | |
| | | LogFactory.GetLog("DTS火警出库").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("DTS火警出库").Info(true, obj.ToJsonString()); |
| | | return content.OK(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | |
| | | using Masuit.Tools; |
| | | using SqlSugar; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | |
| | | } |
| | | |
| | | // 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(); |