Browse Source

粉碎了和回收料

dev_DY_CC
lvzb 1 year ago
parent
commit
d43255ae85
  1. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/Inputs/ItemTransformNoteEditInput.cs
  2. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteAppService.cs
  3. 19
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs
  4. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs
  5. 34
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs
  6. 161
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/Inputs/ItemTransformNoteEditInput.cs

@ -33,5 +33,10 @@ public class ItemTransformNoteEditInput : SfsStoreCreateOrUpdateInputBase
/// </summary>
[Display(Name = "明细列表")]
public List<ItemTransformNoteDetailInput> Details { get; set; } = new List<ItemTransformNoteDetailInput>();
/// <summary>
/// 混拌料入库数据
/// </summary>
public List<RecycledMaterialReceiptNoteDetailInput> RecDetails { get; set; } = new List<RecycledMaterialReceiptNoteDetailInput>();
#endregion
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteAppService.cs

@ -6,4 +6,5 @@ public interface IRecycledMaterialReceiptNoteAppService
: ISfsStoreMasterReadOnlyAppServiceBase<RecycledMaterialReceiptNoteDTO, SfsStoreRequestInputBase, RecycledMaterialReceiptNoteDetailDTO, SfsStoreRequestInputBase>
{
Task<RecycledMaterialReceiptNoteDTO> CreateAsync(RecycledMaterialReceiptNoteEditInput input);
Task<RecycledMaterialReceiptNoteDTO> NewCreateAsync(RecycledMaterialReceiptNoteEditInput input);
}

19
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs

@ -20,13 +20,16 @@ public class ItemTransformNoteAppService :
{
private readonly IItemTransformNoteManager _ItemTransformNoteManager;
private readonly ILocationCapacityAppService _locationCapacityAppService;
private readonly IRecycledMaterialReceiptNoteAppService _recycledMaterialReceiptNoteAppService;
public ItemTransformNoteAppService(IItemTransformNoteRepository repository,
IItemTransformNoteManager ItemTransformNoteManager,
ILocationCapacityAppService locationCapacityAppService) : base(repository)
ILocationCapacityAppService locationCapacityAppService,
IRecycledMaterialReceiptNoteAppService recycledMaterialReceiptNoteAppService) : base(repository)
{
_ItemTransformNoteManager = ItemTransformNoteManager;
_locationCapacityAppService = locationCapacityAppService;
_recycledMaterialReceiptNoteAppService = recycledMaterialReceiptNoteAppService;
}
[HttpPost("")]
@ -41,4 +44,18 @@ public class ItemTransformNoteAppService :
return dto;
}
[HttpPost("new-create")]
//[Authorize(ItemTransformNotePermissions.Create)]
public async Task<ItemTransformNoteDTO> NewCreateAsync(ItemTransformNoteEditInput input)
{
var entity = ObjectMapper.Map<ItemTransformNoteEditInput, ItemTransformNote>(input);
await _ItemTransformNoteManager.CreateAsync(entity).ConfigureAwait(false);
var recInput = ObjectMapper.Map<ItemTransformNoteEditInput, RecycledMaterialReceiptNoteEditInput>(input);
await _recycledMaterialReceiptNoteAppService.NewCreateAsync(recInput).ConfigureAwait(false);
var dto = ObjectMapper.Map<ItemTransformNote, ItemTransformNoteDTO>(entity);
return dto;
}
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs

@ -30,7 +30,12 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.Number)
.Ignore(x => x.Id)
.Ignore(x=>x.ExtraProperties)
.Ignore(x => x.Remark)
;
.Ignore(x => x.Remark);
CreateMap<ItemTransformNoteEditInput, RecycledMaterialReceiptNoteEditInput>()
.ForMember(x => x.Details, y => y.MapFrom(d => d.RecDetails))
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Remark);
}
}

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

@ -78,4 +78,38 @@ public class RecycledMaterialReceiptNoteAppService :
return ObjectMapper.Map<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDTO>(entity);
}
/// <summary>
/// 新增实体
/// </summary>
/// <param name="input">CreateInput</param>
[HttpPost("new-create")]
public async Task<RecycledMaterialReceiptNoteDTO> NewCreateAsync(RecycledMaterialReceiptNoteEditInput input)
{
var entity = ObjectMapper.Map<RecycledMaterialReceiptNoteEditInput, RecycledMaterialReceiptNote>(input);
entity.Number = string.IsNullOrEmpty(input.Number)
? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate)
.ConfigureAwait(false)
: input.Number;
entity.SetId(GuidGenerator.Create());
foreach (var detail in entity.Details)
{
var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate)
.ConfigureAwait(false);
detail.SetIdAndNumber(GuidGenerator, entity.Id, detailNumber);
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false);
detail.LocationErpCode = locationDto.ErpLocationCode;
detail.LocationArea = locationDto.AreaCode;
detail.LocationGroup = locationDto.LocationGroupCode;
detail.WarehouseCode = locationDto.WarehouseCode;
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
detail.StdPackQty = itemBasicDto.StdPackQty;
detail.Uom = itemBasicDto.BasicUom;
}
entity = await _repository.InsertAsync(entity).ConfigureAwait(false);
return ObjectMapper.Map<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDTO>(entity);
}
}

161
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
@ -28,10 +29,11 @@ public class ItemTransformNoteEventHandler
private async Task AddTransactionsAsync(ItemTransformNote note)
{
var inboundTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(BuildTransactions(note));
var noTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(NewBuildTransactions(note));//原料+混拌料
noTransactions.AddRange(BuildNoTransactions(note));//粉碎料
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
await TransactionAppService.AddManyEmptyAsync(noTransactions).ConfigureAwait(false);
}
@ -46,14 +48,16 @@ public class ItemTransformNoteEventHandler
{
var inboundTransactions = new List<TransactionEditInput>();
var noTransactions = new List<TransactionEditInput>();
//如果要做库存事务汇总,可以修改此处
foreach (var note in notes)
{
inboundTransactions.AddRange(BuildTransactions(note));
inboundTransactions.AddRange(NewBuildTransactions(note));//原料+混拌料
noTransactions.AddRange(BuildNoTransactions(note));//粉碎料
}
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
await TransactionAppService.AddManyEmptyAsync(noTransactions).ConfigureAwait(false);
}
private static List<TransactionEditInput> BuildTransactions(ItemTransformNote note)
@ -131,4 +135,151 @@ public class ItemTransformNoteEventHandler
return transactions;
}
/// <summary>
/// 新回收料库存方法
/// </summary>
/// <param name="note"></param>
/// <returns></returns>
private static List<TransactionEditInput> NewBuildTransactions(ItemTransformNote note)
{
var transactions = new List<TransactionEditInput>();
//根据调整记录,构造库存转移记录(只添加原料得)
foreach (var detail in note.Details.Where(r => r.Remark == "原料"))
{
var transactionOut = new TransactionEditInput()
{
Worker = note.Worker,
JobNumber = note.JobNumber,
DocNumber = note.Number,
TransType = Type,
TransSubType = SubType,
TransInOut = EnumTransInOut.Out,
LocationArea = detail.FromLocationArea,
LocationGroup = detail.FromLocationGroup,
LocationErpCode = detail.FromLocationErpCode,
PackingCode = detail.FromPackingCode,
ItemCode = detail.ItemCode,
Lot = detail.FromLot,
Status = detail.FromStatus,
WarehouseCode = detail.FromWarehouseCode,
LocationCode = detail.FromLocationCode,
ContainerCode = detail.FromContainerCode,
SupplierBatch = detail.FromSupplierBatch,
ArriveDate = detail.FromArriveDate,
ProduceDate = detail.FromProduceDate,
ExpireDate = detail.FromExpireDate,
ItemName = detail.ItemName,
ItemDesc1 = detail.ItemDesc1,
ItemDesc2 = detail.ItemDesc2,
Uom = detail.Uom,
Qty = -detail.FromQty,
};
transactions.Add(transactionOut);
}
//混拌料添加事务
var detailfirst = note.Details.First(r => r.Remark == "原料");
var transactionIn = new TransactionEditInput()
{
Worker = note.Worker,
JobNumber = note.JobNumber,
DocNumber = note.Number,
TransType = Type,
TransSubType = SubType,
TransInOut = EnumTransInOut.In,
PackingCode = detailfirst.ToPackingCode,
ItemCode = detailfirst.ToItemCode,
Lot = detailfirst.ToLot,
Status = detailfirst.ToStatus,
LocationArea = detailfirst.ToLocationArea,
LocationGroup = detailfirst.ToLocationGroup,
LocationErpCode = detailfirst.ToLocationErpCode,
WarehouseCode = detailfirst.ToWarehouseCode,
LocationCode = detailfirst.ToLocationCode,
ContainerCode = detailfirst.ToContainerCode,
SupplierBatch = detailfirst.ToSupplierBatch,
ArriveDate = detailfirst.ToArriveDate,
ProduceDate = detailfirst.ToProduceDate,
ExpireDate = detailfirst.ToExpireDate,
ItemName = detailfirst.ItemName,
ItemDesc1 = detailfirst.ItemDesc1,
ItemDesc2 = detailfirst.ItemDesc2,
Uom = detailfirst.Uom,
Qty = detailfirst.ToQty,
};
transactions.Add(transactionIn);
return transactions;
}
private static List<TransactionEditInput> BuildNoTransactions(ItemTransformNote note)
{
var transactions = new List<TransactionEditInput>();
//根据调整记录,构造库存转移记录(只添加原料得)
foreach (var detail in note.Details.Where(r => r.Remark != "原料"))
{
var transactionOut = new TransactionEditInput()
{
Worker = note.Worker,
JobNumber = note.JobNumber,
DocNumber = note.Number,
TransType = Type,
TransSubType = SubType,
TransInOut = EnumTransInOut.Out,
LocationArea = detail.FromLocationArea,
LocationGroup = detail.FromLocationGroup,
LocationErpCode = detail.FromLocationErpCode,
PackingCode = detail.FromPackingCode,
ItemCode = detail.ItemCode,
Lot = detail.FromLot,
Status = detail.FromStatus,
WarehouseCode = detail.FromWarehouseCode,
LocationCode = detail.FromLocationCode,
ContainerCode = detail.FromContainerCode,
SupplierBatch = detail.FromSupplierBatch,
ArriveDate = detail.FromArriveDate,
ProduceDate = detail.FromProduceDate,
ExpireDate = detail.FromExpireDate,
ItemName = detail.ItemName,
ItemDesc1 = detail.ItemDesc1,
ItemDesc2 = detail.ItemDesc2,
Uom = detail.Uom,
Qty = -detail.FromQty,
};
transactions.Add(transactionOut);
var transactionIn = new TransactionEditInput()
{
Worker = note.Worker,
JobNumber = note.JobNumber,
DocNumber = note.Number,
TransType = Type,
TransSubType = SubType,
TransInOut = EnumTransInOut.In,
LocationArea = detail.FromLocationArea,
LocationGroup = detail.FromLocationGroup,
LocationErpCode = detail.FromLocationErpCode,
PackingCode = detail.FromPackingCode,
ItemCode = detail.ItemCode,
Lot = detail.FromLot,
Status = detail.FromStatus,
WarehouseCode = detail.FromWarehouseCode,
LocationCode = detail.FromLocationCode,
ContainerCode = detail.FromContainerCode,
SupplierBatch = detail.FromSupplierBatch,
ArriveDate = detail.FromArriveDate,
ProduceDate = detail.FromProduceDate,
ExpireDate = detail.FromExpireDate,
ItemName = detail.ItemName,
ItemDesc1 = detail.ItemDesc1,
ItemDesc2 = detail.ItemDesc2,
Uom = detail.Uom,
Qty = detail.FromQty,
};
transactions.Add(transactionIn);
}
return transactions;
}
}

Loading…
Cancel
Save