Procházet zdrojové kódy

适配新工件码

张田野 před 1 týdnem
rodič
revize
fd43d6e9dd

+ 12 - 3
src/com/mes/ui/MesClient.java

@@ -1061,12 +1061,21 @@ public class MesClient extends JFrame {
                         MesClient.setMenuStatus("密码错误",-1);
                     }
                 }else{
-                    formatConfigEdit(false);
-                    saveBtn.setText("编辑配置");
-
                     stationA.collectConfigFromUi();
                     stationB.collectConfigFromUi();
 
+                    if (!QmStation.isValidOprno(stationA.configParam.getOprno())) {
+                        MesClient.setMenuStatus("工位A号格式不正确,应为 OP080 或 OP080A", -1);
+                        return;
+                    }
+                    if (!QmStation.isValidOprno(stationB.configParam.getOprno())) {
+                        MesClient.setMenuStatus("工位B号格式不正确,应为 OP080 或 OP080A", -1);
+                        return;
+                    }
+
+                    formatConfigEdit(false);
+                    saveBtn.setText("编辑配置");
+
                     if (dualConfigParam == null) {
                         dualConfigParam = new DualConfigParam();
                     }

+ 27 - 4
src/com/mes/ui/QmStation.java

@@ -352,7 +352,7 @@ public class QmStation {
         labelFont.setText(nvl(configParam.getLabelFont(), "10"));
         stationNo.setText(nvl(configParam.getStationNo(), "1"));
         productSnPre.setText(nvl(configParam.getProductSnPre(), ""));
-        productSnLength.setText(nvl(configParam.getProductSnLength(), ""));
+        productSnLength.setText(nvl(configParam.getProductSnLength(), "33"));
         device.setSelectedItem(nvl(configParam.getDevice(), "innomatec"));
         oprno.setText(nvl(configParam.getOprno(), ""));
         oprnoTitle.setText(nvl(configParam.getOprnoTitle(), ""));
@@ -376,14 +376,21 @@ public class QmStation {
         configParam.setPrintLabel(printLabel.getSelectedItem().toString());
         configParam.setStartMode(startMode.getSelectedItem().toString());
         configParam.setProductSnPre(productSnPre.getText().trim());
-        configParam.setProductSnLength(productSnLength.getText().trim());
+        String snLenTxt = productSnLength.getText().trim();
+        configParam.setProductSnLength(snLenTxt.isEmpty() ? "33" : snLenTxt);
         configParam.setLeakage(leakage.getSelectedItem().toString());
         configParam.setDevice(device.getSelectedItem().toString());
-        configParam.setOprno(oprno.getText().trim());
+        String opr = oprno.getText().trim().toUpperCase();
+        configParam.setOprno(opr);
         configParam.setOprnoTitle(oprnoTitle.getText().trim());
         configParam.setLineSn(lineSn.getText().trim());
     }
 
+    /** 工位号:OP080 或 OP080A */
+    public static boolean isValidOprno(String opr) {
+        return opr != null && opr.matches("^OP\\d{3}[A-Z]?$");
+    }
+
     public static void fillDefault(ConfigParam p) {
         if (p == null) {
             return;
@@ -405,7 +412,10 @@ public class QmStation {
         if (empty(p.getLabelFont())) p.setLabelFont("10");
         if (empty(p.getStationNo())) p.setStationNo("1");
         if (p.getProductSnPre() == null) p.setProductSnPre("");
-        if (p.getProductSnLength() == null) p.setProductSnLength("");
+        // Modena-1B 工件码固定 33 位
+        if (p.getProductSnLength() == null || p.getProductSnLength().trim().isEmpty()) {
+            p.setProductSnLength("33");
+        }
         if (empty(p.getDevice())) p.setDevice("innomatec");
         if (p.getOprno() == null) p.setOprno("");
         if (p.getOprnoTitle() == null) p.setOprnoTitle("");
@@ -461,6 +471,19 @@ public class QmStation {
             product_sn.setText("");
             return;
         }
+        // Modena-1B:默认 33 位;配置了 productSnLength 时以配置为准
+        int snLen = 33;
+        try {
+            if (configParam.getProductSnLength() != null && !configParam.getProductSnLength().trim().isEmpty()) {
+                snLen = Integer.parseInt(configParam.getProductSnLength().trim());
+            }
+        } catch (Exception ignored) {
+            snLen = 33;
+        }
+        if (snLen > 0 && scanBarcode.length() != snLen) {
+            MesClient.setMenuStatus(title + ":工件码长度必须为" + snLen + "位", -1);
+            return;
+        }
         if (checkProductSn(scanBarcode)) {
             if (serialPortUtils != null) {
                 serialPortUtils.changeProgram();

+ 16 - 3
src/com/mes/util/ErrorMsg.java

@@ -1,6 +1,7 @@
 package com.mes.util;
 
 public class ErrorMsg {
+    /** 与 mescloud ErrorMsg / 质量查询返回码对齐 */
     public static String getErrorMsg(String processMsgRet,String lx){
         String lmsg = "该工件本工位不可加工";
         try{
@@ -26,6 +27,8 @@ public class ErrorMsg {
                 lmsg = "首件检查工件不合格停机";
             }else if(processMsgRet.equalsIgnoreCase("GN")) {
                 lmsg = "更换配件首件检查不合格停机";
+            }else if(processMsgRet.equalsIgnoreCase("CS")) {
+                lmsg = "首件检查两小时内未检查,超时停机";
             }else if(processMsgRet.equalsIgnoreCase("DJ")) {
                 lmsg = "未进行开班点检";
             }else if(processMsgRet.equalsIgnoreCase("BM")) {
@@ -33,15 +36,25 @@ public class ErrorMsg {
             }else if(processMsgRet.equalsIgnoreCase("PL")) {
                 lmsg = "配件寿命不足";
             }else if(processMsgRet.equalsIgnoreCase("QM")) {
-                lmsg = "两次气密必须间隔15分钟";
+                lmsg = "两次气密必须间隔10分钟";
+            }else if(processMsgRet.equalsIgnoreCase("MX")) {
+                lmsg = "气密重复加工次数已达上限";
             }else if(processMsgRet.equalsIgnoreCase("GS")) {
                 lmsg = "工件码格式不正确";
             }else if(processMsgRet.equalsIgnoreCase("CF")) {
                 lmsg = "工件码重复";
-            } else if (processMsgRet.equalsIgnoreCase("NL")) {
+            }else if(processMsgRet.equalsIgnoreCase("SB")) {
+                lmsg = "设备信息不存在";
+            }else if(processMsgRet.equalsIgnoreCase("GH")) {
+                lmsg = "固化时间不足";
+            }else if(processMsgRet.equalsIgnoreCase("PZ")) {
+                lmsg = "未拍照不能提交";
+            }else if(processMsgRet.equalsIgnoreCase("NL")) {
                 lmsg = "未开始静置";
-            } else if (processMsgRet.equalsIgnoreCase("HW")) {
+            }else if(processMsgRet.equalsIgnoreCase("HW")) {
                 lmsg = "静置时间未到";
+            }else if(processMsgRet.equalsIgnoreCase("NS")) {
+                lmsg = "服务端处理失败,请重试";
             }
         }catch (Exception e){ }
         return lmsg;

+ 1 - 1
src/resources/config/config.properties

@@ -1,7 +1,7 @@
 # TCP心跳/同步用网关工位(软件设置里工位A/B各自配置 oprno,如 OP260A、OP260B)
 mes.gw=OP260A
 #mes.server_ip=127.0.0.1
-mes.server_ip=192.168.15.99
+mes.server_ip=192.168.12.99
 mes.tcp_port=3000
 mes.heart_beat_cycle=60
 mes.line_sn=XT