|
|
@@ -97,7 +97,7 @@ public class MesClient extends JFrame {
|
|
|
public static JLabel curTaskName;
|
|
|
|
|
|
public static JTable table;
|
|
|
- public static Object[] columnNames = {"工件码", "测试日期", "压力", "泄露值","结果"};
|
|
|
+ public static Object[] columnNames = {"工件码", "测试日期", "压力", "泄露值", "稳压时长", "测试时长", "结果"};
|
|
|
// public static Object[][] rowData = null;
|
|
|
// public static Object[][] rowData = {
|
|
|
// {"151245P00001213100100024120700111","2024-12-09 12:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
|
@@ -105,7 +105,7 @@ public class MesClient extends JFrame {
|
|
|
// {"151245P00001213100100024120700113","2024-12-09 14:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
|
// {"151245P00001213100100024120700113","2024-12-09 14:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
|
// };
|
|
|
- public static Object[][] rowData = new Object[12][5];
|
|
|
+ public static Object[][] rowData = new Object[12][7];
|
|
|
public static JLabel pageLabel;
|
|
|
public static int pageNo=1 ; // 当前页
|
|
|
public static int totalPages; // 总页数
|
|
|
@@ -136,6 +136,11 @@ public class MesClient extends JFrame {
|
|
|
public static Integer isConfigEdit = 0;
|
|
|
public static Integer mesStartFlag = 0;
|
|
|
|
|
|
+ /** 本轮稳压时长(秒),来自 ATEQ 程序参数 */
|
|
|
+ public static String curStabilizeTime = "";
|
|
|
+ /** 本轮测试时长(秒),来自 ATEQ 程序参数 */
|
|
|
+ public static String curTestDuration = "";
|
|
|
+
|
|
|
public static List<TaskParam> taskParamList = new ArrayList<>();
|
|
|
public static TaskParam curTaskParam = null;
|
|
|
|
|
|
@@ -340,6 +345,14 @@ public class MesClient extends JFrame {
|
|
|
tjFlag = 0;
|
|
|
mesStartFlag = 0;
|
|
|
curTaskName.setText("");
|
|
|
+ curStabilizeTime = "";
|
|
|
+ curTestDuration = "";
|
|
|
+ if (param3 != null) {
|
|
|
+ param3.setText("");
|
|
|
+ }
|
|
|
+ if (param4 != null) {
|
|
|
+ param4.setText("");
|
|
|
+ }
|
|
|
|
|
|
// f_scan_data_bt_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
|
// f_scan_data_bt_1.setText("扫码");
|
|
|
@@ -616,9 +629,58 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static void scanBarcode() {
|
|
|
if (work_status == 1) {
|
|
|
+ loadAteqProgramTimes();
|
|
|
MesClient.serialPortUtils.start();
|
|
|
return;
|
|
|
}
|
|
|
+ setMenuStatus("请先扫工件码", -1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从 ATEQ 读取当前程序的稳压时长、测试时长并显示到工作面板。
|
|
|
+ * 非 ateq 或读取失败时不阻断主流程。
|
|
|
+ */
|
|
|
+ public static void loadAteqProgramTimes() {
|
|
|
+ try {
|
|
|
+ if (serialPortUtils == null || !serialPortUtils.isOpen) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String deviceType = serialPortUtils.device != null ? serialPortUtils.device.trim() : "";
|
|
|
+ if (deviceType.isEmpty() && configParam != null && configParam.getDevice() != null) {
|
|
|
+ deviceType = configParam.getDevice().trim();
|
|
|
+ }
|
|
|
+ if (!"ateq".equalsIgnoreCase(deviceType)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String programNoStr = "1";
|
|
|
+ if (configParam != null && configParam.getProgramNo() != null && !configParam.getProgramNo().trim().isEmpty()) {
|
|
|
+ programNoStr = configParam.getProgramNo().trim();
|
|
|
+ } else if (programNo != null && programNo.getText() != null && !programNo.getText().trim().isEmpty()) {
|
|
|
+ programNoStr = programNo.getText().trim();
|
|
|
+ }
|
|
|
+ ATEQ.Parameters parameters = ATEQ.getParams(Integer.valueOf(programNoStr));
|
|
|
+ curStabilizeTime = formatSeconds(parameters.stabilizeTime);
|
|
|
+ curTestDuration = formatSeconds(parameters.testTime);
|
|
|
+ if (param3 != null) {
|
|
|
+ param3.setText(curStabilizeTime.isEmpty() ? "" : (curStabilizeTime + " s"));
|
|
|
+ }
|
|
|
+ if (param4 != null) {
|
|
|
+ param4.setText(curTestDuration.isEmpty() ? "" : (curTestDuration + " s"));
|
|
|
+ }
|
|
|
+ log.info("程序时长参数: 稳压时长={}s, 测试时长={}s", curStabilizeTime, curTestDuration);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("读取稳压/测试时长失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String formatSeconds(Double value) {
|
|
|
+ if (value == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ if (Math.abs(value - Math.rint(value)) < 0.0001) {
|
|
|
+ return String.valueOf((int) Math.rint(value));
|
|
|
+ }
|
|
|
+ return String.valueOf(value);
|
|
|
}
|
|
|
|
|
|
public static void scanBarcode2() {
|
|
|
@@ -679,6 +741,7 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
if(checkProductSn(scanBarcode.trim())){
|
|
|
serialPortUtils.changeProgram(); // 切换程序
|
|
|
+ loadAteqProgramTimes();
|
|
|
if(MesClient.mes_enable){
|
|
|
getUser();
|
|
|
// 查询工件质量
|
|
|
@@ -986,29 +1049,29 @@ public class MesClient extends JFrame {
|
|
|
param2.setBounds(597, 210, 150, 40);
|
|
|
indexPanelA.add(param2);
|
|
|
|
|
|
- JLabel lblNewLabel_2 = new JLabel("测电阻电压");
|
|
|
+ JLabel lblNewLabel_2 = new JLabel("稳压时长");
|
|
|
lblNewLabel_2.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
lblNewLabel_2.setBounds(137, 288, 140, 40);
|
|
|
-// indexPanelA.add(lblNewLabel_2);
|
|
|
+ indexPanelA.add(lblNewLabel_2);
|
|
|
|
|
|
param3 = new JTextField();
|
|
|
param3.setEditable(false);
|
|
|
param3.setColumns(10);
|
|
|
param3.setBounds(287, 288, 150, 40);
|
|
|
-// indexPanelA.add(param3);
|
|
|
+ indexPanelA.add(param3);
|
|
|
|
|
|
- JLabel lblNewLabel_1_1 = new JLabel("电阻");
|
|
|
+ JLabel lblNewLabel_1_1 = new JLabel("测试时长");
|
|
|
lblNewLabel_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
lblNewLabel_1_1.setBounds(447, 288, 140, 40);
|
|
|
-// indexPanelA.add(lblNewLabel_1_1);
|
|
|
+ indexPanelA.add(lblNewLabel_1_1);
|
|
|
|
|
|
param4 = new JTextField();
|
|
|
param4.setEditable(false);
|
|
|
param4.setColumns(10);
|
|
|
param4.setBounds(597, 288, 150, 40);
|
|
|
-// indexPanelA.add(param4);
|
|
|
+ indexPanelA.add(param4);
|
|
|
|
|
|
|
|
|
result = new JLabel("等待结果") {
|
|
|
@@ -1217,12 +1280,20 @@ public class MesClient extends JFrame {
|
|
|
// table.getColumnModel().getColumn(3).setCellRenderer(new TableCellRendererButton());
|
|
|
// table.getColumnModel().getColumn(3).setCellEditor(new TableCellEditorButton());
|
|
|
|
|
|
- // 设置第二列的长度为100像素
|
|
|
TableColumn column = table.getColumnModel().getColumn(0);
|
|
|
- column.setPreferredWidth(290);
|
|
|
+ column.setPreferredWidth(220);
|
|
|
|
|
|
column = table.getColumnModel().getColumn(1);
|
|
|
- column.setPreferredWidth(160);
|
|
|
+ column.setPreferredWidth(140);
|
|
|
+
|
|
|
+ if (table.getColumnCount() > 4) {
|
|
|
+ column = table.getColumnModel().getColumn(4);
|
|
|
+ column.setPreferredWidth(90);
|
|
|
+ }
|
|
|
+ if (table.getColumnCount() > 5) {
|
|
|
+ column = table.getColumnModel().getColumn(5);
|
|
|
+ column.setPreferredWidth(90);
|
|
|
+ }
|
|
|
|
|
|
CenterRenderer centerRenderer = new CenterRenderer();
|
|
|
for (int i = 0; i < table.getColumnCount(); i++) {
|
|
|
@@ -1677,7 +1748,7 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
indexPanelTest.add(testSendBtn);
|
|
|
|
|
|
- JLabel testTipLabel = new JLabel("说明:泄漏=先发 10 30 04 00 00,再发 03 22 15 00 02;设备需为 ateq");
|
|
|
+ JLabel testTipLabel = new JLabel("说明:泄漏=先发 10 30 04,再发 03 22 0A 00 02;设备需为 ateq");
|
|
|
testTipLabel.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
testTipLabel.setBounds(80, 280, 700, 30);
|
|
|
indexPanelTest.add(testTipLabel);
|
|
|
@@ -2070,7 +2141,7 @@ public class MesClient extends JFrame {
|
|
|
if (testSendBtn != null) {
|
|
|
testSendBtn.setEnabled(false);
|
|
|
}
|
|
|
- appendTestLog("正在发送: 压力(10 30 04→22 06),泄漏(先 10 30 04 00 00 再 22 15)...");
|
|
|
+ appendTestLog("正在发送: 压力(10 30 04→22 06),泄漏(先 10 30 04 再 22 0A)...");
|
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|