|
|
@ -99,13 +99,14 @@ public class KittingIssueJobAppService |
|
|
|
[HttpPost("invalid")] |
|
|
|
public override async Task CancelAsync(Guid id) |
|
|
|
{ |
|
|
|
var injectionJob = await _repository.GetAsync(id).ConfigureAwait(false); |
|
|
|
if (injectionJob == null) |
|
|
|
var kittingJob = await _repository.GetAsync(id).ConfigureAwait(false); |
|
|
|
if (kittingJob == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"未找到ID为 {id} 的任务"); |
|
|
|
} |
|
|
|
|
|
|
|
await _kittingIssueJobManager.CancelAsync(injectionJob).ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(kittingJob.Number).ConfigureAwait(false); |
|
|
|
kittingJob.JobStatus = EnumJobStatus.Cancelled; |
|
|
|
await _repository.UpdateAsync(kittingJob).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("cancel-by-request/{requestNumber}")] |
|
|
@ -210,173 +211,52 @@ public class KittingIssueJobAppService |
|
|
|
{ |
|
|
|
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
await RemoveExpectOutAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("CompleteAsync/{id}")] |
|
|
|
/// <summary>
|
|
|
|
/// 完成任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("Complete/{id}")] |
|
|
|
public async Task CompleteAsync(Guid id) |
|
|
|
{ |
|
|
|
var kittingIssueJob=await _repository.FindAsync(id).ConfigureAwait(false); |
|
|
|
var kittingIssueJob = await _repository.FindAsync(id).ConfigureAwait(false); |
|
|
|
|
|
|
|
kittingIssueJob.JobStatus = EnumJobStatus.Done; |
|
|
|
|
|
|
|
await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number, |
|
|
|
kittingIssueJob.Details.First().ItemCode, |
|
|
|
kittingIssueJob.Details.First().HandledToLocationCode, kittingIssueJob.Details.First().HandledToPackingCode, |
|
|
|
kittingIssueJob.Details.First().Status, kittingIssueJob.Details.First().HandledToLot, |
|
|
|
kittingIssueJob.Details.First().HandledToQty).ConfigureAwait(false); |
|
|
|
|
|
|
|
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false); |
|
|
|
|
|
|
|
await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber).ConfigureAwait(false); |
|
|
|
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
#region 私有
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 创建补料记录实体
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="kittingIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<KittingIssueNoteEditInput> BuildKittingIssueNoteAsync(KittingIssueJobDTO kittingIssueJobDto) |
|
|
|
{ |
|
|
|
var kittingIssueNoteCreateInput = |
|
|
|
ObjectMapper.Map<KittingIssueJobDTO, KittingIssueNoteEditInput>(kittingIssueJobDto); |
|
|
|
kittingIssueNoteCreateInput.JobNumber = kittingIssueJobDto.Number; |
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
|
|
|
|
return kittingIssueNoteCreateInput; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在最底层 如果不是则把状态变更为等待 并把库移推荐的From和To赋值
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckMinRowAndSetStatusAsync(KittingIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode != 1) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.Wait; |
|
|
|
} |
|
|
|
else if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode == 1) |
|
|
|
{ |
|
|
|
jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate; |
|
|
|
jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode; |
|
|
|
jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationArea = jobDetailInputdetail.RecommendFromLocationArea; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationCode = jobDetailInputdetail.RecommendFromLocationCode; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationErpCode = jobDetailInputdetail.RecommendFromLocationErpCode; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationGroup = jobDetailInputdetail.RecommendFromLocationGroup; |
|
|
|
jobDetailInputdetail.TransferLibFromLot = jobDetailInputdetail.RecommendFromLot; |
|
|
|
jobDetailInputdetail.TransferLibFromPackingCode = jobDetailInputdetail.RecommendFromPackingCode; |
|
|
|
jobDetailInputdetail.TransferLibFromProduceDate = jobDetailInputdetail.RecommendFromProduceDate; |
|
|
|
jobDetailInputdetail.TransferLibFromQty = jobDetailInputdetail.RecommendFromQty; |
|
|
|
jobDetailInputdetail.TransferLibFromSupplierBatch = jobDetailInputdetail.RecommendFromSupplierBatch; |
|
|
|
jobDetailInputdetail.TransferLibFromWarehouseCode = jobDetailInputdetail.RecommendFromWarehouseCode; |
|
|
|
|
|
|
|
jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate; |
|
|
|
jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode; |
|
|
|
jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate; |
|
|
|
jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot; |
|
|
|
jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode; |
|
|
|
jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate; |
|
|
|
jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty; |
|
|
|
jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch; |
|
|
|
jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.TransferLibFromWarehouseCode; |
|
|
|
jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.TransferLibFromLocationArea; |
|
|
|
jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.TransferLibFromLocationCode; |
|
|
|
jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.TransferLibFromLocationErpCode; |
|
|
|
jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.TransferLibFromLocationGroup; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// 请求点了完成,任务全部都完成
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="requestNumber"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(KittingIssueJobEditInput input) |
|
|
|
[HttpPost("complete-by-request/{requestNumber}")] |
|
|
|
public async Task CompleteByRequestNumberAsync(string requestNumber) |
|
|
|
{ |
|
|
|
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="kittingIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(KittingIssueJobDTO kittingIssueJobDto) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = kittingIssueJobDto.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
//TODO 立体库
|
|
|
|
var ret = await SyncIssueJobStereoAsync(new List<KittingIssueJobDTO> { kittingIssueJobDto }, loctionDto.Code).ConfigureAwait(false); |
|
|
|
if (ret.Code != "1") |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
var kittingIssueJobs = await _repository.GetListAsync(p=>p.KittingRequestNumber==requestNumber).ConfigureAwait(false); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改当前任务状态 和 该任务的请求状态
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="kittingIssueJob"></param>
|
|
|
|
/// <param name="kittingIssueJobDetailDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
private async Task UpdateRequestAndjobStatusDoneAsync(KittingIssueJob kittingIssueJob, |
|
|
|
KittingIssueJobDetailDTO kittingIssueJobDetailDto,decimal handledToQty) |
|
|
|
{ |
|
|
|
if (kittingIssueJob.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None |
|
|
|
or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中
|
|
|
|
foreach (var kittingIssueJob in kittingIssueJobs) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException( |
|
|
|
$"任务状态错误:编号为【{kittingIssueJob.Number}】的任务状态为【{kittingIssueJob.JobStatus.GetDisplayName()}】"); |
|
|
|
kittingIssueJob.JobStatus = EnumJobStatus.Done; |
|
|
|
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
kittingIssueJob.JobStatus = EnumJobStatus.Done; |
|
|
|
|
|
|
|
await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number, |
|
|
|
kittingIssueJobDetailDto.ItemCode, |
|
|
|
kittingIssueJobDetailDto.HandledToLocationCode, kittingIssueJobDetailDto.HandledToPackingCode, |
|
|
|
kittingIssueJobDetailDto.Status, kittingIssueJobDetailDto.HandledToLot, |
|
|
|
handledToQty).ConfigureAwait(false); |
|
|
|
|
|
|
|
//await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
|
|
|
|
|
|
|
|
await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 立库
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 立体库同步
|
|
|
@ -386,7 +266,7 @@ public class KittingIssueJobAppService |
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("sync-issue-job-stereo")] |
|
|
|
|
|
|
|
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input,string p_loc) |
|
|
|
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input, string p_loc) |
|
|
|
{ |
|
|
|
ReusltObject ret = new ReusltObject(); |
|
|
|
ret.Code = "1"; |
|
|
@ -415,7 +295,7 @@ public class KittingIssueJobAppService |
|
|
|
var httpclient = _httpClientFactory.CreateClient(); |
|
|
|
#if DEBUG
|
|
|
|
|
|
|
|
string json= System.Text.Json.JsonSerializer.Serialize(main); |
|
|
|
string json = System.Text.Json.JsonSerializer.Serialize(main); |
|
|
|
_options.Value.Address = "http://localhost:59094/";//测试地址
|
|
|
|
_options.Value.Token = "";//测试token
|
|
|
|
_options.Value.UserName = "";//测试用户名
|
|
|
@ -425,7 +305,7 @@ public class KittingIssueJobAppService |
|
|
|
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|
|
|
{ |
|
|
|
var token = _options.Value.Token; |
|
|
|
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",token ); |
|
|
|
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(_options.Value.UserName) && !string.IsNullOrEmpty(_options.Value.Password)) |
|
|
|
{ |
|
|
@ -437,13 +317,14 @@ public class KittingIssueJobAppService |
|
|
|
IssueJobToRestoClient client = new IssueJobToRestoClient(_options.Value.Address, httpclient); |
|
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
|
} |
|
|
|
catch(Exception ex) { |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
ret = new ReusltObject(); |
|
|
|
ret.Code = "2"; |
|
|
|
ret.Message=ex.Message; |
|
|
|
ret.Message = ex.Message; |
|
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
@ -453,7 +334,7 @@ public class KittingIssueJobAppService |
|
|
|
{ |
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
var json= System.Text.Json.JsonSerializer.Serialize(input); |
|
|
|
var json = System.Text.Json.JsonSerializer.Serialize(input); |
|
|
|
#endif
|
|
|
|
List<string> errors = new List<string>(); |
|
|
|
var ret = new ReusltObject() |
|
|
@ -480,7 +361,7 @@ public class KittingIssueJobAppService |
|
|
|
foreach (var itm in dtos) |
|
|
|
{ |
|
|
|
var first = jobs.FirstOrDefault<IssueJobFromRestoDTO>(p => p.JobNumber == itm.Number); |
|
|
|
var itmDetails= itm.Details.ToList(); |
|
|
|
var itmDetails = itm.Details.ToList(); |
|
|
|
List<KittingIssueJobDetailDTO> details = new List<KittingIssueJobDetailDTO>(); |
|
|
|
foreach (var detail in first.Details) |
|
|
|
{ |
|
|
@ -493,7 +374,7 @@ public class KittingIssueJobAppService |
|
|
|
dto.RecommendToQty = detail.Qty; |
|
|
|
dto.HandledFromQty = detail.Qty; |
|
|
|
dto.HandledToQty = detail.Qty; |
|
|
|
dto.Status =entity.Status; |
|
|
|
dto.Status = entity.Status; |
|
|
|
details.Add(dto); |
|
|
|
} |
|
|
|
itm.Details = details; |
|
|
@ -527,5 +408,157 @@ public class KittingIssueJobAppService |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 私有
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 创建补料记录实体
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="kittingIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<KittingIssueNoteEditInput> BuildKittingIssueNoteAsync(KittingIssueJobDTO kittingIssueJobDto) |
|
|
|
{ |
|
|
|
var kittingIssueNoteCreateInput = |
|
|
|
ObjectMapper.Map<KittingIssueJobDTO, KittingIssueNoteEditInput>(kittingIssueJobDto); |
|
|
|
kittingIssueNoteCreateInput.JobNumber = kittingIssueJobDto.Number; |
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
|
|
|
|
return kittingIssueNoteCreateInput; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在最底层 如果不是则把状态变更为等待 并把库移推荐的From和To赋值
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckMinRowAndSetStatusAsync(KittingIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode != 1) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.Wait; |
|
|
|
} |
|
|
|
else if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode == 1) |
|
|
|
{ |
|
|
|
jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate; |
|
|
|
jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode; |
|
|
|
jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationArea = jobDetailInputdetail.RecommendFromLocationArea; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationCode = jobDetailInputdetail.RecommendFromLocationCode; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationErpCode = jobDetailInputdetail.RecommendFromLocationErpCode; |
|
|
|
jobDetailInputdetail.TransferLibFromLocationGroup = jobDetailInputdetail.RecommendFromLocationGroup; |
|
|
|
jobDetailInputdetail.TransferLibFromLot = jobDetailInputdetail.RecommendFromLot; |
|
|
|
jobDetailInputdetail.TransferLibFromPackingCode = jobDetailInputdetail.RecommendFromPackingCode; |
|
|
|
jobDetailInputdetail.TransferLibFromProduceDate = jobDetailInputdetail.RecommendFromProduceDate; |
|
|
|
jobDetailInputdetail.TransferLibFromQty = jobDetailInputdetail.RecommendFromQty; |
|
|
|
jobDetailInputdetail.TransferLibFromSupplierBatch = jobDetailInputdetail.RecommendFromSupplierBatch; |
|
|
|
jobDetailInputdetail.TransferLibFromWarehouseCode = jobDetailInputdetail.RecommendFromWarehouseCode; |
|
|
|
|
|
|
|
jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate; |
|
|
|
jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode; |
|
|
|
jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate; |
|
|
|
jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot; |
|
|
|
jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode; |
|
|
|
jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate; |
|
|
|
jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty; |
|
|
|
jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch; |
|
|
|
jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.TransferLibFromWarehouseCode; |
|
|
|
jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.TransferLibFromLocationArea; |
|
|
|
jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.TransferLibFromLocationCode; |
|
|
|
jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.TransferLibFromLocationErpCode; |
|
|
|
jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.TransferLibFromLocationGroup; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(KittingIssueJobEditInput 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="kittingIssueJobDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(KittingIssueJobDTO kittingIssueJobDto) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = kittingIssueJobDto.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
//TODO 立体库
|
|
|
|
var ret = await SyncIssueJobStereoAsync(new List<KittingIssueJobDTO> { kittingIssueJobDto }, loctionDto.Code).ConfigureAwait(false); |
|
|
|
if (ret.Code != "1") |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改当前任务状态 和 该任务的请求状态
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="kittingIssueJob"></param>
|
|
|
|
/// <param name="kittingIssueJobDetailDto"></param>
|
|
|
|
/// <param name="handledToQty"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
private async Task UpdateRequestAndjobStatusDoneAsync(KittingIssueJob kittingIssueJob, |
|
|
|
KittingIssueJobDetailDTO kittingIssueJobDetailDto,decimal handledToQty) |
|
|
|
{ |
|
|
|
if (kittingIssueJob.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None |
|
|
|
or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中
|
|
|
|
{ |
|
|
|
throw new UserFriendlyException( |
|
|
|
$"任务状态错误:编号为【{kittingIssueJob.Number}】的任务状态为【{kittingIssueJob.JobStatus.GetDisplayName()}】"); |
|
|
|
} |
|
|
|
|
|
|
|
kittingIssueJob.JobStatus = EnumJobStatus.Done; |
|
|
|
|
|
|
|
await RemoveExpectOutAsync(kittingIssueJob, kittingIssueJobDetailDto, handledToQty).ConfigureAwait(false); |
|
|
|
|
|
|
|
//await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
|
|
|
|
|
|
|
|
await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
private async Task RemoveExpectOutAsync(KittingIssueJob kittingIssueJob, KittingIssueJobDetailDTO kittingIssueJobDetailDto, |
|
|
|
decimal handledToQty) |
|
|
|
{ |
|
|
|
await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number, |
|
|
|
kittingIssueJobDetailDto.ItemCode, |
|
|
|
kittingIssueJobDetailDto.HandledToLocationCode, kittingIssueJobDetailDto.HandledToPackingCode, |
|
|
|
kittingIssueJobDetailDto.Status, kittingIssueJobDetailDto.HandledToLot, |
|
|
|
handledToQty).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|