|
|
@@ -109,6 +109,10 @@ public class MesClient extends JFrame {
|
|
|
public static Object[] columnNames2 = { "任务名称" };
|
|
|
public static Object[][] rowData2 = {{""},{""},{""}};
|
|
|
|
|
|
+ public static JTable materialTable;
|
|
|
+ public static Object[] materialColumnNames = { "物料名称", "绑定批次", "剩余次数", "操作" };
|
|
|
+ public static Object[][] materialRowData = null;
|
|
|
+
|
|
|
public static Integer tjFlag = 0;
|
|
|
|
|
|
public static String tjFlagText2 = "设备运行中";
|
|
|
@@ -343,6 +347,8 @@ public class MesClient extends JFrame {
|
|
|
// MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
MesClient.setMenuStatus("请扫工件码",0);
|
|
|
|
|
|
+ updateMaterailData();
|
|
|
+
|
|
|
// MesClient.result.setText("等待结果");
|
|
|
// MesClient.result.setForeground(Color.GRAY);
|
|
|
}
|
|
|
@@ -957,6 +963,7 @@ public class MesClient extends JFrame {
|
|
|
toolBar.add(space_4);
|
|
|
|
|
|
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
|
+ tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
|
|
tabbedPane.setMinimumSize(new Dimension(400, 50));
|
|
|
tabbedPane.setFont(new Font("宋体", Font.BOLD, 22));
|
|
|
contentPane.add(tabbedPane);
|
|
|
@@ -2120,4 +2127,115 @@ public class MesClient extends JFrame {
|
|
|
MesClient.setMenuStatus("该类型工件未设置任务",-1);
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ public static void getMaterailData(){
|
|
|
+ try{
|
|
|
+ JSONObject retObj = DataUtil.getBindMaterail();
|
|
|
+ if(retObj == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ List<BindMaterialResp> arrs = retObj.getList("data",BindMaterialResp.class);
|
|
|
+ int i = 0;
|
|
|
+ materialRowData = new Object[arrs.size()][7];
|
|
|
+ for (BindMaterialResp bindMaterialResp:arrs){
|
|
|
+ materialRowData[i][0] = bindMaterialResp.getMaterialTitle();
|
|
|
+ materialRowData[i][1] = bindMaterialResp.getBatchSn();
|
|
|
+ materialRowData[i][2] = bindMaterialResp.getLastTimes();
|
|
|
+ materialRowData[i][3] = "";
|
|
|
+ materialRowData[i][4] = bindMaterialResp.getCraft();
|
|
|
+ materialRowData[i][5] = bindMaterialResp.getMaterialId();
|
|
|
+ materialRowData[i][6] = bindMaterialResp.getType();
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ bindBatchPanel();
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.info(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void updateMaterailData(){
|
|
|
+ try{
|
|
|
+ if(materialRowData == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject retObj = DataUtil.getBindMaterail();
|
|
|
+ if(retObj == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ List<BindMaterialResp> arrs = retObj.getList("data",BindMaterialResp.class);
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ for (BindMaterialResp bindMaterialResp:arrs){
|
|
|
+ materialRowData[i][0] = bindMaterialResp.getMaterialTitle();
|
|
|
+ materialRowData[i][1] = bindMaterialResp.getBatchSn();
|
|
|
+ materialRowData[i][2] = bindMaterialResp.getLastTimes();
|
|
|
+ materialRowData[i][3] = "";
|
|
|
+ materialRowData[i][4] = bindMaterialResp.getCraft();
|
|
|
+ materialRowData[i][5] = bindMaterialResp.getMaterialId();
|
|
|
+ materialRowData[i][6] = bindMaterialResp.getType();
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(materialTable != null){
|
|
|
+ materialTable.repaint();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.info(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void scanBatchSn(BindMaterialResp bindMaterialResp) {
|
|
|
+ String scanBarcodeTitle = "请扫物料:"+bindMaterialResp.getMaterialTitle();
|
|
|
+ String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
|
|
|
+ if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
|
|
|
+
|
|
|
+ JSONObject retObj = DataUtil.saveBindMaterail(scanBarcode,bindMaterialResp.getCraft(),bindMaterialResp.getMaterialId(),bindMaterialResp.getType());
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ MesClient.setMenuStatus("扫物料:"+bindMaterialResp.getMaterialTitle()+"成功",0);
|
|
|
+ updateMaterailData();
|
|
|
+ }else{
|
|
|
+ if(retObj.get("result")==null){
|
|
|
+ MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
+ }else{
|
|
|
+ if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
+ MesClient.setMenuStatus(retObj.getString("message"),-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void bindBatchPanel(){
|
|
|
+ JPanel indexPanelBB = new JPanel();
|
|
|
+ JPanel panel = new JPanel();
|
|
|
+ panel.setBounds(0, 0, 990, 550);
|
|
|
+ indexPanelBB.add(panel);
|
|
|
+
|
|
|
+ panel.setLayout(new GridLayout(0, 1, 0, 0));
|
|
|
+ materialTable = new JTable(materialRowData, materialColumnNames){
|
|
|
+ public boolean isCellEditable(int row, int column) {
|
|
|
+ if(column == 3){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ materialTable.setRowHeight(40);
|
|
|
+ materialTable.setEnabled(true);
|
|
|
+ materialTable.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
+
|
|
|
+ materialTable.getColumnModel().getColumn(3).setCellRenderer(new TableCellRendererButton());
|
|
|
+ materialTable.getColumnModel().getColumn(3).setCellEditor(new TableCellEditorButton());
|
|
|
+
|
|
|
+ JScrollPane scrollPane = new JScrollPane(materialTable);
|
|
|
+ panel.add(scrollPane);
|
|
|
+
|
|
|
+ JScrollPane indexScrollPaneB = new JScrollPane(indexPanelBB);
|
|
|
+ indexPanelBB.setLayout(null);
|
|
|
+ tabbedPane.addTab("绑定物料", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexScrollPaneB, null);
|
|
|
+ }
|
|
|
}
|