|
@@ -99,6 +99,7 @@ public class MesClient extends JFrame {
|
|
|
welcomeWin.setVisible(true);
|
|
welcomeWin.setVisible(true);
|
|
|
|
|
|
|
|
getMaterailData();
|
|
getMaterailData();
|
|
|
|
|
+ startGetSNTimer();
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -126,6 +127,9 @@ public class MesClient extends JFrame {
|
|
|
public static java.util.Timer heartBeatTimer;
|
|
public static java.util.Timer heartBeatTimer;
|
|
|
public static java.util.Timer heartBeatIconTimer;
|
|
public static java.util.Timer heartBeatIconTimer;
|
|
|
public static boolean iconREDFlag = true;
|
|
public static boolean iconREDFlag = true;
|
|
|
|
|
+
|
|
|
|
|
+ public static Timer getSntimer;
|
|
|
|
|
+
|
|
|
public static void startHeartBeatTimer() {
|
|
public static void startHeartBeatTimer() {
|
|
|
if(heartBeatTimer!=null) {
|
|
if(heartBeatTimer!=null) {
|
|
|
heartBeatTimer.cancel();
|
|
heartBeatTimer.cancel();
|
|
@@ -151,6 +155,45 @@ public class MesClient extends JFrame {
|
|
|
}, 100,mes_heart_icon_cycle*1000);
|
|
}, 100,mes_heart_icon_cycle*1000);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 定时任务获取SN
|
|
|
|
|
+ public static void startGetSNTimer() {
|
|
|
|
|
+ if (getSntimer != null){
|
|
|
|
|
+ getSntimer.cancel();
|
|
|
|
|
+ }
|
|
|
|
|
+ getSntimer = new Timer();
|
|
|
|
|
+ getSntimer.schedule(new TimerTask() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ System.out.println("work-status:"+work_status);
|
|
|
|
|
+ if (work_status == 1){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }else if (work_status == 0){
|
|
|
|
|
+ JSONObject retObj = DataUtil.getCurSn();
|
|
|
|
|
+ if (retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")){
|
|
|
|
|
+ String sn = retObj.get("data").toString();
|
|
|
|
|
+ product_sn.setText(sn);
|
|
|
|
|
+ //刷新界面
|
|
|
|
|
+ mesClientFrame.repaint();
|
|
|
|
|
+ MesClient.check_quality_result = true;//质量合格,可以绑定加工
|
|
|
|
|
+ MesClient.work_status = 1;
|
|
|
|
|
+ MesClient.f_scan_data_bt_1.setEnabled(false);
|
|
|
|
|
+ MesClient.finish_ok_bt.setEnabled(true);
|
|
|
|
|
+ MesClient.finish_ng_bt.setEnabled(true);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 1000, 1000);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//设置tcp连接状态显示
|
|
//设置tcp连接状态显示
|
|
|
public static void setTcpStatus() {
|
|
public static void setTcpStatus() {
|
|
|
status_menu.setText("已连接MES服务器");
|
|
status_menu.setText("已连接MES服务器");
|
|
@@ -163,18 +206,28 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void resetScanA() {
|
|
public static void resetScanA() {
|
|
|
- work_status = 0;
|
|
|
|
|
- check_quality_result = false;
|
|
|
|
|
- MesClient.finish_ok_bt.setEnabled(false);
|
|
|
|
|
- MesClient.finish_ng_bt.setEnabled(false);
|
|
|
|
|
- product_sn.setText("");
|
|
|
|
|
- MesClient.fxlabel.setVisible(false);
|
|
|
|
|
-
|
|
|
|
|
- MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
|
|
- MesClient.setMenuStatus("请扫工件码",0);
|
|
|
|
|
|
|
+
|
|
|
// MesClient.setMenuStatus("开班点检,请先进行OKNG样件测试",-1);
|
|
// MesClient.setMenuStatus("开班点检,请先进行OKNG样件测试",-1);
|
|
|
|
|
|
|
|
- updateMaterailData();
|
|
|
|
|
|
|
+ JSONObject retObj = DataUtil.delCurSn();
|
|
|
|
|
+ if (retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")){
|
|
|
|
|
+ work_status = 0;
|
|
|
|
|
+ check_quality_result = false;
|
|
|
|
|
+ MesClient.finish_ok_bt.setEnabled(false);
|
|
|
|
|
+ MesClient.finish_ng_bt.setEnabled(false);
|
|
|
|
|
+ product_sn.setText("");
|
|
|
|
|
+ MesClient.fxlabel.setVisible(false);
|
|
|
|
|
+
|
|
|
|
|
+ MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
|
|
+ MesClient.setMenuStatus("请扫工件码",0);
|
|
|
|
|
+ updateMaterailData();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ // 刷新失败
|
|
|
|
|
+ MesClient.setMenuStatus("刷新失败",-1);
|
|
|
|
|
+
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// shiftUserCheck();
|
|
// shiftUserCheck();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -493,7 +546,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.resetScanA();
|
|
MesClient.resetScanA();
|
|
|
MesClient.setMenuStatus(retObj.getString("message"),0);
|
|
MesClient.setMenuStatus(retObj.getString("message"),0);
|
|
|
MesClient.scan_type = 1;
|
|
MesClient.scan_type = 1;
|
|
|
- MesClient.scanBarcode();
|
|
|
|
|
|
|
+// MesClient.scanBarcode();
|
|
|
}else{
|
|
}else{
|
|
|
if(retObj.get("result")==null){
|
|
if(retObj.get("result")==null){
|
|
|
MesClient.setMenuStatus("网络异常",-1);
|
|
MesClient.setMenuStatus("网络异常",-1);
|