hzd 1 주 전
부모
커밋
1d9fc837b2
3개의 변경된 파일72개의 추가작업 그리고 11개의 파일을 삭제
  1. 62 8
      src/com/mes/ui/MesClient.java
  2. 8 1
      src/com/mes/ui/MesRevice.java
  3. 2 2
      src/resources/config/config.properties

+ 62 - 8
src/com/mes/ui/MesClient.java

@@ -148,6 +148,10 @@ public class MesClient extends JFrame {
 
     public static Short curInit = 0; // 初始拉铆数量
 
+    public static Boolean fxModeVal = false;
+    public static JButton fxMode;
+    public static JButton fxMaxBtn;
+
     public static void main(String[] args) {
         EventQueue.invokeLater(new Runnable() {
             @Override
@@ -464,6 +468,7 @@ public class MesClient extends JFrame {
 
     }
     public static int userLoginHours;//用户登录所处小时
+    public static JTextField fxMaxNum;
     //换班用户信息检查
     private static  void  shiftUserCheck() {
         LocalDateTime now = LocalDateTime.now();
@@ -552,15 +557,24 @@ public class MesClient extends JFrame {
                 return;
             }
 
-            // 查询工件质量
-            log.info("【质量检查-扫码触发】准备发送扫码质量询问报文, SN: {}, User: {}", barcode36, user20);
-            Boolean sendret = DataUtil.checkQuality(nettyClient,barcode36,user20);
-            log.info("【质量检查-扫码触发】请求发送结果: {}", sendret);
+            if(!fxModeVal){
+                // 查询工件质量
+                log.info("【质量检查-扫码触发】准备发送扫码质量询问报文, SN: {}, User: {}", barcode36, user20);
+                Boolean sendret = DataUtil.checkQuality(nettyClient,barcode36,user20);
+                log.info("【质量检查-扫码触发】请求发送结果: {}", sendret);
 
-            if(!sendret){
-                JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
-                return;
+                if(!sendret){
+                    JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
+                    return;
+                }
+            }else{
+                MesClient.check_quality_result = true;//质量合格,可以绑定加工
+                MesClient.setMenuStatus("该工件可以加工",0);
+                MesClient.getUser();
+                DataUtil.startWork(MesClient.nettyClient,barcode36,MesClient.user20);
+                MesClient.f_scan_data_bt_2.setEnabled(true);
             }
+
         }else {
             JOptionPane.showMessageDialog(mesClientFrame,"请扫工件码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
             return;
@@ -1044,6 +1058,47 @@ public class MesClient extends JFrame {
         ngResultA.setFont(new Font("微软雅黑", Font.PLAIN, 16));
         ngResultA.setBounds(759, 285, 100, 40);
         indexPanelA.add(ngResultA);
+        
+        fxMode = new JButton("返修模式");
+        fxMode.setFont(new Font("微软雅黑", Font.PLAIN, 16));
+        fxMode.setBounds(161, 10, 107, 40);
+        indexPanelA.add(fxMode);
+        fxMode.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                fxModeVal = !fxModeVal;
+                if(fxModeVal){
+                    fxMode.setBackground(Color.GREEN);
+                    fxMode.setForeground(Color.WHITE);
+                    fxMaxNum.setText("");
+                    fxMaxNum.setEditable(true);
+                    fxMaxBtn.setEnabled(true);
+                }else{
+                    fxMode.setBackground(null);
+                    fxMode.setForeground(null);
+                    fxMaxNum.setText("");
+                    fxMaxNum.setEditable(false);
+                    fxMaxBtn.setEnabled(false);
+                }
+            }
+        });
+        
+        fxMaxNum = new JTextField();
+        fxMaxNum.setBounds(286, 10, 83, 40);
+        indexPanelA.add(fxMaxNum);
+        fxMaxNum.setColumns(10);
+        
+        fxMaxBtn = new JButton("确定数量");
+        fxMaxBtn.setFont(new Font("微软雅黑", Font.PLAIN, 16));
+        fxMaxBtn.setBounds(379, 10, 107, 40);
+        indexPanelA.add(fxMaxBtn);
+        fxMaxBtn.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                int maxNum = Integer.parseInt(fxMaxNum.getText());
+                if(maxNum > 0){
+                    ModbusUtil.setTask(MesClient.plcA,(short)maxNum);
+                }
+            }
+        });
 
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
         tabbedPane.setEnabledAt(0, true);
@@ -1317,5 +1372,4 @@ public class MesClient extends JFrame {
             return;
         }
     }
-
 }

+ 8 - 1
src/com/mes/ui/MesRevice.java

@@ -39,8 +39,15 @@ public class MesRevice {
         try{
             if(processMsgRet.equalsIgnoreCase("OK")) {
 
+                if(MesClient.fxModeVal){
+                    int maxNum = Integer.parseInt(MesClient.fxMaxNum.getText());
+                    if(maxNum > 0){
+                        ModbusUtil.setTask(MesClient.plcA,(short)maxNum);
+                    }
+                }else{
+                    ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
+                }
 
-                ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
                 ModbusUtil.setPowerOn(MesClient.plcA); // 远程关机
 
 //                Short cur = MesClient.plcA.readInt16(1136);

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

@@ -1,6 +1,6 @@
 mes.gw=OP265A
-#mes.server_ip=127.0.0.1
-mes.server_ip=192.168.18.99
+mes.server_ip=127.0.0.1
+#mes.server_ip=192.168.18.99
 mes.tcp_port=3000
 mes.heart_beat_cycle=60
 mes.line_sn=XT