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 6518d705a..fc34f70e0 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 @@ -298,6 +298,91 @@ public class CoatingIssueJobAppService await CancelAcceptAsync(masterId).ConfigureAwait(false); } + /// + /// 执行任务明细 + /// + /// + [HttpPost("ExecuteDetail/{masterId}")] + public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, CoatingIssueJobDetailDTO issueJobDetailDto) + { + var coatingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); + coatingIssueJob.JobStatus = EnumJobStatus.Doing; + if (coatingIssueJob.IsClaims) + { + if (coatingIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{coatingIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } + + var coatingIssueJobDto = ObjectMapper.Map(coatingIssueJob); + + var fromLocationDto = await _locationAppService.GetByCodeAsync(issueJobDetailDto.HandledFromLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(issueJobDetailDto.HandledToLocationCode).ConfigureAwait(false); + + issueJobDetailDto.HandledFromLocationArea = fromLocationDto.AreaCode; + issueJobDetailDto.HandledFromLocationGroup = fromLocationDto.LocationGroupCode; + issueJobDetailDto.HandledFromLocationErpCode = fromLocationDto.ErpLocationCode; + issueJobDetailDto.HandledFromWarehouseCode = fromLocationDto.WarehouseCode; + + issueJobDetailDto.HandledToLocationArea = toLocationDto.AreaCode; + issueJobDetailDto.HandledToLocationGroup = toLocationDto.LocationGroupCode; + issueJobDetailDto.HandledToLocationErpCode = toLocationDto.ErpLocationCode; + issueJobDetailDto.HandledToWarehouseCode = toLocationDto.WarehouseCode; + + coatingIssueJobDto.Details = new List { issueJobDetailDto }; + var coatingIssueNoteEditInput = await BuildCoatingIssueNoteAsync(coatingIssueJobDto).ConfigureAwait(false); + await _coatingIssueNoteAppService.CreateAsync(coatingIssueNoteEditInput).ConfigureAwait(false); + + var issueJobDetail = ObjectMapper.Map(issueJobDetailDto); + var entityDetail = coatingIssueJob.Details.Find(p => p.Id == detailId); + issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; + issueJobDetail.HandledToQty = entityDetail.HandledToQty; + + issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; + issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; + coatingIssueJob.Details = new EditableList { issueJobDetail }; + coatingIssueJob.CompleteUserId = _currentUser.Id; + coatingIssueJob.CompleteUserName = _currentUser.Name; + coatingIssueJob.CompleteTime = DateTime.Now; + if (coatingIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成 + { + if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode) + { + await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, coatingIssueJob.Number) + .ConfigureAwait(false); + } + + await UpdateRequestAndjobStatusDoneAsync(coatingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + await _expectOutAppService.RemoveByNumberAsync(coatingIssueJob.Number).ConfigureAwait(false); + } + else + { + var detail = coatingIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); + if (issueJobDetail.HandledToQty >= detail.RequestQty) + { + await UpdateRequestAndjobStatusDoneAsync(coatingIssueJob, issueJobDetailDto, + issueJobDetailDto.HandledToQty).ConfigureAwait(false); + } + else + { + await RemoveExpectOutAsync(coatingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + } + } + + await _repository.UpdateAsync(coatingIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); + } + + + + /// /// 完成任务 /// @@ -898,7 +983,7 @@ public class CoatingIssueJobAppService details.Add(dto); - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + 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/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs index 5ac57f944..44b14ef50 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 @@ -280,6 +280,80 @@ public class InjectionIssueJobAppService await CancelAcceptAsync(masterId).ConfigureAwait(false); } + /// + /// 执行任务明细 + /// + /// + [HttpPost("ExecuteDetail/{masterId}")] + public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, InjectionIssueJobDetailDTO issueJobDetailDto) + { + var injectionIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); + injectionIssueJob.JobStatus = EnumJobStatus.Doing; + if (injectionIssueJob.IsClaims) + { + if (injectionIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{injectionIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } + + var injectionIssueJobDto = ObjectMapper.Map(injectionIssueJob); + injectionIssueJobDto.Details = new List { issueJobDetailDto }; + var injectionIssueNoteEditInput = await BuildInjectionIssueNoteAsync(injectionIssueJobDto).ConfigureAwait(false); + await _injectionIssueNoteAppService.CreateAsync(injectionIssueNoteEditInput).ConfigureAwait(false); + + var issueJobDetail = ObjectMapper.Map(issueJobDetailDto); + var entityDetail = injectionIssueJob.Details.Find(p => p.Id == detailId); + issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; + issueJobDetail.HandledToQty = entityDetail.HandledToQty; + + issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; + issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; + injectionIssueJob.Details = new EditableList { issueJobDetail }; + injectionIssueJob.CompleteUserId = _currentUser.Id; + injectionIssueJob.CompleteUserName = _currentUser.Name; + injectionIssueJob.CompleteTime = DateTime.Now; + if (injectionIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成 + { + if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode) + { + await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, injectionIssueJob.Number).ConfigureAwait(false); + } + + await UpdateRequestAndjobStatusDoneAsync(injectionIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + await _expectOutAppService.RemoveByNumberAsync(injectionIssueJob.Number).ConfigureAwait(false); + } + else + { + var detail = injectionIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); + if (issueJobDetail.HandledToQty >= detail.RequestQty) + { + await UpdateRequestAndjobStatusDoneAsync(injectionIssueJob, issueJobDetailDto, + issueJobDetailDto.HandledToQty).ConfigureAwait(false); + } + else + { + await RemoveExpectOutAsync(injectionIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + } + } + + await _repository.UpdateAsync(injectionIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); + } + + + + + + + + /// /// 完成任务 /// @@ -850,7 +924,7 @@ public class InjectionIssueJobAppService details.Add(dto); - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + 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/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs index 410a9355f..6e6689621 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 @@ -288,6 +288,78 @@ public class KittingIssueJobAppService await CancelAcceptAsync(masterId).ConfigureAwait(false); } + /// + /// 执行任务明细 + /// + /// + [HttpPost("ExecuteDetail/{masterId}")] + public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto) + { + var kittingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); + kittingIssueJob.JobStatus = EnumJobStatus.Doing; + if (kittingIssueJob.IsClaims) + { + if (kittingIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{kittingIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } + + var kittingIssueJobDto = ObjectMapper.Map(kittingIssueJob); + kittingIssueJobDto.Details = new List { issueJobDetailDto }; + var kittingIssueNoteEditInput = await BuildKittingIssueNoteAsync(kittingIssueJobDto).ConfigureAwait(false); + await _kittingIssueNoteAppService.CreateAsync(kittingIssueNoteEditInput).ConfigureAwait(false); + + var issueJobDetail = ObjectMapper.Map(issueJobDetailDto); + var entityDetail = kittingIssueJob.Details.Find(p => p.Id == detailId); + issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; + issueJobDetail.HandledToQty = entityDetail.HandledToQty; + + issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; + issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; + kittingIssueJob.Details = new EditableList { issueJobDetail }; + kittingIssueJob.CompleteUserId = _currentUser.Id; + kittingIssueJob.CompleteUserName = _currentUser.Name; + kittingIssueJob.CompleteTime = DateTime.Now; + if (kittingIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成 + { + if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode) + { + await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, kittingIssueJob.Number).ConfigureAwait(false); + } + + await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false); + } + else + { + var detail = kittingIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); + if (issueJobDetail.HandledToQty >= detail.RequestQty) + { + await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, + issueJobDetailDto.HandledToQty).ConfigureAwait(false); + } + else + { + await RemoveExpectOutAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + } + } + + await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); + } + + + + + + /// /// 完成任务 /// @@ -859,7 +931,7 @@ public class KittingIssueJobAppService details.Add(dto); - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + 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/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs index 39a11bc11..6f16c88f6 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 @@ -278,6 +278,75 @@ public class SparePartIssueJobAppService await CancelAcceptAsync(masterId).ConfigureAwait(false); } + /// + /// 执行任务明细 + /// + /// + [HttpPost("ExecuteDetail/{masterId}")] + public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, SparePartIssueJobDetailDTO issueJobDetailDto) + { + var sparePartIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); + sparePartIssueJob.JobStatus = EnumJobStatus.Doing; + 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); + await _sparePartIssueNoteAppService.CreateAsync(sparePartIssueNoteEditInput).ConfigureAwait(false); + + var issueJobDetail = ObjectMapper.Map(issueJobDetailDto); + var entityDetail = sparePartIssueJob.Details.Find(p => p.Id == detailId); + issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; + issueJobDetail.HandledToQty = entityDetail.HandledToQty; + + issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; + issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; + sparePartIssueJob.Details = new EditableList { issueJobDetail }; + sparePartIssueJob.CompleteUserId = _currentUser.Id; + sparePartIssueJob.CompleteUserName = _currentUser.Name; + sparePartIssueJob.CompleteTime = DateTime.Now; + if (sparePartIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成 + { + if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode) + { + await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, sparePartIssueJob.Number).ConfigureAwait(false); + } + + await UpdateRequestAndjobStatusDoneAsync(sparePartIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + await _expectOutAppService.RemoveByNumberAsync(sparePartIssueJob.Number).ConfigureAwait(false); + } + else + { + var detail = sparePartIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); + if (issueJobDetail.HandledToQty >= detail.RequestQty) + { + await UpdateRequestAndjobStatusDoneAsync(sparePartIssueJob, issueJobDetailDto, + issueJobDetailDto.HandledToQty).ConfigureAwait(false); + } + else + { + await RemoveExpectOutAsync(sparePartIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + .ConfigureAwait(false); + } + } + + await _repository.UpdateAsync(sparePartIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); + } + + + /// /// 完成任务 /// @@ -837,7 +906,7 @@ public class SparePartIssueJobAppService details.Add(dto); - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); } if (errors.Count > 0)