|
@@ -9,6 +9,8 @@ import com.mes.netty.NettyClient;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
import com.mes.util.DateLocalUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
import com.mes.util.JdbcUtils;
|
|
|
import javafx.embed.swing.JFXPanel;
|
|
import javafx.embed.swing.JFXPanel;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
import javax.swing.*;
|
|
|
import javax.swing.border.EmptyBorder;
|
|
import javax.swing.border.EmptyBorder;
|
|
@@ -29,6 +31,8 @@ import java.util.Timer;
|
|
|
|
|
|
|
|
public class MesClient extends JFrame {
|
|
public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(MesClient.class);
|
|
|
|
|
+
|
|
|
private static String Drivde = "org.sqlite.JDBC";
|
|
private static String Drivde = "org.sqlite.JDBC";
|
|
|
|
|
|
|
|
public static int mes_auth = 0; // 权限级别 0=无权限 1=操作工人 2=管理员
|
|
public static int mes_auth = 0; // 权限级别 0=无权限 1=操作工人 2=管理员
|
|
@@ -98,13 +102,13 @@ public class MesClient extends JFrame {
|
|
|
public static Timer cjTimer3;
|
|
public static Timer cjTimer3;
|
|
|
|
|
|
|
|
public static Short aSetNum = 44;
|
|
public static Short aSetNum = 44;
|
|
|
-// public static Short aSetNum = 49;
|
|
|
|
|
|
|
+ // public static Short aSetNum = 49;
|
|
|
public static Short sortA = 0;
|
|
public static Short sortA = 0;
|
|
|
public static Short aMax = 0;
|
|
public static Short aMax = 0;
|
|
|
public static Short aFinish = 0;
|
|
public static Short aFinish = 0;
|
|
|
public static List<Map> alist = new ArrayList<>();
|
|
public static List<Map> alist = new ArrayList<>();
|
|
|
public static Short bSetNum = 44;
|
|
public static Short bSetNum = 44;
|
|
|
-// public static Short bSetNum = 27;
|
|
|
|
|
|
|
+ // public static Short bSetNum = 27;
|
|
|
public static Short sortB = 0;
|
|
public static Short sortB = 0;
|
|
|
public static Short bMax = 0;
|
|
public static Short bMax = 0;
|
|
|
public static Short bFinish = 0;
|
|
public static Short bFinish = 0;
|
|
@@ -289,7 +293,10 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
//发送AQDW质量询问报文,当收到返回UD才能工作
|
|
//发送AQDW质量询问报文,当收到返回UD才能工作
|
|
|
getUser();
|
|
getUser();
|
|
|
|
|
+ log.info("【质量检查-PLC触发】准备发送 AQDW 质量询问报文, SN: {}, User: {}", curSn, user20);
|
|
|
Boolean sendret = DataUtil.checkQuality(nettyClient,curSn,user20);
|
|
Boolean sendret = DataUtil.checkQuality(nettyClient,curSn,user20);
|
|
|
|
|
+ log.info("【质量检查-PLC触发】请求发送结果: {}", sendret);
|
|
|
|
|
+
|
|
|
if(!sendret){
|
|
if(!sendret){
|
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
|
}
|
|
}
|
|
@@ -313,19 +320,25 @@ public class MesClient extends JFrame {
|
|
|
public void run() {
|
|
public void run() {
|
|
|
try{
|
|
try{
|
|
|
List<ProdReq> prods = JdbcUtils.getProds();
|
|
List<ProdReq> prods = JdbcUtils.getProds();
|
|
|
- System.out.println("prods:"+ JSON.toJSONString(prods));
|
|
|
|
|
|
|
+ log.info("【参数定时上传】获取到待同步的生产数据,记录数: {}", prods.size());
|
|
|
if(prods.size() > 0){
|
|
if(prods.size() > 0){
|
|
|
// 定时上传参数
|
|
// 定时上传参数
|
|
|
|
|
+ log.debug("【参数定时上传】请求数据详情: {}", JSON.toJSONString(prods));
|
|
|
JSONObject retObj = DataUtil.upParams(JSON.toJSONString(prods));
|
|
JSONObject retObj = DataUtil.upParams(JSON.toJSONString(prods));
|
|
|
|
|
+ log.info("【参数定时上传】服务端返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
// 更新sqlite已同步
|
|
// 更新sqlite已同步
|
|
|
for(ProdReq prodReq:prods){
|
|
for(ProdReq prodReq:prods){
|
|
|
JdbcUtils.updateProdSync(prodReq.getId(),1);
|
|
JdbcUtils.updateProdSync(prodReq.getId(),1);
|
|
|
}
|
|
}
|
|
|
|
|
+ log.info("【参数定时上传】本地 SQLite 状态更新完成");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("【参数定时上传】接口返回非 true,未更新本地状态");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ log.error("【参数定时上传】发生异常: ", e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}, 1000,30*1000);
|
|
}, 1000,30*1000);
|
|
@@ -546,7 +559,10 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 查询工件质量
|
|
// 查询工件质量
|
|
|
|
|
+ log.info("【质量检查-扫码触发】准备发送扫码质量询问报文, SN: {}, User: {}", barcode36, user20);
|
|
|
Boolean sendret = DataUtil.checkQuality(nettyClient,barcode36,user20);
|
|
Boolean sendret = DataUtil.checkQuality(nettyClient,barcode36,user20);
|
|
|
|
|
+ log.info("【质量检查-扫码触发】请求发送结果: {}", sendret);
|
|
|
|
|
+
|
|
|
if(!sendret){
|
|
if(!sendret){
|
|
|
JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
return;
|
|
return;
|
|
@@ -742,13 +758,17 @@ public class MesClient extends JFrame {
|
|
|
finish_ok_bt.setEnabled(false);
|
|
finish_ok_bt.setEnabled(false);
|
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【总控操作】点击了 [OK] 按钮,当前产品SN: {}, 操作用户: {}", product_sn.getText(), user_menu.getText());
|
|
|
if(work_status == 1 && check_quality_result){
|
|
if(work_status == 1 && check_quality_result){
|
|
|
|
|
|
|
|
String sn = getBarcode(product_sn.getText());
|
|
String sn = getBarcode(product_sn.getText());
|
|
|
getUser();
|
|
getUser();
|
|
|
|
|
|
|
|
String qret = "OK";
|
|
String qret = "OK";
|
|
|
|
|
+ log.info("【判定上传】准备发送质量判定结果, SN: {}, 结果: {}", sn, qret);
|
|
|
Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20);
|
|
Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20);
|
|
|
|
|
+ log.info("【判定上传】发送结果: {}", sendret);
|
|
|
|
|
+
|
|
|
if(!sendret){
|
|
if(!sendret){
|
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
|
// JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
// JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
@@ -768,12 +788,16 @@ public class MesClient extends JFrame {
|
|
|
finish_ng_bt.setEnabled(false);
|
|
finish_ng_bt.setEnabled(false);
|
|
|
finish_ng_bt.addActionListener(new ActionListener() {
|
|
finish_ng_bt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【总控操作】点击了 [NG] 按钮,当前产品SN: {}, 操作用户: {}", product_sn.getText(), user_menu.getText());
|
|
|
if(work_status == 1 && check_quality_result){
|
|
if(work_status == 1 && check_quality_result){
|
|
|
|
|
|
|
|
String sn = getBarcode(product_sn.getText());
|
|
String sn = getBarcode(product_sn.getText());
|
|
|
getUser();
|
|
getUser();
|
|
|
String qret = "NG";
|
|
String qret = "NG";
|
|
|
|
|
+ log.info("【判定上传】准备发送质量判定结果, SN: {}, 结果: {}", sn, qret);
|
|
|
Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20);
|
|
Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20);
|
|
|
|
|
+ log.info("【判定上传】发送结果: {}", sendret);
|
|
|
|
|
+
|
|
|
if(!sendret){
|
|
if(!sendret){
|
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
MesClient.setMenuStatus("消息发送失败,请重试",-1);
|
|
|
// JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
// JOptionPane.showMessageDialog(mesClientFrame,"消息发送失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
@@ -859,8 +883,12 @@ public class MesClient extends JFrame {
|
|
|
resetResultA = new JButton("重拉");
|
|
resetResultA = new JButton("重拉");
|
|
|
resetResultA.addActionListener(new ActionListener() {
|
|
resetResultA.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【A枪操作】点击了 [重拉] 按钮,当前产品SN: {}", product_sn.getText());
|
|
|
if(zdStatusA == 1){
|
|
if(zdStatusA == 1){
|
|
|
|
|
+ log.info("【NG审核检查】准备校验 A枪 NG中断数据, SN: {}", product_sn.getText());
|
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
|
|
|
+ log.info("【NG审核检查】校验返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
MesClient.zdStatusA = 0;
|
|
MesClient.zdStatusA = 0;
|
|
|
MesClient.resetResultA.setEnabled(false);
|
|
MesClient.resetResultA.setEnabled(false);
|
|
@@ -892,8 +920,12 @@ public class MesClient extends JFrame {
|
|
|
okResultA = new JButton("OK");
|
|
okResultA = new JButton("OK");
|
|
|
okResultA.addActionListener(new ActionListener() {
|
|
okResultA.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【A枪操作】点击了 [OK] 按钮,当前产品SN: {}", product_sn.getText());
|
|
|
if(zdStatusA == 1){
|
|
if(zdStatusA == 1){
|
|
|
|
|
+ log.info("【NG审核检查】准备校验 A枪 NG中断数据, SN: {}", product_sn.getText());
|
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
|
|
|
+ log.info("【NG审核检查】校验返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
|
MesClient.aFinish++;
|
|
MesClient.aFinish++;
|
|
@@ -930,8 +962,12 @@ public class MesClient extends JFrame {
|
|
|
ngResultA = new JButton("NG");
|
|
ngResultA = new JButton("NG");
|
|
|
ngResultA.addActionListener(new ActionListener() {
|
|
ngResultA.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【A枪操作】点击了 [NG] 按钮,当前产品SN: {}", product_sn.getText());
|
|
|
if(zdStatusA == 1){
|
|
if(zdStatusA == 1){
|
|
|
|
|
+ log.info("【NG审核检查】准备校验 A枪 NG中断数据, SN: {}", product_sn.getText());
|
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"A");
|
|
|
|
|
+ log.info("【NG审核检查】校验返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
|
JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"A",foutA,soutA,fminA,sminA,fmaxA,smaxA,"0",curA+"", MesClient.user_menu.getText());
|
|
JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"A",foutA,soutA,fminA,sminA,fmaxA,smaxA,"0",curA+"", MesClient.user_menu.getText());
|
|
@@ -968,8 +1004,12 @@ public class MesClient extends JFrame {
|
|
|
resetResultB = new JButton("重拉");
|
|
resetResultB = new JButton("重拉");
|
|
|
resetResultB.addActionListener(new ActionListener() {
|
|
resetResultB.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【B枪操作】点击了 [重拉] 按钮,当前产品SN: {}", product_sn.getText());
|
|
|
if(zdStatusB == 1){
|
|
if(zdStatusB == 1){
|
|
|
|
|
+ log.info("【NG审核检查】准备校验 B枪 NG中断数据, SN: {}", product_sn.getText());
|
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
|
|
|
+ log.info("【NG审核检查】校验返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
MesClient.zdStatusB = 0;
|
|
MesClient.zdStatusB = 0;
|
|
|
MesClient.resetResultB.setEnabled(false);
|
|
MesClient.resetResultB.setEnabled(false);
|
|
@@ -1001,8 +1041,12 @@ public class MesClient extends JFrame {
|
|
|
okResultB = new JButton("OK");
|
|
okResultB = new JButton("OK");
|
|
|
okResultB.addActionListener(new ActionListener() {
|
|
okResultB.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【B枪操作】点击了 [OK] 按钮,当前产品SN: {}", product_sn.getText());
|
|
|
if(zdStatusB == 1){
|
|
if(zdStatusB == 1){
|
|
|
|
|
+ log.info("【NG审核检查】准备校验 B枪 NG中断数据, SN: {}", product_sn.getText());
|
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
|
|
|
+ log.info("【NG审核检查】校验返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
|
MesClient.bFinish++;
|
|
MesClient.bFinish++;
|
|
@@ -1040,8 +1084,12 @@ public class MesClient extends JFrame {
|
|
|
ngResultB = new JButton("NG");
|
|
ngResultB = new JButton("NG");
|
|
|
ngResultB.addActionListener(new ActionListener() {
|
|
ngResultB.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ log.info("【B枪操作】点击了 [NG] 按钮,当前产品SN: {}", product_sn.getText());
|
|
|
if(zdStatusB == 1){
|
|
if(zdStatusB == 1){
|
|
|
|
|
+ log.info("【NG审核检查】准备校验 B枪 NG中断数据, SN: {}", product_sn.getText());
|
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
JSONObject retObj = DataUtil.checkNgData(product_sn.getText(),"B");
|
|
|
|
|
+ log.info("【NG审核检查】校验返回结果: {}", retObj != null ? retObj.toJSONString() : "null");
|
|
|
|
|
+
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
if(!MesClient.product_sn.getText().isEmpty()){
|
|
|
JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"B",foutA,soutA,fminA,sminA,fmaxA,smaxA,"0",curA+"", MesClient.user_menu.getText());
|
|
JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"B",foutA,soutA,fminA,sminA,fmaxA,smaxA,"0",curA+"", MesClient.user_menu.getText());
|
|
@@ -1082,7 +1130,7 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
|
|
-// searchScrollPane = new JScrollPane((Component) null);
|
|
|
|
|
|
|
+// searchScrollPane = new JScrollPane((Component) null);
|
|
|
|
|
|
|
|
indexPanelC = new JPanel();
|
|
indexPanelC = new JPanel();
|
|
|
searchScrollPaneDj = new JScrollPane(indexPanelC);
|
|
searchScrollPaneDj = new JScrollPane(indexPanelC);
|
|
@@ -1095,10 +1143,10 @@ public class MesClient extends JFrame {
|
|
|
searchScrollPane = new JScrollPane(indexPanelB);
|
|
searchScrollPane = new JScrollPane(indexPanelB);
|
|
|
indexPanelB.setLayout(null);
|
|
indexPanelB.setLayout(null);
|
|
|
|
|
|
|
|
- tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
|
|
|
|
|
|
|
+ tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
- tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
|
|
|
|
+ tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void stateChanged(ChangeEvent e) {
|
|
public void stateChanged(ChangeEvent e) {
|
|
|
JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
|
|
JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
|