Browse Source

报废添加注释

dev_DY_CC
lvzb 10 months ago
parent
commit
f92160f6ef
  1. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Vml.Spreadsheet;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
@ -40,31 +41,32 @@ public class ScrapNoteEventHandler
private async Task AddTransactionsAsync(List<ScrapNote> scrapNotes)
{
var isScrapLocation = await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false); //如果WMS管理报废库,生成报废库存转移(从HOLD库先转移到线边)
var holdLocation = await LocationAclService.GetFirstByTypeAsync(EnumLocationType.HOLD).ConfigureAwait(false); //隔离库位
var transferLogs = new List<TransferLogEditInput>();
var transactions = new List<TransactionEditInput>();
//如果WMS管理报废库,生成报废库存转移(从HOLD库先转移到线边)
if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false))
{
var transactions = new List<TransactionEditInput>();//更新库存的事务
var emptyTransactions = new List<TransactionEditInput>();//不更新库存的事务
foreach (var scrapNote in scrapNotes)
{
if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false))
if (isScrapLocation && scrapNote.Worker == "MES")//管理隔离库并且是mes接口来的从隔离库直接报废(但是要先移到线边)
{
transferLogs.AddRange(BuildTransferLogs(scrapNote, holdLocation));
emptyTransactions.AddRange(BuildTransactions(scrapNote));
}
else
{
transactions.AddRange(BuildTransactions(scrapNote));
}
//报废是库存世界变动是隔离库数量-1,但是增加了一个移库日志从Hold到线边,库存事务是三个,Hold库-1(移库),线边+1(移库),线边-1(报废)
await TransferLogAppService.AddManyWithTransferAsync(transferLogs, transactions).ConfigureAwait(false);
await TransactionAppService.AddManyEmptyAsync(transactions).ConfigureAwait(false);
}
else
{
foreach (var scrapNote in scrapNotes)
if (transferLogs.Count > 0)
{
transactions.AddRange(BuildTransactions(scrapNote));
//报废是库存世界变动是隔离库数量-1,但是增加了一个移库日志从Hold到线边,库存事务是三个,Hold库-1(移库),线边+1(移库),线边-1(报废)
await TransferLogAppService.AddManyWithTransferAsync(transferLogs, emptyTransactions).ConfigureAwait(false);
await TransactionAppService.AddManyEmptyAsync(emptyTransactions).ConfigureAwait(false);
}
if (transactions.Count > 0)
{
await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false);
}
}

Loading…
Cancel
Save