Browse Source

修复盘点描述和新增任务号、计划单号不正确问题

交付给东阳的源代码
周红军 2 weeks ago
parent
commit
c30fcb0b1d
  1. 38
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs

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

@ -310,24 +310,27 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
//var oldDepDetail = entity.DepDetails.FirstOrDefault(r => r.ItemCode == depDetail.ItemCode && r.PackingCode == depDetail.PackingCode && r.LocationCode == depDetail.LocationCode && r.InventoryStage == entity.InventoryStage && r.Lot == depDetail.Lot);
var oldDepDetail = entity.DepDetails.FirstOrDefault(r => r.Id == new Guid(depDetail.Id.ToString()));
if (depDetail.IsDelete)
{
countCount = -oldDepDetail.CountQty;
entity.DepDetails.Remove(oldDepDetail);
//移除的扫描记录盘点数量与计划中盘点数量一致,移除计划中的物料
var planDB = await _planRepository.FindAsync(r => r.Number == input.CountPlanNumber).ConfigureAwait(false);
if (planDB != null)
{
if(oldDepDetail != null)
{
var planDetailDB = planDB.Details.FirstOrDefault(r => r.ItemCode == depDetail.ItemCode && r.PackingCode == depDetail.PackingCode && r.LocationCode == depDetail.LocationCode && r.Lot == depDetail.Lot && r.Status == depDetail.Status);
if (planDetailDB != null)
countCount = -oldDepDetail.CountQty;
entity.DepDetails.Remove(oldDepDetail);
//移除的扫描记录盘点数量与计划中盘点数量一致,移除计划中的物料
var planDB = await _planRepository.FindAsync(r => r.Number == input.CountPlanNumber).ConfigureAwait(false);
if (planDB != null)
{
if(planDetailDB.FinalCountQty == oldDepDetail.CountQty)
var planDetailDB = planDB.Details.FirstOrDefault(r => r.ItemCode == depDetail.ItemCode && r.PackingCode == depDetail.PackingCode && r.LocationCode == depDetail.LocationCode && r.Lot == depDetail.Lot && r.Status == depDetail.Status);
if (planDetailDB != null)
{
planDB.Details.Remove(planDetailDB);
await _planRepository.UpdateAsync(planDB).ConfigureAwait(false);
if (planDetailDB.FinalCountQty == oldDepDetail.CountQty)
{
planDB.Details.Remove(planDetailDB);
await _planRepository.UpdateAsync(planDB).ConfigureAwait(false);
}
}
}
}
}
}
else
{
@ -335,6 +338,7 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
{
countCount = depDetail.CountQty - oldDepDetail.CountQty;
oldDepDetail.CountQty = depDetail.CountQty;
oldDepDetail.CountDescription = depDetail.CountDescription;
}
else
{
@ -358,14 +362,16 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
jobDetail.ProduceDate = DateTime.Now;
jobDetail.ExpireDate = DateTime.Parse("9999-12-31 23:59:59.9999999");
jobDetail.InventoryQty = 0;
var detailNumber = await GetNumber().ConfigureAwait(false);
jobDetail.SetIdAndNumber(GuidGenerator, entity.Id, detailNumber);
//var detailNumber = await GetNumber().ConfigureAwait(false);
jobDetail.CountPlanNumber = input.CountPlanNumber;
jobDetail.SetIdAndNumber(GuidGenerator, entity.Id, depDetail.Number);
jobDetail.CountLabel = GuidGenerator.Create().ToString();
entity.Details.Add(jobDetail);
}
else
{
await entity.SetDetail(detail.Id, detail.SupplierBatch, detail.ArriveDate, detail.ProduceDate, detail.ExpireDate, detail.LocationCode, countCount, detail.CountTime, detail.CountOperator, detail.CountDescription)
await entity.SetDetail(detail.Id, detail.SupplierBatch, detail.ArriveDate, detail.ProduceDate, detail.ExpireDate, detail.LocationCode, countCount, detail.CountTime, detail.CountOperator, depDetail.CountDescription)
.ConfigureAwait(false);
}
}

Loading…
Cancel
Save