diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs index 999f39ec0..58027b767 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; @@ -37,22 +38,43 @@ public class AgvJobAccountService : ApplicationService _Accessor = Accessor; } - + [HttpPost("accountOutOrder")] public async Task AccountOutOrderAsync(AgvRequestOnlyJobHK request) { var res = new AgvResultObject(); - res.Code = "0"; - - var first=request.Data.FirstOrDefault(); - var agvJobAccountService = _Accessor(first.OrderType); - var result = await agvJobAccountService.AccountOutOrderAsync(request).ConfigureAwait(false); - if (result.Code!= "0") + ; + + + List errors= new List(); + var jobList = request.Data.Select(p => p.OrderNum).Distinct(); + foreach (var job in jobList) + { + var jobdetails = request.Data.Where(p => p.OrderNum == job); + if (jobdetails!=null && jobdetails.Any()) { - res.Code = "1"; - res.Message = result.Message; - + var first= jobdetails.FirstOrDefault(); + var agvJobAccountService = _Accessor(first.OrderType); + var jobreq = new AgvRequestOnlyJobHK(); + jobreq.Data =jobdetails.ToList(); + var result = await agvJobAccountService.AccountOutOrderAsync(jobreq).ConfigureAwait(false); + if (result.Code != "0") + { + errors.Add($"任务{job}类型{first.OrderType}错误{result.Message}"); + } } - + } + if (errors.Count > 0) + { + res.Code = "1"; + res.Message =string.Join(",",errors); + res.ReqCode = "0"; + return res; + } + + res.Code = "0"; + res.ReqCode = "0"; + res.Message = "OK"; + return res; } 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 c86024a0b..4d87e7993 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 @@ -7,6 +7,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; +using DocumentFormat.OpenXml.Office2016.Excel; using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -845,15 +846,200 @@ public class AssembleIssueJobAppService /// /// [HttpPost("call-agv")] - public async Task CallAgvAsync(List input) + public async Task CallAgvAsync(List inputs) { - return null; + + var res = new ReusltObject(); + List errors = new List(); + List successList= new List(); + foreach (var itm in inputs) + { + var jobres= await PushOutTaskAsync(itm).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; + + } [HttpPost("call-back-agv")] - public virtual async Task CallBackAgvAsync(IssueRequestFromRestoDTO input) + public async Task AccountOutOrderAsync(AgvRequestOnlyJobHK request) { - return null; + var json = JsonSerializer.Serialize(request); + var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); + _logger.LogInformation($"{flag}接收到AGV确认单据内容:" + json); +#if DEBUG +#endif + var errors = new List(); + var first = request.Data.FirstOrDefault(); + var job = await _repository.GetAsync(p => p.Number == first.OrderNum).ConfigureAwait(false); + var ret = new AgvResultObject + { + Code = "0", + Message = "OK", + ReqCode = job.AssembleRequestNumber, + }; + using var unitOfWork = _unitOfWorkManager.Begin(); + try + { + if (request.Data.Count > 0) + { + var jobs = request.Data; + var numbers = jobs.Select(p => p.OrderNum); + var query = _repository.WithDetails() + .Where(p => numbers.Contains(p.Number) && p.JobStatus != EnumJobStatus.Done); + + var entities = query.ToList(); + if (entities.Count == 0) + { + errors.Add($"任务号{string.Join(",", numbers)}不存在!"); + } + + var dtos = ObjectMapper.Map, List>(entities); + + foreach (var itm in dtos) + { + var arys = jobs.Where(p => p.OrderNum == itm.Number); + var itmDetails = itm.Details.ToList(); + var details = new List(); + foreach (var detail in arys) + { + + var fromloc = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); + if (fromloc == null) + { + errors.Add($"来源起始点{detail.BeginPosition}没查到"); + } + + LocationDTO fromlocation = null; + + if (fromloc != null) + { + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); + } + if (fromlocation == null) + { + errors.Add($"来源起始点{detail.BeginPosition}库位没查到"); + } + + var toloc = await _postionLocationAppService.GetByCodeAsync(detail.EndPosition) + .ConfigureAwait(false); + if (toloc == null) + { + errors.Add($"结束点{detail.EndPosition}库位没查到"); + } + + LocationDTO tolocation = null; + + if (toloc != null) + { + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); + } + if (tolocation == null) + { + errors.Add($"结束点{detail.EndPosition}库位没查到"); + } + var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode); + if (entity == null) + { + errors.Add($"物料号{detail.MatCode}不在任务明细内!"); + } + + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + var dto = new AssembleIssueJobDetailDTO(); + dto.InjectFrom(entity); + dto.HandledToLocationCode = toloc.Code; + dto.HandledToLocationGroup = tolocation.LocationGroupCode; + dto.HandledToLocationArea = tolocation.AreaCode; + dto.HandledToLocationErpCode = tolocation.ErpLocationCode; + + dto.HandledToWarehouseCode = tolocation.WarehouseCode; + dto.HandledToQty = detail.MatQty; + dto.HandledToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; + dto.HandledToPackingCode = string.Empty; + + dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; + dto.HandledFromLocationCode = fromlocation.Code; + dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; + dto.HandledFromLocationArea = fromlocation.AreaCode; + dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledFromQty = detail.MatQty; + dto.HandledFromLot = string.Empty; + dto.HandledFromPackingCode = string.Empty; + details.Add(dto); + + + + + + //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + } + + if (errors.Count > 0) + { + ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + itm.Worker = "AGV"; + itm.Details = details; + + _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成"); + } + } + else + { + errors.Add("Agv确认单据里无数据! \n"); + } + } + catch (Exception ex) + { + ret = new AgvResultObject + { + Code = "-1", + ReqCode = job.AssembleRequestNumber, + Message = ex.Message, + }; + await unitOfWork.RollbackAsync(); + return ret; + } + + if (errors.Count > 0) + { + ret = new AgvResultObject + { + Code = "-1", + Message = string.Join(",", errors.ToArray()), + ReqCode = job.AssembleRequestNumber + }; + } + return ret; } #endregion @@ -985,8 +1171,8 @@ public class AssembleIssueJobAppService - [HttpPost("PushOutTask")] - public async Task PushOutTaskAsync(AssembleIssueJobDTO job) + + private async Task PushOutTaskAsync(AssembleIssueJobDTO job) { var ret = new AgvResultObject { @@ -1002,7 +1188,7 @@ public class AssembleIssueJobAppService request.MatCode = first.ItemCode; request.MatQty = first.HandledToQty; request.OrderNum = job.Number; - request.OrderType = "2"; + request.OrderType = "1001"; var httpclient = _httpClientFactory.CreateClient(); _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) @@ -1049,163 +1235,6 @@ public class AssembleIssueJobAppService return ret; } - [HttpPost("accountOutOrder")] - public async Task AccountOutOrderAsync(AgvRequestOnlyJobHK request) - { - var json = JsonSerializer.Serialize(request); - var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); - _logger.LogInformation($"{flag}接收到AGV确认单据内容:" + json); -#if DEBUG -#endif - var errors = new List(); - var first = request.Data.FirstOrDefault(); - var job=await _repository.GetAsync(p => p.Number == first.OrderNum).ConfigureAwait(false); - - var ret = new AgvResultObject - { - Code = "0", - Message = "OK", - ReqCode = job.AssembleRequestNumber, - - }; - using var unitOfWork = _unitOfWorkManager.Begin(); - try - { - if (request.Data.Count > 0) - { - var jobs = request.Data; - var numbers = jobs.Select(p => p.OrderNum); - var query = _repository.WithDetails() - .Where(p => numbers.Contains(p.Number) && p.JobStatus != EnumJobStatus.Done); - var entities = query.ToList(); - if (entities.Count == 0) - { - errors.Add($"任务号{string.Join(",", numbers)}不存在!"); - } - - var dtos = ObjectMapper.Map, List>(entities); - foreach (var itm in dtos) - { - var arys = jobs.Where(p => p.OrderNum == itm.Number); - var itmDetails = itm.Details.ToList(); - var details = new List(); - foreach (var detail in arys) - { - - var fromloc = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); - if (fromloc == null) - { - errors.Add($"来源起始点{detail.BeginPosition}没查到"); - } - - LocationDTO fromlocation = null; - - if (fromloc != null) - { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); - } - if (fromlocation == null) - { - errors.Add($"来源起始点{detail.BeginPosition}库位没查到"); - } - - var toloc = await _postionLocationAppService.GetByCodeAsync(detail.EndPosition) - .ConfigureAwait(false); - if (toloc == null) - { - errors.Add($"结束点{detail.EndPosition}库位没查到"); - } - - LocationDTO tolocation = null; - - if (toloc != null) - { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); - } - if (tolocation == null) - { - errors.Add($"结束点{detail.EndPosition}库位没查到"); - } - - - var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode); - if (entity == null) - { - errors.Add($"物料号{detail.MatCode}不在任务明细内!"); - } - - var dto = new AssembleIssueJobDetailDTO(); - dto.InjectFrom(entity); - dto.HandledToLocationCode = toloc.Code; - dto.HandledToLocationGroup = tolocation.LocationGroupCode; - dto.HandledToLocationArea = tolocation.AreaCode; - dto.HandledToLocationErpCode = tolocation.ErpLocationCode; - - dto.HandledToWarehouseCode = tolocation.WarehouseCode; - dto.HandledToQty = detail.MatQty; - dto.HandledToLot =!string.IsNullOrEmpty(detail.BatchAttr07)? detail.BatchAttr07: string.Empty; - dto.HandledToPackingCode = string.Empty; - - dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; - dto.HandledFromLocationCode = fromlocation.Code; - dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; - dto.HandledFromLocationArea = fromlocation.AreaCode; - dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; - dto.HandledFromQty = detail.MatQty; - dto.HandledFromLot = string.Empty; - dto.HandledFromPackingCode = string.Empty; - details.Add(dto); - - - - - - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); - } - - if (errors.Count > 0) - { - ret = new AgvResultObject() - { - Code = "-1", - ReqCode="", - Message = string.Join(",", errors.ToArray()) - }; - } - itm.Worker = "AGV"; - itm.Details = details; - - _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成"); - } - } - else - { - errors.Add("Agv确认单据里无数据! \n"); - } - } - catch (Exception ex) - { - ret = new AgvResultObject - { - Code = "-1", - ReqCode=job.AssembleRequestNumber, - Message = ex.Message, - }; - await unitOfWork.RollbackAsync(); - return ret; - } - - if (errors.Count > 0) - { - ret = new AgvResultObject - { - Code = "-1", - Message = string.Join(",", errors.ToArray()), - ReqCode=job.AssembleRequestNumber - }; - } - return ret; - } 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 9ab045668..9fe656cbd 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 @@ -853,7 +853,7 @@ public class CoatingIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -871,7 +871,7 @@ public class CoatingIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -885,6 +885,16 @@ public class CoatingIssueJobAppService errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + var dto = new CoatingIssueJobDetailDTO(); dto.InjectFrom(entity); dto.HandledToLocationCode = toloc.Code; 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 e72132c66..944ce6e88 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 @@ -802,7 +802,7 @@ public class InjectionIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -820,7 +820,7 @@ public class InjectionIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -833,7 +833,15 @@ public class InjectionIssueJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } - + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } var dto = new InjectionIssueJobDetailDTO(); dto.InjectFrom(entity); dto.HandledToLocationCode = toloc.Code; 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 f80d37205..868863728 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 @@ -814,7 +814,7 @@ public class KittingIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -832,7 +832,7 @@ public class KittingIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -846,6 +846,17 @@ public class KittingIssueJobAppService errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new KittingIssueJobDetailDTO(); dto.InjectFrom(entity); dto.HandledToLocationCode = toloc.Code; 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 8a06554c4..3b9400cb5 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 @@ -791,7 +791,7 @@ public class SparePartIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -809,7 +809,7 @@ public class SparePartIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -822,6 +822,17 @@ public class SparePartIssueJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new SparePartIssueJobDetailDTO(); dto.InjectFrom(entity); 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 260a84d37..0519fe0f3 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 @@ -767,7 +767,7 @@ public class UnplannedIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -785,7 +785,7 @@ public class UnplannedIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -798,11 +798,22 @@ public class UnplannedIssueJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new UnplannedIssueJobDetailDTO(); dto.InjectFrom(entity); - //dto.HandledQty = toloc.Code; - //dto.location = tolocation.LocationGroupCode; + dto.HandledQty = detail.MatQty; + //dto.= tolocation.LocationGroupCode; //dto.HandledToLocationArea = tolocation.AreaCode; //dto.HandledToLocationErpCode = tolocation.ErpLocationCode; @@ -811,11 +822,11 @@ public class UnplannedIssueJobAppService //dto.HandledToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; //dto.HandledToPackingCode = string.Empty; - //dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; - //dto.HandledFromLocationCode = fromlocation.Code; - //dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; - //dto.HandledFromLocationArea = fromlocation.AreaCode; - //dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; + dto.HandledFromLocationCode = fromlocation.Code; + dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; + dto.HandledFromLocationArea = fromlocation.AreaCode; + dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; //dto.HandledFromQty = detail.MatQty; //dto.HandledFromLot = string.Empty; //dto.HandledFromPackingCode = string.Empty; @@ -825,7 +836,7 @@ public class UnplannedIssueJobAppService - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + } if (errors.Count > 0) 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 cf7abaa6a..16fce525f 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 @@ -443,7 +443,7 @@ public class UnplannedReceiptJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -461,7 +461,7 @@ public class UnplannedReceiptJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -474,11 +474,25 @@ public class UnplannedReceiptJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new UnplannedReceiptJobDetailDTO(); dto.InjectFrom(entity); - // dto.HandledQty = toloc.Code; - //dto.location = tolocation.LocationGroupCode; + + + + dto.HandledQty = detail.MatQty; + //dto.= tolocation.LocationGroupCode; //dto.HandledToLocationArea = tolocation.AreaCode; //dto.HandledToLocationErpCode = tolocation.ErpLocationCode; @@ -487,11 +501,11 @@ public class UnplannedReceiptJobAppService //dto.HandledToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; //dto.HandledToPackingCode = string.Empty; - //dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; - //dto.HandledFromLocationCode = fromlocation.Code; - //dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; - //dto.HandledFromLocationArea = fromlocation.AreaCode; - //dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledToWarehouseCode = fromlocation.WarehouseCode; + dto.HandledToLocationCode = fromlocation.Code; + dto.HandledToLocationGroup = fromlocation.LocationGroupCode; + dto.HandledToLocationArea = fromlocation.AreaCode; + dto.HandledToLocationErpCode = fromlocation.ErpLocationCode; //dto.HandledFromQty = detail.MatQty; //dto.HandledFromLot = string.Empty; //dto.HandledFromPackingCode = string.Empty;