From 44128eb79b28e59096baa1c740d1390ad4877c9b Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Mon, 28 Oct 2024 10:45:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86=20erp=E6=B7=BB=E5=8A=A0unicode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/ErpInputs/TransferOutstockInput.cs | 1 + .../Entity/WmsTransferInstockD .cs | 1 + WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs | 3 ++- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 14 ++++++++------ .../WmsArtificialInstockService.cs | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs index ca39119f..e9414d44 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs @@ -119,5 +119,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs /// 辅助属性 /// public string auxprop_xph { get; set; } + public string udi_code { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferInstockD .cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferInstockD .cs index c94d60c5..1314c35b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferInstockD .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferInstockD .cs @@ -135,5 +135,6 @@ public partial class WmsTransferInstockD : BaseEntity /// 辅助属性 小批号 /// public string auxprop_xph { get; set; } + public string udi_code { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs index b5b88651..ea1da0f1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs @@ -1686,7 +1686,8 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到!", 500); } wmsTransferInstockD.auxprop_xph = detail.auxprop_xph; - + wmsTransferInstockD.udi_code = detail.udi_code; + wmsTransferInstockDs.Add(wmsTransferInstockD); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 7ba0305c..3abbb119 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -3159,17 +3159,19 @@ namespace Tnb.WarehouseMgr carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID) { } - else + else if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID) { 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(); + } else if (dt.biz_type == "erp_qtrk") { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsArtificialInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsArtificialInstockService.cs index d82d2108..30e8eb9a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsArtificialInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsArtificialInstockService.cs @@ -95,7 +95,7 @@ namespace Tnb.WarehouseMgr } if (wmsCarryH.carry_status != "1") { - throw new AppFriendlyException($"【ArtificialInstock】载具{input.carry_code}未绑定物料", 500); + throw new AppFriendlyException($"【ArtificialInstock】载具{input.carry_code}未绑定物料,托盘状态不是占用状态", 500); } BasLocation carryLoc = await _db.Queryable().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); From 3316377d3e61a8a6dfe4bfd9e093db2194de0123 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Tue, 29 Oct 2024 09:08:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B7=A8=E5=B1=82=E5=9B=9E=E5=86=99?= =?UTF-8?q?=E5=B7=A5=E4=BD=8D=EF=BC=8C=E5=85=B6=E4=BB=96=E5=87=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 3 ++ .../WmsMaterialTransferService.cs | 5 ++- .../Tnb.WarehouseMgr/WmsSaleReleaseService.cs | 40 ++++++++++++++++--- .../Configurations/AgvRequestCfgUrl.json | 2 +- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 3abbb119..736ff72c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -1175,6 +1175,9 @@ 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" }); + getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "右输送线上层允许出箱3", "true" }); getdic.Add("ZSSSXCTU01", new string[] { "YTCS", "左输送线上层允许出箱1", "true" }); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index 4a1d98ae..6d8d4abe 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -667,7 +667,8 @@ namespace Tnb.WarehouseMgr .InnerJoin((a, b, c) => b.source_detail_id == c.id) .InnerJoin((a, b, c, d) => b.id == d.fk_id) .WhereIF(!string.IsNullOrEmpty(input.warehouse_outstock), (a, b, c) => a.warehouse_outstock == input.warehouse_outstock) - .WhereIF(!string.IsNullOrEmpty(input.warehouse_instock), (a, b, c) => a.warehouse_instock == input.warehouse_instock) + .WhereIF(!string.IsNullOrEmpty(input.warehouse_instock) && input.warehouse_instock != WmsWareHouseConst.WAREHOUSE_ZZXBK_ID, (a, b, c) => a.warehouse_instock == input.warehouse_instock) + .WhereIF(!string.IsNullOrEmpty(input.warehouse_instock) && input.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZZXBK_ID, (a, b, c) => a.type == WmsWareHouseConst.MATERIALTRANSFER_CROSSLAYER_CODE) .Where((a, b, c, d) => d.rk_qty < d.actual_outstock_qty) .OrderBy((a, b, c, d) => b.create_time) .Select((a, b, c, d) => new @@ -2876,7 +2877,7 @@ namespace Tnb.WarehouseMgr carryMaterialDetails.Add(carryMaterialDetail); carryMaterialBindInput.details = carryMaterialDetails; await _wmsCarryBindService.CarryMaterialBind(carryMaterialBindInput, _db); - await _db.Updateable().SetColumns(r => r.carry_status == "3").Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(r => new WmsCarryH { carry_status = "3", work_station = wmsMaterialTransferD.station_code }).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync(); // 更新子表已下发数量 await _db.Updateable().SetColumns(r => r.yxfqty_rk == r.yxfqty_rk + input.qty).Where(r => r.id == materialtransferdid).ExecuteCommandAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs index 6d969743..b27e1dab 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; using Microsoft.Extensions.Logging; +using Newtonsoft.Json; using NPOI.HSSF.Record; using NPOI.SS.Formula; using SqlSugar; @@ -500,11 +501,24 @@ namespace Tnb.WarehouseMgr { throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}不存在!", 500); } + await _db.Updateable().SetColumns(r => new BasLocation + { + is_lock = 0, + is_use = "0" + }).Where(r => r.id == new_wmsCarryH.location_id).ExecuteCommandAsync(); + Logger.Information($"托盘{input.new_carrycode} 原先的库位{new_wmsCarryH.location_code} 状态设置为未锁定 、空闲"); + + if (new_wmsCarryH.carry_status != "0") + { + throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}上的状态不为空闲,不能转移!", 500); + } new_wmsCarryH.is_lock = 0; new_wmsCarryH.carry_status = "1"; new_wmsCarryH.location_id = wmsCarryH.location_id; new_wmsCarryH.location_code = wmsCarryH.location_code; + wmsCarryH.is_lock = 0; + wmsCarryH.carry_status = "0"; wmsCarryH.location_id = ""; wmsCarryH.location_code = ""; List new_wmsCarryCodes = await _db.Queryable().Where(r => r.carry_id == new_wmsCarryH.id).ToListAsync(); @@ -516,10 +530,14 @@ namespace Tnb.WarehouseMgr WmsCarryCode new_wmsCarryCode = wmsCarryCode.Adapt(); if (new_wmsCarryCodes.Count > 0) { - if (new_wmsCarryCodes[0].material_id != wmsCarryCode.material_id || new_wmsCarryCodes[0].code_batch != wmsCarryCode.code_batch) + if (new_wmsCarryCodes.Count > 0) { - throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}上的物料批次数据与分拣托盘上的物料批次数据不一致,不能转移!", 500); + throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}已存在条码,不能转移!", 500); } + //if (new_wmsCarryCodes[0].material_id != wmsCarryCode.material_id || new_wmsCarryCodes[0].code_batch != wmsCarryCode.code_batch) + //{ + // throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}上的物料批次数据与分拣托盘上的物料批次数据不一致,不能转移!", 500); + //} new_wmsCarryCode = new_wmsCarryCodes[0]; new_wmsCarryCode.codeqty = wmsCarryCode.codeqty - wmsSortingtask.qty + new_wmsCarryCodes[0].codeqty; await _db.Updateable(new_wmsCarryCode).UpdateColumns(r => new { r.codeqty }).ExecuteCommandAsync(); @@ -530,12 +548,24 @@ namespace Tnb.WarehouseMgr new_wmsCarryCode.carry_id = new_wmsCarryH.id; new_wmsCarryCode.barcode = new_wmsCarryH.carry_code; new_wmsCarryCode.codeqty = wmsCarryCode.codeqty - wmsSortingtask.qty; - await _db.Insertable(new_wmsCarryCode).ExecuteCommandAsync(); + if (new_wmsCarryCode.codeqty > 0) + { + Logger.Information($"托盘{new_wmsCarryH.carry_code} 新增条码数据{JsonConvert.SerializeObject(new_wmsCarryCode)}"); + await _db.Insertable(new_wmsCarryCode).ExecuteCommandAsync(); + } + else + { + Logger.Information($"托盘{new_wmsCarryH.carry_code} 分拣数量{wmsSortingtask.qty}与条码数量{wmsCarryCode.codeqty}相同 无需新增新托盘的条码数据"); + } } - await _db.Updateable().SetColumns(r => r.codeqty == wmsSortingtask.qty).Where(r => r.carry_id == wmsSortingtask.carry_id).ExecuteCommandAsync(); + //await _db.Updateable().SetColumns(r => r.codeqty == wmsSortingtask.qty).Where(r => r.carry_id == wmsSortingtask.carry_id).ExecuteCommandAsync(); await _db.Updateable(new_wmsCarryH).UpdateColumns(r => new { r.is_lock, r.carry_status, r.location_id, r.location_code }).ExecuteCommandAsync(); - await _db.Updateable(wmsCarryH).UpdateColumns(r => new { r.location_id, r.location_code }).ExecuteCommandAsync(); + await _db.Updateable(wmsCarryH).UpdateColumns(r => new { r.is_lock, r.carry_status, r.location_id, r.location_code }).ExecuteCommandAsync(); + await _db.Deleteable().Where(r => r.carry_id == wmsSortingtask.carry_id).ExecuteCommandAsync(); + Logger.Information($"新托盘{new_wmsCarryH.carry_code} 更新数据: 锁定状态{new_wmsCarryH.is_lock} 占用状态{new_wmsCarryH.carry_status} 库位id{new_wmsCarryH.location_id} 库位编码{new_wmsCarryH.location_code}"); + Logger.Information($"老托盘{wmsCarryH.carry_code} 更新数据为 锁定状态{wmsCarryH.is_lock} 占用状态{wmsCarryH.carry_status} 库位id{wmsCarryH.location_id} 库位编码{wmsCarryH.location_code} "); + Logger.Information($"老托盘{wmsSortingtask.carry_code} 在转移新托盘时清除条码数据"); } await _db.Updateable().SetColumns(r => new WmsSortingtask diff --git a/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json b/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json index 7b3082bf..9350335f 100644 --- a/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json +++ b/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json @@ -1,6 +1,6 @@ { "AgvRequestUrls": { - "CreateTaskChainUrl": "http://10.147.19.104:5013/api/task-chain/create", + "CreateTaskChainUrl": "http://192.168.11.104:1880/api/task-chain/create", "CancelTaskChainUrl": "http://192.168.11.104:1880/api/task-chain/cancel", "thirdFloorUrl": "http://192.168.11.104:1880/api/lift/thirdFloor" }