diff --git a/Sln.Wcs.Business/InStore/PalletInStore.cs b/Sln.Wcs.Business/InStore/PalletInStore.cs index 9b05506..24ad1ae 100644 --- a/Sln.Wcs.Business/InStore/PalletInStore.cs +++ b/Sln.Wcs.Business/InStore/PalletInStore.cs @@ -23,32 +23,177 @@ #endregion << 版 本 注 释 >> +using System.Linq.Expressions; using Sln.Wcs.Business.Domain.Dto.CreateTask; using Sln.Wcs.Business.Domain.Dto.FilterLocation; using Sln.Wcs.Business.Domain.Dto.SaveTask; using Sln.Wcs.Business.Domain.Dto.ValidateMaterial; +using Sln.Wcs.Business.Domain.Enum; +using Sln.Wcs.Business.Domain.Model.CreateTask; +using Sln.Wcs.Business.Domain.Model.FilterLocation; +using Sln.Wcs.Business.Domain.Model.SaveTask; +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service; namespace Sln.Wcs.Business.InStore; public class PalletInStore:BaseBusiness -{ +{private readonly IBasePathInfoService _basePathInfoService; + private readonly ILiveTaskQueueService _liveTaskQueueService; + private readonly IBaseStoreInfoService _baseStoreInfoService; + + public PalletInStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService, IBaseStoreInfoService baseStoreInfoService) + { + _basePathInfoService = basePathInfoService; + _liveTaskQueueService = liveTaskQueueService; + _baseStoreInfoService = baseStoreInfoService; + } + public override ValidateMaterialResultDto ValidateMaterial(ValidateMaterialDto validateMaterialDto) { throw new NotImplementedException(); } + /// + /// 创建任务 + /// + /// + /// + /// public override CreateTaskResultDto CreateTask(CreateTaskDto createTaskDto) { - throw new NotImplementedException(); + CreateTaskResultDto resultDto = new CreateTaskResultDto(); + try + { + #region CreateTaskDto 参数校验 + + if (string.IsNullOrEmpty(createTaskDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.palletBarcode)) + { + throw new InvalidOperationException($"托盘条码不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.startPoint) || string.IsNullOrEmpty(createTaskDto.endPoint)) + { + throw new InvalidOperationException($"起始位置、终点位置不允许为 NULL"); + } + + #endregion + + createTaskDto.taskType = TaskTypeEnum.InStore; + createTaskDto.taskCategory = TaskCategoryEnum.Pallet; + //获取托盘入库路径 + Expression> exp = x=>x.startPoint == createTaskDto.startPoint && x.endPoint == createTaskDto.endPoint && x.pathType == (int)createTaskDto.taskType && x.pathCategory == (int)createTaskDto.taskCategory; + BasePathInfo pathInfo = _basePathInfoService.GetBasePathInfo(exp).FirstOrDefault() ?? throw new InvalidOperationException($"托盘入库输送路径为 NULL"); + + #region 路径转为任务 + + string taskCode = "2026050700001"; //需根据现场实际定义生成规则 + + List taskDetails = pathInfo.pathDetails.Select( item => base.LiveTaskDetailWrapper(taskCode,createTaskDto,item)).ToList(); + + var taskQueue = base.LiveTaskQueueWrapper(taskCode, createTaskDto, pathInfo); + taskQueue.taskSteps = taskDetails.Count; + taskQueue.taskDetails = taskDetails; + #endregion + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = $"托盘入库任务创建成功:{taskCode};关联路径:{pathInfo.pathName}"; + resultDto.data = new CreateTaskResultModel() + { + taskCode = taskCode, + taskQueue = taskQueue, + taskDetails = taskDetails, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + return resultDto; } + /// + /// 筛选库位 + /// + /// + /// + /// public override FilterLocationResultDto FilterLocation(FilterLocationDto filterLocationDto) { - throw new NotImplementedException(); + FilterLocationResultDto resultDto = new FilterLocationResultDto(); + try + { + + #region 参数校验 + + if (string.IsNullOrEmpty(filterLocationDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + #endregion + + Expression> storeWhere = x => x.storeType == (int)StoreTypeEnum.Material; + Expression> locationWhere = x=>x.materialCode==filterLocationDto.materialCode && x.locationStatus == 0 && x.isFlag == 1; + + List storeInfos = _baseStoreInfoService.GetBasePathInfo(storeWhere,locationWhere); + + //先对仓库进行排序 + BaseStoreInfo? storeInfo = storeInfos.Where(s => s.locationInfos.Count > 0).OrderBy(x=>x.storeCode).FirstOrDefault() ?? throw new ArgumentNullException($"未获取到可用仓库"); + + BaseLocationInfo? locationInfo = storeInfo.locationInfos.OrderBy(x => x.locationRows).ThenBy(x=>x.locationColumns).ThenBy(x=>x.locationLayers).FirstOrDefault() ?? throw new ArgumentNullException($"目标仓库:{storeInfo.storeName}中未获取到可用库位"); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new FilterLocationResultModel() + { + storeInfo = storeInfo, + + locationInfos = storeInfo.locationInfos, + + locationInfo = locationInfo, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; } + /// + /// 保存任务 + /// + /// + /// public override SaveTaskResultDto SaveTask(SaveTaskDto saveTaskDto) { - throw new NotImplementedException(); + SaveTaskResultDto resultDto = new SaveTaskResultDto(); + try + { + var inRes = _liveTaskQueueService.InsertTaskQueue(saveTaskDto.taskQueue); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new SaveTaskResultModel() + { + isRes = inRes + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; } } \ No newline at end of file diff --git a/Sln.Wcs.Business/InStore/ProductInStore.cs b/Sln.Wcs.Business/InStore/ProductInStore.cs index 7fa9989..e047a16 100644 --- a/Sln.Wcs.Business/InStore/ProductInStore.cs +++ b/Sln.Wcs.Business/InStore/ProductInStore.cs @@ -23,9 +23,178 @@ #endregion << 版 本 注 释 >> +using System.Linq.Expressions; +using Sln.Wcs.Business.Domain.Dto.CreateTask; +using Sln.Wcs.Business.Domain.Dto.FilterLocation; +using Sln.Wcs.Business.Domain.Dto.SaveTask; +using Sln.Wcs.Business.Domain.Dto.ValidateMaterial; +using Sln.Wcs.Business.Domain.Enum; +using Sln.Wcs.Business.Domain.Model.CreateTask; +using Sln.Wcs.Business.Domain.Model.FilterLocation; +using Sln.Wcs.Business.Domain.Model.SaveTask; +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service; + namespace Sln.Wcs.Business.InStore; -public class ProductInStore +public class ProductInStore:BaseBusiness { - + private readonly IBasePathInfoService _basePathInfoService; + private readonly ILiveTaskQueueService _liveTaskQueueService; + private readonly IBaseStoreInfoService _baseStoreInfoService; + + public ProductInStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService, IBaseStoreInfoService baseStoreInfoService) + { + _basePathInfoService = basePathInfoService; + _liveTaskQueueService = liveTaskQueueService; + _baseStoreInfoService = baseStoreInfoService; + } + + public override ValidateMaterialResultDto ValidateMaterial(ValidateMaterialDto validateMaterialDto) + { + throw new NotImplementedException(); + } + + /// + /// 创建任务 + /// + /// + /// + /// + public override CreateTaskResultDto CreateTask(CreateTaskDto createTaskDto) + { + CreateTaskResultDto resultDto = new CreateTaskResultDto(); + try + { + #region CreateTaskDto 参数校验 + + if (string.IsNullOrEmpty(createTaskDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.palletBarcode)) + { + throw new InvalidOperationException($"成品条码不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.startPoint) || string.IsNullOrEmpty(createTaskDto.endPoint)) + { + throw new InvalidOperationException($"起始位置、终点位置不允许为 NULL"); + } + + #endregion + + createTaskDto.taskType = TaskTypeEnum.InStore; + createTaskDto.taskCategory = TaskCategoryEnum.Product; + //获取成品入库路径 + Expression> exp = x=>x.startPoint == createTaskDto.startPoint && x.endPoint == createTaskDto.endPoint && x.pathType == (int)createTaskDto.taskType && x.pathCategory == (int)createTaskDto.taskCategory; + BasePathInfo pathInfo = _basePathInfoService.GetBasePathInfo(exp).FirstOrDefault() ?? throw new InvalidOperationException($"成品入库输送路径为 NULL"); + + #region 路径转为任务 + + string taskCode = "2026050700001"; //需根据现场实际定义生成规则 + + List taskDetails = pathInfo.pathDetails.Select( item => base.LiveTaskDetailWrapper(taskCode,createTaskDto,item)).ToList(); + + var taskQueue = base.LiveTaskQueueWrapper(taskCode, createTaskDto, pathInfo); + taskQueue.taskSteps = taskDetails.Count; + taskQueue.taskDetails = taskDetails; + #endregion + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = $"成品入库任务创建成功:{taskCode};关联路径:{pathInfo.pathName}"; + resultDto.data = new CreateTaskResultModel() + { + taskCode = taskCode, + taskQueue = taskQueue, + taskDetails = taskDetails, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + return resultDto; + } + + /// + /// 筛选库位 + /// + /// + /// + /// + public override FilterLocationResultDto FilterLocation(FilterLocationDto filterLocationDto) + { + FilterLocationResultDto resultDto = new FilterLocationResultDto(); + try + { + + #region 参数校验 + + if (string.IsNullOrEmpty(filterLocationDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + #endregion + + Expression> storeWhere = x => x.storeType == (int)StoreTypeEnum.Material; + Expression> locationWhere = x=>x.materialCode==filterLocationDto.materialCode && x.locationStatus == 0 && x.isFlag == 1; + + List storeInfos = _baseStoreInfoService.GetBasePathInfo(storeWhere,locationWhere); + + //先对仓库进行排序 + BaseStoreInfo? storeInfo = storeInfos.Where(s => s.locationInfos.Count > 0).OrderBy(x=>x.storeCode).FirstOrDefault() ?? throw new ArgumentNullException($"未获取到可用仓库"); + + BaseLocationInfo? locationInfo = storeInfo.locationInfos.OrderBy(x => x.locationRows).ThenBy(x=>x.locationColumns).ThenBy(x=>x.locationLayers).FirstOrDefault() ?? throw new ArgumentNullException($"目标仓库:{storeInfo.storeName}中未获取到可用库位"); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new FilterLocationResultModel() + { + storeInfo = storeInfo, + + locationInfos = storeInfo.locationInfos, + + locationInfo = locationInfo, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; + } + + /// + /// 保存任务 + /// + /// + /// + public override SaveTaskResultDto SaveTask(SaveTaskDto saveTaskDto) + { + SaveTaskResultDto resultDto = new SaveTaskResultDto(); + try + { + var inRes = _liveTaskQueueService.InsertTaskQueue(saveTaskDto.taskQueue); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new SaveTaskResultModel() + { + isRes = inRes + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; + } } \ No newline at end of file diff --git a/Sln.Wcs.Business/OutStore/PalletOutStore.cs b/Sln.Wcs.Business/OutStore/PalletOutStore.cs index bd8d311..bedb8e9 100644 --- a/Sln.Wcs.Business/OutStore/PalletOutStore.cs +++ b/Sln.Wcs.Business/OutStore/PalletOutStore.cs @@ -23,9 +23,178 @@ #endregion << 版 本 注 释 >> +using System.Linq.Expressions; +using Sln.Wcs.Business.Domain.Dto.CreateTask; +using Sln.Wcs.Business.Domain.Dto.FilterLocation; +using Sln.Wcs.Business.Domain.Dto.SaveTask; +using Sln.Wcs.Business.Domain.Dto.ValidateMaterial; +using Sln.Wcs.Business.Domain.Enum; +using Sln.Wcs.Business.Domain.Model.CreateTask; +using Sln.Wcs.Business.Domain.Model.FilterLocation; +using Sln.Wcs.Business.Domain.Model.SaveTask; +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service; + namespace Sln.Wcs.Business.OutStore; -public class PalletOutStore +public class PalletOutStore:BaseBusiness { - + private readonly IBasePathInfoService _basePathInfoService; + private readonly ILiveTaskQueueService _liveTaskQueueService; + private readonly IBaseStoreInfoService _baseStoreInfoService; + + public PalletOutStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService, IBaseStoreInfoService baseStoreInfoService) + { + _basePathInfoService = basePathInfoService; + _liveTaskQueueService = liveTaskQueueService; + _baseStoreInfoService = baseStoreInfoService; + } + + public override ValidateMaterialResultDto ValidateMaterial(ValidateMaterialDto validateMaterialDto) + { + throw new NotImplementedException(); + } + + /// + /// 创建任务 + /// + /// + /// + /// + public override CreateTaskResultDto CreateTask(CreateTaskDto createTaskDto) + { + CreateTaskResultDto resultDto = new CreateTaskResultDto(); + try + { + #region CreateTaskDto 参数校验 + + if (string.IsNullOrEmpty(createTaskDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.palletBarcode)) + { + throw new InvalidOperationException($"托盘条码不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.startPoint) || string.IsNullOrEmpty(createTaskDto.endPoint)) + { + throw new InvalidOperationException($"起始位置、终点位置不允许为 NULL"); + } + + #endregion + + createTaskDto.taskType = TaskTypeEnum.OutStore; + createTaskDto.taskCategory = TaskCategoryEnum.Material; + //获取托盘出库路径 + Expression> exp = x=>x.startPoint == createTaskDto.startPoint && x.endPoint == createTaskDto.endPoint && x.pathType == (int)createTaskDto.taskType && x.pathCategory == (int)createTaskDto.taskCategory; + BasePathInfo pathInfo = _basePathInfoService.GetBasePathInfo(exp).FirstOrDefault() ?? throw new InvalidOperationException($"托盘出库输送路径为 NULL"); + + #region 路径转为任务 + + string taskCode = "2026050700001"; //需根据现场实际定义生成规则 + + List taskDetails = pathInfo.pathDetails.Select( item => base.LiveTaskDetailWrapper(taskCode,createTaskDto,item)).ToList(); + + var taskQueue = base.LiveTaskQueueWrapper(taskCode, createTaskDto, pathInfo); + taskQueue.taskSteps = taskDetails.Count; + taskQueue.taskDetails = taskDetails; + #endregion + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = $"托盘出库任务创建成功:{taskCode};关联路径:{pathInfo.pathName}"; + resultDto.data = new CreateTaskResultModel() + { + taskCode = taskCode, + taskQueue = taskQueue, + taskDetails = taskDetails, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + return resultDto; + } + + /// + /// 筛选库位 + /// + /// + /// + /// + public override FilterLocationResultDto FilterLocation(FilterLocationDto filterLocationDto) + { + FilterLocationResultDto resultDto = new FilterLocationResultDto(); + try + { + + #region 参数校验 + + if (string.IsNullOrEmpty(filterLocationDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + #endregion + + Expression> storeWhere = x => x.storeType == (int)StoreTypeEnum.Pallet; + Expression> locationWhere = x=>x.materialCode==filterLocationDto.materialCode && x.locationStatus == 1 && x.isFlag == 1; + + List storeInfos = _baseStoreInfoService.GetBasePathInfo(storeWhere,locationWhere); + + //先对仓库进行排序 + BaseStoreInfo? storeInfo = storeInfos.Where(s => s.locationInfos.Count > 0).OrderBy(x=>x.storeCode).FirstOrDefault() ?? throw new ArgumentNullException($"未获取到可用仓库"); + + BaseLocationInfo? locationInfo = storeInfo.locationInfos.OrderBy(x => x.locationRows).ThenBy(x=>x.locationColumns).ThenBy(x=>x.locationLayers).FirstOrDefault() ?? throw new ArgumentNullException($"目标仓库:{storeInfo.storeName}中未获取到可用库位"); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new FilterLocationResultModel() + { + storeInfo = storeInfo, + + locationInfos = storeInfo.locationInfos, + + locationInfo = locationInfo, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; + } + + /// + /// 保存任务 + /// + /// + /// + public override SaveTaskResultDto SaveTask(SaveTaskDto saveTaskDto) + { + SaveTaskResultDto resultDto = new SaveTaskResultDto(); + try + { + var inRes = _liveTaskQueueService.InsertTaskQueue(saveTaskDto.taskQueue); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new SaveTaskResultModel() + { + isRes = inRes + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; + } } \ No newline at end of file diff --git a/Sln.Wcs.Business/OutStore/ProductOutStore.cs b/Sln.Wcs.Business/OutStore/ProductOutStore.cs index 9a76d03..125d364 100644 --- a/Sln.Wcs.Business/OutStore/ProductOutStore.cs +++ b/Sln.Wcs.Business/OutStore/ProductOutStore.cs @@ -23,9 +23,178 @@ #endregion << 版 本 注 释 >> +using System.Linq.Expressions; +using Sln.Wcs.Business.Domain.Dto.CreateTask; +using Sln.Wcs.Business.Domain.Dto.FilterLocation; +using Sln.Wcs.Business.Domain.Dto.SaveTask; +using Sln.Wcs.Business.Domain.Dto.ValidateMaterial; +using Sln.Wcs.Business.Domain.Enum; +using Sln.Wcs.Business.Domain.Model.CreateTask; +using Sln.Wcs.Business.Domain.Model.FilterLocation; +using Sln.Wcs.Business.Domain.Model.SaveTask; +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service; + namespace Sln.Wcs.Business.OutStore; -public class ProductOutStore +public class ProductOutStore:BaseBusiness { - + private readonly IBasePathInfoService _basePathInfoService; + private readonly ILiveTaskQueueService _liveTaskQueueService; + private readonly IBaseStoreInfoService _baseStoreInfoService; + + public ProductOutStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService, IBaseStoreInfoService baseStoreInfoService) + { + _basePathInfoService = basePathInfoService; + _liveTaskQueueService = liveTaskQueueService; + _baseStoreInfoService = baseStoreInfoService; + } + + public override ValidateMaterialResultDto ValidateMaterial(ValidateMaterialDto validateMaterialDto) + { + throw new NotImplementedException(); + } + + /// + /// 创建任务 + /// + /// + /// + /// + public override CreateTaskResultDto CreateTask(CreateTaskDto createTaskDto) + { + CreateTaskResultDto resultDto = new CreateTaskResultDto(); + try + { + #region CreateTaskDto 参数校验 + + if (string.IsNullOrEmpty(createTaskDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.palletBarcode)) + { + throw new InvalidOperationException($"托盘条码不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.startPoint) || string.IsNullOrEmpty(createTaskDto.endPoint)) + { + throw new InvalidOperationException($"起始位置、终点位置不允许为 NULL"); + } + + #endregion + + createTaskDto.taskType = TaskTypeEnum.OutStore; + createTaskDto.taskCategory = TaskCategoryEnum.Material; + //获取托盘成品路径 + Expression> exp = x=>x.startPoint == createTaskDto.startPoint && x.endPoint == createTaskDto.endPoint && x.pathType == (int)createTaskDto.taskType && x.pathCategory == (int)createTaskDto.taskCategory; + BasePathInfo pathInfo = _basePathInfoService.GetBasePathInfo(exp).FirstOrDefault() ?? throw new InvalidOperationException($"托盘成品输送路径为 NULL"); + + #region 路径转为任务 + + string taskCode = "2026050700001"; //需根据现场实际定义生成规则 + + List taskDetails = pathInfo.pathDetails.Select( item => base.LiveTaskDetailWrapper(taskCode,createTaskDto,item)).ToList(); + + var taskQueue = base.LiveTaskQueueWrapper(taskCode, createTaskDto, pathInfo); + taskQueue.taskSteps = taskDetails.Count; + taskQueue.taskDetails = taskDetails; + #endregion + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = $"托盘成品任务创建成功:{taskCode};关联路径:{pathInfo.pathName}"; + resultDto.data = new CreateTaskResultModel() + { + taskCode = taskCode, + taskQueue = taskQueue, + taskDetails = taskDetails, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + return resultDto; + } + + /// + /// 筛选库位 + /// + /// + /// + /// + public override FilterLocationResultDto FilterLocation(FilterLocationDto filterLocationDto) + { + FilterLocationResultDto resultDto = new FilterLocationResultDto(); + try + { + + #region 参数校验 + + if (string.IsNullOrEmpty(filterLocationDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + #endregion + + Expression> storeWhere = x => x.storeType == (int)StoreTypeEnum.Product; + Expression> locationWhere = x=>x.materialCode==filterLocationDto.materialCode && x.locationStatus == 1 && x.isFlag == 1; + + List storeInfos = _baseStoreInfoService.GetBasePathInfo(storeWhere,locationWhere); + + //先对仓库进行排序 + BaseStoreInfo? storeInfo = storeInfos.Where(s => s.locationInfos.Count > 0).OrderBy(x=>x.storeCode).FirstOrDefault() ?? throw new ArgumentNullException($"未获取到可用仓库"); + + BaseLocationInfo? locationInfo = storeInfo.locationInfos.OrderBy(x => x.locationRows).ThenBy(x=>x.locationColumns).ThenBy(x=>x.locationLayers).FirstOrDefault() ?? throw new ArgumentNullException($"目标仓库:{storeInfo.storeName}中未获取到可用库位"); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new FilterLocationResultModel() + { + storeInfo = storeInfo, + + locationInfos = storeInfo.locationInfos, + + locationInfo = locationInfo, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; + } + + /// + /// 保存任务 + /// + /// + /// + public override SaveTaskResultDto SaveTask(SaveTaskDto saveTaskDto) + { + SaveTaskResultDto resultDto = new SaveTaskResultDto(); + try + { + var inRes = _liveTaskQueueService.InsertTaskQueue(saveTaskDto.taskQueue); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new SaveTaskResultModel() + { + isRes = inRes + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; + } } \ No newline at end of file diff --git a/Sln.Wcs.sln b/Sln.Wcs.sln index 5646b3e..a7bd297 100644 --- a/Sln.Wcs.sln +++ b/Sln.Wcs.sln @@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.HoistApi", "Sln.Wcs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Business", "Sln.Wcs.Business\Sln.Wcs.Business.csproj", "{BC972937-1470-4B74-85F0-90F6162ADA27}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Strategy", "Sln.Wcs.Strategy\Sln.Wcs.Strategy.csproj", "{F7658F97-F78A-4612-A1A5-490F2CDE49DD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -80,6 +82,10 @@ Global {BC972937-1470-4B74-85F0-90F6162ADA27}.Debug|Any CPU.Build.0 = Debug|Any CPU {BC972937-1470-4B74-85F0-90F6162ADA27}.Release|Any CPU.ActiveCfg = Release|Any CPU {BC972937-1470-4B74-85F0-90F6162ADA27}.Release|Any CPU.Build.0 = Release|Any CPU + {F7658F97-F78A-4612-A1A5-490F2CDE49DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F7658F97-F78A-4612-A1A5-490F2CDE49DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F7658F97-F78A-4612-A1A5-490F2CDE49DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F7658F97-F78A-4612-A1A5-490F2CDE49DD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE