From 53aa2123e1f43c1beba26d35c0b4210c88f7d3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Jul 2023 10:30:50 +0800 Subject: [PATCH 1/7] =?UTF-8?q?add=20=E5=B7=A5=E5=8D=95=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql index 1deca4c..3566602 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql @@ -27,7 +27,7 @@ 输入.workprocedure_ids TYPEAS f_string 输入.unFinish TYPEAS s_string 输入.region_code TYPEAS s_string - + 输入.device TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -89,6 +89,9 @@ ENDOPTION OPTION 输入.region_code <> "" device.region_code = 输入.region_code + ENDOPTION + OPTION 输入.device <> "" + device.device_name = 输入.device ENDOPTION ENDSELECT ENDPAGEQUERY @@ -241,6 +244,9 @@ OPTION 输入.region_code <> "" device.region_code = 输入.region_code ENDOPTION + OPTION 输入.device <> "" + device.device_name = 输入.device + ENDOPTION ORDER BY ShiftOrder.order_status ASC, ShiftOrder.create_time DESC ENDSELECT From 12fac73999718ac00597a18bb1cf75e2333f3f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Jul 2023 15:02:49 +0800 Subject: [PATCH 2/7] =?UTF-8?q?add=20=E5=96=B7=E7=A0=81=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/nl/wms/sch/task/util/TaskUtils.java | 52 +++++++++++++++++++ .../resources/config/application-prod.yml | 5 ++ .../src/main/resources/config/application.yml | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index 2769385..264e564 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -13,6 +13,8 @@ import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.common.PickType; import org.nl.wms.sch.manage.*; +import java.util.regex.Pattern; + /** * 辽宁晟华任务工具类 * @@ -233,4 +235,54 @@ public class TaskUtils { regionIn.put("cBatch", order_code); return regionIn; } + + // 字母表 + static String[] alphabet = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; + + // 喷码月份映射数组 + static String[] month = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "N", "D"}; + + /** + * 生成喷码内容。 + * + * @param vd 组盘对象 + * @param yjCode 压机编码 + * @return 喷码内容 + */ + public static String codingCode(JSONObject vd, String yjCode) { + try { + JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_id = " + vd.getString("material_id")).uniqueResult(0); + + // 使用部位2位。从物料编码截取使用部位。 + String partUsed = material.getString("material_code").substring(21, 23); + + // 砖型5位。一般砖型如"22/30"不需要处理,但如果'/'右边到达了3位数,需要特殊处理成"1H"。 + String brickType = material.getString("brick_type"); + int slashIndex = brickType.lastIndexOf("/"); + int brickTypeRight = Integer.parseInt(brickType.substring(slashIndex + 1)); + if (brickTypeRight >= 100) { + int brickTypeFront = Integer.parseInt(brickType.substring(0, slashIndex)); + brickType = brickTypeFront + "/" + "1H"; + } + + // 压机号1位,A代表1号压机,以此类推。从压机设备编码截取数字,例如"YJ07"截取"07",转换成数字后减去1即是压机对应字母在 alphabet 数组中的索引位置。 + yjCode = alphabet[Integer.parseInt(Pattern.compile("[^0-9]").matcher(yjCode).replaceAll("").trim()) - 1]; + + // 混料机号1位,A代表1号混料机。以此类推,从混料机设备编码截取数字,例如"HLJ07"截取"07",转换成数字后减去1即是压机对应字母在 alphabet 数组中的索引位置。 + JSONObject workOrder = WQLObject.getWQLObject("pdm_bd_workorder").query("workorder_id = " + vd.getString("workorder_id")).uniqueResult(0); + String hljCode = alphabet[Integer.parseInt(Pattern.compile("[^0-9]").matcher(workOrder.getString("device_code")).replaceAll("").trim()) - 1]; + + // 碾次2位。表里存储的是整数,对于少于2位的数字 String 简单格式化即可。 + String mixNum = String.format("%02d", vd.getIntValue("mix_num")); + + // 日期3位,第1位表示月,超过1位的'0'表示10月,'N'表示11月,'D'表示12月,后2位表示日,对于少于2位的日 String 简单格式化即可。 + String date = month[DateUtil.thisMonth() - 1] + String.format("%02d", DateUtil.thisDayOfMonth()); + + // 拼接字符串返回。 + return partUsed + brickType + yjCode + hljCode + mixNum + date; + } catch (Exception ignore) { + // 如果报错返回 null。 + return null; + } + } } diff --git a/lms/nladmin-system/src/main/resources/config/application-prod.yml b/lms/nladmin-system/src/main/resources/config/application-prod.yml index 14d60b1..13b9ffb 100644 --- a/lms/nladmin-system/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/src/main/resources/config/application-prod.yml @@ -1,5 +1,10 @@ server: port: 8010 + tomcat: + accept-count: 1000 + max-connections: 10000 + max-threads: 800 + min-spare-threads: 100 #配置数据源 spring: datasource: diff --git a/lms/nladmin-system/src/main/resources/config/application.yml b/lms/nladmin-system/src/main/resources/config/application.yml index 6f01423..942ceff 100644 --- a/lms/nladmin-system/src/main/resources/config/application.yml +++ b/lms/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: From 79fcd718b5501d20fb5c85fc81acd28e7ead291a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Jul 2023 15:09:22 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix=20=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/wms/sch/task/util/TaskUtils.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index 264e564..4c9baf1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -23,12 +23,6 @@ import java.util.regex.Pattern; */ public class TaskUtils { - public static void isEmptyPoint(JSONObject point) { - if (PointStatus.NOT_EMPTY.value().equals(point.getString("point_status"))) { - throw new BadRequestException("[" + point.getString("point_code") + "] 上有货!"); - } - } - public static void isNotEmptyPoint(JSONObject point) { if (PointStatus.EMPTY.value().equals(point.getString("point_status"))) { throw new BadRequestException("[" + point.getString("point_code") + "] 上无货!"); @@ -243,7 +237,7 @@ public class TaskUtils { static String[] month = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "N", "D"}; /** - * 生成喷码内容。 + * 生成喷码内容,祥见 SVN 项目文档信息。 * * @param vd 组盘对象 * @param yjCode 压机编码 From ca123d21485f60a075caf202a3d052fdf780947f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Jul 2023 15:18:53 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix=20=E6=9C=88=E4=BB=BD=E4=BB=8E0=E5=BC=80?= =?UTF-8?q?=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/wms/sch/task/util/TaskUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index 4c9baf1..dbdcf8c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -270,7 +270,7 @@ public class TaskUtils { String mixNum = String.format("%02d", vd.getIntValue("mix_num")); // 日期3位,第1位表示月,超过1位的'0'表示10月,'N'表示11月,'D'表示12月,后2位表示日,对于少于2位的日 String 简单格式化即可。 - String date = month[DateUtil.thisMonth() - 1] + String.format("%02d", DateUtil.thisDayOfMonth()); + String date = month[DateUtil.thisMonth()] + String.format("%02d", DateUtil.thisDayOfMonth()); // 拼接字符串返回。 return partUsed + brickType + yjCode + hljCode + mixNum + date; From 8de6cd3eada7dd625ceab2880ab3f8b11a1a0485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Jul 2023 15:28:08 +0800 Subject: [PATCH 5/7] =?UTF-8?q?rev=20=E5=8F=98=E9=87=8F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/wms/sch/task/util/TaskUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index dbdcf8c..a914a72 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -255,8 +255,8 @@ public class TaskUtils { int slashIndex = brickType.lastIndexOf("/"); int brickTypeRight = Integer.parseInt(brickType.substring(slashIndex + 1)); if (brickTypeRight >= 100) { - int brickTypeFront = Integer.parseInt(brickType.substring(0, slashIndex)); - brickType = brickTypeFront + "/" + "1H"; + int brickTypeLeft = Integer.parseInt(brickType.substring(0, slashIndex)); + brickType = brickTypeLeft + "/" + "1H"; } // 压机号1位,A代表1号压机,以此类推。从压机设备编码截取数字,例如"YJ07"截取"07",转换成数字后减去1即是压机对应字母在 alphabet 数组中的索引位置。 From 4f64cadbb3b005721f25b770d9d5540461883742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Jul 2023 15:35:13 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix=20=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/wms/sch/task/util/TaskUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index a914a72..9146f5f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -262,7 +262,7 @@ public class TaskUtils { // 压机号1位,A代表1号压机,以此类推。从压机设备编码截取数字,例如"YJ07"截取"07",转换成数字后减去1即是压机对应字母在 alphabet 数组中的索引位置。 yjCode = alphabet[Integer.parseInt(Pattern.compile("[^0-9]").matcher(yjCode).replaceAll("").trim()) - 1]; - // 混料机号1位,A代表1号混料机。以此类推,从混料机设备编码截取数字,例如"HLJ07"截取"07",转换成数字后减去1即是压机对应字母在 alphabet 数组中的索引位置。 + // 混料机号1位,A代表1号混料机,以此类推。从混料机设备编码截取数字,例如"HLJ07"截取"07",转换成数字后减去1即是压机对应字母在 alphabet 数组中的索引位置。 JSONObject workOrder = WQLObject.getWQLObject("pdm_bd_workorder").query("workorder_id = " + vd.getString("workorder_id")).uniqueResult(0); String hljCode = alphabet[Integer.parseInt(Pattern.compile("[^0-9]").matcher(workOrder.getString("device_code")).replaceAll("").trim()) - 1]; From 32acfcb2e39a86596425f633d0e3b902a10dda36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Tue, 4 Jul 2023 09:53:54 +0800 Subject: [PATCH 7/7] =?UTF-8?q?add=20=E7=AA=91=E5=86=85=E5=8F=8A=E5=86=B7?= =?UTF-8?q?=E5=8D=B4=E9=81=93=E6=89=98=E7=9B=98=E6=8E=A8=E9=80=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 暂未启用,先看电气能不能上报 --- .../cockpit/constant/CockpitConstants.java | 24 +++++++++ .../org/nl/wms/sch/task/util/TaskUtils.java | 52 +++++++++++++++++-- 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/constant/CockpitConstants.java diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/constant/CockpitConstants.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/constant/CockpitConstants.java new file mode 100644 index 0000000..125a8ac --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/constant/CockpitConstants.java @@ -0,0 +1,24 @@ +package org.nl.wms.cockpit.constant; + +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * 大屏常量类 + * + * @author zhangjiangwei + * @date 2023/07/03 16:58 + */ +public class CockpitConstants { + + // 入窑输送线及窑内数据 + public static CopyOnWriteArrayList kilnData = new CopyOnWriteArrayList<>(new String[44]); + + // 入窑输送线及窑内数据 redis key + public static final String KILN_DATA_KEY = "KILN_DATA_KEY"; + + // 冷却道数据 + public static CopyOnWriteArrayList coolingData = new CopyOnWriteArrayList<>(new String[46]); + + // 冷却道数据 redis key + public static final String COOLING_DATA_KEY = "COOLING_DATA_KEY"; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index 9146f5f..b9214a1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -4,12 +4,17 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.common.utils.RedisUtils; import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.SpringContextHolder; +import org.nl.wms.cockpit.constant.CockpitConstants; import org.nl.wms.common.PickType; import org.nl.wms.sch.manage.*; @@ -239,17 +244,17 @@ public class TaskUtils { /** * 生成喷码内容,祥见 SVN 项目文档信息。 * - * @param vd 组盘对象 + * @param vd 组盘对象 * @param yjCode 压机编码 * @return 喷码内容 */ public static String codingCode(JSONObject vd, String yjCode) { try { JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_id = " + vd.getString("material_id")).uniqueResult(0); - + // 使用部位2位。从物料编码截取使用部位。 String partUsed = material.getString("material_code").substring(21, 23); - + // 砖型5位。一般砖型如"22/30"不需要处理,但如果'/'右边到达了3位数,需要特殊处理成"1H"。 String brickType = material.getString("brick_type"); int slashIndex = brickType.lastIndexOf("/"); @@ -279,4 +284,45 @@ public class TaskUtils { return null; } } + + public static void inKiln(String vehicleCode) { + if (StrUtil.isBlank(CockpitConstants.kilnData.get(0))) { + CockpitConstants.kilnData.set(0, vehicleCode); + SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.KILN_DATA_KEY, JSON.toJSONString(CockpitConstants.kilnData, SerializerFeature.WriteMapNullValue)); + } else { + for (int i = CockpitConstants.kilnData.size() - 1; i > 0; i--) { + CockpitConstants.kilnData.set(i, CockpitConstants.kilnData.get(i - 1)); + } + CockpitConstants.kilnData.set(0, vehicleCode); + SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.KILN_DATA_KEY, JSON.toJSONString(CockpitConstants.kilnData, SerializerFeature.WriteMapNullValue)); + } + } + + public static void outKiln(String vehicleCode) { + if (vehicleCode.equals(CockpitConstants.kilnData.get(CockpitConstants.kilnData.size() - 1))) { + for (int i = CockpitConstants.kilnData.size() - 1; i > 0; i--) { + CockpitConstants.kilnData.set(i, CockpitConstants.kilnData.get(i - 1)); + } + CockpitConstants.kilnData.set(0, null); + SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.KILN_DATA_KEY, JSON.toJSONString(CockpitConstants.kilnData, SerializerFeature.WriteMapNullValue)); + } + } + + public static void inCooling(String vehicleCode) { + for (int i = CockpitConstants.coolingData.size() - 1; i > 0; i--) { + CockpitConstants.coolingData.set(i, CockpitConstants.coolingData.get(i - 1)); + } + CockpitConstants.coolingData.set(0, vehicleCode); + SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.COOLING_DATA_KEY, JSON.toJSONString(CockpitConstants.coolingData, SerializerFeature.WriteMapNullValue)); + } + + public static void outCooling(String vehicleCode) { + if (vehicleCode.equals(CockpitConstants.coolingData.get(CockpitConstants.coolingData.size() - 1))) { + for (int i = CockpitConstants.coolingData.size() - 1; i > 0; i--) { + CockpitConstants.coolingData.set(i, CockpitConstants.coolingData.get(i - 1)); + } + CockpitConstants.coolingData.set(0, null); + SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.COOLING_DATA_KEY, JSON.toJSONString(CockpitConstants.coolingData, SerializerFeature.WriteMapNullValue)); + } + } }