From 86d07260afdf1aeb8856a57e32a5697ceebdc356 Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Fri, 24 May 2024 14:21:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BasMaterial.cs | 4 + .../Dto/PrdManage/PADPackageTaskPageOutput.cs | 13 ++- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 80 ++++++++++++++++++- .../Tnb.ProductionMgr/PrdPackReportService.cs | 3 + .../Tnb.ProductionMgr/TimeWorkService.cs | 67 ++++++++++++---- 5 files changed, 150 insertions(+), 17 deletions(-) diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs index ceb22bc4..5c91aab3 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs @@ -269,4 +269,8 @@ public partial class BasMaterial : BaseEntity /// public int? deleted { get; set; } + /// + /// 箱号 + /// + public string container_no { get; set; } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs index 26bb1497..a0587d74 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs @@ -174,7 +174,18 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 入库库位编号 /// public string? as_location_code { get; set; } - + /// + /// 规格型号 + /// + public string material_standard { get; set; } + /// + /// 箱号 + /// + public string container_no { get; set; } + /// + /// di编码 + /// + public string di { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 7cb023dd..2b63d503 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2784,6 +2784,35 @@ namespace Tnb.ProductionMgr return prdMoTask; } + /// + /// 根据chanxian 获取进行中的任务单信息 + /// + /// + /// + [HttpPost] + public async Task GetPrdMoTaskInfoByWorklineId(Dictionary dic) + { + string workline_id = dic.ContainsKey("workline_id") ? dic["workline_id"] : ""; + if (string.IsNullOrEmpty(workline_id)) + { + throw Oops.Bah("产线错误"); + } + + PrdMoTask? prdMoTask = await _db.Queryable().Where(x => x.workline_id == workline_id && x.parent_id == null && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync(); + PrdMoTask? childPrdMoTask = null; + if (prdMoTask != null) + { + childPrdMoTask = await _db.Queryable().Where(x => x.parent_id == prdMoTask.id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync(); + if (childPrdMoTask != null) + { + BasMaterial basMaterial = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); + childPrdMoTask.material_name = basMaterial.name; + } + } + + return childPrdMoTask; + } + /// /// 根据工位获取进行中待开工暂停的任务单信息 /// @@ -2910,12 +2939,59 @@ namespace Tnb.ProductionMgr public async Task GetLabelInfo(MarkingLabelInput input) { Log.Information($"获取喷码贴标信息参数:{JsonConvert.SerializeObject(input)}"); + Dictionary dic = new Dictionary() + { + ["WBZX1"] = "30019971917589",//血路管自动生产线1线 + ["WBZX2"] = "123", + ["WBZX3"] = "123", + }; + if (dic.TryGetValue(input.result, out string worklineId)) + { + if (worklineId != null && !worklineId.IsEmpty()) + { + PrdMoTask prdMoTask = await GetPrdMoTaskInfoByWorklineId(new Dictionary() + { + { "workline_id", worklineId } + }); + if (prdMoTask == null) throw Oops.Bah("没找到对应任务单"); - return "(01)16945155732691(11)240510(17)270510(10)24053026#TX-JB-12*24053026*202405*1020270510RJ-A1F3NC2"; + if (await _db.Queryable().Where(x => + x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync()) + { + await _db.Updateable() + .SetColumns(x => x.is_label == 0) + .Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && + x.is_mark == 0) + .ExecuteCommandAsync(); + } + else + { + PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel() + { + is_mark = null, + is_label = 0, + mo_task_code = prdMoTask.mo_task_code, + material_code = prdMoTask.material_code, + create_time = DateTime.Now, + }; + + await _db.Insertable(prdOutPackMarkLabel).ExecuteCommandAsync(); + } + + PrdMoTask parent = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.parent_id); + BasMaterial basMaterial = await _db.Queryable().SingleAsync(x=>x.id==parent.material_id); + + string code = $"(01){basMaterial.di ?? ""}(11){DateTime.Now.ToString("yyMMdd")}(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}(10){parent.batch??""}#{basMaterial.material_standard}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}"; + return code; + } + } + + // return "(01)16945155732691(11)240510(17)270510(10)24053026#TX-JB-12*24053026*202405*1020270510RJ-A1F3NC2"; + return ""; } /// - /// 觉设备判定 + /// 视觉设备判定 /// /// [HttpPost] diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 3c2dbd24..bf8c8a66 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -436,6 +436,9 @@ namespace Tnb.ProductionMgr material_id = a.material_id, material_code = b.code, material_name = b.name, + material_standard = b.material_standard, + container_no = b.container_no, + di = b.di, workline_id = a.workline_id, workline_name = d.FullName, bom_id = a.bom_id, diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index cf8f8a35..222ebbf0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -93,12 +93,14 @@ namespace Tnb.ProductionMgr string result = ""; bool? cs01 = await _redisData.TryGetValueByKeyField("YTCS", "CallCtuEmptyIn_CS01"); bool? cs03 = await _redisData.TryGetValueByKeyField("YTCS", "CallCtuEmptyIn_CS03"); + bool? cs06 = await _redisData.TryGetValueByKeyField("YTCS", "CallCtuEmptyIn_CS06"); bool cs01Flag = _redisData.Get("YTCS_CallCtuEmptyIn_CS01_flag"); bool cs03Flag = _redisData.Get("YTCS_CallCtuEmptyIn_CS03_flag"); + bool cs06Flag = _redisData.Get("YTCS_CallCtuEmptyIn_CS06_flag"); if (cs01==true && !cs01Flag) { BasFactoryConfig config = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN); - string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-left"); + string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-ctu1"); // string response = HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-left"); AuthResponse authResponse = JsonConvert.DeserializeObject(response); result += authResponse.data.ToString(); @@ -107,7 +109,16 @@ namespace Tnb.ProductionMgr if (cs03==true && !cs03Flag) { BasFactoryConfig config = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN); - string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-right"); + string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-ctu3"); + // string response = HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-right"); + AuthResponse authResponse = JsonConvert.DeserializeObject(response); + result += authResponse.data.ToString(); + } + + if (cs06==true && !cs06Flag) + { + BasFactoryConfig config = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN); + string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-ctu6"); // string response = HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-right"); AuthResponse authResponse = JsonConvert.DeserializeObject(response); result += authResponse.data.ToString(); @@ -118,7 +129,7 @@ namespace Tnb.ProductionMgr [HttpGet] [AllowAnonymous] - public async Task EmptyCarryOutStkLeft() + public async Task EmptyCarryOutStkCtu1() { string msg = ""; MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput(); @@ -128,25 +139,25 @@ namespace Tnb.ProductionMgr input.carrystd_id = WmsWareHouseConst.LIAOXIANGID; input.qty = 1; input.create_id = WmsWareHouseConst.AdministratorUserId; - Log.Information($"【EmptyCarryOutStk】左输送线空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}"); + Log.Information($"【EmptyCarryOutStk】ctu1空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}"); Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input); if (result.code == HttpStatusCode.OK) { - msg = "左输送线空箱入呼叫成功"; - Log.Information("【EmptyCarryOutStk】左输送线空箱入呼叫成功"); + msg = "ctu1空箱入呼叫成功"; + Log.Information("【EmptyCarryOutStk】ctu1空箱入呼叫成功"); //_redisData.Set("YTCS_CallCtuEmptyIn_CS01_flag", true, TimeSpan.FromMinutes(20)); } else { - msg = $"左输送线空箱入呼叫失败:{result.msg}"; - Log.Error($"【EmptyCarryOutStk】左输送线空箱入呼叫失败:{result.msg}"); + msg = $"ctu1空箱入呼叫失败:{result.msg}"; + Log.Error($"【EmptyCarryOutStk】ctu1空箱入呼叫失败:{result.msg}"); } return msg; } [HttpGet] [AllowAnonymous] - public async Task EmptyCarryOutStkRight() + public async Task EmptyCarryOutStkCtu3() { string msg = ""; MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput(); @@ -156,18 +167,46 @@ namespace Tnb.ProductionMgr input.carrystd_id = WmsWareHouseConst.LIAOXIANGID; input.qty = 1; input.create_id = WmsWareHouseConst.AdministratorUserId; - Log.Information($"【EmptyCarryOutStk】右输送线空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}"); + Log.Information($"【EmptyCarryOutStk】ctu3空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}"); Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input); if (result.code == HttpStatusCode.OK) { - msg = "右输送线空箱入呼叫成功"; - Log.Information("【EmptyCarryOutStk】右输送线空箱入呼叫成功"); + msg = "ctu3空箱入呼叫成功"; + Log.Information("【EmptyCarryOutStk】ctu3空箱入呼叫成功"); //_redisData.Set("YTCS_CallCtuEmptyIn_CS03_flag", true, TimeSpan.FromMinutes(20)); } else { - msg = $"右输送线空箱入呼叫失败:{result.msg}"; - Log.Error($"【EmptyCarryOutStk】右输送线空箱入呼叫失败:{result.msg}"); + msg = $"ctu3空箱入呼叫失败:{result.msg}"; + Log.Error($"【EmptyCarryOutStk】ctu3空箱入呼叫失败:{result.msg}"); + } + return msg; + } + + [HttpGet] + [AllowAnonymous] + public async Task EmptyCarryOutStkCtu6() + { + string msg = ""; + MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput(); + input.org_id = WmsWareHouseConst.AdministratorOrgId; + input.location_code = "SSX-011-006"; + input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID; + input.carrystd_id = WmsWareHouseConst.LIAOXIANGID; + input.qty = 1; + input.create_id = WmsWareHouseConst.AdministratorUserId; + Log.Information($"【EmptyCarryOutStk】ctu6空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}"); + Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input); + if (result.code == HttpStatusCode.OK) + { + msg = "ctu6空箱入呼叫成功"; + Log.Information("【EmptyCarryOutStk】ctu6空箱入呼叫成功"); + //_redisData.Set("YTCS_CallCtuEmptyIn_CS03_flag", true, TimeSpan.FromMinutes(20)); + } + else + { + msg = $"ctu6空箱入呼叫失败:{result.msg}"; + Log.Error($"【EmptyCarryOutStk】ctu6空箱入呼叫失败:{result.msg}"); } return msg; }