|
|
@ -49,36 +49,19 @@ public class ThirdLocationJobManager : SfsJobManagerBase<ThirdLocationJob, Third |
|
|
|
|
|
|
|
|
|
|
|
bool isDone = false; |
|
|
|
var jobDetail = entity.Details.FirstOrDefault(p => p.ItemCode == entity.Details[0].ItemCode); |
|
|
|
//if (jobDetail.RecommendQty == jobDetail.HandledQty + input.Details[0].HandledQty)
|
|
|
|
//{
|
|
|
|
// jobDetail.HandledQty += input.Details[0].HandledQty;
|
|
|
|
// isDone = true;
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// jobDetail.HandledQty = input.Details[0].HandledQty;
|
|
|
|
// isDone = false;
|
|
|
|
//}
|
|
|
|
|
|
|
|
if (jobDetail.RecommendQty == input.Details[0].HandledQty) |
|
|
|
{ |
|
|
|
jobDetail.HandledQty += input.Details[0].HandledQty; |
|
|
|
jobDetail.RecommendQty= jobDetail.RecommendQty- input.Details[0].HandledQty; |
|
|
|
jobDetail.SingleCodeJob = input.Details[0].SingleCodeJob; |
|
|
|
isDone = true; |
|
|
|
} |
|
|
|
else |
|
|
|
foreach(var jobDetail in entity.Details) |
|
|
|
{ |
|
|
|
jobDetail.HandledQty += input.Details[0].HandledQty; |
|
|
|
jobDetail.RecommendQty = jobDetail.RecommendQty - input.Details[0].HandledQty; |
|
|
|
jobDetail.SingleCodeJob = input.Details[0].SingleCodeJob; |
|
|
|
isDone = false; |
|
|
|
} |
|
|
|
var inputDetail= input.Details.FirstOrDefault(p=>p.ItemCode== jobDetail.ItemCode); |
|
|
|
jobDetail.HandledQty += inputDetail.HandledQty; |
|
|
|
jobDetail.RecommendQty = jobDetail.RecommendQty - inputDetail.HandledQty; |
|
|
|
jobDetail.SingleCodeJob = inputDetail.SingleCodeJob; |
|
|
|
|
|
|
|
inputDetail.RecommendQty = jobDetail.RecommendQty; |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var item in entity.Details.FindAll(p => p.ItemCode != entity.Details[0].ItemCode)) |
|
|
|
foreach (var item in entity.Details) |
|
|
|
{ |
|
|
|
if (item.RecommendQty == item.HandledQty) |
|
|
|
if (item.RecommendQty == 0) |
|
|
|
{ |
|
|
|
isDone = true; |
|
|
|
} |
|
|
@ -91,15 +74,14 @@ public class ThirdLocationJobManager : SfsJobManagerBase<ThirdLocationJob, Third |
|
|
|
if (isDone) |
|
|
|
{ |
|
|
|
await entity.CompleteAsync(user.Id, user.Name, Clock.Now).ConfigureAwait(false); |
|
|
|
input.Details[0].RecommendQty = jobDetail.RecommendQty; |
|
|
|
|
|
|
|
await PublishCompletedAsync(input).ConfigureAwait(false); |
|
|
|
return await Repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
//return await base.CompleteAsync(entity, user).ConfigureAwait(false);
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
entity.JobStatus = EnumJobStatus.Partial; |
|
|
|
input.Details[0].RecommendQty = jobDetail.RecommendQty; |
|
|
|
entity.JobStatus = EnumJobStatus.Partial; |
|
|
|
await PublishCompletedAsync(input).ConfigureAwait(false); |
|
|
|
return await Repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|