日志与库存数扣减优化

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

@@ -11,7 +11,7 @@
{ {
"Conn": "Data Source=10.72.80.161;User ID=root;Password=doantech123;Initial Catalog=pbl_huaxiang;Port=3306", "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog=pbl_huaxiang;Port=3306",
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3PgSql = 4 "DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3PgSql = 4
"ConfigId": "0", //多租户唯一标识 "ConfigId": "0", //多租户唯一标识
"IsAutoCloseConnection": true "IsAutoCloseConnection": true

View File

@@ -131,7 +131,7 @@ namespace DOAN.Service.PBL
if (isSuccess) if (isSuccess)
{ {
storagelocation.IsLight = 0; storagelocation.IsLight = 0;
storagelocation.PackageNum -= 1; // storagelocation.PackageNum -= 1;
if (storagelocation.PackageNum < 0) if (storagelocation.PackageNum < 0)
{ {
storagelocation.PackageNum = 0; storagelocation.PackageNum = 0;

View File

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