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] =?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: