jingbo před 1 týdnem
rodič
revize
69a5f0ab18
2 změnil soubory, kde provedl 82 přidání a 61 odebrání
  1. 1 1
      src/com/mes/ui/DataUtil.java
  2. 81 60
      src/com/mes/ui/MesClient.java

+ 1 - 1
src/com/mes/ui/DataUtil.java

@@ -84,7 +84,7 @@ public class DataUtil {
             String mes_server_ip = pro.getProperty("mes.server_ip");
             String oprno = pro.getProperty("mes.gw").trim();
             String url = "http://"+mes_server_ip+":8980/js/a/mes/mesProductDbjBind/dbjBind";
-            String params = "__ajax=json&oprno="+oprno+"&dbjSn="+sn+"&materielSn="+materielSn;
+            String params = "__ajax=json&oprno="+oprno+"&dbjSn="+sn.trim()+"&materialSn="+materielSn;
             log.info("params="+params);
             String result = doPost(url,params);
             log.info("result="+result);

+ 81 - 60
src/com/mes/ui/MesClient.java

@@ -58,10 +58,11 @@ public class MesClient extends JFrame {
     public static JButton finish_ok_bt;
     public static JButton finish_ng_bt;
     public static JTextField product_sn;
-    public static JTextField product_sn_lb;
     public static JTextField product_sn_dbj1;
+    public static JTextField product_sn_dbj2;
     public static JButton f_scan_data_bt_1;
-    public static JButton f_scan_data_bt_2;
+    public static JButton f_scan_data_bt_dbj1;
+    public static JButton f_scan_data_bt_dbj2;
 
     public static String user20 = "";
 
@@ -170,8 +171,10 @@ public class MesClient extends JFrame {
         check_quality_result = false;
         MesClient.finish_ok_bt.setEnabled(false);
         MesClient.finish_ng_bt.setEnabled(false);
-        product_sn_lb.setText("");
-        f_scan_data_bt_2.setEnabled(false);
+        product_sn_dbj1.setText("");
+        product_sn_dbj2.setText("");
+        f_scan_data_bt_dbj1.setEnabled(false);
+        f_scan_data_bt_dbj2.setEnabled(false);
         product_sn.setText("");
         MesClient.fxlabel.setVisible(false);
 
@@ -274,7 +277,8 @@ public class MesClient extends JFrame {
                 MesClient.f_scan_data_bt_1.setEnabled(false);
                 MesClient.finish_ok_bt.setEnabled(true);
                 MesClient.finish_ng_bt.setEnabled(true);
-                f_scan_data_bt_2.setEnabled(true);
+                f_scan_data_bt_dbj1.setEnabled(true);
+                f_scan_data_bt_dbj2.setEnabled(true);
             }else{
                 MesClient.check_quality_result = false;
                 MesClient.work_status = 0;
@@ -465,42 +469,69 @@ public class MesClient extends JFrame {
         indexPanelA.add(f_scan_data_bt_1);
 
 
-        JLabel lbLabel = new JLabel("单部件1:");
-        lbLabel.setFont(new Font("微软雅黑", Font.PLAIN, 24));
-        lbLabel.setBounds(20, 165, 100, 50);
-        indexPanelA.add(lbLabel);
-        product_sn_lb = new JTextField();
-        product_sn_lb.setHorizontalAlignment(SwingConstants.CENTER);
-        product_sn_lb.setEditable(false);
-        product_sn_lb.setFont(new Font("微软雅黑", Font.PLAIN, 28));
-        product_sn_lb.setBounds(100, 160, 580, 70);
-        indexPanelA.add(product_sn_lb);
-        product_sn_lb.setColumns(10);
-
-
-        f_scan_data_bt_2 = new JButton("扫码");
-        f_scan_data_bt_2.addActionListener(new ActionListener() {
+        JLabel lbLabel1 = new JLabel("单部件1:");
+        lbLabel1.setFont(new Font("微软雅黑", Font.PLAIN, 24));
+        lbLabel1.setBounds(20, 165, 100, 50);
+        indexPanelA.add(lbLabel1);
+        product_sn_dbj1 = new JTextField();
+        product_sn_dbj1.setHorizontalAlignment(SwingConstants.CENTER);
+        product_sn_dbj1.setEditable(false);
+        product_sn_dbj1.setFont(new Font("微软雅黑", Font.PLAIN, 28));
+        product_sn_dbj1.setBounds(100, 160, 450, 70);
+        indexPanelA.add(product_sn_dbj1);
+        product_sn_dbj1.setColumns(10);
+
+        JLabel lbLabel2 = new JLabel("单部件2:");
+        lbLabel2.setFont(new Font("微软雅黑", Font.PLAIN, 24));
+        lbLabel2.setBounds(20, 245, 100, 50);
+        indexPanelA.add(lbLabel2);
+        product_sn_dbj2 = new JTextField();
+        product_sn_dbj2.setHorizontalAlignment(SwingConstants.CENTER);
+        product_sn_dbj2.setEditable(false);
+        product_sn_dbj2.setFont(new Font("微软雅黑", Font.PLAIN, 28));
+        product_sn_dbj2.setBounds(100, 240, 450, 70);
+        indexPanelA.add(product_sn_dbj2);
+        product_sn_dbj2.setColumns(10);
+
+        f_scan_data_bt_dbj1 = new JButton("扫码");
+        f_scan_data_bt_dbj1.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
-
-//                scanBarcodeLb();
-//                scan_type = 1;
                 if (product_sn.getText().isEmpty()){
                     setMenuStatus("请在工件上料完成后扫码!",1);
                     return;
                 }
                 if (work_status == 1&&check_quality_result){
-                    scanBarcodeLb();
+                    bindWarehouse();
+                }else{
+                    setMenuStatus("请在工件质量检测合格后扫码!",1);
+                }
+            }
+        });
+        f_scan_data_bt_dbj1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
+        f_scan_data_bt_dbj1.setFont(new Font("微软雅黑", Font.PLAIN, 30));
+        f_scan_data_bt_dbj1.setBounds(560, 160, 140, 70);
+        f_scan_data_bt_dbj1.setEnabled(false);
+        indexPanelA.add(f_scan_data_bt_dbj1);
+
+        f_scan_data_bt_dbj2 = new JButton("扫码");
+        f_scan_data_bt_dbj2.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                if (product_sn.getText().isEmpty()){
+                    setMenuStatus("请在工件上料完成后扫码!",1);
+                    return;
+                }
+                if (work_status == 1&&check_quality_result){
+                    bindWarehouse2();
                 }else{
                     setMenuStatus("请在工件质量检测合格后扫码!",1);
                 }
-
             }
         });
-        f_scan_data_bt_2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
-        f_scan_data_bt_2.setFont(new Font("微软雅黑", Font.PLAIN, 30));
-        f_scan_data_bt_2.setBounds(693, 160, 140, 70);
-        f_scan_data_bt_2.setEnabled(false);
-        indexPanelA.add(f_scan_data_bt_2);
+        f_scan_data_bt_dbj2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
+        f_scan_data_bt_dbj2.setFont(new Font("微软雅黑", Font.PLAIN, 30));
+        f_scan_data_bt_dbj2.setBounds(560, 240, 140, 70);
+        f_scan_data_bt_dbj2.setEnabled(false);
+        indexPanelA.add(f_scan_data_bt_dbj2);
 
 //        String[] hjtitles = new String[]{"焊机1","焊机2","焊机3"};
 //        String[] hjvals = new String[]{"HJ001","HJ002","HJ003"};
@@ -522,8 +553,8 @@ public class MesClient extends JFrame {
         finish_ok_bt.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 if(work_status == 1 && check_quality_result){
-                    if (product_sn_lb.getText().equals("")){
-                        JOptionPane.showMessageDialog(MesClient.mesClientFrame,"请绑定冷板码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
+                    if (product_sn_dbj1.getText().equals("") || product_sn_dbj2.getText().equals("")){
+                        JOptionPane.showMessageDialog(MesClient.mesClientFrame,"请绑定两个单部件二维码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
                         return;
                     }
                     getUser();
@@ -822,35 +853,25 @@ public class MesClient extends JFrame {
         });
     }
 
-    public static void scanBarcodeLb() {
+    // 单部件1扫码绑定
+    public static void bindWarehouse(){
         String scanBarcodeTitle = "";
-
-        product_sn_lb.setText("");
-//        resetLb();
-        scanBarcodeTitle = "请扫冷板码";
-        //弹窗扫工件码
+        product_sn_dbj1.setText("");
+        scanBarcodeTitle = "请扫单部件二维码";
         String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
-        System.out.println("冷板码="+scanBarcode);
+        System.out.println("单部件="+scanBarcode);
         if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
-            //获取用户
-            getUser();
-            //获取扫码内容36位
-            String barcode36 = getBarcode(scanBarcode);//处理36为码
-            //工位号
-            String gw = "";
-            product_sn_lb.setText(scanBarcode);
-
+            product_sn_dbj1.setText(scanBarcode);
             //刷新界面
             mesClientFrame.repaint();
-
             if(!scanBarcode.isEmpty()) {
                 // 检查工件质量
                 if(work_status == 1) {
                     // 直接调用绑定
-                    String warehouseSn = getBarcode(product_sn_lb.getText());
+                    String warehouseSn = getBarcode(product_sn_dbj1.getText());
                     String sn = getBarcode(product_sn.getText());
-                    getUser();
-                    JSONObject retObj = DataUtil.bindWarehouse(sn, warehouseSn, user20, "400006");
+
+                    JSONObject retObj = DataUtil.bindMaterail(sn, warehouseSn);
                     if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
                         MesClient.setMenuStatus("绑定成功",0);
                     }else{
@@ -868,32 +889,32 @@ public class MesClient extends JFrame {
                     return;
                 }
             }else {
-                setMenuStatus("冷板码为空,请重新扫码",1);
-
+                setMenuStatus("单部件二维码为空,请重新扫码",1);
                 return;
             }
         }else {
-            setMenuStatus("冷板码为空,请重新扫码",1);
+            setMenuStatus("单部件二维码为空,请重新扫码",1);
             return;
         }
+
     }
 
-    // 单部件扫码绑定
-    public static void bindWarehouse(){
+    // 单部件2扫码绑定
+    public static void bindWarehouse2(){
         String scanBarcodeTitle = "";
-        product_sn_dbj1.setText("");
+        product_sn_dbj2.setText("");
         scanBarcodeTitle = "请扫单部件二维码";
         String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
-        System.out.println("单部件="+scanBarcode);
+        System.out.println("单部件2="+scanBarcode);
         if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
-            product_sn_dbj1.setText(scanBarcode);
+            product_sn_dbj2.setText(scanBarcode);
             //刷新界面
             mesClientFrame.repaint();
             if(!scanBarcode.isEmpty()) {
                 // 检查工件质量
                 if(work_status == 1) {
                     // 直接调用绑定
-                    String warehouseSn = getBarcode(product_sn_dbj1.getText());
+                    String warehouseSn = getBarcode(product_sn_dbj2.getText());
                     String sn = getBarcode(product_sn.getText());
 
                     JSONObject retObj = DataUtil.bindMaterail(sn, warehouseSn);