张田野 пре 2 недеља
родитељ
комит
090e458e22

+ 20 - 7
src/com/mes/component/MesWebView.java

@@ -18,16 +18,16 @@ public class MesWebView extends JFXPanel {
 
 
     public static final Logger log =  LoggerFactory.getLogger(MesWebView.class);
     public static final Logger log =  LoggerFactory.getLogger(MesWebView.class);
 
 
-    public static WebEngine engine = null;
+    // 每个实例持有自己的 WebEngine,双工位分屏时两个 WebView 互不干扰
+    private WebEngine engine;
+    private String currentUrl;
 
 
     public MesWebView(String url){
     public MesWebView(String url){
-
+        this.currentUrl = url;
         Platform.runLater(() -> {
         Platform.runLater(() -> {
             WebView webView = new WebView();
             WebView webView = new WebView();
             setScene(new Scene(webView));
             setScene(new Scene(webView));
-            Date date = new Date();
-//            String url = "http://"+mes_server_ip+":8980/js/a/mes/mesQuality/check?__sid="+sessionid+"&oprno="+mes_gw+"&t="+date.getTime();
-            log.info(url);
+            log.info(currentUrl);
             engine = webView.getEngine();
             engine = webView.getEngine();
             CallFromJs bridge = new CallFromJs();
             CallFromJs bridge = new CallFromJs();
             engine.getLoadWorker().stateProperty().addListener(
             engine.getLoadWorker().stateProperty().addListener(
@@ -39,11 +39,24 @@ public class MesWebView extends JFXPanel {
                         }
                         }
                     }
                     }
             );
             );
-            engine.load(url);
+            engine.load(currentUrl);
+        });
+    }
+
+    /** 按新 URL 重新加载:软件设置里的工位号变更后,点检页签刷新时调用 */
+    public void loadUrl(String url){
+        this.currentUrl = url;
+        Platform.runLater(() -> {
+            if (engine != null) {
+                log.info(currentUrl);
+                engine.load(currentUrl);
+            }
         });
         });
     }
     }
 
 
     public void reloadWeb(){
     public void reloadWeb(){
-        engine.reload();
+        Platform.runLater(() -> {
+            if (engine != null) engine.reload();
+        });
     }
     }
 }
 }

+ 2 - 6
src/com/mes/ui/LoginFarme.java

@@ -190,12 +190,8 @@ public class LoginFarme extends JFrame {
 //                        MesClient.indexPanelB.add(MesClient.jfxPanel);
 //                        MesClient.indexPanelB.add(MesClient.jfxPanel);
 //                    }
 //                    }
 //
 //
-//                    if(MesClient.jfxPanel2 == null){
-//                        String url = "http://"+ MesClient.mes_server_ip+":8980/js/a/mes/mesProcessCheckRecord/ulist?ucode="+user_id+"&oprno="+MesClient.mes_gw+"&lineSn="+MesClient.mes_line_sn;
-//                        MesClient.jfxPanel2 = new MesWebView(url);
-//                        MesClient.jfxPanel2.setSize(990, 550);
-//                        MesClient.indexPanelC.add(MesClient.jfxPanel2);
-//                    }
+                    // 开班点检:按软件设置(configParam)里的工位号加载 MES 点检页面
+                    MesClient.refreshCheckPage();
 
 
                     MesClient.initWarehouseData();
                     MesClient.initWarehouseData();
                 }
                 }

+ 66 - 5
src/com/mes/ui/MesClient.java

@@ -84,6 +84,9 @@ public class MesClient extends JFrame {
     public static MesWebView jfxPanel = null;
     public static MesWebView jfxPanel = null;
     public static JPanel indexPanelC;
     public static JPanel indexPanelC;
     public static JPanel indexPanelD;
     public static JPanel indexPanelD;
+    public static JPanel indexPanelCheck;      // 开班点检页签面板(独立于「记录查询」)
+    public static JPanel panelCheck;           // 点检 WebView 容器
+    public static JLabel labCheckTitle;        // 显示当前点检工位号
     public static MesWebView jfxPanel2 = null;
     public static MesWebView jfxPanel2 = null;
     public static MesWebView jfxPanel3 = null;
     public static MesWebView jfxPanel3 = null;
     public static MesRadio mesRadioHj;
     public static MesRadio mesRadioHj;
@@ -167,7 +170,7 @@ public class MesClient extends JFrame {
 
 
 //                    resetScanA();
 //                    resetScanA();
                 }catch (Exception e){
                 }catch (Exception e){
-                    log.error(e.getMessage());
+                    log.error("启动初始化异常", e);
                 }
                 }
             }
             }
         });
         });
@@ -1233,6 +1236,16 @@ public class MesClient extends JFrame {
 
 
         tabbedPane.addTab("记录查询", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
         tabbedPane.addTab("记录查询", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
 
 
+        // 开班点检页签:独立于「记录查询」,工位号从软件设置(configParam)读取
+        indexPanelCheck = new JPanel(new BorderLayout());
+        indexPanelCheck.setPreferredSize(new Dimension(990, 550));
+        labCheckTitle = new JLabel("开班点检(工位号读取软件设置)", JLabel.CENTER);
+        indexPanelCheck.add(labCheckTitle, BorderLayout.NORTH);
+        panelCheck = new JPanel(new BorderLayout());
+        indexPanelCheck.add(panelCheck, BorderLayout.CENTER);
+        JScrollPane searchScrollPaneCheck = new JScrollPane(indexPanelCheck);
+        tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneCheck, null);
+
 
 
 //        indexPanelB = new JPanel();
 //        indexPanelB = new JPanel();
 //        searchScrollPane = new JScrollPane(indexPanelB);
 //        searchScrollPane = new JScrollPane(indexPanelB);
@@ -1249,10 +1262,15 @@ public class MesClient extends JFrame {
         indexPanelD.setLayout(null);
         indexPanelD.setLayout(null);
 
 
         PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
         PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
-        String[] printerNames = (printServices != null && printServices.length > 0) ?
-                new String[printServices.length] : new String[]{"未知"};
-        for (int i = 0; i < printerNames.length; i++) {
-            printerNames[i] = printServices[i].getName();
+        String[] printerNames;
+        if (printServices != null && printServices.length > 0) {
+            printerNames = new String[printServices.length];
+            for (int i = 0; i < printServices.length; i++) {
+                printerNames[i] = printServices[i].getName();
+            }
+        } else {
+            // 本机未检测到打印机:用占位项,避免用 printerNames.length 索引空数组导致越界
+            printerNames = new String[]{"未知"};
         }
         }
         
         
         JLabel lblNewLabel_3 = new JLabel("设备程序号");
         JLabel lblNewLabel_3 = new JLabel("设备程序号");
@@ -1937,11 +1955,54 @@ public class MesClient extends JFrame {
                 if(selectedIndex == 1){
                 if(selectedIndex == 1){
 
 
                 }
                 }
+                // 切到「开班点检」页签时按当前软件设置重新加载,保证工位号改动即时生效
+                if(selectedIndex >= 0 && "开班点检".equals(tabbedPane.getTitleAt(selectedIndex))){
+                    refreshCheckPage();
+                }
                 JdbcUtils.getTestData();
                 JdbcUtils.getTestData();
             }
             }
         });
         });
     }
     }
 
 
+    /**
+     * 加载/刷新「开班点检」页面:工位号与产线号均取自软件设置(configParam),
+     * 而不是 config.properties 里写死的 mes.gw。未配置时才回退到 mes.gw / mes_line_sn。
+     */
+    public static void refreshCheckPage(){
+        if(sessionid == null || sessionid.isEmpty()) return;   // 未登录不加载
+        if(configParam == null) return;
+
+        String oprno = configParam.getOprno();
+        if(oprno == null || oprno.trim().isEmpty()){
+            // 不回退到 config.properties 的 mes_gw,避免把点检记录提交到错误工位
+            if(labCheckTitle != null){
+                labCheckTitle.setText("开班点检  -  未配置工位号,请在「软件设置」中配置后切回本页签");
+            }
+            return;
+        }
+        String lineSn = configParam.getLineSn();
+        if(lineSn == null || lineSn.trim().isEmpty()) lineSn = mes_line_sn;
+
+        String url = "http://" + mes_server_ip + ":8980/js/a/mes/mesProcessCheckRecord/ulist?__sid="
+                + sessionid + "&oprno=" + oprno.trim() + "&lineSn=" + lineSn.trim();
+        if(labCheckTitle != null){
+            labCheckTitle.setText("开班点检  -  工位号:" + oprno.trim() + "(来自软件设置)");
+        }
+        try {
+            if(jfxPanel2 == null){
+                jfxPanel2 = new MesWebView(url);
+                panelCheck.add(jfxPanel2, BorderLayout.CENTER);
+                panelCheck.revalidate();
+                panelCheck.repaint();
+            }else{
+                jfxPanel2.loadUrl(url);
+            }
+        } catch (Exception ex) {
+            System.err.println("开班点检页面加载失败: " + ex.getMessage());
+            ex.printStackTrace();
+        }
+    }
+
     public static void setMenuStatus(String msg,int error){
     public static void setMenuStatus(String msg,int error){
         if(error == 0){
         if(error == 0){
             MesClient.status_menu.setForeground(Color.GREEN);
             MesClient.status_menu.setForeground(Color.GREEN);

+ 2 - 18
src/com/mes/ui/OprnoUtil.java

@@ -6,27 +6,11 @@ import java.util.Map;
 
 
 public class OprnoUtil {
 public class OprnoUtil {
     public static String[] xtoprnos = new String[]{
     public static String[] xtoprnos = new String[]{
-            "OP040", "OP050", "OP060", "OP070", "OP080",
-            "OP090", "OP100", "OP110", "OP120", "OP130",
-            "OP140", "OP150", "OP160", "OP170", "OP180",
-            "OP190", "OP200", "OP210", "OP220", "OP230",
-            "OP240", "OP250", "OP260", "OP270", "OP280",
-            "OP290", "OP300", "OP310", "OP320", "OP330",
-            "OP340", "OP350", "OP360", "OP370", "OP380",
-            "OP390", "OP400", "OP410", "OP420", "OP430",
-            "OP440", "OP450"
+            "OP260"
     };
     };
 
 
     public static String[] xtoprnodes = new String[]{
     public static String[] xtoprnodes = new String[]{
-            "镭雕二维码", "前边梁小总成(焊接)", "前边梁小总成(拉铆)+右边梁小总成(拉铆)", "前边梁小总成气密", "前边梁小总成/左边梁小总成压铆",
-            "前边梁小总成/左边梁小总成涂胶", "框架CMT焊接", "人工补焊", "焊道铣削", "焊道缺陷检验",
-            "框架气密", "总成正面CNC", "总成反面CNC", "框架清洁", "框架涂胶+液冷板安装",
-            "反面铆接", "激光点焊", "水冷板FSW", "清除FSW飞边", "TIG焊接水嘴",
-            "TIG补焊尾孔+封堵片焊接", "总成清洁+涂封堵胶", "涂胶+压套筒", "胶水固化", "正面装配",
-            "反面装配", "半成品气密", "箱体补强件位置涂胶", "安装补强件", "胶水固化",
-            "FSW焊道位置涂胶", "胶水固化", "底护板装配", "复拧螺栓", "成品气密",
-            "液冷板气检", "总成检具", "CCD", "总成清洁", "终检",
-            "GP12", "包装"
+            "半成品气密"
     };
     };
     public static String[] lboprnos = new String[]{
     public static String[] lboprnos = new String[]{
 
 

+ 2 - 5
src/com/mes/util/ATEQ.java

@@ -143,14 +143,11 @@ public class ATEQ {
             return "实时结果{" +
             return "实时结果{" +
                     " 压力值: " + pressureValue +
                     " 压力值: " + pressureValue +
                     ", 泄漏值: " + leakValue +
                     ", 泄漏值: " + leakValue +
-//                    ", FIFO数量: " + FIFO_Number +
                     ", 当前步骤CODE: " + stepCode +
                     ", 当前步骤CODE: " + stepCode +
                     ", 当前步骤: " + step +
                     ", 当前步骤: " + step +
-//                    ", 循环是否结束: " + isCycleEnd +
-//                    ", 测试通过: " + isPass +
-//                    ", 是否关键存在: " + isKeyExist +
+                    ", 循环是否结束: " + isCycleEnd +
+                    ", 测试通过: " + isPass +
                     ", 程序号: " + programNumber +
                     ", 程序号: " + programNumber +
-//                    ", 测试类型: " + testType +
                     '}';
                     '}';
         }
         }
     }
     }

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

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

+ 15 - 7
src/com/mes/util/WorkTimer.java

@@ -59,7 +59,8 @@ public class WorkTimer {
                     ATEQ.RealtimeResult realtimeResult = ATEQ.readRealtimeResult();  // 循环查询实时结果
                     ATEQ.RealtimeResult realtimeResult = ATEQ.readRealtimeResult();  // 循环查询实时结果
                     log.info(realtimeResult.toString());
                     log.info(realtimeResult.toString());
                     Boolean isEnd = false;
                     Boolean isEnd = false;
-                    if(realtimeResult.stepCode == 65535){ // 监测结束
+                    // stepCode=65535 表示回到空闲;需配合 isCycleEnd 区分「正常测完」和「中途停止」
+                    if(realtimeResult.stepCode == 65535){
                         if(MesClient.mesStartFlag == 1){
                         if(MesClient.mesStartFlag == 1){
                             isEnd = true;
                             isEnd = true;
                         }
                         }
@@ -72,20 +73,27 @@ public class WorkTimer {
                     MesClient.param1.setText(isEnd ? "" : realtimeResult.pressureValue + " " + realtimeResult.pressureUnit);
                     MesClient.param1.setText(isEnd ? "" : realtimeResult.pressureValue + " " + realtimeResult.pressureUnit);
                     MesClient.param2.setText(isEnd ? "" : realtimeResult.leakValue + " " + realtimeResult.leakUnit);
                     MesClient.param2.setText(isEnd ? "" : realtimeResult.leakValue + " " + realtimeResult.leakUnit);
 
 
-                    // 如果从实时结果中得到到测试结束,则查询最后结果,并提交结果
+                    // 回到空闲后:仅正常结束(isCycleEnd)才读 LastResult 并记录/上传;中途停止不记不传
                     if (isEnd) {
                     if (isEnd) {
+                        if (!Boolean.TRUE.equals(realtimeResult.isCycleEnd)) {
+                            // 中途暂停/停止:不落库、不上传,仅复位开测标记,避免反复进入结束逻辑
+                            log.warn("检测到测试中途停止(isCycleEnd=false),不记录不上传");
+                            MesClient.mesStartFlag = 0;
+                            MesClient.setMenuStatus("测试中途停止,未记录结果", 0);
+                            return;
+                        }
+
                         ATEQ.LastResult lastResult = ATEQ.readLastResult();
                         ATEQ.LastResult lastResult = ATEQ.readLastResult();
                         log.info(lastResult.toString());
                         log.info(lastResult.toString());
-                        MesClient.param1.setText(lastResult.pressureValue+lastResult.pressureUnit);
+                        MesClient.param1.setText(lastResult.pressureValue + lastResult.pressureUnit);
 
 
-                        if(lastResult.leakValue == 0 && !lastResult.isPass){
+                        if (lastResult.leakValue == 0 && !lastResult.isPass) {
                             MesClient.param2.setText("9999");
                             MesClient.param2.setText("9999");
-                        }else{
-                            MesClient.param2.setText(lastResult.leakValue+lastResult.leakUnit);
+                        } else {
+                            MesClient.param2.setText(lastResult.leakValue + lastResult.leakUnit);
                         }
                         }
 
 
                         String lastRet = lastResult.isPass ? "OK" : "NG";
                         String lastRet = lastResult.isPass ? "OK" : "NG";
-
                         if(lastRet.equals("OK")){
                         if(lastRet.equals("OK")){
                             MesClient.result.setText("OK");
                             MesClient.result.setText("OK");
                             MesClient.result.setForeground(Color.GREEN);
                             MesClient.result.setForeground(Color.GREEN);

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

@@ -1,7 +1,7 @@
-mes.gw=OP300A
+mes.gw=OP350B
 #mes.server_ip=127.0.0.1
 #mes.server_ip=127.0.0.1
-mes.server_ip=192.168.22.99
+mes.server_ip=192.168.12.99
 mes.tcp_port=3000
 mes.tcp_port=3000
 mes.heart_beat_cycle=60
 mes.heart_beat_cycle=60
 mes.line_sn=XT
 mes.line_sn=XT
-portName1=COM9
+portName1=COM7