弃用的方法

  public Task creatTaskAndRunTaskqiyongde(String pinbanFangshi){
        return new Task() {
            @Override
            protected Object call() throws Exception {

                try {
                    System.out.println("第一次");
                    String parentFile = getParentFile();
                    //todo
                    updateProgress(0, 100);

                    String message = "";
                    int countS = 0;
                    int countE = 0;
                    if (isSelected()) {
                        for (int i = 0; i < selectedCells.size(); i++) {
                            TablePosition tablePosition = selectedCells.get(i);
                            ObservableList selectedItems = tablePosition.getTableView().getSelectionModel().getSelectedItems();
                            List<RowData> list = new ArrayList<>();
                            for (int j = 0; j < selectedItems.size(); j++) {
                                list.add((RowData) selectedItems.get(j));
                            }
                            for (int j = 0; j < list.size(); j++) {
                                try {
                                    RowData rowData = list.get(j);
                                    System.out.println("--------------------");
                                    Paper paper33 = getPaperByChoiceBox((String)choiceBox.getValue());
                                    System.out.println(rowData+"\n"+pinbanFangshi+"\n"+choiceBox.getValue()+"\n"+paper33);

                                    if (rowData.getState().equals("待处理")) {
                                        File file = new File(rowData.getFile());
                                        util.Storage.pdfReaderMap = new HashMap<Integer, PdfReader>();
                                        String name = file.getName();
                                        name = NameUtilss.removeSuffix(name);
                                        String yaoqiu = NameUtilss.midString(name, "[", "]");
                                        File fileXml = new File(ChatController.class.getClassLoader().getResource("info/info.xml").getPath());
                                        //todo
                                        updateProgress(5, 100);
                                        SAXReader saxReader = new SAXReader();
                                        //读取xml文件 并且返回一个Document 对象
                                        Document document = saxReader.read(fileXml);
                                        //得到xml文件的根节点
                                        Element rootElement = document.getRootElement();
                                        util.Storage.impInfo = new ImpInfo();
                                        //todo
                                        updateProgress(10, 100);
                                        /**
                                         * 打印方式
                                         */
                                        List<String> danMianPrintList = TomXmlUtil.getPrintList(TomXmlUtil.getElement(rootElement, "要求→打印方式→单面打印"));
                                        List<String> shuangMianPrintList = TomXmlUtil.getPrintList(TomXmlUtil.getElement(rootElement, "要求→打印方式→双面打印"));
                                        String makeUp = NameUtilss.getMakeUp(yaoqiu, danMianPrintList, shuangMianPrintList);
                                        System.out.println("makeUp:"+makeUp);
                                        util.Storage.impInfo.setMakeUp(makeUp);

                                        /**
                                         * 材料
                                         */
                                        List<String> materialList = TomXmlUtil.getMaterialList(TomXmlUtil.getElement(rootElement, "要求→材料"));
                                        String material = NameUtilss.getMaterial(yaoqiu, materialList);
                                        util.Storage.impInfo.setMaterial(material);
                                        //todo
                                        updateProgress(15, 100);
                                        /**
                                         * 工艺
                                         */
                                        List<String> technologyList = TomXmlUtil.getMaterialList(TomXmlUtil.getElement(rootElement, "要求→工艺"));
                                        String technology = NameUtilss.getMaterial(yaoqiu, technologyList);
                                        util.Storage.impInfo.setTechnology(technology);

                                        /**
                                         * 后道
                                         */
                                        List<String> lastProcessList = TomXmlUtil.getMaterialList(TomXmlUtil.getElement(rootElement, "要求→后道"));
                                        String lastProcess = NameUtilss.getMaterial(yaoqiu, lastProcessList);
                                        util.Storage.impInfo.setLastProcess(lastProcess);

                                        /**
                                         * 克重
                                         */
                                        int weight = NameUtilss.getWeight(yaoqiu);
                                        util.Storage.impInfo.setWeight(weight);
                                        /**
                                         * 数量
                                         */
                                        int number = NameUtilss.getNumber(yaoqiu);
                                        util.Storage.impInfo.setNumber(number);
                                        //todo
                                        updateProgress(20, 100);
                                        /**
                                         * 纸张与定位与需要添加的文件
                                         */
                                        entry.Paper paper = TomXmlUtil.getPaper(material, lastProcess, rootElement);

                                        TomXmlUtil.setImpInfo(file.toString(), document);
                                        //todo
                                        updateProgress(25, 100);
                                        //间距 1这个值需要后面传进来

                                        String finalName = null;
                                        if (paper != null) {
                                            //获取拼版属性 ImpositionInfo(col=6, row=14, rotate=90, spellNumber=84, impSize=Size(w=314.9995, h=442.99994), singleSize=Size(w=49.99992, h=29.999996))
                                            ImpositionInfo impositionInfo = ImpositionUtil.getImposition(paper, util.Storage.impInfo, "210509001");
                                            //todo
                                            updateProgress(35, 100);
                                            finalName = parentFile + "/" + System.currentTimeMillis() + ".pdf";

                                            ItextUtil.createPdfImposition(paper, impositionInfo, finalName);
//                                        for(int k=1;k<12;){
//                                            //todo
//                                            updateProgress(35+k*5, 100);
//                                        }

                                        } else {
                                            System.out.println("材料未找到");
                                        }


                                        if (file != null && new File(finalName).exists()) {
                                            tableView.getItems().remove(rowData);
                                            countS++;

                                            rowData.setState("√-" + pinbanFangshi);
                                            rowData.setFile(finalName);
                                            tableView2.getItems().add(rowData);
                                        } else {
                                            countE++;
                                        }
                                        updateProgress(100, 100);
                                    }
                                }catch (Exception e3){
                                    e3.printStackTrace();
                                }

                            }
                        }
                        errorMessage(message, countS, countE);
                    }

                } catch (Exception e) {
                    log.error(pinbanFangshi + "拼版报错了");

                }
                System.out.println("22222");
                return true;
            }
        };
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值