Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
郑勃旭 11 months ago
parent
commit
adfd5c2e7d
  1. 13
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs
  2. 40
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ThirdLocationJobs/ThirdLocationJobManager.cs
  3. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ThirdLocationNotes/ThirdLocationNoteDbContextModelCreatingExtensions.cs
  4. 13
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs

13
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs

@ -22,16 +22,19 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
private readonly IBalanceAppService _balanceAppService; private readonly IBalanceAppService _balanceAppService;
private readonly ICountJobRepository _repository; private readonly ICountJobRepository _repository;
private readonly ICountNoteRepository _noteRepository; private readonly ICountNoteRepository _noteRepository;
private readonly ICountAdjustRequestRepository _countAdjustRequestRepository;
public CountJobManager( public CountJobManager(
ICountJobRepository repository, ICountJobRepository repository,
IBalanceAppService balanceAppService, IBalanceAppService balanceAppService,
ICountNoteRepository noteRepository ICountNoteRepository noteRepository,
ICountAdjustRequestRepository countAdjustRequestRepository
) : base(repository) ) : base(repository)
{ {
_noteRepository = noteRepository; _noteRepository = noteRepository;
_balanceAppService = balanceAppService; _balanceAppService = balanceAppService;
_repository = repository; _repository = repository;
_countAdjustRequestRepository= countAdjustRequestRepository;
} }
/// <summary> /// <summary>
/// 根据选择的任务号码重置盘点任务 /// 根据选择的任务号码重置盘点任务
@ -47,13 +50,13 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
{ {
throw new UserFriendlyException($"所选任务属于多个盘点计划,无法重盘!"); throw new UserFriendlyException($"所选任务属于多个盘点计划,无法重盘!");
} }
foreach (var job in joblist) var note = await _noteRepository.FindAsync(r => r.CountPlanNumber == planNumbers.First()).ConfigureAwait(false);
{
var note = await _noteRepository.FindAsync(r => r.CountJobNumber == job.Number).ConfigureAwait(false);
if (note != null && note.Adjusted == true) if (note != null && note.Adjusted == true)
{ {
throw new UserFriendlyException($"任务号 【{job.Number}】生成的记录【{note.Number}】已经进行了调整,无法重盘"); throw new UserFriendlyException($"计划单号 【{note.CountPlanNumber}】生成了调整纪律,无法重盘");
} }
foreach (var job in joblist)
{
job.JobStatus = EnumJobStatus.Open; job.JobStatus = EnumJobStatus.Open;
var details = job.Details.Where(r => r.InventoryStage == job.InventoryStage && r.InventoryQty != 0).ToList(); var details = job.Details.Where(r => r.InventoryStage == job.InventoryStage && r.InventoryQty != 0).ToList();
List<CountJobDetail> newDetails = new List<CountJobDetail>(); List<CountJobDetail> newDetails = new List<CountJobDetail>();

40
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ThirdLocationJobs/ThirdLocationJobManager.cs

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

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ThirdLocationNotes/ThirdLocationNoteDbContextModelCreatingExtensions.cs

@ -56,8 +56,8 @@ public static class ThirdLocationNoteDbContextModelCreatingExtensions
//Relations //Relations
//Indexes //Indexes
b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode }).IsUnique(); //b.HasIndex(q => new { q.Number, q.ItemCode, q.FromLocationCode, q.ToLocationCode }).IsUnique();
b.HasIndex(q => new { q.FromPackingCode }); b.HasIndex(q => new { q.Number });
}); });
} }
} }

13
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs

@ -55,17 +55,18 @@ public class ThirdLocationNoteEventHandler
if(requestEntities.Count>0 && entity.Details.Count>0) if(requestEntities.Count>0 && entity.Details.Count>0)
{ {
bool isDone = false; bool isDone = false;
var requestDetail = requestEntities[0].Details.FirstOrDefault(p => p.ItemCode == entity.Details[0].ItemCode); foreach(var item in requestEntities[0].Details)
if(requestDetail != null)
{ {
requestDetail.ReceivedQty += entity.Details[0].HandledQty; var noteDetail = entity.Details.FirstOrDefault(p => p.ItemCode == item.ItemCode);
if(requestDetail.IssuedQty == requestDetail.ReceivedQty) if(noteDetail != null)
{ {
isDone = true; item.ReceivedQty += noteDetail.HandledQty;
} }
} }
foreach(var item in requestEntities[0].Details.FindAll(p=>p.ItemCode!= entity.Details[0].ItemCode)) foreach(var item in requestEntities[0].Details)
{ {
if(item.IssuedQty == item.ReceivedQty) if(item.IssuedQty == item.ReceivedQty)
{ {

Loading…
Cancel
Save