Browse Source

修改 回收料 发料状态

集成Redis
郑勃旭 2 years ago
parent
commit
f993ecaf70
  1. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Entities/SfsMasterAggregateRootBase.cs
  2. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs
  3. 29
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Entities/SfsMasterAggregateRootBase.cs

@ -106,7 +106,6 @@ public abstract class SfsMasterAggregateRootBase<TDetail> : SfsAggregateRootBase
property.SetValue(detail, newValue); property.SetValue(detail, newValue);
} }
} }
/* /*
////todo check ////todo check
//var detail = GetDetail(id); //var detail = GetDetail(id);

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs

@ -55,12 +55,13 @@ public class RecycledMaterialReceiptNoteAppService :
? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) ? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate)
.ConfigureAwait(false) .ConfigureAwait(false)
: input.Number; : input.Number;
entity.SetId(GuidGenerator.Create());
foreach (var detail in entity.Details) foreach (var detail in entity.Details)
{ {
var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate)
.ConfigureAwait(false); .ConfigureAwait(false);
detail.Number=detailNumber; detail.SetIdAndNumber(GuidGenerator, entity.Id, detailNumber);
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false);
detail.LocationErpCode = locationDto.ErpLocationCode; detail.LocationErpCode = locationDto.ErpLocationCode;
detail.LocationArea = locationDto.AreaCode; detail.LocationArea = locationDto.AreaCode;

29
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs

@ -27,7 +27,7 @@ public class MaterialRequestManager
/// <returns></returns> /// <returns></returns>
public virtual async Task<MaterialRequest> CreateBynNumberAsync(MaterialRequest entity) public virtual async Task<MaterialRequest> CreateBynNumberAsync(MaterialRequest entity)
{ {
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(typeof(MaterialRequest).Name, entity.ActiveDate).ConfigureAwait(false) : entity.Number; var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(MaterialRequest), entity.ActiveDate).ConfigureAwait(false) : entity.Number;
entity.SetIdAndNumberWithDetails(GuidGenerator, number); entity.SetIdAndNumberWithDetails(GuidGenerator, number);
entity.Submit(); entity.Submit();
entity.Agree(); entity.Agree();
@ -128,16 +128,35 @@ public class MaterialRequestManager
oldEntity.ReplaceDetail(newDetail.Id, newDetail); oldEntity.ReplaceDetail(newDetail.Id, newDetail);
} }
var flag=oldEntity.Details.Any(p => p.ReceivedQty < p.Qty);//还有补料完 没收到的货 foreach (var detail in oldEntity.Details)
if (!flag)
{ {
oldEntity.Complete(); SetMaterialRequestDetailStatus(detail);
} }
//SetMaterialRequestStatus(oldEntity);
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false); await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
} }
private void SetMaterialRequestDetailStatus(MaterialRequestDetail detail)
{
if (detail.Qty > detail.IssuedQty)//要100 实际只有50
{
if (detail.ReceivedQty >= detail.Qty)//执行的时候发的比100还多 就完成
{
detail.Status = EnumStatus.Close;
}
else
{
detail.Status=EnumStatus.Open;
}
}
else//要100 实际够100
{
detail.Status = EnumStatus.Close;
}
}
public virtual async Task CompleteAsync(string number) public virtual async Task CompleteAsync(string number)
{ {
var entity = await GetByNumberAsync(number).ConfigureAwait(false); var entity = await GetByNumberAsync(number).ConfigureAwait(false);

Loading…
Cancel
Save