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" }