|
|
@ -7,22 +7,15 @@ using System.Text; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Castle.Components.DictionaryAdapter; |
|
|
|
using DocumentFormat.OpenXml.Bibliography; |
|
|
|
using DocumentFormat.OpenXml.Office2016.Excel; |
|
|
|
using DocumentFormat.OpenXml.Spreadsheet; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.Extensions.Hosting; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using MyNamespace; |
|
|
|
using Omu.ValueInjecter; |
|
|
|
using Org.BouncyCastle.Asn1.Ocsp; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using Win_in.Sfs.Basedata.Application; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; |
|
|
@ -57,7 +50,7 @@ public class AssembleIssueJobAppService |
|
|
|
|
|
|
|
private readonly ICurrentUser _currentUser; |
|
|
|
private readonly UnitOfWorkManager _unitOfWorkManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<AssembleIssueJobAppService> _logger; |
|
|
|
|
|
|
@ -78,12 +71,9 @@ public class AssembleIssueJobAppService |
|
|
|
, IOptions<AgvOptions> agvOptions |
|
|
|
, IPostionLocationAppService postionLocationAppService, ILocationDeliveryAppService locationDeliveryAppService |
|
|
|
, ITransferNoteAppService transferNoteAppService |
|
|
|
|
|
|
|
) : base( |
|
|
|
) : base( |
|
|
|
repository, assembleIssueJobManager |
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
{ |
|
|
|
_postionLocationAppService = postionLocationAppService; |
|
|
|
_locationDeliveryAppService = locationDeliveryAppService; |
|
|
@ -118,7 +108,8 @@ public class AssembleIssueJobAppService |
|
|
|
{ |
|
|
|
await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); |
|
|
|
//如果是立库 就给直接承接了
|
|
|
|
var dimensionalStorehouseflag = await UpdateJobStatusWaitByDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
var dimensionalStorehouseflag = |
|
|
|
await UpdateJobStatusWaitByDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
if (dimensionalStorehouseflag) |
|
|
|
{ |
|
|
|
input.IsClaims = true; |
|
|
@ -152,7 +143,8 @@ public class AssembleIssueJobAppService |
|
|
|
{ |
|
|
|
await DoingDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
var firstDetail = assembleIssueJobDto.Details.First(); |
|
|
|
await DoingAgvAsync(assembleIssueJobDto, firstDetail.RecommendFromLocationCode, firstDetail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
await DoingAgvAsync(assembleIssueJobDto, firstDetail.RecommendFromLocationCode, |
|
|
|
firstDetail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
return assembleIssueJobDtos; |
|
|
@ -162,7 +154,8 @@ public class AssembleIssueJobAppService |
|
|
|
public override async Task<AssembleIssueJobDTO> CreateAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); |
|
|
|
var flagDimensionalStorehouse= await UpdateJobStatusWaitByDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
var flagDimensionalStorehouse = |
|
|
|
await UpdateJobStatusWaitByDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
if (flagDimensionalStorehouse == false) |
|
|
|
{ |
|
|
|
await UpdateJobStatusWaitByAgvAsync(input).ConfigureAwait(false); |
|
|
@ -173,7 +166,8 @@ public class AssembleIssueJobAppService |
|
|
|
if (flagDimensionalStorehouse == false) |
|
|
|
{ |
|
|
|
var firstDetail = assembleIssueJobDto.Details.First(); |
|
|
|
await DoingAgvAsync(assembleIssueJobDto, firstDetail.RecommendFromLocationCode, firstDetail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
await DoingAgvAsync(assembleIssueJobDto, firstDetail.RecommendFromLocationCode, |
|
|
|
firstDetail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
return assembleIssueJobDto; |
|
|
@ -191,8 +185,8 @@ public class AssembleIssueJobAppService |
|
|
|
if (assembleJob.JobStatus == EnumJobStatus.Open || |
|
|
|
assembleJob.JobStatus == EnumJobStatus.Partial || |
|
|
|
assembleJob.JobStatus == EnumJobStatus.Wait || |
|
|
|
assembleJob.JobStatus == EnumJobStatus.Doing|| |
|
|
|
assembleJob.JobStatus==EnumJobStatus.WaitAgv) |
|
|
|
assembleJob.JobStatus == EnumJobStatus.Doing || |
|
|
|
assembleJob.JobStatus == EnumJobStatus.WaitAgv) |
|
|
|
{ |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(assembleJob.Number).ConfigureAwait(false); |
|
|
|
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(assembleJob.AssembleRequestNumber) |
|
|
@ -207,9 +201,9 @@ public class AssembleIssueJobAppService |
|
|
|
$"{EnumJobStatus.Open.GetDisplayName()}、" + |
|
|
|
$"{EnumJobStatus.Partial.GetDisplayName()}、" + |
|
|
|
$"{EnumJobStatus.Doing.GetDisplayName()}、" + |
|
|
|
$"{EnumJobStatus.Wait.GetDisplayName()}"+ |
|
|
|
$"{EnumJobStatus.Wait.GetDisplayName()}" + |
|
|
|
$"{EnumJobStatus.WaitAgv.GetDisplayName()}" |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -429,16 +423,18 @@ 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()); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
#region 业务库移 高位置库位转低位置库位
|
|
|
|
#region 业务库移 高位置库位转低位置库位
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 库移回调
|
|
|
@ -448,7 +444,7 @@ public class AssembleIssueJobAppService |
|
|
|
[HttpPost("Do-Call-Back")] |
|
|
|
public async Task DoTransferLibCallbackAsync(TransferLibJobDTO dto) |
|
|
|
{ |
|
|
|
var job = await _repository.FindAsync(p => p.Number == dto.CallJobNumber,true).ConfigureAwait(false); |
|
|
|
var job = await _repository.FindAsync(p => p.Number == dto.CallJobNumber).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (job.JobStatus != EnumJobStatus.Wait) |
|
|
|
{ |
|
|
@ -491,9 +487,11 @@ public class AssembleIssueJobAppService |
|
|
|
jobDetail.TransferLibToSupplierBatch = transferLibNoteDetail.HandledToSupplierBatch; |
|
|
|
jobDetail.TransferLibToWarehouseCode = transferLibNoteDetail.HandledToWarehouseCode; |
|
|
|
|
|
|
|
var jobDto=ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(job); |
|
|
|
var jobDto = ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(job); |
|
|
|
|
|
|
|
var isDoingAgv=await DoingAgvAsync(jobDto, transferLibNoteDetail.HandledToLocationCode, jobDetail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
var isDoingAgv = |
|
|
|
await DoingAgvAsync(jobDto, transferLibNoteDetail.HandledToLocationCode, jobDetail.RecommendToLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
_logger.LogInformation("是否agv:" + isDoingAgv); |
|
|
|
|
|
|
@ -512,9 +510,9 @@ public class AssembleIssueJobAppService |
|
|
|
: _options.Value.StereosPassword; |
|
|
|
} |
|
|
|
|
|
|
|
_logger.LogInformation("任务状态:"+job.JobStatus.ToString()); |
|
|
|
_logger.LogInformation("任务状态:" + job.JobStatus); |
|
|
|
|
|
|
|
job = await _repository.UpdateAsync(job,true).ConfigureAwait(false); |
|
|
|
job = await _repository.UpdateAsync(job, true).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("---------------结束回调"); |
|
|
@ -708,7 +706,6 @@ 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>(); |
|
|
@ -720,12 +717,14 @@ public class AssembleIssueJobAppService |
|
|
|
{ |
|
|
|
errors.Add($"来源库位{detail.FromLocationCode}没查到"); |
|
|
|
} |
|
|
|
|
|
|
|
var toloc = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (toloc == null) |
|
|
|
{ |
|
|
|
errors.Add($"目标库位{detail.ToLocationCode}没查到"); |
|
|
|
} |
|
|
|
|
|
|
|
var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.ItemCode); |
|
|
|
if (entity == null) |
|
|
|
{ |
|
|
@ -781,6 +780,7 @@ public class AssembleIssueJobAppService |
|
|
|
Data = json |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
itm.Worker = "LITK"; |
|
|
|
itm.Details = details; |
|
|
|
// await CompleteAsync(itm.Id, itm).ConfigureAwait(false);
|
|
|
@ -830,56 +830,24 @@ public class AssembleIssueJobAppService |
|
|
|
/// <param name="fromLocationCode"></param>
|
|
|
|
/// <param name="toLocationCode"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> DoingAgvAsync(AssembleIssueJobDTO assembleIssueJobDto,string fromLocationCode,string toLocationCode) |
|
|
|
private async Task<bool> DoingAgvAsync(AssembleIssueJobDTO assembleIssueJobDto, string fromLocationCode, |
|
|
|
string toLocationCode) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); |
|
|
|
var locationDeliveryDto = await _locationDeliveryAppService.GetByFromLocationCodeAndToLocationCodeAsync( |
|
|
|
fromLocationCode, toLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (locationDeliveryDto != null && locationDeliveryDto.EnumLocationDeliveryType == EnumLocationDeliveryType.Agv) |
|
|
|
{ |
|
|
|
//TODO AGV
|
|
|
|
//来源永远是库位 目标永远是工位
|
|
|
|
var ret = await CallAgvAsync(assembleIssueJobDto, fromLocationCode, jobDetailInputdetail.Remark).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (ret.Code != 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调用AGV不成功!原因:{ret.Message}"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是有Agv
|
|
|
|
/// 判断是不是有Agv
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> UpdateJobStatusWaitByAgvAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var locationDeliveryDto=await _locationDeliveryAppService.GetByFromLocationCodeAndToLocationCodeAsync( |
|
|
|
jobDetailInputdetail.RecommendFromLocationCode, jobDetailInputdetail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (locationDeliveryDto!=null&& locationDeliveryDto.EnumLocationDeliveryType==EnumLocationDeliveryType.Agv) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.WaitAgv; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 调用 Agv 接口
|
|
|
|
/// 调用 Agv 接口
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="beginPosition"></param>
|
|
|
@ -888,157 +856,34 @@ public class AssembleIssueJobAppService |
|
|
|
[HttpPost("call-agv")] |
|
|
|
public async Task<ReusltObject> CallAgvAsync(AssembleIssueJobDTO input, string beginPosition, string endPosition) |
|
|
|
{ |
|
|
|
var res = new ReusltObject(); |
|
|
|
List<string> errors = new List<string>(); |
|
|
|
List<string> successList = new List<string>(); |
|
|
|
|
|
|
|
var jobres = await SendInterFaceAsync(input, beginPosition, endPosition).ConfigureAwait(false); |
|
|
|
if (jobres.Code != "0") |
|
|
|
{ |
|
|
|
_logger.LogInformation(jobres.Message); |
|
|
|
errors.Add(jobres.Message); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
successList.Add(jobres.Message); |
|
|
|
} |
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
res.Code = -1; |
|
|
|
res.Message = string.Join(",", errors); |
|
|
|
res.Data = ""; |
|
|
|
return res; |
|
|
|
} |
|
|
|
return res; |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Agv 执行完发料回调接口
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("call-back-agv")] |
|
|
|
/// <summary>
|
|
|
|
/// Agv 执行完发料回调接口
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("call-back-agv")] |
|
|
|
public async Task<AgvResultObject> CallBackAgvIssueAsync(AgvRequestDto request) |
|
|
|
{ |
|
|
|
_logger.LogInformation($"发料回库{JsonSerializer.Serialize(request)}"); |
|
|
|
|
|
|
|
if (request.Data.Count==0) |
|
|
|
{ |
|
|
|
return ReturnMessage("-1", "请求Data明细数量不能为0"); |
|
|
|
} |
|
|
|
var entity=await _repository.FindAsync(p => p.Number == request.Data.First().OrderNum).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (entity == null) |
|
|
|
{ |
|
|
|
return ReturnMessage("-1", $"{request.Data.First().OrderNum}任务单据不存在!"); |
|
|
|
} |
|
|
|
var dto=ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(entity); |
|
|
|
if (entity.JobStatus == EnumJobStatus.Done) |
|
|
|
{ |
|
|
|
return ReturnMessage("-1", $"{entity.Number}任务单据已结束!"); |
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
foreach (var detail in entity.Details) |
|
|
|
{ |
|
|
|
var detailDto = new AssembleIssueJobDetailDTO(); |
|
|
|
if (!string.IsNullOrEmpty(detail.TransferLibFromLocationCode)) |
|
|
|
{ |
|
|
|
var fromloc = new LocationDTO(); |
|
|
|
if (detail.TransferLibFromLocationCode == detail.RecommendFromLocationCode && |
|
|
|
detail.TransferLibToLocationCode == detail.RecommendToLocationCode) |
|
|
|
{ |
|
|
|
//库移的最终目标 挪到 推荐的目标
|
|
|
|
fromloc = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//库移的最终目标 挪到 推荐的目标
|
|
|
|
fromloc = await _locationAppService.GetByCodeAsync(detail.TransferLibToLocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var toloc = await _locationAppService.GetByCodeAsync(detail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
detailDto.InjectFrom(detail); |
|
|
|
|
|
|
|
detailDto.HandledToLocationCode = toloc.Code; |
|
|
|
detailDto.HandledToLocationGroup = toloc.LocationGroupCode; |
|
|
|
detailDto.HandledToLocationArea = toloc.AreaCode; |
|
|
|
detailDto.HandledToLocationErpCode = toloc.ErpLocationCode; |
|
|
|
detailDto.HandledToWarehouseCode = toloc.WarehouseCode; |
|
|
|
detailDto.HandledToQty = request.Data.First().MatQty; |
|
|
|
detailDto.HandledToLot = detail.TransferLibToLot; |
|
|
|
detailDto.HandledToPackingCode = detail.TransferLibToPackingCode; |
|
|
|
|
|
|
|
detailDto.HandledFromLocationCode = fromloc.Code; |
|
|
|
detailDto.HandledFromLocationGroup = fromloc.LocationGroupCode; |
|
|
|
detailDto.HandledFromLocationArea = fromloc.AreaCode; |
|
|
|
detailDto.HandledFromLocationErpCode = fromloc.ErpLocationCode; |
|
|
|
detailDto.HandledFromWarehouseCode = fromloc.WarehouseCode; |
|
|
|
detailDto.HandledFromQty = request.Data.First().MatQty;//2024-12-16 和励 张旭确认的 因为没有人工干预 也没校验 一托就直接顶走了
|
|
|
|
detailDto.HandledFromLot = detail.TransferLibToLot; |
|
|
|
detailDto.HandledFromPackingCode = detail.TransferLibToPackingCode; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var fromloc = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode).ConfigureAwait(false); |
|
|
|
var toloc = await _locationAppService.GetByCodeAsync(detail.RecommendToLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
detailDto.InjectFrom(detail); |
|
|
|
|
|
|
|
detailDto.HandledToLocationCode = toloc.Code; |
|
|
|
detailDto.HandledToLocationGroup = toloc.LocationGroupCode; |
|
|
|
detailDto.HandledToLocationArea = toloc.AreaCode; |
|
|
|
detailDto.HandledToLocationErpCode = toloc.ErpLocationCode; |
|
|
|
detailDto.HandledToWarehouseCode = toloc.WarehouseCode; |
|
|
|
detailDto.HandledToQty = request.Data.First().MatQty; |
|
|
|
detailDto.HandledToLot = detail.RecommendToLot; |
|
|
|
detailDto.HandledToPackingCode = detail.RecommendToPackingCode; |
|
|
|
|
|
|
|
detailDto.HandledFromLocationCode = fromloc.Code; |
|
|
|
detailDto.HandledFromLocationGroup = fromloc.LocationGroupCode; |
|
|
|
detailDto.HandledFromLocationArea = fromloc.AreaCode; |
|
|
|
detailDto.HandledFromLocationErpCode = fromloc.ErpLocationCode; |
|
|
|
detailDto.HandledFromWarehouseCode = fromloc.WarehouseCode; |
|
|
|
detailDto.HandledFromQty = request.Data.First().MatQty;//2024-12-16 和励 张旭确认的 因为没有人工干预 也没校验 一托就直接顶走了
|
|
|
|
detailDto.HandledFromLot = detail.RecommendToLot; |
|
|
|
detailDto.HandledFromPackingCode = detail.RecommendToPackingCode; |
|
|
|
} |
|
|
|
|
|
|
|
await ExecuteDetailExtAsync(entity.Id, entity.Details.First().Id, detailDto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
return ReturnMessage("-1", e.Message); |
|
|
|
} |
|
|
|
|
|
|
|
return ReturnMessage("0", "OK"); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 返回信息
|
|
|
|
/// 返回信息
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="code">0成功其他失败</param>
|
|
|
|
/// <param name="message">OK成功其他错误信息</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private AgvResultObject ReturnMessage(string code, string message) |
|
|
|
{ |
|
|
|
return new AgvResultObject() |
|
|
|
{ |
|
|
|
Code = code, |
|
|
|
Message = message, |
|
|
|
ReqCode = "" |
|
|
|
}; |
|
|
|
return new AgvResultObject { Code = code, Message = message, ReqCode = "" }; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Agv 回库 接口
|
|
|
|
/// Agv 回库 接口
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <returns></returns>
|
|
|
@ -1054,10 +899,7 @@ public class AssembleIssueJobAppService |
|
|
|
|
|
|
|
var ret = ReturnMessage("0", "OK"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using var unitOfWork = _unitOfWorkManager.Begin(); |
|
|
|
try |
|
|
|
{ |
|
|
@ -1074,18 +916,24 @@ public class AssembleIssueJobAppService |
|
|
|
transfer.UseOnTheWayLocation = false; |
|
|
|
transfer.Confirmed = true; |
|
|
|
var detailInput = new TransferNoteDetailInput(); |
|
|
|
|
|
|
|
var fromPosition = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); |
|
|
|
|
|
|
|
var fromPosition = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (fromPosition == null) |
|
|
|
{ |
|
|
|
errors.Add($"未查询到工位{detail.BeginPosition}关联的库位"); |
|
|
|
} |
|
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(fromPosition.LocationCode).ConfigureAwait(false); |
|
|
|
var tolocationDto = await _locationAppService.GetByCodeAsync(detail.EndPosition).ConfigureAwait(false); |
|
|
|
|
|
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(fromPosition.LocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
var tolocationDto = |
|
|
|
await _locationAppService.GetByCodeAsync(detail.EndPosition).ConfigureAwait(false); |
|
|
|
if (tolocationDto != null) |
|
|
|
{ |
|
|
|
tolocationDto = await _locationAppService.GetByCodeAsync(detail.EndPosition).ConfigureAwait(false); |
|
|
|
tolocationDto = await _locationAppService.GetByCodeAsync(detail.EndPosition) |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
var item = await _itemBasicAppService.GetByCodeAsync(detail.MatCode).ConfigureAwait(false); |
|
|
|
if (item == null) |
|
|
|
{ |
|
|
@ -1098,11 +946,12 @@ public class AssembleIssueJobAppService |
|
|
|
detailInput.ItemName = item.Name; |
|
|
|
detailInput.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : string.Empty; |
|
|
|
} |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
return ReturnMessage("-1", string.Join(",", errors.ToArray())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
detailInput.ToLocationCode = tolocationDto.Code; |
|
|
|
detailInput.ToLocationGroup = tolocationDto.LocationGroupCode; |
|
|
|
detailInput.ToLocationArea = tolocationDto.AreaCode; |
|
|
@ -1143,50 +992,35 @@ public class AssembleIssueJobAppService |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
ret = ReturnMessage("-1", string.Join(",",errors.ToArray())); |
|
|
|
ret = ReturnMessage("-1", string.Join(",", errors.ToArray())); |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
} |
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 调用Agv接口实现
|
|
|
|
/// 调用Agv接口实现
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="job"></param>
|
|
|
|
/// <param name="beginPosition"></param>
|
|
|
|
/// <param name="endPosition"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<AgvResultObject> SendInterFaceAsync(AssembleIssueJobDTO job,string beginPosition, string endPosition) |
|
|
|
private async Task<AgvResultObject> SendInterFaceAsync(AssembleIssueJobDTO job, string beginPosition, |
|
|
|
string endPosition) |
|
|
|
{ |
|
|
|
#if DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
return |
|
|
|
new AgvResultObject |
|
|
|
{ |
|
|
|
Code = "0", |
|
|
|
ReqCode = job.AssembleRequestNumber, |
|
|
|
Message = "OK" |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
new AgvResultObject { Code = "0", ReqCode = job.AssembleRequestNumber, Message = "OK" }; |
|
|
|
|
|
|
|
|
|
|
|
var ret = new AgvResultObject |
|
|
|
{ |
|
|
|
Code = "0", |
|
|
|
ReqCode = job.AssembleRequestNumber, |
|
|
|
Message = "OK" |
|
|
|
}; |
|
|
|
var ret = new AgvResultObject { Code = "0", ReqCode = job.AssembleRequestNumber, Message = "OK" }; |
|
|
|
using var unitOfWork = _unitOfWorkManager.Begin(); |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
if (job.JobStatus == EnumJobStatus.Done) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"任务{job.Number}为已完成状态,不能发起AGV任务!"); |
|
|
@ -1196,6 +1030,7 @@ public class AssembleIssueJobAppService |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"任务{job.Number}没有推荐库存!"); |
|
|
|
} |
|
|
|
|
|
|
|
var first = job.Details.FirstOrDefault(); |
|
|
|
var request = new AgvRequest(); |
|
|
|
request.MatCode = first.ItemCode; |
|
|
@ -1236,7 +1071,6 @@ public class AssembleIssueJobAppService |
|
|
|
|
|
|
|
var client = new AgvJobClient(_agvOptions.Value.Address, httpclient, _agvOptions.Value.Path); |
|
|
|
ret = await client.PushOutTaskAssembleAsync(request).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
@ -1247,6 +1081,7 @@ public class AssembleIssueJobAppService |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
throw new UserFriendlyException($"接口报错 错误信息{e.Message}"); |
|
|
|
} |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|