|
|
@@ -35,6 +35,8 @@ public class WorkStationPanel extends JPanel {
|
|
|
public static Object[][] rowData = null;
|
|
|
|
|
|
private Timer heartBeatTimer;
|
|
|
+ private Timer getSnBeatTimer;
|
|
|
+
|
|
|
private boolean iconREDFlag = true;
|
|
|
|
|
|
public WorkStationPanel(String gw, String gwDes, String lineSn, String serverIp) {
|
|
|
@@ -44,6 +46,7 @@ public class WorkStationPanel extends JPanel {
|
|
|
this.serverIp = serverIp;
|
|
|
initUI();
|
|
|
startHeartBeatTimer();
|
|
|
+ startGetCurSn();
|
|
|
}
|
|
|
|
|
|
private void initUI() {
|
|
|
@@ -332,6 +335,35 @@ public class WorkStationPanel extends JPanel {
|
|
|
iconREDFlag = true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ }, 100, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void startGetCurSn(){
|
|
|
+ if (getSnBeatTimer != null) {
|
|
|
+ getSnBeatTimer.cancel();
|
|
|
+ }
|
|
|
+ getSnBeatTimer = new Timer();
|
|
|
+ getSnBeatTimer.schedule(new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (workStatus == 1) {
|
|
|
+ return;
|
|
|
+ } else if (workStatus == 0) {
|
|
|
+ JSONObject result = DataUtil.getCurSn(gw, serverIp, lineSn);
|
|
|
+ // 正常处理结果
|
|
|
+ if (result.containsKey("data")) {
|
|
|
+ String data = result.getString("data");
|
|
|
+ if (data != null && !data.isEmpty()) {
|
|
|
+ productSnField.setText(data);
|
|
|
+ checkQuality(data);
|
|
|
+ } else {
|
|
|
+ JOptionPane.showMessageDialog(WorkStationPanel.this, "获取工件码为空", "提示", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}, 100, 1000);
|
|
|
}
|
|
|
|