|
|
@@ -88,6 +88,12 @@ public class MesClient extends JFrame {
|
|
|
String currentSerialPort1 = Config.portName1;
|
|
|
String currentSerialPort2 = Config.portName2;
|
|
|
|
|
|
+ public static TCPClient tcpClient1 = new TCPClient("192.168.18.184",9004);
|
|
|
+ public static TCPClient tcpClient2 = new TCPClient("192.168.18.183",9004);
|
|
|
+ public static int scanFlag1 = 0;
|
|
|
+ public static int scanFlag2 = 0;
|
|
|
+
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
EventQueue.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
@@ -190,7 +196,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ok_bt_1.setEnabled(false);
|
|
|
MesClient.finish_ng_bt_1.setEnabled(false);
|
|
|
MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
-// product_sn_1.setText("");
|
|
|
+ product_sn_1.setText("");
|
|
|
// leakText_1.setText("");
|
|
|
// pressureText_1.setText("");
|
|
|
// MesClient.setMenuState_1("请扫工件码", 0);
|
|
|
@@ -203,7 +209,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ok_bt_2.setEnabled(false);
|
|
|
MesClient.finish_ng_bt_2.setEnabled(false);
|
|
|
MesClient.f_scan_data_bt_2.setEnabled(true);
|
|
|
-// product_sn_2.setText("");
|
|
|
+ product_sn_2.setText("");
|
|
|
// leakText_2.setText("");
|
|
|
// pressureText_2.setText("");
|
|
|
// MesClient.setMenuState_2("请扫工件码", 0);
|
|
|
@@ -288,7 +294,8 @@ public class MesClient extends JFrame {
|
|
|
pressureText_1.setText("");
|
|
|
MesClient.setMenuState_1("请扫工件码", 0);
|
|
|
//弹窗扫工件码
|
|
|
- String scanBarcode = JOptionPane.showInputDialog(null, "请扫工件码");
|
|
|
+// String scanBarcode = JOptionPane.showInputDialog(null, "请扫工件码");
|
|
|
+ String scanBarcode = MesClient.scanQrcode1();
|
|
|
if (scanBarcode != null && !scanBarcode.equalsIgnoreCase("")) {
|
|
|
product_sn_1.setText(scanBarcode);
|
|
|
//刷新界面
|
|
|
@@ -320,7 +327,8 @@ public class MesClient extends JFrame {
|
|
|
pressureText_2.setText("");
|
|
|
MesClient.setMenuState_2("请扫工件码", 0);
|
|
|
//弹窗扫工件码
|
|
|
- String scanBarcode = JOptionPane.showInputDialog(null, "请扫工件码");
|
|
|
+// String scanBarcode = JOptionPane.showInputDialog(null, "请扫工件码");
|
|
|
+ String scanBarcode = MesClient.scanQrcode2();
|
|
|
if (scanBarcode != null && !scanBarcode.equalsIgnoreCase("")) {
|
|
|
product_sn_2.setText(scanBarcode);
|
|
|
//刷新界面
|
|
|
@@ -940,4 +948,56 @@ public class MesClient extends JFrame {
|
|
|
indexPanelBB.setLayout(null);
|
|
|
tabbedPane.addTab("绑定物料", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexScrollPaneB, null);
|
|
|
}
|
|
|
+
|
|
|
+ public static String scanQrcode1(){
|
|
|
+ if(scanFlag1 == 1){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ scanFlag1 = 1;
|
|
|
+ String sn = "";
|
|
|
+ try{
|
|
|
+ if (tcpClient1.socket == null || !tcpClient1.socket.isConnected() || tcpClient1.socket.isClosed()) {
|
|
|
+ tcpClient1.connect();
|
|
|
+ }
|
|
|
+ log.error("扫码枪1正在进行扫码,请勿操作",0);
|
|
|
+ sn = tcpClient1.receiveResponse();
|
|
|
+ if (sn == null || sn.equals("")) {
|
|
|
+ sn = "";
|
|
|
+ }
|
|
|
+ tcpClient1.close();
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("scanQrcode1:"+sn);
|
|
|
+ tcpClient1.close();
|
|
|
+ }
|
|
|
+ MesClient.setMenuState_1(sn,0);
|
|
|
+ scanFlag1 = 0;
|
|
|
+ return sn;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String scanQrcode2(){
|
|
|
+ if(scanFlag2 == 1){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ scanFlag2 = 1;
|
|
|
+ String sn = "";
|
|
|
+ try{
|
|
|
+ if (tcpClient2.socket == null || !tcpClient2.socket.isConnected() || tcpClient2.socket.isClosed()) {
|
|
|
+ tcpClient2.connect();
|
|
|
+ }
|
|
|
+ log.error("扫码枪2正在进行扫码,请勿操作",0);
|
|
|
+ sn = tcpClient2.receiveResponse();
|
|
|
+ if (sn == null || sn.equals("")) {
|
|
|
+ sn = "";
|
|
|
+ }
|
|
|
+ tcpClient2.close();
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("scanQrcode2:"+sn);
|
|
|
+ tcpClient2.close();
|
|
|
+ }
|
|
|
+ MesClient.setMenuState_2(sn,0);
|
|
|
+ scanFlag2 = 0;
|
|
|
+ return sn;
|
|
|
+ }
|
|
|
}
|