From 46f7b4bf205cf4d7e505483c834aa7bee34c4a1a Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Mon, 1 Jul 2024 11:19:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E7=AE=A1=E6=8A=95=E6=96=99=E4=B8=8D?= =?UTF-8?q?=E8=A7=A3=E7=BB=91=E7=88=B6=E8=BD=BD=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/PrdFeedingService.cs | 8 +++- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 38 ++++++++------- .../Tnb.ProductionMgr/TimeWorkService.cs | 46 +++++++++++++++++++ .../Consts/WmsWareHouseConst.cs | 4 ++ 4 files changed, 79 insertions(+), 17 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 88d7cdd6..36738cde 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -18,6 +18,7 @@ using Tnb.ProductionMgr.Entities.Dto; using Tnb.ProductionMgr.Interfaces; using Tnb.WarehouseMgr; using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; using Tnb.WarehouseMgr.Entities.Enums; @@ -511,8 +512,13 @@ namespace Tnb.ProductionMgr _ = await db.Insertable(prdFeedingH).ExecuteCommandAsync(); _ = await db.Insertable(list).ExecuteCommandAsync(); + + if (prdMaterialReceiptH == null) + { + throw Oops.Bah("未找到投料记录"); + } - if (prdMaterialReceiptH.first_feed) + if (prdMaterialReceiptH.first_feed && carry.carrystd_id==WmsWareHouseConst.CARRY_LXSTD_ID) { await db.Updateable() .SetColumns(x => x.first_feed == false) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 5a996e9b..3b564be8 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1619,6 +1619,12 @@ namespace Tnb.ProductionMgr { ["30019971917589"] = "外包装箱码垛线" }; + + Dictionary dic2 = new Dictionary() + { + [WmsWareHouseConst.XUELUGUAN1XIAN] = "WBZX_x1_Enquantity", + [WmsWareHouseConst.XUELUGUAN2XIAN] = "WBZX_x2_Enquantity" + }; string materialBoxCode = input.material_box_code; BasLocation location = null; try @@ -1975,27 +1981,27 @@ namespace Tnb.ProductionMgr if (prdMoTask.schedule_type == 2) { - Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) - { - ["DevName"] = dic[prdMoTask.workline_id], - ["token"] = _eleCtlCfg.token, - ["TagName"] = "WBZX_x1_ok", - ["Value"] = "true", - }; - Log.Information($"提拔确认完成参数:{JsonConvert.SerializeObject(dicCommand2)}"); - string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2); - Log.Information($"提拔确认完成参数成返回结果:{responseresult}"); - X2ServerResult x2ServerResult = JsonConvert.DeserializeObject(responseresult); - if (x2ServerResult.Result != X2ServerResult.Ok) - { - throw Oops.Bah(x2ServerResult.Msg); - } + // Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) + // { + // ["DevName"] = dic[prdMoTask.workline_id], + // ["token"] = _eleCtlCfg.token, + // ["TagName"] = "WBZX_x1_ok", + // ["Value"] = "true", + // }; + // Log.Information($"提拔确认完成参数:{JsonConvert.SerializeObject(dicCommand2)}"); + // string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2); + // Log.Information($"提拔确认完成参数成返回结果:{responseresult}"); + // X2ServerResult x2ServerResult = JsonConvert.DeserializeObject(responseresult); + // if (x2ServerResult.Result != X2ServerResult.Ok) + // { + // throw Oops.Bah(x2ServerResult.Msg); + // } Dictionary dicCommand4 = new(StringComparer.OrdinalIgnoreCase) { ["DevName"] = "外包装箱码垛线", ["token"] = _eleCtlCfg.token, - ["TagName"] = "WBZX_x1_Enquantity", + ["TagName"] = dic2[prdMoTask.workline_id], ["Value"] = "0", }; diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index d00ffe77..a1ae37ca 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -355,9 +355,29 @@ namespace Tnb.ProductionMgr return msg; } + [HttpGet] [AllowAnonymous] public async Task AutoPrdReport() + { + BasFactoryConfig config = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN); + bool qu1 = await _redisData.TryGetValueByKeyField("外包装箱码垛线", "WBZX_x1_AGV_qu"); + if (qu1) + { + HttpUtils.RequestGet($"{config.value}/api/production/time-work/x1-auto-prd-report"); + } + + bool qu2 = await _redisData.TryGetValueByKeyField("外包装箱码垛线", "WBZX_x2_AGV_qu"); + if (qu2) + { + HttpUtils.RequestGet($"{config.value}/api/production/time-work/x2-auto-prd-report"); + } + return "true"; + } + + [HttpGet] + [AllowAnonymous] + private async Task X1AutoPrdReport() { string carryCode = await _redisData.TryGetValueByKeyField("外包装箱码垛线", "WBZX_x1_take_tp"); int num = await _redisData.TryGetValueByKeyField("外包装箱码垛线", "WBZX_x1_Enquantity"); @@ -380,6 +400,32 @@ namespace Tnb.ProductionMgr await _prdMoTaskService.PrdReport(input); return "true"; } + + [HttpGet] + [AllowAnonymous] + private async Task X2AutoPrdReport() + { + string carryCode = await _redisData.TryGetValueByKeyField("外包装箱码垛线", "WBZX_x2_take_tp"); + int num = await _redisData.TryGetValueByKeyField("外包装箱码垛线", "WBZX_x2_Enquantity"); + if (string.IsNullOrEmpty(carryCode) || num<=0) + { + return "无载具或数量为0"; + } + PrdMoTask prdMoTask = await _db.Queryable().Where(x => x.workline_id == WmsWareHouseConst.XUELUGUAN2XIAN && x.mo_task_status == DictConst.InProgressEnCode && x.parent_id != null).FirstAsync(); + if (prdMoTask == null) + { + return "血路管2线没有进行中的任务单"; + } + + PrdReportCrInput input = new PrdReportCrInput(); + input.mo_task_code = prdMoTask.mo_task_code; + input.mo_task_id = prdMoTask.id; + input.reported_qty = num; + input.station = ""; + input.material_box_code = carryCode; + await _prdMoTaskService.PrdReport(input); + return "true"; + } } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index e21c5c76..03775ecf 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -263,6 +263,10 @@ /// public const string CARRY_LJSTD_ID = "26037267399717"; /// + /// 载具规格-料箱 + /// + public const string CARRY_LXSTD_ID = "26037262680357"; + /// /// 打印状态-未打印 /// public const string PRINT_STATUS_NOTPRINTED = "26191366982437";