|
|
@@ -11,7 +11,9 @@ import com.mes.component.MesRadio;
|
|
|
import com.mes.component.MesWebView;
|
|
|
import com.mes.component.MyDialog;
|
|
|
import com.mes.netty.NettyClient;
|
|
|
+import com.mes.util.ConfigLoader;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
|
+import com.mes.util.EncodingUtil;
|
|
|
import com.mes.util.HttpUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
|
import javafx.embed.swing.JFXPanel;
|
|
|
@@ -20,6 +22,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import javax.swing.*;
|
|
|
import javax.swing.border.EmptyBorder;
|
|
|
+import javax.swing.plaf.FontUIResource;
|
|
|
import javax.swing.event.ChangeEvent;
|
|
|
import javax.swing.event.ChangeListener;
|
|
|
import java.awt.*;
|
|
|
@@ -42,6 +45,11 @@ import java.util.TimerTask;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class MesClient extends JFrame {
|
|
|
+
|
|
|
+ static {
|
|
|
+ EncodingUtil.init();
|
|
|
+ }
|
|
|
+
|
|
|
public static final Logger log = LoggerFactory.getLogger(MesClient.class);
|
|
|
private static String Drivde = "org.sqlite.JDBC";
|
|
|
|
|
|
@@ -53,7 +61,6 @@ public class MesClient extends JFrame {
|
|
|
public static int mes_heart_beat_cycle = 10;
|
|
|
public static int mes_heart_icon_cycle = 1;
|
|
|
public static String mes_line_sn = "";
|
|
|
- public static String mes_gwflag = ""; // 工位标识
|
|
|
|
|
|
public static NettyClient nettyClient;
|
|
|
public static boolean tcp_connect_flag = false;
|
|
|
@@ -112,6 +119,9 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static String curPage = "";
|
|
|
|
|
|
+ /** 最近一次镭雕扫码所在面(A/B),用于 MES 开工与 PLC 允许信号 */
|
|
|
+ public static String lastScanSide = "A";
|
|
|
+
|
|
|
public static Integer checkA = 0;
|
|
|
|
|
|
public static Integer checkB = 0;
|
|
|
@@ -136,7 +146,7 @@ public class MesClient extends JFrame {
|
|
|
public static JPanel indexPanelC;
|
|
|
public static MesWebView jfxPanel2 = null;
|
|
|
|
|
|
- public static S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.7.223"); //100 B工位
|
|
|
+ public static S7PLC s7PLC = new S7PLC(EPlcType.S1200, "192.168.7.100"); //100 B工位
|
|
|
|
|
|
public static List<String> hjparams = new ArrayList<>();
|
|
|
|
|
|
@@ -148,14 +158,13 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
+ initUiFont();
|
|
|
EventQueue.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try{
|
|
|
- //鐠囩粯鏋冩禒鍫曞帳缂冿拷
|
|
|
readProperty();
|
|
|
|
|
|
- // 閺勫墽銇氶悾宀勬桨
|
|
|
mesClientFrame = new MesClient();
|
|
|
mesClientFrame.setVisible(false);
|
|
|
|
|
|
@@ -182,6 +191,37 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /** 优先使用系统中文字体,避免 jar 部署机器字体名不一致 */
|
|
|
+ private static Font resolveUiFont(int size) {
|
|
|
+ String[] candidates = {"Microsoft YaHei UI", "微软雅黑", "Microsoft YaHei", "SimSun"};
|
|
|
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
|
|
+ String[] available = ge.getAvailableFontFamilyNames();
|
|
|
+ java.util.Set<String> set = new java.util.HashSet<>();
|
|
|
+ for (String name : available) {
|
|
|
+ set.add(name);
|
|
|
+ }
|
|
|
+ for (String name : candidates) {
|
|
|
+ if (set.contains(name)) {
|
|
|
+ return new Font(name, Font.PLAIN, size);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new Font(Font.SANS_SERIF, Font.PLAIN, size);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 全局 UI 字体,避免登录页等使用 Dialog 字体时中文显示异常 */
|
|
|
+ private static void initUiFont() {
|
|
|
+ Font baseFont = resolveUiFont(12);
|
|
|
+ java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
|
|
|
+ while (keys.hasMoreElements()) {
|
|
|
+ Object key = keys.nextElement();
|
|
|
+ Object value = UIManager.get(key);
|
|
|
+ if (value instanceof Font) {
|
|
|
+ Font old = (Font) value;
|
|
|
+ UIManager.put(key, new FontUIResource(baseFont.getName(), old.getStyle(), old.getSize()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static Timer cjTimerText;
|
|
|
public static void textFocus() {
|
|
|
if(cjTimerText!=null) {
|
|
|
@@ -210,26 +250,91 @@ public class MesClient extends JFrame {
|
|
|
cjTimer3 = new Timer();
|
|
|
cjTimer3.schedule(new TimerTask() {
|
|
|
public void run() {
|
|
|
- try{
|
|
|
- List<CmtReq> prods = JdbcUtils.getCmtParams();
|
|
|
- System.out.println("prods:"+ JSON.toJSONString(prods));
|
|
|
- if(prods.size() > 0){
|
|
|
- // 定时上传参数
|
|
|
- JSONObject retObj = DataUtil.upParams(JSON.toJSONString(prods));
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
- // 更新sqlite已同步
|
|
|
- for(CmtReq prodReq:prods){
|
|
|
- JdbcUtils.updateProdSync(prodReq.getId(),1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ uploadPendingCmtParams();
|
|
|
}
|
|
|
}, 1000,30*1000);
|
|
|
}
|
|
|
|
|
|
+ /** 立即上传本地未同步的焊接采样数据 */
|
|
|
+ public static void uploadPendingCmtParams() {
|
|
|
+ try{
|
|
|
+ List<CmtReq> prods = JdbcUtils.getCmtParams();
|
|
|
+ if(prods.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject retObj = DataUtil.upParams(JSON.toJSONString(prods));
|
|
|
+ if(retObj != null && retObj.get("result") != null
|
|
|
+ && retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ for(CmtReq prodReq : prods){
|
|
|
+ JdbcUtils.updateProdSync(prodReq.getId(),1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 焊接报工后:先上传采样数据,再刷新工作记录页 */
|
|
|
+ public static void notifyWorkSubmitted() {
|
|
|
+ uploadPendingCmtParams();
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ refreshWorkRecord();
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 刷新「工作记录」WebView */
|
|
|
+ public static void refreshWorkRecord() {
|
|
|
+ if(jfxPanel == null || sessionid == null || sessionid.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String url = "http://" + mes_server_ip + ":8980/js/a/mes/mesProductRecord/work?__sid="
|
|
|
+ + sessionid + "&oprno=" + mes_gw + "&lineSn=" + mes_line_sn
|
|
|
+ + "&t=" + System.currentTimeMillis();
|
|
|
+ jfxPanel.loadPageUrl(url);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String resolveOprnoForSubmit(String op) {
|
|
|
+ return mes_gw + op;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 根据 MES 返回工位号或最近扫码面,判定 A/B(仅 OP080A / OP080B) */
|
|
|
+ public static String resolveScanSide(String oprno) {
|
|
|
+ if (oprno != null) {
|
|
|
+ String o = oprno.trim();
|
|
|
+ if (o.endsWith("B")) {
|
|
|
+ return "B";
|
|
|
+ }
|
|
|
+ if (o.endsWith("A")) {
|
|
|
+ return "A";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("B".equals(lastScanSide)) {
|
|
|
+ return "B";
|
|
|
+ }
|
|
|
+ if ("B".equals(curPage)) {
|
|
|
+ return "B";
|
|
|
+ }
|
|
|
+ return "A";
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 焊接结束时落库未满 60 条的剩余采样 */
|
|
|
+ public static void flushHjparamsToDb(String oprno, String sn) {
|
|
|
+ if (hjparams == null || hjparams.isEmpty() || sn == null || sn.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ JdbcUtils.insertCmtData(oprno, mes_line_sn, sn, JSON.toJSONString(hjparams));
|
|
|
+ hjparams = new ArrayList<>();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final int TAB_WORK_RECORD = 2;
|
|
|
+
|
|
|
public static Timer cjTimer;
|
|
|
public static void getPlcParam() {
|
|
|
if(cjTimer!=null) {
|
|
|
@@ -254,7 +359,8 @@ public class MesClient extends JFrame {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- }, 1000,2000);
|
|
|
+ // 运行中 500ms 轮询,降低漏检 PLC「焊接完成」短脉冲的概率(不改 PLC)
|
|
|
+ }, 1000,500);
|
|
|
}
|
|
|
|
|
|
public static Timer cjTimer2;
|
|
|
@@ -270,41 +376,37 @@ public class MesClient extends JFrame {
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ try{
|
|
|
+ PlcUtil.getTipLife(s7PLC);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}, 1000,500);
|
|
|
}
|
|
|
|
|
|
- //鐠囧鍘ょ純顔芥瀮娴狅拷
|
|
|
+ //读配置文件
|
|
|
private static void readProperty() throws IOException{
|
|
|
- String enconding = "UTF-8";
|
|
|
- InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
- Properties pro = new Properties();
|
|
|
- BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
- pro.load(br);
|
|
|
- mes_gw = pro.getProperty("mes.gw");
|
|
|
+ Properties pro = ConfigLoader.loadProperties();
|
|
|
+ mes_gw = pro.getProperty("mes.gw").trim();
|
|
|
|
|
|
// mes_gw_des = pro.getProperty("mes.gw_des");
|
|
|
- mes_server_ip = pro.getProperty("mes.server_ip");
|
|
|
+ mes_server_ip = pro.getProperty("mes.server_ip").trim();
|
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|
|
|
mes_heart_beat_cycle = Integer.parseInt(pro.getProperty("mes.heart_beat_cycle"));
|
|
|
- mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
+ mes_line_sn = pro.getProperty("mes.line_sn").trim();
|
|
|
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
|
|
|
- mes_gwflag = pro.getProperty("mes.gwflag");
|
|
|
-
|
|
|
System.out.println(mes_gw + ";" + mes_gw_des + ";" + mes_server_ip + ";" + mes_tcp_port + ";" + mes_heart_beat_cycle);
|
|
|
}
|
|
|
|
|
|
- // 閸掓繂顫愰崠鏈P
|
|
|
+ // 初始化TCP
|
|
|
public static void initTcpConnection() {
|
|
|
try {
|
|
|
if(nettyClient==null) {
|
|
|
- //閸掓繂顫愰崠鏈P鏉╃偞甯�
|
|
|
nettyClient = new NettyClient();
|
|
|
- //TCP鏉╃偞甯撮悩鑸碉拷锟�
|
|
|
tcp_connect_flag = false;
|
|
|
- //鐠佸墽鐤員CP鐠囬攱鐪伴悩鑸碉拷锟�
|
|
|
connect_request_flag = true;
|
|
|
|
|
|
DataUtil.synrTcp(nettyClient,mes_gw);
|
|
|
@@ -315,7 +417,6 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //閸氼垰濮╄箛鍐儲閸栧懐鈻兼惔锟�
|
|
|
public static java.util.Timer heartBeatTimer;
|
|
|
public static java.util.Timer heartBeatIconTimer;
|
|
|
public static boolean iconREDFlag = true;
|
|
|
@@ -324,6 +425,18 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param3;
|
|
|
public static JTextField param4;
|
|
|
public static JTextField param5;
|
|
|
+ public static JTextField tipLifeA;
|
|
|
+ public static JTextField tipLifeB;
|
|
|
+ public static JTextField tipLifeC;
|
|
|
+ public static volatile boolean tipAlarmAShown = false;
|
|
|
+ public static volatile boolean tipAlarmBShown = false;
|
|
|
+ public static volatile boolean tipAlarmCShown = false;
|
|
|
+ public static int lastTipSyncAActual = Integer.MIN_VALUE;
|
|
|
+ public static int lastTipSyncASet = Integer.MIN_VALUE;
|
|
|
+ public static int lastTipSyncBActual = Integer.MIN_VALUE;
|
|
|
+ public static int lastTipSyncBSet = Integer.MIN_VALUE;
|
|
|
+ public static int lastTipSyncCActual = Integer.MIN_VALUE;
|
|
|
+ public static int lastTipSyncCSet = Integer.MIN_VALUE;
|
|
|
public static JTextField product_sn2;
|
|
|
public static JTextField param21;
|
|
|
public static JTextField param22;
|
|
|
@@ -353,7 +466,6 @@ public class MesClient extends JFrame {
|
|
|
heartBeatTimer.schedule(new TimerTask() {
|
|
|
public void run() {
|
|
|
if(nettyClient!=null&&tcp_connect_flag) {
|
|
|
- //System.out.println("閸欐垿锟戒礁绺剧捄铏Г閺傦拷");
|
|
|
DataUtil.heartBeat(nettyClient,mes_gw);
|
|
|
|
|
|
heart_beat_menu.setText(DateLocalUtils.getCurrentTime());
|
|
|
@@ -361,7 +473,6 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
}, 100,mes_heart_beat_cycle*1000);
|
|
|
|
|
|
- //韫囧啳鐑﹂弰鍓с仛閸ョ偓鐖�
|
|
|
if(heartBeatIconTimer!=null) {
|
|
|
heartBeatIconTimer.cancel();
|
|
|
}
|
|
|
@@ -383,13 +494,9 @@ public class MesClient extends JFrame {
|
|
|
heart_beat_menu.setText(DateLocalUtils.getCurrentTime());
|
|
|
heart_beat_menu.repaint();
|
|
|
|
|
|
- //閼汇儲婀潻鐐村复閸掓瑥鐨剧拠鏇$箾閹猴拷
|
|
|
if(nettyClient!=null&&!tcp_connect_flag){
|
|
|
- System.out.println("TCP瀹稿弶鏌囧锟�");
|
|
|
- //TCP闁插秵鏌婇崥灞绢劄鏉╃偞甯�
|
|
|
+ // TCP未连接,尝试重连
|
|
|
if(!connect_request_flag) {
|
|
|
- //System.out.println("TCP闁插秵鏌婇崥灞绢劄鏉╃偞甯�");
|
|
|
- //鐠佸墽鐤員CP鐠囬攱鐪伴悩鑸碉拷锟�,閸欘亪鍣搁弬鏉挎倱濮濄儴绻涢幒銉ょ濞嗭拷
|
|
|
connect_request_flag = true;
|
|
|
|
|
|
DataUtil.synrTcp(nettyClient,mes_gw);
|
|
|
@@ -401,7 +508,7 @@ public class MesClient extends JFrame {
|
|
|
}, 100,mes_heart_icon_cycle*1000);
|
|
|
}
|
|
|
|
|
|
- //鐠佸墽鐤唗cp鏉╃偞甯撮悩鑸碉拷浣规▔缁�锟�
|
|
|
+ // 设置TCP连接状态
|
|
|
public static void setTcpStatus() {
|
|
|
if(tcp_connect_flag) {
|
|
|
status_menu.setText("已连接MES服务器");
|
|
|
@@ -459,6 +566,8 @@ public class MesClient extends JFrame {
|
|
|
MesClient.curSna = "";
|
|
|
MesClient.tjFlaga = 0;
|
|
|
MesClient.checkA = 0;
|
|
|
+ PlcUtil.resetRunDetectA();
|
|
|
+ MesClient.hjparams = new ArrayList<>();
|
|
|
|
|
|
// MesClient.batch_status = 0;
|
|
|
// MesClient.textField.setText("");
|
|
|
@@ -536,7 +645,9 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
MesClient.curSnb = "";
|
|
|
MesClient.tjFlagb = 0;
|
|
|
+ MesClient.hjparams = new ArrayList<>();
|
|
|
MesClient.checkB = 0;
|
|
|
+ PlcUtil.resetRunDetectB();
|
|
|
|
|
|
// MesClient.batch_status2 = 0;
|
|
|
// MesClient.textField_1.setText("");
|
|
|
@@ -552,7 +663,7 @@ public class MesClient extends JFrame {
|
|
|
// shiftUserCheck();
|
|
|
}
|
|
|
|
|
|
- //閼惧嘲褰囬悽銊﹀煕20娴o拷
|
|
|
+ // 获取用户20位
|
|
|
public static void getUser() {
|
|
|
user20 = user_menu.getText().toString();
|
|
|
String space_tmp1 = "";
|
|
|
@@ -564,7 +675,6 @@ public class MesClient extends JFrame {
|
|
|
user20 = user20 + space_tmp1;
|
|
|
}
|
|
|
|
|
|
- //閼惧嘲褰嘼arcode閸愬懎顔�36娴o拷
|
|
|
public static String getBarcode(String barcodeTmp) {
|
|
|
String barcodeRet = barcodeTmp;
|
|
|
if(barcodeTmp.equalsIgnoreCase("")) {
|
|
|
@@ -616,7 +726,7 @@ public class MesClient extends JFrame {
|
|
|
fileMenu.add(exitMenuItem);
|
|
|
exitMenuItem.addMouseListener(new MouseAdapter() {
|
|
|
@Override
|
|
|
- public void mousePressed(MouseEvent e) {//閸欘亣鍏樺Λ锟藉ù瀣煂mousePressed娴滃娆�
|
|
|
+ public void mousePressed(MouseEvent e) {
|
|
|
super.mouseClicked(e);
|
|
|
//dispose();
|
|
|
logoff();
|
|
|
@@ -636,7 +746,6 @@ public class MesClient extends JFrame {
|
|
|
@Override
|
|
|
public void mousePressed(MouseEvent e) {
|
|
|
super.mouseClicked(e);
|
|
|
- //闁插秷绻沵es
|
|
|
nettyClient.future.channel().close();
|
|
|
}
|
|
|
});
|
|
|
@@ -831,6 +940,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.pxstatus1.setText("A:提交成功");
|
|
|
MesClient.status_menu.setText("A件提交成功");
|
|
|
MesClient.resetScanA();
|
|
|
+ MesClient.notifyWorkSubmitted();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -872,6 +982,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.pxstatus2.setText("B:提交成功");
|
|
|
MesClient.status_menu.setText("B件提交成功");
|
|
|
MesClient.resetScanB();
|
|
|
+ MesClient.notifyWorkSubmitted();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -903,6 +1014,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.pxstatus2.setText("B:提交成功");
|
|
|
MesClient.status_menu.setText("B件提交成功");
|
|
|
MesClient.resetScanB();
|
|
|
+ MesClient.notifyWorkSubmitted();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -944,6 +1056,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.pxstatus2.setText("B:提交成功");
|
|
|
MesClient.status_menu.setText("B件提交成功");
|
|
|
MesClient.resetScanB();
|
|
|
+ MesClient.notifyWorkSubmitted();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1040,6 +1153,21 @@ public class MesClient extends JFrame {
|
|
|
param5.setBounds(196, 400, 70, 40);
|
|
|
indexPanelA.add(param5);
|
|
|
|
|
|
+ JLabel lblTipA = new JLabel("导电嘴");
|
|
|
+ lblTipA.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
+ lblTipA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblTipA.setBounds(276, 400, 70, 40);
|
|
|
+ indexPanelA.add(lblTipA);
|
|
|
+
|
|
|
+ tipLifeA = new JTextField("0/0");
|
|
|
+ tipLifeA.setEnabled(false);
|
|
|
+ tipLifeA.setEditable(false);
|
|
|
+ tipLifeA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ tipLifeA.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 16));
|
|
|
+ tipLifeA.setBounds(356, 400, 110, 40);
|
|
|
+ tipLifeA.setToolTipText("实际数量/设定数量");
|
|
|
+ indexPanelA.add(tipLifeA);
|
|
|
+
|
|
|
|
|
|
// --- B枪 区域 ---
|
|
|
JLabel lblB_Title = new JLabel("焊枪 B");
|
|
|
@@ -1117,6 +1245,21 @@ public class MesClient extends JFrame {
|
|
|
param25.setBounds(687, 400, 70, 40);
|
|
|
indexPanelA.add(param25);
|
|
|
|
|
|
+ JLabel lblTipB = new JLabel("导电嘴");
|
|
|
+ lblTipB.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
+ lblTipB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblTipB.setBounds(767, 400, 70, 40);
|
|
|
+ indexPanelA.add(lblTipB);
|
|
|
+
|
|
|
+ tipLifeB = new JTextField("0/0");
|
|
|
+ tipLifeB.setEnabled(false);
|
|
|
+ tipLifeB.setEditable(false);
|
|
|
+ tipLifeB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ tipLifeB.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 16));
|
|
|
+ tipLifeB.setBounds(847, 400, 110, 40);
|
|
|
+ tipLifeB.setToolTipText("实际数量/设定数量");
|
|
|
+ indexPanelA.add(tipLifeB);
|
|
|
+
|
|
|
|
|
|
// --- C枪 区域 ---
|
|
|
JLabel lblC_Title = new JLabel("焊枪 C");
|
|
|
@@ -1189,6 +1332,21 @@ public class MesClient extends JFrame {
|
|
|
param35.setBounds(196, 620, 70, 40);
|
|
|
indexPanelA.add(param35);
|
|
|
|
|
|
+ JLabel lblTipC = new JLabel("导电嘴");
|
|
|
+ lblTipC.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
+ lblTipC.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblTipC.setBounds(276, 620, 70, 40);
|
|
|
+ indexPanelA.add(lblTipC);
|
|
|
+
|
|
|
+ tipLifeC = new JTextField("0/0");
|
|
|
+ tipLifeC.setEnabled(false);
|
|
|
+ tipLifeC.setEditable(false);
|
|
|
+ tipLifeC.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ tipLifeC.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 16));
|
|
|
+ tipLifeC.setBounds(356, 620, 110, 40);
|
|
|
+ tipLifeC.setToolTipText("实际数量/设定数量");
|
|
|
+ indexPanelA.add(tipLifeC);
|
|
|
+
|
|
|
|
|
|
// --- D枪 区域 ---
|
|
|
JLabel lblD_Title = new JLabel("焊枪 D");
|
|
|
@@ -1459,8 +1617,8 @@ public class MesClient extends JFrame {
|
|
|
int selectedIndex = tabbedPane.getSelectedIndex();
|
|
|
System.out.println("selectedIndex:"+selectedIndex);
|
|
|
|
|
|
- if(selectedIndex == 1){
|
|
|
-
|
|
|
+ if(selectedIndex == TAB_WORK_RECORD){
|
|
|
+ refreshWorkRecord();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1494,6 +1652,7 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
if(MesClient.curPage.equals("A")){
|
|
|
System.out.println("typeA");
|
|
|
+ MesClient.lastScanSide = "A";
|
|
|
if(!product_sn.getText().isEmpty() && mesQualityFlagA){
|
|
|
MesClient.setMenuStatus("A面已存在工件码,勿重复扫码",1);
|
|
|
return;
|
|
|
@@ -1501,6 +1660,7 @@ public class MesClient extends JFrame {
|
|
|
product_sn.setText(scanBarcodeSn);
|
|
|
}else{
|
|
|
System.out.println("typeB");
|
|
|
+ MesClient.lastScanSide = "B";
|
|
|
if(!product_sn2.getText().isEmpty() && mesQualityFlagB){
|
|
|
MesClient.setMenuStatus("B面已存在工件码,勿重复扫码",1);
|
|
|
return;
|
|
|
@@ -1514,7 +1674,7 @@ public class MesClient extends JFrame {
|
|
|
System.out.println("123");
|
|
|
getUser();
|
|
|
// 查询工件质量
|
|
|
- Boolean sendret = DataUtil.checkQuality(nettyClient,scanBarcodeSn,user20,MesClient.curPage);
|
|
|
+ Boolean sendret = DataUtil.checkQuality(nettyClient,scanBarcodeSn,user20,MesClient.lastScanSide);
|
|
|
if(!sendret){
|
|
|
MesClient.setMenuStatus("消息发送失败,请重试",1);
|
|
|
}
|
|
|
@@ -1532,8 +1692,15 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static void getMaterailData(){
|
|
|
JSONObject retObj = DataUtil.getBindMaterail();
|
|
|
+ if (retObj == null) {
|
|
|
+ log.warn("加载物料列表失败,请检查MES服务或网络连接");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
List<BindMaterialResp> arrs = retObj.getList("data",BindMaterialResp.class);
|
|
|
+ if (arrs == null || arrs.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
int i = 0;
|
|
|
rowData = new Object[arrs.size()][7];
|
|
|
for (BindMaterialResp bindMaterialResp:arrs){
|
|
|
@@ -1552,9 +1719,15 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static void updateMaterailData(){
|
|
|
JSONObject retObj = DataUtil.getBindMaterail();
|
|
|
+ if (retObj == null) {
|
|
|
+ log.warn("更新物料列表失败,请检查MES服务或网络连接");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
List<BindMaterialResp> arrs = retObj.getList("data",BindMaterialResp.class);
|
|
|
-
|
|
|
+ if (arrs == null || arrs.isEmpty() || rowData == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
int i = 0;
|
|
|
for (BindMaterialResp bindMaterialResp:arrs){
|
|
|
rowData[i][0] = bindMaterialResp.getMaterialTitle();
|
|
|
@@ -1579,6 +1752,10 @@ public class MesClient extends JFrame {
|
|
|
if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
|
|
|
|
|
|
JSONObject retObj = DataUtil.saveBindMaterail(scanBarcode,bindMaterialResp.getCraft(),bindMaterialResp.getMaterialId(),bindMaterialResp.getType());
|
|
|
+ if (retObj == null) {
|
|
|
+ MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
MesClient.setMenuStatus("扫物料:"+bindMaterialResp.getMaterialTitle()+"成功",0);
|
|
|
updateMaterailData();
|