This commit is contained in:
2024-10-10 16:36:47 +08:00
parent 88d83e46d3
commit 8049743296
3 changed files with 255 additions and 211 deletions

View File

@@ -586,6 +586,8 @@ namespace Tnb.ProductionMgr
public override async Task ModifyAsync(WareHouseUpInput input)
{
Log.Information($"物料呼叫完成回更参数:{JsonConvert.SerializeObject(input)}");
try
{
if (input == null)
{
throw new ArgumentNullException(nameof(input));
@@ -620,7 +622,7 @@ namespace Tnb.ProductionMgr
{
clearCarryIds.Add(carryId);
WmsCarryH carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
string code = await _billRullService.GetBillNumber(CodeTemplateConst.MATERIAL_RECEIPT_CODE);
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
{
code = code,
@@ -639,7 +641,7 @@ namespace Tnb.ProductionMgr
};
insertHList.Add(prdMaterialReceiptH);
string feedCode = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
string feedCode = await _billRullService.GetBillNumber(CodeTemplateConst.FEEDING_CODE);
PrdFeedingH prdFeedingH = new PrdFeedingH()
{
code = feedCode,
@@ -736,13 +738,13 @@ namespace Tnb.ProductionMgr
}
else
{
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
{
carry_id = detail.member_carry_id
},db);
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
if (result.code != HttpStatusCode.OK)
{
throw Oops.Bah(result.msg);
}
@@ -752,13 +754,13 @@ namespace Tnb.ProductionMgr
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
{
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
{
carry_id = carry.id
},db);
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
if (result.code != HttpStatusCode.OK)
{
throw Oops.Bah(result.msg);
}
@@ -772,7 +774,7 @@ namespace Tnb.ProductionMgr
if (carry.carrystd_id==WmsWareHouseConst.CARRY_LXSTD_ID || carry.carrystd_id==WmsWareHouseConst.CARRY_LJSTD_ID)
{
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 = await _wmsCarryUnbindService.CarryUnbindWithoutTran(new CarryBindInput()
Result result2 = await _wmsCarryUnbindService.CarryUnbindWithoutTran(new CarryBindInput()
{
org = prdFeedingH.org_id,
create_id = prdFeedingH.create_id,
@@ -783,7 +785,7 @@ namespace Tnb.ProductionMgr
membercarry_id = "",
},db);
if (result2.code != JNPF.Common.Enums.HttpStatusCode.OK)
if (result2.code != HttpStatusCode.OK)
{
throw Oops.Bah(result2.msg);
}
@@ -797,6 +799,10 @@ namespace Tnb.ProductionMgr
string isCheck = ((int)EnumCheckConclusion.).ToString();
foreach(string carryId in clearCarryIds)
{
string sql = $"update wms_carry_h set carry_status='0',is_check='8' where id='{carryId}';";
Log.Information($"自动签收更新载具sql:{sql}");
await db.Ado.ExecuteCommandAsync(sql);
Log.Information($"用SQL更新载具{carryId}状态为空闲{carryStatus},检验为{isCheck}成功");
await db.Updateable<WmsCarryH>()
.SetColumns(x => x.carry_status == carryStatus)
.SetColumns(x => x.is_check == isCheck)
@@ -821,5 +827,11 @@ namespace Tnb.ProductionMgr
throw Oops.Bah(ErrorCode.COM1000);
}
}
catch (Exception e)
{
Logger.Error("自动签收投料失败:"+e.Message,e);
throw Oops.Bah(e.Message,e);
}
}
}
}

View File

@@ -1,4 +1,4 @@
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Dtos.VisualDev;
using SqlSugar;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;

View File

@@ -1,4 +1,4 @@
using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Enums;
using JNPF.Common.Security;
@@ -332,7 +332,15 @@ namespace Tnb.WarehouseMgr
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
//await _runService.Create(templateEntity, visualDevModelCrInput);
if (tranFlag) await db.Ado.BeginTranAsync();
if (tranFlag)
{
Logger.LogInformation($"【CarryUnbindWithoutTran】开始事务");
await db.Ado.BeginTranAsync();
}
else
{
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】不使用事务");
}
int row = await db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
//isOk = row > 0;
@@ -343,7 +351,11 @@ namespace Tnb.WarehouseMgr
Logger.LogInformation($"【CarryUnbindWithoutTran】料架{carry.carry_code}已解绑,解绑条数{row}");
if (tranFlag) await db.Ado.CommitTranAsync();
if (tranFlag)
{
Logger.LogInformation($"【CarryUnbindWithoutTran】提交事务");
await db.Ado.CommitTranAsync();
}
}
else
{
@@ -357,7 +369,11 @@ namespace Tnb.WarehouseMgr
{
Logger.LogError($"【CarryUnbindWithoutTran】 {ex.Message}");
Logger.LogError($"【CarryUnbindWithoutTran】 {ex.StackTrace}");
if (tranFlag) await db.Ado.RollbackTranAsync();
if (tranFlag)
{
Logger.LogInformation($"【CarryUnbindWithoutTran】回滚事务");
await db.Ado.RollbackTranAsync();
}
throw Oops.Bah(ex.Message);
}
@@ -391,9 +407,21 @@ namespace Tnb.WarehouseMgr
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
if (carry != null)
{
if (tranFlag) await db.Ado.BeginTranAsync();
if (tranFlag)
{
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】开始事务");
await db.Ado.BeginTranAsync();
}
else
{
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】不使用事务");
}
int row = await db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
if (tranFlag) await db.Ado.CommitTranAsync();
if (tranFlag)
{
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】提交事务");
await db.Ado.CommitTranAsync();
}
isOk = row > 0;
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】载具{carry.carry_code}已解绑,解绑条数{row}");
@@ -414,7 +442,11 @@ namespace Tnb.WarehouseMgr
{
Logger.LogError($"【CarryCodeUnbindWithoutTran】 {ex.Message}");
Logger.LogError($"【CarryCodeUnbindWithoutTran】 {ex.StackTrace}");
if (tranFlag) await db.Ado.RollbackTranAsync();
if (tranFlag)
{
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】回滚事务");
await db.Ado.RollbackTranAsync();
}
throw Oops.Bah(ex.Message);
}
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");