| | |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.ComplexTable; |
| | | import com.example.client.utils.Compute; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.Dto.StatistReportsDto; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.CacheUtils; |
| | | import com.example.server.utils.UserAndSiteUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3Service djJdgzNetworkLevel3Service; |
| | | @Autowired |
| | | private StatisDismantService statisDismantService; |
| | | @Autowired |
| | | private StatisDismant2Service statisDismant2Service; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | private JTable trackTable; |
| | | private List<ColumnDto> columnDto; |
| | | private DjJdgzNetworkLevel3 nowLevel3; |
| | | private List<DjJdgzDismantTrack> list; |
| | | |
| | | public JPanel createTrack(Integer width, Integer height, DjJdgzNetworkLevel3 djJdgzNetworkLevel3,JFrame frame) { |
| | | nowLevel3 = djJdgzNetworkLevel3; |
| | | JPanel panel = new JPanel(new BorderLayout()); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width - 10, 37)); |
| | | topJpanel.setPreferredSize(new Dimension(width - 10, 40)); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,frame))); |
| | | |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | |
| | | JButton btnTj = new JButton("统计报表"); |
| | | JButton btnTjz = new JButton("拆卸进度统计总表"); |
| | | JButton btnTj = new JButton("拆卸进度详情表"); |
| | | JButton btnExport = new JButton("导出拆卸报表"); |
| | | JButton btnSave = new JButton("保存"); |
| | | JButton btnImport = new JButton("批量导入"); |
| | | |
| | | topJpanel.add(btnTjz); |
| | | topJpanel.add(btnTj); |
| | | topJpanel.add(btnExport); |
| | | topJpanel.add(btnSave); |
| | | topJpanel.add(btnImport); |
| | | |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(djJdgzNetworkLevel3.getId(), null); |
| | | list = djJdgzDismantTrackService.getList(nowLevel3.getId(), null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "编辑")); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] statusList = { |
| | | new JComboBoxItem(0, "进行中"), |
| | | new JComboBoxItem(1, "已完成"), |
| | | new JComboBoxItem(0L, "进行中"), |
| | | new JComboBoxItem(1L, "已完成"), |
| | | }; |
| | | |
| | | // 创建左侧表格 |
| | |
| | | columnDto.add(new ColumnDto("拆卸时间", "dismantTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("拆卸单位", "dismantUnit", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("拆卸人员", "dismantStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("拆卸助修艇员", "dismantAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("拆卸助修T员", "dismantAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("出舱时间", "exitTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("出舱单位", "exitUnit", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("出舱人员", "exitStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("出舱助修艇员", "exitAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("出舱助修T员", "exitAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("退重时间", "returnWeightTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("称重员", "weigher", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("退重重量", "returnWeight", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("退重助修艇员", "returnWeightAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("退重助修T员", "returnWeightAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("入库时间", "warehouseTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("入库人员", "warehouseStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("当前存放位置", "currentLocation", 160, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("状态", "status", 120, "dict", true, null, statusList)); |
| | | columnDto.add(new ColumnDto("状态", "status", 120, "dicts", true, null, statusList)); |
| | | |
| | | trackTable = CommonTable.createCommonTable(list, columnDto); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | |
| | |
| | | "出舱阶段",ComplexTable.mergeCellX,ComplexTable.mergeCellX,ComplexTable.mergeCellX,"退重阶段",ComplexTable.mergeCellX,ComplexTable.mergeCellX,ComplexTable.mergeCellX, |
| | | "入库阶段",ComplexTable.mergeCellX,"当前存放位置"}; |
| | | //此处2-5是不会显示出来的,因为1-4向下合并了一行 + 向右合并了一列 , 而2-5被这个矩形范围包括了 |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, ComplexTable.mergeCellY ,ComplexTable.mergeCellY ,"时间","单位","人员","助修艇员", |
| | | "时间","单位","人员","助修艇员","时间","称重员","重量","助修艇员","时间","人员",ComplexTable.mergeCellY}; |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, ComplexTable.mergeCellY ,ComplexTable.mergeCellY ,"时间","单位","人员","助修T员", |
| | | "时间","单位","人员","助修T员","时间","称重员","重量","助修T员","时间","人员",ComplexTable.mergeCellY}; |
| | | |
| | | String[][] body = CommonTable.getRowData(list,columnDto); |
| | | |
| | | trackTable = new ComplexTable(headerRows,body); |
| | | CommonTable.setColumnType(columnDto, trackTable);*/ |
| | | |
| | | btnTjz.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | frame.setEnabled(false); |
| | | statisDismantService.createTable(frame,nowLevel3.getLevel1NetworkId()); |
| | | } |
| | | }); |
| | | btnTj.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | statisDismantService.createTable(frame,djJdgzNetworkLevel3.getLevel1NetworkId()); |
| | | frame.setEnabled(false); |
| | | statisDismant2Service.createTable(frame,nowLevel3.getLevel1NetworkId()); |
| | | } |
| | | }); |
| | | |
| | | btnExport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | frame.setEnabled(false); |
| | | exportDismantTrackService.openDialog(frame); |
| | | } |
| | | }); |
| | |
| | | btnSave.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | SysUser user = (SysUser) CacheUtils.get("user", "user"); |
| | | if (user.getTeamgroup()==null||user.getTeamgroup().equals(djJdgzNetworkLevel3.getTeamgroupId())){ |
| | | if (trackTable.isEditing()) { |
| | | trackTable.getCellEditor().stopCellEditing(); |
| | | } |
| | | SysUser user = (SysUser) UserAndSiteUtils.get("user", "user"); |
| | | if (user == null) { |
| | | JOptionPane.showMessageDialog(null, "当前用户已失效请重新登录", "提示", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | | if (user.getTeamgroup()==null||user.getTeamgroup().equals(nowLevel3.getTeamgroupId().toString())){ |
| | | CommonTable.saveTableList(list, trackTable, columnDto); |
| | | djJdgzDismantTrackService.save(list); |
| | | JOptionPane.showMessageDialog(null, "保存成功", "提示", JOptionPane.WARNING_MESSAGE); |
| | | }else{ |
| | | JOptionPane.showMessageDialog(null, "不可操作其他专业数据", "提示", JOptionPane.WARNING_MESSAGE); |
| | | JOptionPane.showMessageDialog(null, "当前用户不可操作其他专业数据", "提示", JOptionPane.WARNING_MESSAGE); |
| | | } |
| | | } |
| | | }); |
| | |
| | | btnImport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | importDismantTrackService.FileUpload(djJdgzNetworkLevel3.getId(),frame); |
| | | frame.setEnabled(false); |
| | | importDismantTrackService.FileUpload(nowLevel3.getId(),frame); |
| | | } |
| | | }); |
| | | |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(trackTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(trackTable); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 130)); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(40,frame))); |
| | | centerJpanel.add(scrollPane); |
| | | frame.addComponentListener(new ComponentAdapter() { |
| | | @Override |
| | | public void componentResized(ComponentEvent e) { |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,frame))); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20,Compute.ComputeHeightWithScroll(40,frame))); |
| | | centerJpanel.revalidate(); |
| | | centerJpanel.repaint(); |
| | | scrollPane.revalidate(); |
| | | scrollPane.repaint(); |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | | public void refreshTable(Long level3Id){ |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(level3Id, null); |
| | | nowLevel3 = djJdgzNetworkLevel3Service.get(level3Id); |
| | | list = djJdgzDismantTrackService.getList(level3Id, null); |
| | | CommonTable.refreshTable(list, columnDto, trackTable); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | } |
| | | |