|
|
@@ -86,10 +86,10 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param3;
|
|
|
public static JTextField param4;
|
|
|
|
|
|
- public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.7");
|
|
|
- public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.8");
|
|
|
-// public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
|
|
|
-// public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
|
|
|
+// public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.7");
|
|
|
+// public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.8");
|
|
|
+ public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
|
|
|
+ public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
|
|
|
|
|
|
public static Timer cjTimer;
|
|
|
|
|
|
@@ -97,16 +97,17 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static Timer cjTimer3;
|
|
|
|
|
|
- public static Short aSetNum = 40;
|
|
|
+ public static Short aSetNum = 19;
|
|
|
// public static Short aSetNum = 49;
|
|
|
public static Short sortA = 0;
|
|
|
public static Short aMax = 0;
|
|
|
public static Short aFinish = 0;
|
|
|
public static List<Map> alist = new ArrayList<>();
|
|
|
- public static Short bSetNum = 22;
|
|
|
+ public static Short bSetNum = 50;
|
|
|
// public static Short bSetNum = 27;
|
|
|
public static Short sortB = 0;
|
|
|
public static Short bMax = 0;
|
|
|
+ public static Short bFinish = 0;
|
|
|
public static List<Map> blist = new ArrayList<>();
|
|
|
public static Short deviceControl = 0; // 0=本地 1=远程
|
|
|
public static Integer tjStatus = 0; // 1=提交失败
|
|
|
@@ -115,6 +116,29 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static String curSn = "";
|
|
|
|
|
|
+ public static Integer zdStatusA = 0;
|
|
|
+ public static Integer zdStatusB = 0;
|
|
|
+ public static String foutA = "";
|
|
|
+ public static String fmaxA = "";
|
|
|
+ public static String fminA = "";
|
|
|
+ public static String soutA = "";
|
|
|
+ public static String smaxA = "";
|
|
|
+ public static String sminA = "";
|
|
|
+ public static String curA = "";
|
|
|
+ public static String foutB = "";
|
|
|
+ public static String fmaxB = "";
|
|
|
+ public static String fminB = "";
|
|
|
+ public static String soutB = "";
|
|
|
+ public static String smaxB = "";
|
|
|
+ public static String sminB = "";
|
|
|
+ public static String curB = "";
|
|
|
+ public static JButton resetResultA;
|
|
|
+ public static JButton okResultA;
|
|
|
+ public static JButton ngResultA;
|
|
|
+ public static JButton resetResultB;
|
|
|
+ public static JButton okResultB;
|
|
|
+ public static JButton ngResultB;
|
|
|
+
|
|
|
public static JTable table;
|
|
|
public static Object[] columnNames = { "物料名称", "绑定批次", "剩余次数", "操作" };
|
|
|
public static Object[][] rowData = null;
|
|
|
@@ -412,6 +436,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.aMax = 0;
|
|
|
MesClient.bMax = 0;
|
|
|
MesClient.aFinish = 0;
|
|
|
+ MesClient.bFinish = 0;
|
|
|
MesClient.alist = new ArrayList<>();
|
|
|
MesClient.blist = new ArrayList<>();
|
|
|
MesClient.sortB = 0;
|
|
|
@@ -421,6 +446,15 @@ public class MesClient extends JFrame {
|
|
|
MesClient.param3.setText("");
|
|
|
MesClient.param4.setText("");
|
|
|
|
|
|
+ zdStatusA = 0;
|
|
|
+ zdStatusB = 0;
|
|
|
+ resetResultA.setEnabled(false);
|
|
|
+ okResultA.setEnabled(false);
|
|
|
+ ngResultA.setEnabled(false);
|
|
|
+ resetResultB.setEnabled(false);
|
|
|
+ okResultB.setEnabled(false);
|
|
|
+ ngResultB.setEnabled(false);
|
|
|
+
|
|
|
deviceControl = ModbusUtil.getControlModel(plcA);
|
|
|
if(deviceControl == 1){
|
|
|
|
|
|
@@ -720,8 +754,7 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
finish_ok_bt.setIcon(new ImageIcon(MesClient.class.getResource("/bg/ok_bg.png")));
|
|
|
finish_ok_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
-// finish_ok_bt.setBounds(185, 291, 240, 80);
|
|
|
- finish_ok_bt.setBounds(185, 371, 240, 80);
|
|
|
+ finish_ok_bt.setBounds(185, 395, 240, 80);
|
|
|
finish_ok_bt.setEnabled(false);
|
|
|
indexPanelA.add(finish_ok_bt);
|
|
|
|
|
|
@@ -737,7 +770,6 @@ public class MesClient extends JFrame {
|
|
|
Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20);
|
|
|
if(!sendret){
|
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
|
-// JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -745,7 +777,7 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
finish_ng_bt.setIcon(new ImageIcon(MesClient.class.getResource("/bg/ng_bg.png")));
|
|
|
finish_ng_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
- finish_ng_bt.setBounds(508, 371, 240, 80);
|
|
|
+ finish_ng_bt.setBounds(508, 395, 240, 80);
|
|
|
finish_ng_bt.setEnabled(false);
|
|
|
indexPanelA.add(finish_ng_bt);
|
|
|
|
|
|
@@ -817,6 +849,218 @@ public class MesClient extends JFrame {
|
|
|
param4.setBounds(608, 285, 83, 34);
|
|
|
indexPanelA.add(param4);
|
|
|
|
|
|
+ JLabel lblNgJudgeA = new JLabel("NG\u590d\u5224");
|
|
|
+ lblNgJudgeA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ lblNgJudgeA.setBounds(204, 322, 167, 22);
|
|
|
+ indexPanelA.add(lblNgJudgeA);
|
|
|
+
|
|
|
+ JLabel lblNgJudgeB = new JLabel("NG\u590d\u5224");
|
|
|
+ lblNgJudgeB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ lblNgJudgeB.setBounds(525, 322, 167, 22);
|
|
|
+ indexPanelA.add(lblNgJudgeB);
|
|
|
+
|
|
|
+ resetResultA = new JButton("重拉");
|
|
|
+ resetResultA.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if(zdStatusA == 1){
|
|
|
+ JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ zdStatusA = 0;
|
|
|
+ resetResultA.setEnabled(false);
|
|
|
+ okResultA.setEnabled(false);
|
|
|
+ ngResultA.setEnabled(false);
|
|
|
+ sortA = (short)(sortA - 1);
|
|
|
+ param2.setText(sortA+"");
|
|
|
+ plcA.writeInt16(1136, sortA);
|
|
|
+ foutA = "";
|
|
|
+ soutA = "";
|
|
|
+ fmaxA = "";
|
|
|
+ fminA = "";
|
|
|
+ smaxA = "";
|
|
|
+ sminA = "";
|
|
|
+ curA = "";
|
|
|
+ ModbusUtil.setPowerOn(plcA);
|
|
|
+ }else{
|
|
|
+ setMenuStatus("NG中断未审核",-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ resetResultA.setEnabled(false);
|
|
|
+ resetResultA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ resetResultA.setBounds(204, 348, 70, 36);
|
|
|
+ indexPanelA.add(resetResultA);
|
|
|
+
|
|
|
+ okResultA = new JButton("OK");
|
|
|
+ okResultA.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if(zdStatusA == 1){
|
|
|
+ JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ if(!product_sn.getText().isEmpty()){
|
|
|
+ aFinish++;
|
|
|
+ JdbcUtils.insertProdData(mes_gw, mes_line_sn, product_sn.getText(),"A",foutA,soutA,fminA,sminA,fmaxA,smaxA,"1",curA, user_menu.getText());
|
|
|
+ }
|
|
|
+ zdStatusA = 0;
|
|
|
+ resetResultA.setEnabled(false);
|
|
|
+ okResultA.setEnabled(false);
|
|
|
+ ngResultA.setEnabled(false);
|
|
|
+ foutA = "";
|
|
|
+ soutA = "";
|
|
|
+ fmaxA = "";
|
|
|
+ fminA = "";
|
|
|
+ smaxA = "";
|
|
|
+ sminA = "";
|
|
|
+ curA = "";
|
|
|
+ ModbusUtil.upResult();
|
|
|
+ ModbusUtil.setPowerOn(plcA);
|
|
|
+ }else{
|
|
|
+ setMenuStatus("NG中断未审核",-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ okResultA.setEnabled(false);
|
|
|
+ okResultA.setForeground(new Color(0, 128, 0));
|
|
|
+ okResultA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ okResultA.setBounds(281, 348, 70, 36);
|
|
|
+ indexPanelA.add(okResultA);
|
|
|
+
|
|
|
+ ngResultA = new JButton("NG");
|
|
|
+ ngResultA.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if(zdStatusA == 1){
|
|
|
+ JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ if(!product_sn.getText().isEmpty()){
|
|
|
+ JdbcUtils.insertProdData(mes_gw, mes_line_sn, product_sn.getText(),"A",foutA,soutA,fminA,sminA,fmaxA,smaxA,"0",curA, user_menu.getText());
|
|
|
+ }
|
|
|
+ zdStatusA = 0;
|
|
|
+ resetResultA.setEnabled(false);
|
|
|
+ okResultA.setEnabled(false);
|
|
|
+ ngResultA.setEnabled(false);
|
|
|
+ foutA = "";
|
|
|
+ soutA = "";
|
|
|
+ fmaxA = "";
|
|
|
+ fminA = "";
|
|
|
+ smaxA = "";
|
|
|
+ sminA = "";
|
|
|
+ curA = "";
|
|
|
+ ModbusUtil.upResult();
|
|
|
+ ModbusUtil.setPowerOn(plcA);
|
|
|
+ }else{
|
|
|
+ setMenuStatus("NG中断未审核",-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ngResultA.setEnabled(false);
|
|
|
+ ngResultA.setForeground(new Color(255, 0, 0));
|
|
|
+ ngResultA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ ngResultA.setBounds(358, 348, 70, 36);
|
|
|
+ indexPanelA.add(ngResultA);
|
|
|
+
|
|
|
+ resetResultB = new JButton("重拉");
|
|
|
+ resetResultB.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if(zdStatusB == 1){
|
|
|
+ JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ zdStatusB = 0;
|
|
|
+ resetResultB.setEnabled(false);
|
|
|
+ okResultB.setEnabled(false);
|
|
|
+ ngResultB.setEnabled(false);
|
|
|
+ sortB = (short)(sortB - 1);
|
|
|
+ param4.setText(sortB+"");
|
|
|
+ plcB.writeInt16(1136, sortB);
|
|
|
+ foutB = "";
|
|
|
+ soutB = "";
|
|
|
+ fmaxB = "";
|
|
|
+ fminB = "";
|
|
|
+ smaxB = "";
|
|
|
+ sminB = "";
|
|
|
+ curB = "";
|
|
|
+ ModbusUtil.setPowerOn(plcB);
|
|
|
+ }else{
|
|
|
+ setMenuStatus("NG中断未审核",-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ resetResultB.setEnabled(false);
|
|
|
+ resetResultB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ resetResultB.setBounds(525, 348, 70, 36);
|
|
|
+ indexPanelA.add(resetResultB);
|
|
|
+
|
|
|
+ okResultB = new JButton("OK");
|
|
|
+ okResultB.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if(zdStatusB == 1){
|
|
|
+ JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ if(!product_sn.getText().isEmpty()){
|
|
|
+ bFinish++;
|
|
|
+ JdbcUtils.insertProdData(mes_gw, mes_line_sn, product_sn.getText(),"B",foutB,soutB,fminB,sminB,fmaxB,smaxB,"1",curB, user_menu.getText());
|
|
|
+ }
|
|
|
+ zdStatusB = 0;
|
|
|
+ resetResultB.setEnabled(false);
|
|
|
+ okResultB.setEnabled(false);
|
|
|
+ ngResultB.setEnabled(false);
|
|
|
+ foutB = "";
|
|
|
+ soutB = "";
|
|
|
+ fmaxB = "";
|
|
|
+ fminB = "";
|
|
|
+ smaxB = "";
|
|
|
+ sminB = "";
|
|
|
+ curB = "";
|
|
|
+ ModbusUtil.upResult();
|
|
|
+ ModbusUtil.setPowerOn(plcB);
|
|
|
+ }else{
|
|
|
+ setMenuStatus("NG中断未审核",-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ okResultB.setEnabled(false);
|
|
|
+ okResultB.setForeground(new Color(0, 128, 0));
|
|
|
+ okResultB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ okResultB.setBounds(602, 348, 70, 36);
|
|
|
+ indexPanelA.add(okResultB);
|
|
|
+
|
|
|
+ ngResultB = new JButton("NG");
|
|
|
+ ngResultB.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if(zdStatusB == 1){
|
|
|
+ JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ if(!product_sn.getText().isEmpty()){
|
|
|
+ JdbcUtils.insertProdData(mes_gw, mes_line_sn, product_sn.getText(),"B",foutB,soutB,fminB,sminB,fmaxB,smaxB,"0",curB, user_menu.getText());
|
|
|
+ }
|
|
|
+ zdStatusB = 0;
|
|
|
+ resetResultB.setEnabled(false);
|
|
|
+ okResultB.setEnabled(false);
|
|
|
+ ngResultB.setEnabled(false);
|
|
|
+ foutB = "";
|
|
|
+ soutB = "";
|
|
|
+ fmaxB = "";
|
|
|
+ fminB = "";
|
|
|
+ smaxB = "";
|
|
|
+ sminB = "";
|
|
|
+ curB = "";
|
|
|
+ ModbusUtil.upResult();
|
|
|
+ ModbusUtil.setPowerOn(plcB);
|
|
|
+ }else{
|
|
|
+ setMenuStatus("NG中断未审核",-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ngResultB.setEnabled(false);
|
|
|
+ ngResultB.setForeground(new Color(255, 0, 0));
|
|
|
+ ngResultB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+ ngResultB.setBounds(679, 348, 70, 36);
|
|
|
+ indexPanelA.add(ngResultB);
|
|
|
+
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|