|
@@ -6,6 +6,8 @@ import com.mes.component.MesWebView;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
import com.mes.util.DateLocalUtils;
|
|
|
import com.mes.util.HttpUtils;
|
|
import com.mes.util.HttpUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
import com.mes.util.JdbcUtils;
|
|
|
|
|
+import com.mes.util.OkngRecordParam;
|
|
|
|
|
+import com.mes.util.OkngUploadUtil;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import javax.swing.*;
|
|
import javax.swing.*;
|
|
@@ -79,7 +81,8 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
public static JFrame welcomeWin;
|
|
public static JFrame welcomeWin;
|
|
|
|
|
|
|
|
- public static JPanel indexPanelB; // 已弃用,改为使用 WorkRecordPanel
|
|
|
|
|
|
|
+ public static JPanel indexPanelB;
|
|
|
|
|
+ public static WorkRecordPanel workRecordPanel;
|
|
|
public static MesWebView jfxPanel = null;
|
|
public static MesWebView jfxPanel = null;
|
|
|
public static JPanel indexPanelC;
|
|
public static JPanel indexPanelC;
|
|
|
public static MesWebView jfxPanel2 = null;
|
|
public static MesWebView jfxPanel2 = null;
|
|
@@ -409,6 +412,15 @@ public class MesClient extends JFrame {
|
|
|
// shiftUserCheck();
|
|
// shiftUserCheck();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static void disableOkNgButtons() {
|
|
|
|
|
+ if (finish_ok_bt != null) {
|
|
|
|
|
+ finish_ok_bt.setEnabled(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (finish_ng_bt != null) {
|
|
|
|
|
+ finish_ng_bt.setEnabled(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static int userLoginHours;//用户登录所处小时
|
|
public static int userLoginHours;//用户登录所处小时
|
|
|
//换班用户信息检查
|
|
//换班用户信息检查
|
|
|
private static void shiftUserCheck() {
|
|
private static void shiftUserCheck() {
|
|
@@ -490,33 +502,22 @@ public class MesClient extends JFrame {
|
|
|
//刷新界面
|
|
//刷新界面
|
|
|
mesClientFrame.repaint();
|
|
mesClientFrame.repaint();
|
|
|
|
|
|
|
|
- // 查询工件质量
|
|
|
|
|
- JSONObject retObj = DataUtil.checkQuality(scanBarcode,user20);
|
|
|
|
|
- if(retObj == null){
|
|
|
|
|
|
|
+ // 查询工件质量(含已加工校验,万能码除外)
|
|
|
|
|
+ String qualityMsg = DataUtil.resolveQualityCheckMessage(scanBarcode, user20);
|
|
|
|
|
+ if (qualityMsg != null) {
|
|
|
MesClient.check_quality_result = false;
|
|
MesClient.check_quality_result = false;
|
|
|
MesClient.work_status = 0;
|
|
MesClient.work_status = 0;
|
|
|
- MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
|
|
+ disableOkNgButtons();
|
|
|
|
|
+ MesClient.setMenuStatus(qualityMsg, -1);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
|
|
- MesClient.status_menu.setForeground(Color.GREEN);
|
|
|
|
|
- MesClient.check_quality_result = true;//质量合格,可以绑定加工
|
|
|
|
|
- MesClient.status_menu.setText("该工件可以加工");
|
|
|
|
|
- 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{
|
|
|
|
|
- MesClient.check_quality_result = false;
|
|
|
|
|
- MesClient.work_status = 0;
|
|
|
|
|
- if(retObj.get("result")==null){
|
|
|
|
|
- MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
- }else{
|
|
|
|
|
- if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
|
|
- MesClient.setMenuStatus(retObj.getString("message"),-1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ MesClient.status_menu.setForeground(Color.GREEN);
|
|
|
|
|
+ MesClient.check_quality_result = true;
|
|
|
|
|
+ MesClient.status_menu.setText("该工件可以加工");
|
|
|
|
|
+ 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 {
|
|
}else {
|
|
|
MesClient.setMenuStatus("请扫工件码,请重试",-1);
|
|
MesClient.setMenuStatus("请扫工件码,请重试",-1);
|
|
|
// JOptionPane.showMessageDialog(mesClientFrame,"请扫工件码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
// JOptionPane.showMessageDialog(mesClientFrame,"请扫工件码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
@@ -715,32 +716,36 @@ public class MesClient extends JFrame {
|
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
if(work_status == 1 && check_quality_result){
|
|
if(work_status == 1 && check_quality_result){
|
|
|
|
|
+ finish_ok_bt.setEnabled(false);
|
|
|
|
|
+ finish_ng_bt.setEnabled(false);
|
|
|
getUser();
|
|
getUser();
|
|
|
String sn = MesClient.product_sn.getText().trim();
|
|
String sn = MesClient.product_sn.getText().trim();
|
|
|
if(sn.isEmpty()){
|
|
if(sn.isEmpty()){
|
|
|
MesClient.setMenuStatus("工件码为空,请重试",-1);
|
|
MesClient.setMenuStatus("工件码为空,请重试",-1);
|
|
|
|
|
+ finish_ok_bt.setEnabled(true);
|
|
|
|
|
+ finish_ng_bt.setEnabled(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- JSONObject retObj = DataUtil.sendQuality(sn,"OK",user20);
|
|
|
|
|
- if(retObj == null){
|
|
|
|
|
- MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
|
|
+ String dupMsg = DataUtil.resolveQualityCheckMessage(sn, user20);
|
|
|
|
|
+ if (dupMsg != null) {
|
|
|
|
|
+ MesClient.setMenuStatus(dupMsg, -1);
|
|
|
|
|
+ MesClient.work_status = 0;
|
|
|
|
|
+ MesClient.check_quality_result = false;
|
|
|
|
|
+ MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- System.out.println(retObj);
|
|
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
|
|
- MesClient.resetScanA();
|
|
|
|
|
- MesClient.setMenuStatus("结果提交成功,请扫下一件",0);
|
|
|
|
|
- MesClient.scan_type = 1;
|
|
|
|
|
- MesClient.scanBarcode();
|
|
|
|
|
- }else{
|
|
|
|
|
- if(retObj.get("result")==null){
|
|
|
|
|
- MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
- }else{
|
|
|
|
|
- if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
|
|
- MesClient.setMenuStatus(retObj.getString("message"),-1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ OkngRecordParam record = new OkngRecordParam();
|
|
|
|
|
+ record.setSn(sn);
|
|
|
|
|
+ record.setOprno(MesClient.mes_gw);
|
|
|
|
|
+ record.setLineSn(MesClient.mes_line_sn);
|
|
|
|
|
+ record.setUcode(user20);
|
|
|
|
|
+ record.setResult("OK");
|
|
|
|
|
+ record.setCreateTime(DateLocalUtils.getCurrentTime());
|
|
|
|
|
+ if (!OkngUploadUtil.saveAndUpload(record, true)) {
|
|
|
|
|
+ MesClient.setMenuStatus("本地记录保存失败,请重试", -1);
|
|
|
|
|
+ finish_ok_bt.setEnabled(true);
|
|
|
|
|
+ finish_ng_bt.setEnabled(true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -756,31 +761,36 @@ public class MesClient extends JFrame {
|
|
|
finish_ng_bt.addActionListener(new ActionListener() {
|
|
finish_ng_bt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
if(work_status == 1 && check_quality_result){
|
|
if(work_status == 1 && check_quality_result){
|
|
|
|
|
+ finish_ok_bt.setEnabled(false);
|
|
|
|
|
+ finish_ng_bt.setEnabled(false);
|
|
|
getUser();
|
|
getUser();
|
|
|
String sn = MesClient.product_sn.getText().trim();
|
|
String sn = MesClient.product_sn.getText().trim();
|
|
|
if(sn.isEmpty()){
|
|
if(sn.isEmpty()){
|
|
|
MesClient.setMenuStatus("工件码为空,请重试",-1);
|
|
MesClient.setMenuStatus("工件码为空,请重试",-1);
|
|
|
|
|
+ finish_ok_bt.setEnabled(true);
|
|
|
|
|
+ finish_ng_bt.setEnabled(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- JSONObject retObj = DataUtil.sendQuality(sn,"NG",user20);
|
|
|
|
|
- if(retObj == null){
|
|
|
|
|
- MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
|
|
+ String dupMsg = DataUtil.resolveQualityCheckMessage(sn, user20);
|
|
|
|
|
+ if (dupMsg != null) {
|
|
|
|
|
+ MesClient.setMenuStatus(dupMsg, -1);
|
|
|
|
|
+ MesClient.work_status = 0;
|
|
|
|
|
+ MesClient.check_quality_result = false;
|
|
|
|
|
+ MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
|
|
- MesClient.resetScanA();
|
|
|
|
|
- MesClient.setMenuStatus("结果提交成功,请扫下一件",0);
|
|
|
|
|
- MesClient.scan_type = 1;
|
|
|
|
|
- MesClient.scanBarcode();
|
|
|
|
|
- }else{
|
|
|
|
|
- if(retObj.get("result")==null){
|
|
|
|
|
- MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
- }else{
|
|
|
|
|
- if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
|
|
- MesClient.setMenuStatus(retObj.getString("message"),-1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ OkngRecordParam record = new OkngRecordParam();
|
|
|
|
|
+ record.setSn(sn);
|
|
|
|
|
+ record.setOprno(MesClient.mes_gw);
|
|
|
|
|
+ record.setLineSn(MesClient.mes_line_sn);
|
|
|
|
|
+ record.setUcode(user20);
|
|
|
|
|
+ record.setResult("NG");
|
|
|
|
|
+ record.setCreateTime(DateLocalUtils.getCurrentTime());
|
|
|
|
|
+ if (!OkngUploadUtil.saveAndUpload(record, true)) {
|
|
|
|
|
+ MesClient.setMenuStatus("本地记录保存失败,请重试", -1);
|
|
|
|
|
+ finish_ok_bt.setEnabled(true);
|
|
|
|
|
+ finish_ng_bt.setEnabled(true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -803,12 +813,10 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
- // ========== 工作记录 Tab(改造:当前工位Tab + 所有工位Tab) ==========
|
|
|
|
|
- // 旧代码已注释:
|
|
|
|
|
- indexPanelB = new JPanel();
|
|
|
|
|
- searchScrollPane = new JScrollPane(indexPanelB);
|
|
|
|
|
- indexPanelB.setLayout(null);
|
|
|
|
|
- tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
|
|
|
|
|
|
|
+ // ========== 工作记录 Tab(本地记录 + 分页查询) ==========
|
|
|
|
|
+ workRecordPanel = new WorkRecordPanel(mes_gw, mes_line_sn);
|
|
|
|
|
+ tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), workRecordPanel, null);
|
|
|
|
|
+ int workRecordTabIndex = tabbedPane.getTabCount() - 1;
|
|
|
|
|
|
|
|
// 创建“软件设置”页面,并加入主Tab页签
|
|
// 创建“软件设置”页面,并加入主Tab页签
|
|
|
JPanel softwareSettingPanel = buildSoftwareSettingPanel();
|
|
JPanel softwareSettingPanel = buildSoftwareSettingPanel();
|
|
@@ -853,6 +861,10 @@ public class MesClient extends JFrame {
|
|
|
int selectedIndex = tabbedPane.getSelectedIndex();
|
|
int selectedIndex = tabbedPane.getSelectedIndex();
|
|
|
System.out.println("selectedIndex:"+selectedIndex);
|
|
System.out.println("selectedIndex:"+selectedIndex);
|
|
|
|
|
|
|
|
|
|
+ if (selectedIndex == workRecordTabIndex && workRecordPanel != null) {
|
|
|
|
|
+ workRecordPanel.refreshData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (softwareTabReverting) {
|
|
if (softwareTabReverting) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|