|
|
@ -107,7 +107,7 @@ public class AssembleIssueJobAppService |
|
|
|
{ |
|
|
|
await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); |
|
|
|
//如果是立库 就给直接承接了
|
|
|
|
var dimensionalStorehouseflag = await CheckDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
var dimensionalStorehouseflag = await UpdateJobStatusWaitByDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
if (dimensionalStorehouseflag) |
|
|
|
{ |
|
|
|
input.IsClaims = true; |
|
|
@ -118,12 +118,26 @@ public class AssembleIssueJobAppService |
|
|
|
? "LYF" |
|
|
|
: _options.Value.StereosPassword; |
|
|
|
} |
|
|
|
|
|
|
|
//如果是Agv
|
|
|
|
var agvFlag = await UpdateJobStatusWaitByAgvAsync(input).ConfigureAwait(false); |
|
|
|
if (agvFlag) |
|
|
|
{ |
|
|
|
input.IsClaims = true; |
|
|
|
input.ClaimsUserId = string.IsNullOrEmpty(_options.Value.StereosUser) |
|
|
|
? "AGV" |
|
|
|
: _options.Value.StereosUser; |
|
|
|
input.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) |
|
|
|
? "AGV" |
|
|
|
: _options.Value.StereosPassword; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var assembleIssueJobDtos = await base.CreateManyAsync(inputs).ConfigureAwait(false); |
|
|
|
foreach (var assembleIssueJobDto in assembleIssueJobDtos) |
|
|
|
{ |
|
|
|
await CheckDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
await DoingDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
await DoingAgvAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
return assembleIssueJobDtos; |
|
|
@ -133,10 +147,12 @@ public class AssembleIssueJobAppService |
|
|
|
public override async Task<AssembleIssueJobDTO> CreateAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); |
|
|
|
await CheckDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
await UpdateJobStatusWaitByDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
await UpdateJobStatusWaitByAgvAsync(input).ConfigureAwait(false); |
|
|
|
|
|
|
|
var assembleIssueJobDto = await base.CreateAsync(input).ConfigureAwait(false); |
|
|
|
await CheckDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
await DoingDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
await DoingAgvAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
|
|
|
|
return assembleIssueJobDto; |
|
|
|
} |
|
|
@ -460,17 +476,61 @@ public class AssembleIssueJobAppService |
|
|
|
[HttpPost("get-job-by-packing/{packingCode}")] |
|
|
|
public virtual async Task<AssembleIssueJobDTO> GetJobByPackingCodeAsync(string packingCode) |
|
|
|
{ |
|
|
|
var list=await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode==packingCode)).ConfigureAwait(false); |
|
|
|
var list = await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode == packingCode)).ConfigureAwait(false); |
|
|
|
if (list == null || list.Count < 1) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("未找到该箱码的任务"); |
|
|
|
} |
|
|
|
var dto=ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(list.First()); |
|
|
|
var dto = ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(list.First()); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
#region 立库
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 调用立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="assembleIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task DoingDimensionalStorehouseAsync(AssembleIssueJobDTO assembleIssueJobDto) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); |
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
//TODO 立体库
|
|
|
|
var ret = await SyncIssueJobStereoAsync(new List<AssembleIssueJobDTO> { assembleIssueJobDto }, |
|
|
|
jobDetailInputdetail.RecommendToLocationCode, assembleIssueJobDto.Id).ConfigureAwait(false); |
|
|
|
if (ret.Code != 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> UpdateJobStatusWaitByDimensionalStorehouseAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.Wait; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 立体库同步
|
|
|
|
/// </summary>
|
|
|
@ -611,6 +671,7 @@ public class AssembleIssueJobAppService |
|
|
|
|
|
|
|
foreach (var itm in dtos) |
|
|
|
{ |
|
|
|
|
|
|
|
var first = jobs.FirstOrDefault(p => p.JobNumber == itm.Number); |
|
|
|
var itmDetails = itm.Details.ToList(); |
|
|
|
var details = new List<AssembleIssueJobDetailDTO>(); |
|
|
@ -723,6 +784,80 @@ public class AssembleIssueJobAppService |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Agv
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 调用AGV
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="assembleIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task DoingAgvAsync(AssembleIssueJobDTO assembleIssueJobDto) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); |
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.EnableAgv) |
|
|
|
{ |
|
|
|
//TODO AGV
|
|
|
|
var ret = await CallAgvAsync(new List<AssembleIssueJobDTO> { assembleIssueJobDto }).ConfigureAwait(false); |
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
|
|
|
ret.Code = 1; |
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (ret.Code != 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调用AGV不成功!原因:{ret.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是有Agv
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> UpdateJobStatusWaitByAgvAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.EnableAgv) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.WaitAgv; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 调用 Agv 接口
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="pLoc"></param>
|
|
|
|
/// <param name="uid"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("call-agv")] |
|
|
|
public async Task<ReusltObject> CallAgvAsync(List<AssembleIssueJobDTO> input) |
|
|
|
{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("call-back-agv")] |
|
|
|
public virtual async Task<ReusltObject> CallBackAgvAsync(IssueRequestFromRestoDTO input) |
|
|
|
{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 私有
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -789,70 +924,6 @@ public class AssembleIssueJobAppService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
//private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input)
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
// var jobDetailInputdetail = input.Details.FirstOrDefault();
|
|
|
|
|
|
|
|
// var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
|
|
|
|
// .ConfigureAwait(false);
|
|
|
|
|
|
|
|
// if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
|
|
|
|
// {
|
|
|
|
// input.JobStatus = EnumJobStatus.Wait;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.Wait; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="assembleIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobDTO assembleIssueJobDto) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); |
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
//TODO 立体库
|
|
|
|
var ret = await SyncIssueJobStereoAsync(new List<AssembleIssueJobDTO> { assembleIssueJobDto }, |
|
|
|
jobDetailInputdetail.RecommendToLocationCode, assembleIssueJobDto.Id).ConfigureAwait(false); |
|
|
|
if (ret.Code != 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改当前任务状态 和 该任务的请求状态
|
|
|
|
/// </summary>
|
|
|
|