|
|
|
|
@ -30,6 +30,7 @@ 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;
|
|
|
|
|
@ -43,11 +44,13 @@ public class MaterialInStore:BaseBusiness
|
|
|
|
|
{
|
|
|
|
|
private readonly IBasePathInfoService _basePathInfoService;
|
|
|
|
|
private readonly ILiveTaskQueueService _liveTaskQueueService;
|
|
|
|
|
private readonly IBaseStoreInfoService _baseStoreInfoService;
|
|
|
|
|
|
|
|
|
|
public MaterialInStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService)
|
|
|
|
|
public MaterialInStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService, IBaseStoreInfoService baseStoreInfoService)
|
|
|
|
|
{
|
|
|
|
|
_basePathInfoService = basePathInfoService;
|
|
|
|
|
_liveTaskQueueService = liveTaskQueueService;
|
|
|
|
|
_baseStoreInfoService = baseStoreInfoService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override ValidateMaterialResultDto ValidateMaterial(ValidateMaterialDto validateMaterialDto)
|
|
|
|
|
@ -66,6 +69,25 @@ public class MaterialInStore:BaseBusiness
|
|
|
|
|
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.Material;
|
|
|
|
|
//获取包材入库路径
|
|
|
|
|
@ -100,9 +122,55 @@ public class MaterialInStore:BaseBusiness
|
|
|
|
|
return resultDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 筛选库位
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="filterLocationDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
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<Func<BaseStoreInfo,bool>> storeWhere = x => x.storeType == (int)StoreTypeEnum.Material;
|
|
|
|
|
Expression<Func<BaseLocationInfo,bool>> locationWhere = x=>x.materialCode==filterLocationDto.materialCode && x.locationStatus == 0 && x.isFlag == 1;
|
|
|
|
|
|
|
|
|
|
List<BaseStoreInfo> 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|