From f61a73e9e14c33314d3fd510ddf85d133fedc1e5 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Tue, 29 Oct 2024 11:14:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 6 ++++-- .../WmsMaterialTransferService.cs | 19 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 736ff72c..2606ae31 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -4166,11 +4166,13 @@ namespace Tnb.WarehouseMgr if (sPoint == null) { - throw new Exception($"库位{input.startlocation_id} 的起点点位未维护"); + BasLocation _loc = await db.Queryable().FirstAsync(it => it.id == input.startlocation_id); + throw new Exception($"起点库位{_loc.location_code} 的点位未维护"); } if (ePoint == null) { - throw new Exception($"库位{input.endlocation_id} 的终点点位未维护"); + BasLocation _loc = await db.Queryable().FirstAsync(it => it.id == input.endlocation_id); + throw new Exception($"终点库位{_loc.location_code} 的点位未维护"); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index 6d8d4abe..74051509 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -498,7 +498,7 @@ namespace Tnb.WarehouseMgr if (string.IsNullOrEmpty(input.source_id)) { - throw new AppFriendlyException("来源单据id不可为空", 500); + throw new Exception("来源单据id不可为空"); } WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable().FirstAsync(it => it.id == input.source_id); @@ -507,7 +507,7 @@ namespace Tnb.WarehouseMgr if (wmsMaterialTransfer == null) { - throw new AppFriendlyException($"不存在id为{input.source_id}的转库单", 500); + throw new Exception($"不存在id为{input.source_id}的转库单"); } await _db.Ado.BeginTranAsync(); @@ -535,7 +535,7 @@ namespace Tnb.WarehouseMgr decimal canOutstockQty = items_pretask.Sum(r => r.Item3.codeqty).ParseToDecimal(); if (canOutstockQty != needOut) { - throw new AppFriendlyException($@"当前可出库数量与需要出库数量不一致时无法出库! 当前可出库数量为 {canOutstockQty.ToString("G")},需要出库数量为{needOut.ToString("G")}", 500); + throw new Exception($@"当前可出库数量与需要出库数量不一致时无法出库! 当前可出库数量为 {canOutstockQty.ToString("G")},需要出库数量为{needOut.ToString("G")}"); } InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = items_pretask.Count, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID }; @@ -617,8 +617,8 @@ namespace Tnb.WarehouseMgr var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db); if (res.code != JNPF.Common.Enums.HttpStatusCode.OK) { - Logger.LogInformation($"【DistributeF4JXC】生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code}"); - throw new AppFriendlyException($"生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code}", 500); + Logger.LogInformation($"【DistributeF4JXC】生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code} {res.msg}"); + throw new Exception($"生成预任务失败 载具 {wmsMaterialTransferCarry.carry_code} {res.msg}"); } JObject keyValuePairs = JObject.Parse(res.data.ToString()); JArray array = JArray.Parse(keyValuePairs["pretaskids"].ToString()); @@ -636,7 +636,7 @@ namespace Tnb.WarehouseMgr if (xfCarrysCount == 0) { - throw new AppFriendlyException($"可下发数量为0", 500); + throw new Exception($"可下发数量为0"); } await _db.Ado.CommitTranAsync(); @@ -645,8 +645,8 @@ namespace Tnb.WarehouseMgr { await _db.Ado.RollbackTranAsync(); Logger.LogError("【DistributeF4JXC】" + ex.Message); - Logger.LogError("【DistributeF4JXC】" + ex.StackTrace); - return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); + Logger.LogError("【DistributeF4JXC】" + ex.StackTrace); + throw new AppFriendlyException(ex.Message, 500); } finally { @@ -654,8 +654,7 @@ namespace Tnb.WarehouseMgr semaphoreSlim_CPK.Release(); } - - return await ToApiResult(HttpStatusCode.OK, "成功"); + return "成功"; } From a076cb361baa6a0dbceb256cdd04ef2e38dbcb30 Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Tue, 29 Oct 2024 15:04:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=AD=BE=E6=94=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 2606ae31..243b4496 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -3141,11 +3141,23 @@ namespace Tnb.WarehouseMgr clearCarryIds.AddRange(memberCarryIds); } + // await db.Updateable() + // .SetColumns(x => x.carry_status == carryStatus) + // .SetColumns(x => x.is_check == isCheck) + // .Where(x => clearCarryIds.Contains(x.id)) + // .ExecuteCommandAsync(); + await db.Updateable() .SetColumns(x => x.carry_status == carryStatus) + .Where(x => clearCarryIds.Contains(x.id)) + .ExecuteCommandAsync(); + Logger.Information($"【TaskComplate FloorCallMaterial】 更新载具状态 {JsonConvert.SerializeObject(clearCarryIds)}成功"); + + await db.Updateable() .SetColumns(x => x.is_check == isCheck) .Where(x => clearCarryIds.Contains(x.id)) .ExecuteCommandAsync(); + Logger.Information($"【TaskComplate FloorCallMaterial】 更新载具检验 {JsonConvert.SerializeObject(clearCarryIds)}成功"); //await QTRK2BIP(dt, db); // require_code是任务单 @@ -3167,11 +3179,23 @@ namespace Tnb.WarehouseMgr memberCarryIds = await db.Queryable().Where(x=>x.carry_id==carry.id).Select(x=>x.membercarry_id).ToListAsync(); clearCarryIds.AddRange(memberCarryIds); + // await db.Updateable() + // .SetColumns(x => x.carry_status == carryStatus) + // .SetColumns(x => x.is_check == isCheck) + // .Where(x => clearCarryIds.Contains(x.id)) + // .ExecuteCommandAsync(); + await db.Updateable() - .SetColumns(x => x.carry_status == carryStatus) - .SetColumns(x => x.is_check == isCheck) - .Where(x => clearCarryIds.Contains(x.id)) - .ExecuteCommandAsync(); + .SetColumns(x => x.carry_status == carryStatus) + .Where(x => clearCarryIds.Contains(x.id)) + .ExecuteCommandAsync(); + Logger.Information($"【TaskComplate 长管签收】 更新载具状态 {JsonConvert.SerializeObject(clearCarryIds)}成功"); + + await db.Updateable() + .SetColumns(x => x.is_check == isCheck) + .Where(x => clearCarryIds.Contains(x.id)) + .ExecuteCommandAsync(); + Logger.Information($"【TaskComplate 长管签收】 更新载具检验 {JsonConvert.SerializeObject(clearCarryIds)}成功"); } From 874c11ec8e38782f6b6e09265b34a9e9a0f8c87c Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Wed, 30 Oct 2024 08:59:48 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8A=95=E6=96=99?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WmsCarryUnbindService.cs | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs index b5bbe325..0732bbeb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs @@ -341,20 +341,24 @@ namespace Tnb.WarehouseMgr { Logger.LogInformation($"【CarryCodeUnbindWithoutTran】不使用事务"); } - int row = await db.Deleteable().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync(); - //isOk = row > 0; - //if (!isOk) - //{ - // throw new Exception($"料架id{input.carry_id}载具解绑失败"); - //} - Logger.LogInformation($"【CarryUnbindWithoutTran】料架{carry.carry_code}已解绑,解绑条数{row}"); - - - if (tranFlag) + if (await db.Queryable().Where(r => r.carry_id == input.carry_id).AnyAsync()) { - Logger.LogInformation($"【CarryUnbindWithoutTran】提交事务"); - await db.Ado.CommitTranAsync(); + int row = await db.Deleteable().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync(); + //isOk = row > 0; + + //if (!isOk) + //{ + // throw new Exception($"料架id{input.carry_id}载具解绑失败"); + //} + Logger.LogInformation($"【CarryUnbindWithoutTran】料架{carry.carry_code}已解绑,解绑条数{row}"); + + + if (tranFlag) + { + Logger.LogInformation($"【CarryUnbindWithoutTran】提交事务"); + await db.Ado.CommitTranAsync(); + } } } else @@ -416,19 +420,23 @@ namespace Tnb.WarehouseMgr { Logger.LogInformation($"【CarryCodeUnbindWithoutTran】不使用事务"); } - int row = await db.Deleteable().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync(); - if (tranFlag) - { - Logger.LogInformation($"【CarryCodeUnbindWithoutTran】提交事务"); - await db.Ado.CommitTranAsync(); - } - isOk = row > 0; - Logger.LogInformation($"【CarryCodeUnbindWithoutTran】载具{carry.carry_code}已解绑,解绑条数{row}"); - //if (!isOk) - //{ - // throw Oops.Oh(ErrorCode.COM1001); - //} + if (await db.Queryable().Where(r => r.carry_id == input.carry_id).AnyAsync()) + { + int row = await db.Deleteable().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync(); + if (tranFlag) + { + Logger.LogInformation($"【CarryCodeUnbindWithoutTran】提交事务"); + await db.Ado.CommitTranAsync(); + } + isOk = row > 0; + + Logger.LogInformation($"【CarryCodeUnbindWithoutTran】载具{carry.carry_code}已解绑,解绑条数{row}"); + //if (!isOk) + //{ + // throw Oops.Oh(ErrorCode.COM1001); + //} + } } else { From 49142dbf1cf8dd7fdc6827a899e7fd4faa6d0c7b Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Wed, 30 Oct 2024 10:47:05 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=8B=A8=E5=85=A5udi=5Fcode=20lis?= =?UTF-8?q?t=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs | 1 + WarehouseMgr/Tnb.WarehouseMgr/TransferInstockHService.cs | 2 +- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs index de9c776d..c5e31e74 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs @@ -1873,6 +1873,7 @@ namespace Tnb.WarehouseMgr wmsTransferInstockD.xf_qty = 0; wmsTransferInstockD.pr_qty = detail.qty; wmsTransferInstockD.lineno = detail.lineno; + wmsTransferInstockD.udi_code = detail.udi_code; var material = await db.Queryable().Where(p => p.code == detail.material_code).FirstAsync(); if (material != null) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TransferInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/TransferInstockHService.cs index 4af4c78d..6bef965b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TransferInstockHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TransferInstockHService.cs @@ -98,7 +98,7 @@ namespace Tnb.WarehouseMgr JObject jobject = new JObject(); jobject["code"] = "200"; - List wmsTransferInstockDs = _db.Queryable().Where(r => r.bill_id == input.id && r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).ToList(); + List wmsTransferInstockDs = _db.Queryable().Where(r => r.bill_id == input.id).ToList(); jobject["data"] = JArray.Parse(JsonConvert.SerializeObject(wmsTransferInstockDs)); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 243b4496..37249c9c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -1175,8 +1175,8 @@ namespace Tnb.WarehouseMgr getdic.Add("ZZ-01-02", new string[] { "外包装箱码垛线", "WBZX_x1_take_mtp", "true" }); getdic.Add("ZZ-02-02", new string[] { "外包装箱码垛线", "WBZX_x2_take_mtp", "true" }); - getdic.Add("ZZ-01-01", new string[] { "外包装箱码垛线", "WBZX_x1_put_mtp", "true" }); - getdic.Add("ZZ-02-01", new string[] { "外包装箱码垛线", "WBZX_x2_put_mtp", "true" }); + putdic.Add("ZZ-01-01", new string[] { "外包装箱码垛线", "WBZX_x1_put_mtp", "true" }); + putdic.Add("ZZ-02-01", new string[] { "外包装箱码垛线", "WBZX_x2_put_mtp", "true" }); getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "右输送线上层允许出箱3", "true" });