日志与库存数扣减优化

This commit is contained in:
2024-11-14 18:24:10 +08:00
parent 368941225e
commit ebfc811f99
3 changed files with 11 additions and 10 deletions

View File

@@ -73,30 +73,31 @@ namespace DOAN.ServiceCore
if (result)
{
//缺料,需要补料
// 仓库库存修正
if (storagelocation.PackageNum >= PackageLine)
// 从满料到缺料 仓库库存修正
if (storagelocation.PackageNum > PackageLine)
{
storagelocation.PackageNum = PackageLine;
inventorylog.Operation = 1;
// 减少日志输出
/* inventorylog.Operation = 1;
inventorylog.PackageNum = 1;
inventorylog.CreatedBy = "PLC";
inventorylog.CreatedTime = DateTime.Now.ToLocalTime();
inventorylog.CreatedBy = "PLC-缺料";
inventorylog.CreatedTime = DateTime.Now.ToLocalTime();*/
await DbScoped.SugarScope.CopyNew().Updateable(storagelocation).ExecuteCommandAsync();
await DbScoped.SugarScope.CopyNew().Insertable(inventorylog).ExecuteCommandAsync();
//await DbScoped.SugarScope.CopyNew().Insertable(inventorylog).ExecuteCommandAsync();
}
}
else
{
// 仓库库存修正
// 从缺料到补料 仓库库存修正
if (storagelocation.PackageNum <= PackageLine)
{
//不需要补料 补料成功
storagelocation.PackageNum = storagelocation.MaxCapacity;
inventorylog.Operation = 2;
inventorylog.PackageNum = storagelocation.MaxCapacity;
inventorylog.CreatedBy = "PLC";
inventorylog.CreatedBy = "PLC-补料成功";
inventorylog.CreatedTime = DateTime.Now.ToLocalTime();
await DbScoped.SugarScope.CopyNew().Updateable(storagelocation).ExecuteCommandAsync();
await DbScoped.SugarScope.CopyNew().Insertable(inventorylog).ExecuteCommandAsync();