From bfc22c7326c5449b6a7f4459c00248cf10ad8348 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Tue, 16 Jul 2024 12:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AD=E8=8F=8C=E7=BA=BF=E3=80=81=E4=BF=A1?= =?UTF-8?q?=E5=8F=B7=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 136 +++++++++++++++--- .../Entity/WmsFloor4stewingConfig.cs | 52 +++++++ ...r_carry.cs => WmsMaterialTransferCarry.cs} | 0 .../Entity/WmsSterilizationInstockH.cs | 92 ++++++++++++ .../Tnb.WarehouseMgr/WareHouseService.cs | 9 +- 5 files changed, 265 insertions(+), 24 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFloor4stewingConfig.cs rename WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/{wms_material_transfer_carry.cs => WmsMaterialTransferCarry.cs} (100%) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index e3219857..d4c8c0bb 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -1892,23 +1892,27 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA return; } - List endLocations = db_Floor4DMJ2MJX.Queryable().Where(r => r.wh_id == WmsWareHouseConst.WAREHOUSE_DMJC_ID - && r.is_type == ((int)EnumLocationType.分拣库位).ToString() && r.is_lock == 0).ToList(); + Dictionary putdic = new Dictionary(); + putdic.Add("SLD1", new string[] { "设备名", "信号" }); - Dictionary getdic = new Dictionary(); - foreach (BasLocation endLocation in endLocations) - { - getdic.Add(endLocation, new string[] { "", "" }); - } + //Dictionary putdic = new Dictionary(); + //List endLocations = db_Floor4DMJ2MJX.Queryable().Where(r => r.wh_id == WmsWareHouseConst.WAREHOUSE_DMJC_ID + //&& r.is_type == ((int)EnumLocationType.分拣库位).ToString() && r.is_lock == 0).ToList(); - foreach (var key in getdic.Keys) + //foreach (BasLocation endLocation in endLocations) + //{ + // putdic.Add(endLocation, new string[] { "", "" }); + //} + + foreach (var key in putdic.Keys) { await db_Floor4DMJ2MJX.Ado.BeginTranAsync(); - var strs = getdic.Where(p => p.Key == key).First().Value; + var strs = putdic.Where(p => p.Key == key).First().Value; bool result = await GetBoolTag(strs[0], strs[1]); if (result) { - LoggerYCLGLDPJInstock.LogInformation($"【四楼待灭菌仓到灭菌线】 上料点 {key} {strs[1]}采集到 {result}"); + + LoggerFloor4DMJ2MJX.LogInformation($"【四楼待灭菌仓到灭菌线】 上料点 {key} {strs[1]}采集到 {result}"); OutStockStrategyQuery outStockStrategyInput = new() { @@ -1919,23 +1923,25 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA if (items.Count < 1) { - LoggerYCLGLDPJInstock.LogInformation($"【四楼待灭菌仓到灭菌线】 没有可以出库的空载具"); + LoggerFloor4DMJ2MJX.LogWarning($"【四楼待灭菌仓到灭菌线】 没有可以出库的空载具"); + break; } + BasLocation endlocation = await db_Floor4DMJ2MJX.Queryable().Where(r => r.location_code == key).FirstAsync(); WmsCarryH wmsCarryH = items[0]; - //锁定起点库位 更新为空闲 - await db_YCLWXDPJInstocktimer.Updateable().SetColumns(r => new BasLocation { is_lock = 1, is_use = "0" }).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync(); + //锁定起点库位 + await db_Floor4DMJ2MJX.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync(); //锁定终点库位 - await db_YCLWXDPJInstocktimer.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == key.id).ExecuteCommandAsync(); + await db_Floor4DMJ2MJX.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endlocation.id).ExecuteCommandAsync(); - bool result_createPretask = await createPretask(wmsCarryH.location_id, key.id, "", "", LoggerYCLGLDPJInstock, db_YCLWXDPJInstocktimer); + bool result_createPretask = await createPretask(wmsCarryH.location_id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerFloor4DMJ2MJX, db_Floor4DMJ2MJX); if (!result_createPretask) { - LoggerYCLGLDPJInstock.LogWarning($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {key.location_code} 预任务生成失败"); - throw new Exception($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {key.location_code} 预任务生成失败"); + LoggerFloor4DMJ2MJX.LogWarning($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {endlocation.location_code} 预任务生成失败"); + throw new Exception($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {endlocation.location_code} 预任务生成失败"); } - LoggerYCLGLDPJInstock.LogWarning($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {key.location_code} 预任务生成成功"); + LoggerFloor4DMJ2MJX.LogInformation($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {endlocation.location_code} 预任务生成成功"); } await db_Floor4DMJ2MJX.Ado.CommitTranAsync(); @@ -1986,10 +1992,90 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行四楼待灭菌线到灭菌仓"); LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行四楼待灭菌线到灭菌仓"); - await db_Floor4MJX2MJC.Ado.BeginTranAsync(); + if (true) + { + return; + } + Dictionary getdic = new Dictionary(); + getdic.Add("SLD1", new string[] { "设备名", "信号", "条码信号" }); + + //List startLocations = db_Floor4MJX2MJC.Queryable().Where(r => r.wh_id == WmsWareHouseConst.WAREHOUSE_MJC_ID + //&& r.is_type == ((int)EnumLocationType.分拣库位).ToString() && r.is_lock == 0).ToList(); + + //Dictionary getdic = new Dictionary(); + + //foreach (BasLocation startLocation in getdic) + //{ + // getdic.Add(startLocation, new string[] { "", "" }); + //} + + foreach (var key in getdic.Keys) + { + var strs = getdic.Where(p => p.Key == key).First().Value; + bool result = await GetBoolTag(strs[0], strs[1]); + if (result) + { + LoggerFloor4MJX2MJC.LogInformation($"【四楼待灭菌线到灭菌仓】 上料点 {key} {strs[1]}采集到 {result}"); + + InStockStrategyQuery inStockStrategyInput = new() + { + warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, + Size = 1 + }; + List items = await _wareHouseService.InStockStrategy(inStockStrategyInput); + + if (items.Count < 1) + { + LoggerFloor4MJX2MJC.LogWarning($"【四楼待灭菌线到灭菌仓】 没有可以入库的库位"); + break; + } + await db_Floor4MJX2MJC.Ado.BeginTranAsync(); + + BasLocation startlocation = await db_Floor4DMJ2MJX.Queryable().Where(r => r.location_code == key).FirstAsync(); + BasLocation endlocation = items[0]; + + string carry_code = ""; + WmsCarryH wmsCarryH = await db_Floor4MJX2MJC.Queryable().Where(r => r.carry_code == carry_code).FirstAsync(); + + //锁定起点库位 + await db_Floor4MJX2MJC.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == startlocation.id).ExecuteCommandAsync(); + //锁定终点库位 + await db_Floor4MJX2MJC.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endlocation.id).ExecuteCommandAsync(); + + bool result_createPretask = await createPretask(startlocation.id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerFloor4MJX2MJC, db_Floor4MJX2MJC); + if (!result_createPretask) + { + LoggerFloor4MJX2MJC.LogWarning($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成失败"); + throw new Exception($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成失败"); + } + LoggerFloor4MJX2MJC.LogInformation($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成成功"); + + DateTime dateTime = DateTime.Now; + WmsSterilizationInstockH wmsSterilizationInstockH = new WmsSterilizationInstockH(); + wmsSterilizationInstockH.carry_id = wmsCarryH.id; + wmsSterilizationInstockH.carry_code = wmsCarryH.carry_code; + wmsSterilizationInstockH.location_id = endlocation.id; + wmsSterilizationInstockH.location_code = endlocation.location_code; + wmsSterilizationInstockH.create_id = WmsWareHouseConst.AdministratorUserId; + wmsSterilizationInstockH.create_time = dateTime; + wmsSterilizationInstockH.instock_time = dateTime; + wmsSterilizationInstockH.org_id = WmsWareHouseConst.AdministratorOrgId; + wmsSterilizationInstockH.xl_location_id = startlocation.id; + wmsSterilizationInstockH.xl_location_code = startlocation.location_code; + wmsSterilizationInstockH.status = WmsWareHouseConst.BILLSTATUS_ON_ID; + + int row = await db_Floor4MJX2MJC.Insertable(wmsSterilizationInstockH).ExecuteCommandAsync(); + if (row > 0) + LoggerFloor4MJX2MJC.LogInformation($"【四楼待灭菌线到灭菌仓】 灭菌入库记录生成成功"); + else + LoggerFloor4MJX2MJC.LogWarning($"【四楼待灭菌线到灭菌仓】 灭菌入库记录生成失败"); + + } + await db_Floor4MJX2MJC.Ado.CommitTranAsync(); + } + _ = _wareHouseService.GenTaskExecute(); - await db_Floor4MJX2MJC.Ado.CommitTranAsync(); } catch (ObjectDisposedException ex) { @@ -2034,6 +2120,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行四楼灭菌仓到成品库"); LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行四楼灭菌仓到成品库"); + int hours = 168; + List wmsSterilizationInstockHs = db_Floor4DMC2CPK.Queryable() + .Where(r => DateTime.Now.Subtract(r.instock_time.Value).TotalHours > hours && r.status == WmsWareHouseConst.BILLSTATUS_ON_ID).ToList(); + + foreach (WmsSterilizationInstockH wmsSterilizationInstockH in wmsSterilizationInstockHs) + { + + + } + await db_Floor4DMC2CPK.Ado.BeginTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFloor4stewingConfig.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFloor4stewingConfig.cs new file mode 100644 index 00000000..fc00fbd8 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFloor4stewingConfig.cs @@ -0,0 +1,52 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.WarehouseMgr.Entities.Entity; + +/// +/// 四楼静置仓配置 +/// +[SugarTable("wms_floor4stewing_config")] +public partial class WmsFloor4stewingConfig : BaseEntity +{ + public WmsFloor4stewingConfig() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 配置项 + /// + public string? name { get; set; } + + /// + /// 值 + /// + public string? value { get; set; } + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/wms_material_transfer_carry.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsMaterialTransferCarry.cs similarity index 100% rename from WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/wms_material_transfer_carry.cs rename to WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsMaterialTransferCarry.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs new file mode 100644 index 00000000..3d15f8dd --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs @@ -0,0 +1,92 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.WarehouseMgr.Entities.Entity; + +/// +/// 灭菌入库记录 +/// +[SugarTable("wms_sterilization_instock_h")] +public partial class WmsSterilizationInstockH : BaseEntity +{ + public WmsSterilizationInstockH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 载具id + /// + public string? carry_id { get; set; } + + /// + /// 载具编码 + /// + public string? carry_code { get; set; } + + /// + /// 入库时间 + /// + public DateTime? instock_time { get; set; } + + /// + /// 入库库位id + /// + public string? location_id { get; set; } + + /// + /// 入库库位编码 + /// + public string? location_code { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 下料库位id + /// + public string? xl_location_id { get; set; } + + /// + /// 下料库位编码 + /// + public string? xl_location_code { get; set; } + + /// + /// 成品仓库位id + /// + public string? cp_location_id { get; set; } + + /// + /// 成品仓库位编码 + /// + public string? cp_location_code { get; set; } + + /// + /// 状态 + /// + public string? status { get; set; } + +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 0c7f27d2..a0e5b5f1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -657,10 +657,11 @@ namespace Tnb.WarehouseMgr Logger.Information($"【Check】 判断KIVA是否可以{action} {code}"); Dictionary putdic = new Dictionary(); Dictionary getdic = new Dictionary(); - putdic.Add("ZSSSXCTU02", new string[] { "YTCS", "右输送线下层允许入箱4", }); - putdic.Add("ZSSSXCTU01", new string[] { "YTCS", "左输送线下层允许入箱2", }); - getdic.Add("ZSSSXCTU01", new string[] { "YTCS", "左输送线上层允许出箱1" }); - getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "右输送线上层允许出箱3" }); + + putdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AllowAgvFullIn_CS04", }); + putdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AllowAgvFullIn_CS02", }); + getdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AllowAgvEmptyOut_CS01" }); + getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AllowAgvEmptyOut_CS03" }); #region 注塑车间点位 putdic.Add("ZS-C01-1", new string[] { "hxjC", "A2允许入空箱", });