|
|
@@ -99,9 +99,14 @@ public class MesClient extends JFrame {
|
|
|
// };
|
|
|
public static Object[][] rowData = new Object[12][5];
|
|
|
public static JLabel pageLabel;
|
|
|
+ public static JLabel totalCountLabel;
|
|
|
public static int pageNo=1 ; // 当前页
|
|
|
public static int totalPages; // 总页数
|
|
|
public static JTextField textField;//搜索框
|
|
|
+ public static JButton dayShiftButton;
|
|
|
+ public static JButton nightShiftButton;
|
|
|
+ public static Date startTime;
|
|
|
+ public static Date endTime;
|
|
|
|
|
|
public static Integer tjFlag = 0;
|
|
|
|
|
|
@@ -1187,7 +1192,7 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
JPanel panel2 = new JPanel();
|
|
|
// 改用自适应宽度,避免工控机出现横向滚动条
|
|
|
- panel2.setBounds(0, 0, 1000, 50);
|
|
|
+ panel2.setBounds(0, 0, 1000, 100);
|
|
|
// panel2.setLayout(new GridLayout(0, 1, 0, 0));
|
|
|
panel2.setLayout(null);
|
|
|
//记录查询搜索框
|
|
|
@@ -1195,47 +1200,59 @@ public class MesClient extends JFrame {
|
|
|
textField.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
// textField.setEnabled(false);
|
|
|
textField.setForeground(Color.BLACK);
|
|
|
- textField.setBounds(10, 5, 371, 40);
|
|
|
+ textField.setToolTipText("输入工件码");
|
|
|
+ textField.setBounds(70, 5, 190, 40);
|
|
|
panel2.add(textField);
|
|
|
// textField.setColumns(20);
|
|
|
indexPanelC.add(panel2);
|
|
|
|
|
|
+ JLabel snLabel = new JLabel("工件码");
|
|
|
+ snLabel.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
+ snLabel.setBounds(10, 5, 60, 40);
|
|
|
+ panel2.add(snLabel);
|
|
|
+
|
|
|
+ dayShiftButton = new JButton("白班");
|
|
|
+ dayShiftButton.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ dayShiftButton.setBounds(270, 5, 100, 40);
|
|
|
+ dayShiftButton.addActionListener(e -> selectShift(true));
|
|
|
+ panel2.add(dayShiftButton);
|
|
|
+
|
|
|
+ nightShiftButton = new JButton("夜班");
|
|
|
+ nightShiftButton.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ nightShiftButton.setBounds(380, 5, 100, 40);
|
|
|
+ nightShiftButton.addActionListener(e -> selectShift(false));
|
|
|
+ panel2.add(nightShiftButton);
|
|
|
+ selectShift(true, false);
|
|
|
+
|
|
|
JButton btnNewButton = new JButton("搜索");
|
|
|
btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- btnNewButton.setBounds(385, 5, 90, 40);
|
|
|
+ btnNewButton.setBounds(500, 5, 90, 40);
|
|
|
panel2.add(btnNewButton);
|
|
|
// 上一页按钮添加按钮事件监听
|
|
|
btnNewButton.addActionListener(e -> {
|
|
|
+ pageNo = 1;
|
|
|
JdbcUtils.getTestData();
|
|
|
});
|
|
|
JButton resetBtn = new JButton("重置");
|
|
|
resetBtn.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- resetBtn.setBounds(475, 5, 90, 40);
|
|
|
+ resetBtn.setBounds(600, 5, 90, 40);
|
|
|
panel2.add(resetBtn);
|
|
|
// 上一页按钮添加按钮事件监听
|
|
|
resetBtn.addActionListener(e -> {
|
|
|
textField.setText("");
|
|
|
+ selectShift(true, false);
|
|
|
+ pageNo = 1;
|
|
|
JdbcUtils.getTestData();
|
|
|
});
|
|
|
|
|
|
- JButton resetBtn2 = new JButton("导出");
|
|
|
- resetBtn2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- resetBtn2.setBounds(565, 5, 90, 40);
|
|
|
- panel2.add(resetBtn2);
|
|
|
- // 上一页按钮添加按钮事件监听
|
|
|
- resetBtn2.addActionListener(e -> {
|
|
|
- List<QmData> lists = JdbcUtils.getTestDataAll();
|
|
|
- Boolean ret = ExportUtil.export(lists);
|
|
|
- if(ret){
|
|
|
- MesClient.setMenuStatus("导出成功,请在D盘中查看",0);
|
|
|
- }else{
|
|
|
- MesClient.setMenuStatus("导出失败,请重试",-1);
|
|
|
- }
|
|
|
- });
|
|
|
+ totalCountLabel = new JLabel("数量:0");
|
|
|
+ totalCountLabel.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ totalCountLabel.setBounds(10, 55, 160, 40);
|
|
|
+ panel2.add(totalCountLabel);
|
|
|
|
|
|
JButton btnPrevious = new JButton("上一页");
|
|
|
btnPrevious.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- btnPrevious.setBounds(680, 5, 90, 40);
|
|
|
+ btnPrevious.setBounds(680, 55, 90, 40);
|
|
|
panel2.add(btnPrevious);
|
|
|
|
|
|
// 页码显示
|
|
|
@@ -1243,13 +1260,13 @@ public class MesClient extends JFrame {
|
|
|
pageLabel.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
pageLabel.setHorizontalAlignment(SwingConstants.CENTER); // 设置文本居中对齐
|
|
|
pageLabel.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); // 添加灰色边框
|
|
|
- pageLabel.setBounds(775, 5, 90, 40); // 调整位置适配1024屏幕
|
|
|
+ pageLabel.setBounds(775, 55, 90, 40); // 调整位置适配1024屏幕
|
|
|
panel2.add(pageLabel);
|
|
|
|
|
|
// “下一页”按钮
|
|
|
JButton btnNext = new JButton("下一页");
|
|
|
btnNext.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- btnNext.setBounds(870, 5, 90, 40); // 调整位置,总宽度控制在960以内
|
|
|
+ btnNext.setBounds(870, 55, 90, 40); // 调整位置,总宽度控制在960以内
|
|
|
panel2.add(btnNext);
|
|
|
|
|
|
// 分页逻辑变量
|
|
|
@@ -1271,7 +1288,7 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
JPanel panel = new JPanel();
|
|
|
// 改用自适应宽度
|
|
|
- panel.setBounds(0, 49, 1000, 518);
|
|
|
+ panel.setBounds(0, 99, 1000, 468);
|
|
|
panel.setLayout(new GridLayout(0, 1, 0, 0));
|
|
|
indexPanelC.add(panel);
|
|
|
|
|
|
@@ -1353,8 +1370,8 @@ public class MesClient extends JFrame {
|
|
|
@Override
|
|
|
public void componentResized(ComponentEvent e) {
|
|
|
// 同时调整顶部按钮区和表格区的宽度
|
|
|
- panel2.setBounds(0, 0, indexPanelC.getWidth(), 50);
|
|
|
- panel.setBounds(0, 49, indexPanelC.getWidth(), Math.max(0, indexPanelC.getHeight() - 49));
|
|
|
+ panel2.setBounds(0, 0, indexPanelC.getWidth(), 100);
|
|
|
+ panel.setBounds(0, 99, indexPanelC.getWidth(), Math.max(0, indexPanelC.getHeight() - 99));
|
|
|
panel.revalidate();
|
|
|
panel2.revalidate();
|
|
|
}
|
|
|
@@ -2102,6 +2119,45 @@ public class MesClient extends JFrame {
|
|
|
submitNgWithLeakPoints(leakPoints, isManualOverride);
|
|
|
}
|
|
|
|
|
|
+ private static void selectShift(boolean isDayShift) {
|
|
|
+ selectShift(isDayShift, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void selectShift(boolean isDayShift, boolean queryImmediately) {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ if (isDayShift) {
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 8);
|
|
|
+ startTime = calendar.getTime();
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 20);
|
|
|
+ endTime = calendar.getTime();
|
|
|
+ } else {
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 20);
|
|
|
+ calendar.add(Calendar.DATE, -1);
|
|
|
+ startTime = calendar.getTime();
|
|
|
+ calendar.add(Calendar.DATE, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 8);
|
|
|
+ endTime = calendar.getTime();
|
|
|
+ }
|
|
|
+ updateShiftButtonState(isDayShift);
|
|
|
+ if (queryImmediately) {
|
|
|
+ pageNo = 1;
|
|
|
+ JdbcUtils.getTestData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void updateShiftButtonState(boolean isDayShift) {
|
|
|
+ Color selectedColor = new Color(184, 207, 229);
|
|
|
+ if (dayShiftButton != null) {
|
|
|
+ dayShiftButton.setBackground(isDayShift ? selectedColor : null);
|
|
|
+ }
|
|
|
+ if (nightShiftButton != null) {
|
|
|
+ nightShiftButton.setBackground(isDayShift ? null : selectedColor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 提交NG结果,不提交泄露点位。
|
|
|
*/
|