diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs index 32b0748f3..b2e8329f1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs @@ -907,8 +907,22 @@ public class AssembleIssueJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvIssueAsync(AgvRequestDto 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(entity); + if (entity.JobStatus == EnumJobStatus.Done) + { + return ReturnMessage("-1", $"{entity.Number}任务单据已结束!"); + } foreach (var detail in entity.Details) { @@ -968,14 +982,28 @@ public class AssembleIssueJobAppService await ExecuteDetailExtAsync(entity.Id, entity.Details.First().Id, detailDto).ConfigureAwait(false); } - return new AgvResultObject + return ReturnMessage("0", "OK"); + } + + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { + return new AgvResultObject() { - Code = "0", - Message = "OK", - ReqCode = "", + Code = code, + Message = message, + ReqCode = "" }; } + + + /// /// Agv 回库 接口 /// @@ -990,12 +1018,13 @@ public class AssembleIssueJobAppService #if DEBUG #endif var errors = new List(); - var ret = new AgvResultObject - { - Code = "0", - Message = "OK", - ReqCode = "", - }; + + var ret = ReturnMessage("0", "OK"); + + + + + using var unitOfWork = _unitOfWorkManager.Begin(); try { @@ -1038,12 +1067,8 @@ public class AssembleIssueJobAppService } if (errors.Count > 0) { - return ret = new AgvResultObject() - { - Code = "-1", - ReqCode = "", - Message = string.Join(",", errors.ToArray()) - }; + return ReturnMessage("-1", string.Join(",", errors.ToArray())); + } detailInput.ToLocationCode = tolocationDto.Code; detailInput.ToLocationGroup = tolocationDto.LocationGroupCode; @@ -1079,24 +1104,13 @@ public class AssembleIssueJobAppService } catch (Exception ex) { - ret = new AgvResultObject - { - Code = "-1", - ReqCode = "", - Message = ex.Message - }; + ret = ReturnMessage("-1", ex.Message); await unitOfWork.RollbackAsync().ConfigureAwait(false); - } if (errors.Count > 0) { - ret = new AgvResultObject - { - Code = "-1", - Message = string.Join(",", errors.ToArray()), - ReqCode = "" - }; + ret = ReturnMessage("-1", string.Join(",",errors.ToArray())); await unitOfWork.RollbackAsync().ConfigureAwait(false); } return ret; @@ -1119,6 +1133,17 @@ public class AssembleIssueJobAppService #if DEBUG #endif + return + new AgvResultObject + { + Code = "0", + ReqCode = job.AssembleRequestNumber, + Message = "OK" + }; + + + + var ret = new AgvResultObject { Code = "0", diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs index 59f664555..c860c2d95 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs @@ -929,8 +929,21 @@ public class CoatingIssueJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvIssueAsync(AgvRequestDto 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(entity); + if (entity.JobStatus == EnumJobStatus.Done) + { + return ReturnMessage("-1", $"{entity.Number}任务单据已结束!"); + } foreach (var detail in entity.Details) { @@ -990,11 +1003,21 @@ public class CoatingIssueJobAppService await ExecuteDetailExtAsync(entity.Id, entity.Details.First().Id, detailDto).ConfigureAwait(false); } - return new AgvResultObject + return ReturnMessage("0", "OK"); + } + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { + return new AgvResultObject() { - Code = "0", - Message = "OK", - ReqCode = "", + Code = code, + Message = message, + ReqCode = "" }; } @@ -1147,6 +1170,11 @@ public class CoatingIssueJobAppService ReqCode = job.CoatingRequestNumber, Message = "OK" }; + + return ret;//暂时无接口直接返回 + + + using var unitOfWork = _unitOfWorkManager.Begin(); try { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs index 0f47d4c0b..f50a6ca7e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs @@ -258,8 +258,22 @@ public class InjectionIssueJobAppService jobDetail.TransferLibToQty = transferLibNoteDetail.HandledToQty; jobDetail.TransferLibToSupplierBatch = transferLibNoteDetail.HandledToSupplierBatch; jobDetail.TransferLibToWarehouseCode = transferLibNoteDetail.HandledToWarehouseCode; + var jobDto = ObjectMapper.Map(job); + var isDoingAgv = await DoingAgvAsync(jobDto, jobDetail.TransferLibToLocationCode, jobDetail.RecommendToLocationCode).ConfigureAwait(false); - await _repository.UpdateAsync(job).ConfigureAwait(false); + if (isDoingAgv) + { + job.JobStatus = EnumJobStatus.WaitAgv; + job.IsClaims = true; + job.ClaimsUserId = string.IsNullOrEmpty(_options.Value.StereosUser) + ? "AGV" + : _options.Value.StereosUser; + job.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) + ? "AGV" + : _options.Value.StereosPassword; + } + + job = await _repository.UpdateAsync(job).ConfigureAwait(false); } /// @@ -878,8 +892,21 @@ public class InjectionIssueJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvIssueAsync(AgvRequestDto 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(entity); + if (entity.JobStatus == EnumJobStatus.Done) + { + return ReturnMessage("-1", $"{entity.Number}任务单据已结束!"); + } foreach (var detail in entity.Details) { @@ -939,11 +966,21 @@ public class InjectionIssueJobAppService await ExecuteDetailExtAsync(entity.Id, entity.Details.First().Id, detailDto).ConfigureAwait(false); } - return new AgvResultObject + return ReturnMessage("0", "OK"); + } + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { + return new AgvResultObject() { - Code = "0", - Message = "OK", - ReqCode = "", + Code = code, + Message = message, + ReqCode = "" }; } @@ -1096,6 +1133,10 @@ public class InjectionIssueJobAppService ReqCode = job.InjectionRequestNumber, Message = "OK" }; + + return ret;//暂时无接口直接返回 + + using var unitOfWork = _unitOfWorkManager.Begin(); try { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs index eca6f8c8e..d5525a364 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs @@ -893,8 +893,21 @@ public class KittingIssueJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvIssueAsync(AgvRequestDto 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(entity); + if (entity.JobStatus == EnumJobStatus.Done) + { + return ReturnMessage("-1", $"{entity.Number}任务单据已结束!"); + } foreach (var detail in entity.Details) { @@ -950,15 +963,23 @@ public class KittingIssueJobAppService detailDto.HandledFromLot = detail.RecommendToLot; detailDto.HandledFromPackingCode = detail.RecommendToPackingCode; } - await ExecuteDetailExtAsync(entity.Id, entity.Details.First().Id, detailDto).ConfigureAwait(false); } - - return new AgvResultObject + return ReturnMessage("0", "OK"); + } + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { + return new AgvResultObject() { - Code = "0", - Message = "OK", - ReqCode = "", + Code = code, + Message = message, + ReqCode = "" }; } @@ -1111,6 +1132,8 @@ public class KittingIssueJobAppService ReqCode = job.KittingRequestNumber, Message = "OK" }; + return ret;//暂时无接口直接返回 + using var unitOfWork = _unitOfWorkManager.Begin(); try { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs index f855361d9..be508225a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs @@ -360,21 +360,6 @@ public class SparePartIssueJobAppService ? "LYF" : _options.Value.StereosPassword; - - - - //if (sparePartIssueJob.IsClaims) - //{ - // if (sparePartIssueJob.ClaimsUserId != _currentUser.Id.ToString()) - // { - // throw new UserFriendlyException($"该任务已被【{sparePartIssueJob.ClaimsUserName}】承接"); - // } - //} - //else - //{ - // throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); - //} - var sparePartIssueJobDto = ObjectMapper.Map(sparePartIssueJob); sparePartIssueJobDto.Details = new List { issueJobDetailDto }; var sparePartIssueNoteEditInput = await BuildSparePartIssueNoteAsync(sparePartIssueJobDto).ConfigureAwait(false); @@ -904,9 +889,21 @@ public class SparePartIssueJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvIssueAsync(AgvRequestDto 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); - var dto = ObjectMapper.Map(entity); + if (entity == null) + { + return ReturnMessage("-1", $"{request.Data.First().OrderNum}任务单据不存在!"); + } + var dto = ObjectMapper.Map(entity); + if (entity.JobStatus == EnumJobStatus.Done) + { + return ReturnMessage("-1", $"{entity.Number}任务单据已结束!"); + } foreach (var detail in entity.Details) { var detailDto = new SparePartIssueJobDetailDTO(); @@ -972,6 +969,21 @@ public class SparePartIssueJobAppService ReqCode = "", }; } + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { + return new AgvResultObject() + { + Code = code, + Message = message, + ReqCode = "" + }; + } /// /// Agv 回库 接口 @@ -1122,6 +1134,7 @@ public class SparePartIssueJobAppService ReqCode = job.SparePartRequestNumber, Message = "OK" }; + return ret;//暂时无接口直接返回 using var unitOfWork = _unitOfWorkManager.Begin(); try { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs index d0988cdef..3b12d6686 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs @@ -477,128 +477,6 @@ public class UnplannedIssueJobAppService var job = await _repository.GetAsync(id).ConfigureAwait(false); var isHasAgvFlag = false; - - //var details = ObjectMapper.Map, List>(detailDtos); - //var job = await _repository.FindAsync(p => p.Number == jobNumber).ConfigureAwait(false); - //var isHasAgvFlag = false; - - //if (job == null) - //{ - // throw new UserFriendlyException($"{jobNumber}【任务】不存在"); - //} - - //if (job.JobStatus != EnumJobStatus.Doing) - //{ - // throw new UserFriendlyException($"{jobNumber}【任务】不是【执行】状态"); - //} - - //if (detailDtos.Count(p => p.ItemCode != job.ItemCode) > 0) - //{ - // throw new UserFriendlyException("请确认ERP料号是否正确"); - //} - - //if (detailDtos.Sum(p => p.HandledQty) > job.Qty) - //{ - // throw new UserFriendlyException("实际数量大于申请数量"); - //} - - //foreach (var detail in details) - //{ - // var locationDto = await _locationAppService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); - // var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - - // detail.HandledToLocationArea = locationDto.AreaCode; - // detail.HandledToLocationErpCode = locationDto.ErpLocationCode; - // detail.HandledToLocationGroup = locationDto.LocationGroupCode; - // detail.HandledToLocationCode = locationDto.Code; - // detail.Status = EnumInventoryStatus.OK; - // detail.HandledArriveDate = DateTime.Now; - // detail.HandledProduceDate = DateTime.Now; - // detail.Uom = itemBasicDto.BasicUom; - // detail.ItemName = itemBasicDto.Name; - // detail.ItemDesc1 = itemBasicDto.Desc1; - // detail.ItemDesc2 = itemBasicDto.Desc2; - // detail.StdPackQty = itemBasicDto.StdPackQty; - // #region 过期时间 - - // if (itemBasicDto.ValidityUnit == EnumValidityUnit.Day) - // { - // detail.HandledExpireDate = detail.HandledArriveDate.AddDays(itemBasicDto.Validity); - // } - // else if (itemBasicDto.ValidityUnit == EnumValidityUnit.WeeK) - // { - // detail.HandledExpireDate = detail.HandledArriveDate.AddDays(itemBasicDto.Validity * 7); - // } - // else if (itemBasicDto.ValidityUnit == EnumValidityUnit.Month) - // { - // detail.HandledExpireDate = detail.HandledArriveDate.AddDays(itemBasicDto.Validity * 30); - // } - // else if (itemBasicDto.ValidityUnit == EnumValidityUnit.Infinite) - // { - // detail.HandledExpireDate = DateTime.MaxValue; - // } - - // #endregion - - // if (locationDto.ErpLocationCode != job.FromErpLocationCode) - // { - // throw new UserFriendlyException($"库位【{locationDto.ErpLocationCode}】不在【{job.FromErpLocationCode}】储位下"); - // } - - // if (locationDto.Type == EnumLocationType.DimensionalStorehouse) - // { - // throw new UserFriendlyException("立库功能暂未开放"); - // } - - // var dto = await _locationDeliveryAppService.GetByFromLocationCodeAndToLocationCodeAsync(detail.HandledToLocationCode, detail.HandledToLocationCode).ConfigureAwait(false); - // if (dto != null) - // { - // await CallAgvAsync(job, detail).ConfigureAwait(false); - // isHasAgvFlag = true; - // } - //} - - //job.Details = details; - //job.CompleteUserName = worker; - //job.JobStatus = EnumJobStatus.Done; - //job.CompleteTime = DateTime.Now; - //job.Worker = worker; - - //if (isHasAgvFlag) - //{ - // job.JobStatus = EnumJobStatus.WaitAgv; - //} - - //job = await _repository.UpdateAsync(job).ConfigureAwait(false); - - //if (!isHasAgvFlag)//没有AGV就执行 - //{ - // await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData(job), false) - // .ConfigureAwait(false); - // await UpdateRequestStatusAsync(job.UnplannedReceiptRequestNumber).ConfigureAwait(false); - //} - - - - - - - - - - - - - - - - - - - - - - if (dto.Details.Count > 0) { @@ -801,8 +679,13 @@ public class UnplannedIssueJobAppService } else { - + handleDto = ObjectMapper.Map(job); } + + + + + //}; @@ -850,20 +733,28 @@ public class UnplannedIssueJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvAsync(AgvRequestUnplannedDto request) { + + if (request.Data.Count == 0) + { + return ReturnMessage("-1", "请求明细Data数量不能为0"); + } var agvRequest = request.Data.First(); var job = await _repository.FindAsync(p => p.Number == agvRequest.OrderNum).ConfigureAwait(false); if (job == null) { - throw new UserFriendlyException("未找到该任务"); + return ReturnMessage("-1", $"{agvRequest.OrderNum}未找到该任务"); } if (job.JobStatus != EnumJobStatus.WaitAgv) { - throw new UserFriendlyException("该任务状态不是等待AGV中"); + return ReturnMessage("-1", "该任务状态不是等待AGV中"); + } + var toLocationDto = await _locationAppService.GetByCodeAsync(agvRequest.EndPosition ).ConfigureAwait(false);//agvRequest.BeginPosition调试时确认 + if (toLocationDto == null) + { + return ReturnMessage("-1", $"{agvRequest.EndPosition}库位没查到!"); } - - var toLocationDto = await _locationAppService.GetByCodeAsync(agvRequest.EndPosition).ConfigureAwait(false); var detail = job.Details.First(); detail.HandledQty = agvRequest.MatQty; @@ -873,37 +764,34 @@ public class UnplannedIssueJobAppService detail.HandledFromLocationGroup = toLocationDto.LocationGroupCode; detail.HandledFromLocationArea = toLocationDto.AreaCode; detail.HandledFromLocationErpCode = toLocationDto.ErpLocationCode; - + job.JobStatus= EnumJobStatus.Done; job = await _repository.UpdateAsync(job).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData(job), false) .ConfigureAwait(false); await UpdateRequestStatusAsync(job.UnplannedIssueRequestNumber).ConfigureAwait(false);//await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + return ReturnMessage("0", "OK"); + } + + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { return new AgvResultObject() { - Code = "", - Message = "", + Code = code, + Message = message, ReqCode = "" }; } - ///// - ///// Agv 回库 接口 - ///// - ///// - ///// - //[HttpPost("call-return-back-agv")] - //public async Task CallReturnBackAgvAsync(AgvRequestDto request) - //{ - - - - - - - //} + /// /// 调用Agv接口实现 @@ -915,12 +803,19 @@ public class UnplannedIssueJobAppService #if DEBUG return new AgvResultObject(); #endif + + + + var ret = new AgvResultObject { Code = "0", ReqCode = job.UnplannedIssueRequestNumber, Message = "OK" }; + + return ret;//暂时无接口直接返回 + using var unitOfWork = _unitOfWorkManager.Begin(); try { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs index e550968d7..19b10a2d5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs @@ -387,21 +387,26 @@ public class UnplannedReceiptJobAppService [HttpPost("call-back-agv")] public async Task CallBackAgvAsync(AgvRequestUnplannedDto request) { - var agvRequest = request.Data.First(); + if (request.Data.Count == 0) + { + return ReturnMessage("-1", "请求明细Data数量不能为0"); + } + var agvRequest = request.Data.First(); var job = await _repository.FindAsync(p => p.Number == agvRequest.OrderNum).ConfigureAwait(false); if (job == null) { - throw new UserFriendlyException("未找到该任务"); + return ReturnMessage("-1", $"{agvRequest.OrderNum}未找到该任务"); } - if (job.JobStatus != EnumJobStatus.WaitAgv) { - throw new UserFriendlyException("该任务状态不是等待AGV中"); + return ReturnMessage("-1", $"{agvRequest.OrderNum}任务状态不是等待AGV中"); } - var toLocationDto = await _locationAppService.GetByCodeAsync(agvRequest.EndPosition).ConfigureAwait(false); - + if (toLocationDto == null) + { + return ReturnMessage("-1", $"{agvRequest.EndPosition}库位没查到!"); + } var detail = job.Details.First(); detail.HandledQty = agvRequest.MatQty; detail.HandledPackingCode = agvRequest.PakingCode; @@ -410,16 +415,26 @@ public class UnplannedReceiptJobAppService detail.HandledToLocationGroup = toLocationDto.LocationGroupCode; detail.HandledToLocationArea = toLocationDto.AreaCode; detail.HandledToLocationErpCode = toLocationDto.ErpLocationCode; - + job.JobStatus = EnumJobStatus.Done; job = await _repository.UpdateAsync(job).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData(job), false) .ConfigureAwait(false); await UpdateRequestStatusAsync(job.UnplannedReceiptRequestNumber).ConfigureAwait(false);//await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + return ReturnMessage("0", "OK"); + } + /// + /// 返回信息 + /// + /// 0成功其他失败 + /// OK成功其他错误信息 + /// + private AgvResultObject ReturnMessage(string code, string message) + { return new AgvResultObject() { - Code = "0", - Message = "OK", + Code = code, + Message = message, ReqCode = "" }; } @@ -435,12 +450,16 @@ public class UnplannedReceiptJobAppService #if DEBUG return new AgvResultObject(); #endif + + var ret = new AgvResultObject { Code = "0", ReqCode = job.UnplannedReceiptRequestNumber, Message = "OK" }; + return ret;//暂时无接口直接返回 + using var unitOfWork = _unitOfWorkManager.Begin(); try { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/CoatingIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/CoatingIssueRequestEventHandler.cs index 4a62caf3f..cca1e2797 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/CoatingIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/CoatingIssueRequestEventHandler.cs @@ -605,6 +605,14 @@ public class CoatingIssueRequestEventHandler if (CoatingIssueJobEditInputs.Count > 0) //有库存 可以创建任务 { + CoatingIssueJobEditInputs.ForEach(p => + { + p.Details.ForEach(x => x.Remark = CoatingIssueRequest.Remark); + p.Remark = CoatingIssueRequest.Remark; + }); + + + //新增任务 var addCoatingIssueJobDtos = await _CoatingIssueJobAppService .CreateManyAsync(CoatingIssueJobEditInputs) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/InjectionIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/InjectionIssueRequestEventHandler.cs index 0b886f202..403b6ce3c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/InjectionIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/InjectionIssueRequestEventHandler.cs @@ -605,6 +605,14 @@ public class InjectionIssueRequestEventHandler if (InjectionIssueJobEditInputs.Count > 0) //有库存 可以创建任务 { + InjectionIssueJobEditInputs.ForEach(p => + { + p.Details.ForEach(x => x.Remark = InjectionIssueRequest.Remark); + p.Remark = InjectionIssueRequest.Remark; + }); + + + //新增任务 var addInjectionIssueJobDtos = await _InjectionIssueJobAppService .CreateManyAsync(InjectionIssueJobEditInputs) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/KittingIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/KittingIssueRequestEventHandler.cs index 8f22bf842..567625b02 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/KittingIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/KittingIssueRequestEventHandler.cs @@ -605,6 +605,13 @@ public class KittingIssueRequestEventHandler if (KittingIssueJobEditInputs.Count > 0) //有库存 可以创建任务 { + KittingIssueJobEditInputs.ForEach(p => + { + p.Details.ForEach(x => x.Remark = KittingIssueRequest.Remark); + p.Remark = KittingIssueRequest.Remark; + }); + + //新增任务 var addKittingIssueJobDtos = await _KittingIssueJobAppService .CreateManyAsync(KittingIssueJobEditInputs) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/SparePartIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/SparePartIssueRequestEventHandler.cs index f4e3152e4..1cfd0e9d2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/SparePartIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueRequest/SparePartIssueRequestEventHandler.cs @@ -605,6 +605,14 @@ public class SparePartIssueRequestEventHandler if (SparePartIssueJobEditInputs.Count > 0) //有库存 可以创建任务 { + SparePartIssueJobEditInputs.ForEach(p => + { + p.Details.ForEach(x => x.Remark = SparePartIssueRequest.Remark); + p.Remark = SparePartIssueRequest.Remark; + }); + + + //新增任务 var addSparePartIssueJobDtos = await _SparePartIssueJobAppService .CreateManyAsync(SparePartIssueJobEditInputs)