|
|
package com.langtech.plm.project;
|
|
|
|
|
|
import java.awt.BorderLayout;
|
|
|
import java.awt.Color;
|
|
|
import java.awt.FlowLayout;
|
|
|
import java.awt.event.ActionEvent;
|
|
|
import java.awt.event.ActionListener;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.swing.JButton;
|
|
|
import javax.swing.JFrame;
|
|
|
import javax.swing.JLabel;
|
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JTextField;
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
|
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
|
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
import com.teamcenter.rac.kernel.TCComponentMEOP;
|
|
|
import com.teamcenter.rac.kernel.TCComponentMEOPRevision;
|
|
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
import com.teamcenter.rac.util.UIUtilities;
|
|
|
|
|
|
public class CalculateDialog extends JFrame implements ActionListener {
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
private AbstractAIFApplication application;
|
|
|
private TCComponentMEOPRevision meop;
|
|
|
private TCSession session;
|
|
|
|
|
|
TCComponentItemRevision rawMaterialRevision;
|
|
|
|
|
|
//<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD>
|
|
|
//ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>D
|
|
|
private JLabel zjdLabel;
|
|
|
private JTextField zjdTextField;
|
|
|
//ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
private JLabel lkcLabel;
|
|
|
private JTextField lkcTextField;
|
|
|
//<2F>ж<EFBFBD><D0B6>ó<EFBFBD><C3B3><EFBFBD>
|
|
|
private JLabel qdycdLabel;
|
|
|
private JTextField qdycdTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>
|
|
|
private JLabel cdmycdLabel;
|
|
|
private JTextField cdmycdTextField;
|
|
|
//<2F><>ͷ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD>
|
|
|
private JLabel jtycdLabel;
|
|
|
private JTextField jtycdTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
private JLabel kzljsLabel;
|
|
|
private JTextField kzljsTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
private JLabel ggLabel;
|
|
|
private JTextField ggTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƺ<EFBFBD>
|
|
|
private JLabel clphLabel;
|
|
|
private JTextField clphTextField;
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD>
|
|
|
//<2F>ܳ<EFBFBD>
|
|
|
private JLabel zcLabel;
|
|
|
private JTextField zcTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
private JLabel djcdLabel;
|
|
|
private JTextField djcdTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
private JLabel djzlLabel;
|
|
|
private JTextField djzlTextField;
|
|
|
//<2F><><EFBFBD><D7BC>ʱ
|
|
|
private JLabel bzgsLabel;
|
|
|
private JTextField bzgsTextField;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
private JLabel fzgsLabel;
|
|
|
private JTextField fzgsTextField;
|
|
|
|
|
|
//<2F><><EFBFBD>㰴ť
|
|
|
private JButton calculateButton;
|
|
|
//ͬ<><CDAC><EFBFBD><EFBFBD>ť
|
|
|
private JButton syncButton;
|
|
|
//ȡ<><C8A1><EFBFBD><EFBFBD>ť
|
|
|
private JButton celButton;
|
|
|
|
|
|
//<2F>ܶ<EFBFBD>
|
|
|
private String density;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
private String crossSection;
|
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
private String auxiliaryTime;
|
|
|
//<2F>̶<EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
private String fixedTime;
|
|
|
//<2F>и<EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
private String cuttingTime;
|
|
|
|
|
|
|
|
|
public CalculateDialog(AbstractAIFApplication application,TCComponentMEOPRevision meop) throws TCException {
|
|
|
this.application = application;
|
|
|
this.meop = meop;
|
|
|
this.session = (TCSession) application.getSession();
|
|
|
initUI();
|
|
|
getProperties(this.meop);
|
|
|
}
|
|
|
|
|
|
|
|
|
private JPanel getTopPanel() {
|
|
|
JPanel centerPanel = new JPanel(new PropertyLayout());
|
|
|
centerPanel.add("1.1.left.top",this.zjdLabel);
|
|
|
centerPanel.add("1.2.left.top",this.zjdTextField);
|
|
|
centerPanel.add("2.1.left.top",this.lkcLabel);
|
|
|
centerPanel.add("2.2.left.top",this.lkcTextField);
|
|
|
centerPanel.add("3.1.left.top",this.qdycdLabel);
|
|
|
centerPanel.add("3.2.left.top",this.qdycdTextField);
|
|
|
centerPanel.add("4.1.left.top",this.cdmycdLabel);
|
|
|
centerPanel.add("4.2.left.top",this.cdmycdTextField);
|
|
|
centerPanel.add("5.1.left.top",this.jtycdLabel);
|
|
|
centerPanel.add("5.2.left.top",this.jtycdTextField);
|
|
|
centerPanel.add("6.1.left.top",this.kzljsLabel);
|
|
|
centerPanel.add("6.2.left.top",this.kzljsTextField);
|
|
|
centerPanel.add("7.1.left.top",this.ggLabel);
|
|
|
centerPanel.add("7.2.left.top",this.ggTextField);
|
|
|
centerPanel.add("8.1.left.top",this.clphLabel);
|
|
|
centerPanel.add("8.2.left.top",this.clphTextField);
|
|
|
|
|
|
centerPanel.add("1.3.left.top",this.zcLabel);
|
|
|
centerPanel.add("1.4.left.top",this.zcTextField);
|
|
|
centerPanel.add("2.3.left.top",this.djcdLabel);
|
|
|
centerPanel.add("2.4.left.top",this.djcdTextField);
|
|
|
centerPanel.add("3.3.left.top",this.djzlLabel);
|
|
|
centerPanel.add("3.4.left.top",this.djzlTextField);
|
|
|
centerPanel.add("4.3.left.top",this.bzgsLabel);
|
|
|
centerPanel.add("4.4.left.top",this.bzgsTextField);
|
|
|
centerPanel.add("5.3.left.top",this.fzgsLabel);
|
|
|
centerPanel.add("5.4.left.top",this.fzgsTextField);
|
|
|
centerPanel.add("6.3.left.top",this.calculateButton);
|
|
|
|
|
|
return centerPanel;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
|
|
|
*/
|
|
|
private void setPanelProperties() {
|
|
|
this.zjdLabel = new JLabel("ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>D");
|
|
|
this.lkcLabel = new JLabel("ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
this.qdycdLabel = new JLabel("<22>ж<EFBFBD><D0B6>ó<EFBFBD><C3B3><EFBFBD>");
|
|
|
this.cdmycdLabel = new JLabel("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>");
|
|
|
this.jtycdLabel = new JLabel("<22><>ͷ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD>");
|
|
|
this.kzljsLabel = new JLabel("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
this.ggLabel = new JLabel("<22><><EFBFBD><EFBFBD>");
|
|
|
this.clphLabel = new JLabel("<22><><EFBFBD><EFBFBD><EFBFBD>ƺ<EFBFBD>");
|
|
|
this.zcLabel = new JLabel("<22>ܳ<EFBFBD>");
|
|
|
this.djcdLabel = new JLabel("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
this.djzlLabel = new JLabel("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
this.bzgsLabel = new JLabel("<22><><EFBFBD><D7BC>ʱ");
|
|
|
this.fzgsLabel = new JLabel("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ");
|
|
|
|
|
|
this.zjdTextField = new JTextField(32);
|
|
|
this.lkcTextField = new JTextField(32);
|
|
|
this.qdycdTextField = new JTextField(32);
|
|
|
this.cdmycdTextField = new JTextField(32);
|
|
|
this.jtycdTextField = new JTextField(32);
|
|
|
this.kzljsTextField = new JTextField(32);
|
|
|
this.ggTextField = new JTextField(32);
|
|
|
this.ggTextField.setEditable(false);
|
|
|
this.ggTextField.setBackground(new Color(200, 200, 200));
|
|
|
this.clphTextField = new JTextField(32);
|
|
|
this.clphTextField.setEditable(false);
|
|
|
this.ggTextField.setBackground(new Color(200, 200, 200));
|
|
|
this.zcTextField = new JTextField(32);
|
|
|
this.djcdTextField = new JTextField(32);
|
|
|
this.djzlTextField = new JTextField(32);
|
|
|
this.bzgsTextField = new JTextField(32);
|
|
|
this.fzgsTextField = new JTextField(32);
|
|
|
|
|
|
this.calculateButton = new JButton("<22><><EFBFBD><EFBFBD>");
|
|
|
this.syncButton = new JButton("ͬ<><CDAC>");
|
|
|
this.celButton = new JButton("ȡ<><C8A1>");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>ȡ<EFBFBD>ײ<EFBFBD><D7B2><EFBFBD>ť
|
|
|
* @return
|
|
|
*/
|
|
|
private JPanel getButtomPanel() {
|
|
|
JPanel bottomPanel = new JPanel(new FlowLayout(1));
|
|
|
// bottomPanel.add(this.calculateButton);
|
|
|
bottomPanel.add(this.syncButton);
|
|
|
bottomPanel.add(this.celButton);
|
|
|
|
|
|
return bottomPanel;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>ʼ<EFBFBD><CABC>ͼ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>
|
|
|
*/
|
|
|
private void initUI() {
|
|
|
this.setTitle("<22><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EEBCB0>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>");
|
|
|
this.setSize(500, 500);
|
|
|
this.setLayout(new BorderLayout());
|
|
|
|
|
|
setPanelProperties();
|
|
|
|
|
|
JPanel centerPanel = getTopPanel();
|
|
|
|
|
|
JPanel bottomPanel = getButtomPanel();
|
|
|
|
|
|
this.add(centerPanel,BorderLayout.CENTER);
|
|
|
this.add(bottomPanel,BorderLayout.SOUTH);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|
|
this.calculateButton.addActionListener(this);
|
|
|
this.syncButton.addActionListener(this);
|
|
|
this.celButton.addActionListener(this);
|
|
|
|
|
|
//<2F>ŵ<EFBFBD><C5B5><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
|
|
|
UIUtilities.centerToScreen(this);
|
|
|
this.setVisible(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>ȡ<EFBFBD><C8A1>ѡMEOP<4F><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @param meop
|
|
|
* @throws TCException
|
|
|
*/
|
|
|
private void getProperties(TCComponentMEOPRevision meop) throws TCException {
|
|
|
String outlineDiameter = meop.getStringProperty("ly6_outlineDiameter");
|
|
|
String outlineLength = meop.getStringProperty("ly6_outlineLength");
|
|
|
String cuttingLength = meop.getStringProperty("ly6_cuttingLength");
|
|
|
String transverseLength = meop.getStringProperty("ly6_transverseLength");
|
|
|
String colletLength = meop.getStringProperty("ly6_colletLength");
|
|
|
String manufacturingQuantity =meop.getStringProperty("ly6_manufacturableQuantity");
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƺŵ<C6BA><C5B5><EFBFBD><EFBFBD><EFBFBD>bomline<6E>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ã<EFBFBD>
|
|
|
String specifications = null;
|
|
|
String brandNum = null;
|
|
|
// String specifications = meop.getStringProperty("ly6_specifications");
|
|
|
// String brandNum = meop.getStringProperty("ly6_material");
|
|
|
TCComponentItem item = meop.getItem();
|
|
|
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡĬ<C8A1>Ϲ<EFBFBD><CFB9><EFBFBD>
|
|
|
TCComponentBOMWindow view = winType.create(null);
|
|
|
// <20><><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>BOM<4F><4D><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>BOM<4F><4D> args:item<65><6D><EFBFBD><EFBFBD> <20>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD> ...
|
|
|
TCComponentBOMLine topBomLine = view.setWindowTopLine(item, meop, null, null);
|
|
|
topBomLine.lock();
|
|
|
if (topBomLine.hasChildren()) {
|
|
|
System.out.println("dialog<6F><67>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bom<6F><6D><EFBFBD>У<EFBFBD>");
|
|
|
AIFComponentContext[] childrens = topBomLine.getChildren();
|
|
|
int tag = 0;
|
|
|
for (AIFComponentContext children : childrens) {
|
|
|
TCComponentBOMLine bomLine = (TCComponentBOMLine)children.getComponent();
|
|
|
TCComponentItemRevision itemRevision = bomLine.getItemRevision();
|
|
|
String childType = itemRevision.getType();
|
|
|
System.out.println("<22><>ǰͨ<C7B0><CDA8>bomline<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>"+childType);
|
|
|
if (childType.equals("LY6_RawMaterial") || childType.equals("LY6_RawMaterialRevision")) {
|
|
|
System.out.println("<22>ɹ<EFBFBD><C9B9><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
specifications = itemRevision.getStringProperty("ly6_specifications");
|
|
|
brandNum = itemRevision.getStringProperty("ly6_material");
|
|
|
System.out.println("<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+specifications);
|
|
|
System.out.println("<22><>ȡ<EFBFBD><C8A1><EFBFBD>ƺţ<C6BA>"+brandNum);
|
|
|
tag ++;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (tag == 0) {//bomline<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>LY6_RawMaterialRevision<6F>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
MessageBox.post("δ<><CEB4><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>","<22><>ʾ",MessageBox.INFORMATION);
|
|
|
//todo burangjisuan
|
|
|
topBomLine.unlock();
|
|
|
view.close();
|
|
|
//<2F>ر<EFBFBD>
|
|
|
this.setVisible(false);
|
|
|
//<2F>ͷ<EFBFBD>
|
|
|
this.dispose();
|
|
|
return;
|
|
|
}
|
|
|
}else {
|
|
|
MessageBox.post("δ<><CEB4><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>","<22><>ʾ",MessageBox.INFORMATION);
|
|
|
//todo burangjisuan
|
|
|
topBomLine.unlock();
|
|
|
view.close();
|
|
|
//<2F>ر<EFBFBD>
|
|
|
this.setVisible(false);
|
|
|
//<2F>ͷ<EFBFBD>
|
|
|
this.dispose();
|
|
|
return;
|
|
|
}
|
|
|
topBomLine.unlock();
|
|
|
view.close();
|
|
|
|
|
|
this.zjdTextField.setText(outlineDiameter != null ? outlineDiameter : "");
|
|
|
this.lkcTextField.setText(outlineLength != null ? outlineLength : "");
|
|
|
this.qdycdTextField.setText(cuttingLength != null ? cuttingLength : "");
|
|
|
this.cdmycdTextField.setText(transverseLength != null ? transverseLength : "");
|
|
|
this.jtycdTextField.setText(colletLength != null ? colletLength : "");
|
|
|
this.kzljsTextField.setText(manufacturingQuantity != null ? manufacturingQuantity : "");
|
|
|
this.ggTextField.setText(specifications != null ? specifications : "");
|
|
|
this.clphTextField.setText(brandNum != null ? brandNum : "");
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD>
|
|
|
* @return
|
|
|
*/
|
|
|
private String calculateTotalLength() {
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> TextField <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
String lkcText = this.lkcTextField.getText();
|
|
|
String qdycdText = this.qdycdTextField.getText();
|
|
|
String cdmycdText = this.cdmycdTextField.getText();
|
|
|
String kzljsText = this.kzljsTextField.getText();
|
|
|
String jtycdText = this.jtycdTextField.getText();
|
|
|
|
|
|
// <20><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA>ֵ
|
|
|
double lkcValue = Double.parseDouble(lkcText);
|
|
|
double qdycdValue = Double.parseDouble(qdycdText);
|
|
|
double cdmycdValue = Double.parseDouble(cdmycdText);
|
|
|
double kzljsValue = Double.parseDouble(kzljsText);
|
|
|
double jtycdValue = Double.parseDouble(jtycdText);
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
double result = (lkcValue + qdycdValue + cdmycdValue) * kzljsValue + jtycdValue;
|
|
|
System.out.println("ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+lkcValue+"<22>ж<EFBFBD><D0B6>ó<EFBFBD><C3B3>ȣ<EFBFBD>"+qdycdValue+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>ȣ<EFBFBD>"+cdmycdValue+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+kzljsValue+"<22><>ͷ<EFBFBD>ó<EFBFBD><C3B3>ȣ<EFBFBD>"+jtycdValue);
|
|
|
// double cm = result / 10.0;
|
|
|
String formattedCm = String.format("%.2f", result);
|
|
|
return formattedCm;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD>㵥<EFBFBD><E3B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @return
|
|
|
*/
|
|
|
private String calculateSingleLength(){
|
|
|
String zcText = this.zcTextField.getText();
|
|
|
String kzljsText = this.kzljsTextField.getText();
|
|
|
|
|
|
double zcValue = Double.parseDouble(zcText);
|
|
|
double kzljsValue = Double.parseDouble(kzljsText);
|
|
|
if (kzljsValue == 0){
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is 0");
|
|
|
}
|
|
|
double result = zcValue / kzljsValue;
|
|
|
System.out.println("<22>ܳ<EFBFBD><DCB3><EFBFBD>"+zcValue+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+kzljsValue);
|
|
|
// double cm = result / 10.0;
|
|
|
String format = String.format("%.2f", result);
|
|
|
return format;
|
|
|
}
|
|
|
|
|
|
private void downLoadFile(File file) throws Exception {
|
|
|
FileInputStream inputStream = new FileInputStream(file);
|
|
|
// ָ<><D6B8><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>·<EFBFBD><C2B7>
|
|
|
String localFilePath = "C:\\"+file.getName();
|
|
|
|
|
|
try {
|
|
|
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>·<EFBFBD><C2B7>
|
|
|
Path path = Paths.get(localFilePath);
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>뵽<EFBFBD><EBB5BD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
Files.copy(inputStream, path);
|
|
|
|
|
|
System.out.println("<22>ļ<EFBFBD><C4BC>ѳɹ<D1B3><C9B9><EFBFBD><EFBFBD><EFBFBD>: "+localFilePath);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
} finally {
|
|
|
// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Դ
|
|
|
if (inputStream != null) {
|
|
|
try {
|
|
|
inputStream.close();
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>е<EFBFBD>uid<69><64>ȡ<EFBFBD><C8A1><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>EXCEL<45><4C>
|
|
|
* <20><><EFBFBD><EFBFBD>uid<69><64>ȡitem<65><6D><EFBFBD><EFBFBD>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>µ<EFBFBD>
|
|
|
* <20><><EFBFBD>ݡ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡEXCEL<45><4C><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>Ҫ<EFBFBD><D2AA>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ͱ<EFBFBD><EFBFBD><D7BC>ʱ
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private void getDataset(){
|
|
|
System.out.println("getDataset");
|
|
|
TCPreferenceService preferenceService = session.getPreferenceService();
|
|
|
String itemId = preferenceService.getStringValue("LY6_MEOPTypeTime");
|
|
|
|
|
|
InterfaceAIFComponent[] resultComponents;
|
|
|
try {
|
|
|
resultComponents = session.search("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...", new String[] {"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID"}, new String[] {itemId});
|
|
|
|
|
|
InterfaceAIFComponent component = resultComponents[0];
|
|
|
if (component instanceof TCComponentItem){
|
|
|
TCComponentItem item = (TCComponentItem) component;
|
|
|
//<2F><>ȡitem<65><6D><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°汾<C2B0>淶<EFBFBD><E6B7B6>ϵ<EFBFBD>µ<EFBFBD>MSEXCEL<45><4C><EFBFBD>ݼ<EFBFBD>
|
|
|
TCComponentItemRevision[] releasedItemRevisions = item.getReleasedItemRevisions();
|
|
|
int releaseRevNum = releasedItemRevisions.length;
|
|
|
if (releaseRevNum == 0) {
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD>汾");
|
|
|
}
|
|
|
TCComponentItemRevision tcComponentItemRevision = releasedItemRevisions[releaseRevNum - 1];
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>汾<EFBFBD>Ĺ淶<C4B9><E6B7B6>ϵ<EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
TCComponent[] referenceListProperty = tcComponentItemRevision.getReferenceListProperty("IMAN_specification");
|
|
|
if(referenceListProperty.length>0) {
|
|
|
System.out.println("<22>淶<EFBFBD><E6B7B6>ϵ<EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+referenceListProperty.length);
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
TCComponentTcFile[] tcFiles = ((TCComponentDataset)referenceListProperty[0]).getTcFiles();
|
|
|
if (tcFiles.length > 0) {
|
|
|
// System.out.println("<22><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + tcFiles.length);
|
|
|
File file = tcFiles[0].getFmsFile();
|
|
|
// if (file.exists()) {
|
|
|
// System.out.println("<22><>ʼ<EFBFBD><CABC><EFBFBD>أ<EFBFBD>");
|
|
|
// downLoadFile(file);
|
|
|
// }
|
|
|
System.out.println("<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD><C4BC><EFBFBD>"+file.getName());
|
|
|
// <20><><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ݼ<EFBFBD>-excel<65><6C><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䡢<EFBFBD>̶<EFBFBD>ʱ<EFBFBD>䡢<EFBFBD>и<EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
FileInputStream fis = new FileInputStream(file);
|
|
|
Workbook workbook = new HSSFWorkbook(fis);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
//<2F>ӵ<EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
for (int i = 2; i < sheet.getPhysicalNumberOfRows(); i++) {
|
|
|
Row row = sheet.getRow(i);
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ÿ<EFBFBD>еĵ<D0B5>һ<EFBFBD><D2BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>
|
|
|
// double diam = row.getCell(0).getNumericCellValue();
|
|
|
String diam = row.getCell(0).getStringCellValue();
|
|
|
// <20><><EFBFBD>ݹ<EFBFBD><DDB9><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD>е<EFBFBD>ֱ<EFBFBD><D6B1>
|
|
|
if (diam.equals(this.ggTextField.getText())){
|
|
|
// if (diam == Double.parseDouble(this.ggTextField.getText())){
|
|
|
System.out.println("=========<3D><>ֱ<EFBFBD><D6B1>ƥ<EFBFBD><C6A5><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ͱ<EFBFBD><EFBFBD><D7BC>ʱ"+"=========<3D><><EFBFBD><EFBFBD>ǰ<EFBFBD>кţ<D0BA>"+(i+1)+"<22><><EFBFBD><EFBFBD>ǰ<EFBFBD>е<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD>"+diam);
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>11<31>е<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><D7BC>ʱ
|
|
|
this.bzgsTextField.setText(row.getCell(10).getStringCellValue());
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>12<31>е<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
this.fzgsTextField.setText(row.getCell(11).getStringCellValue());
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
workbook.close();
|
|
|
}else {
|
|
|
System.out.println("<22><>ȡ<EFBFBD><C8A1><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD>㸨<EFBFBD><E3B8A8><EFBFBD><EFBFBD>ʱ
|
|
|
* @return
|
|
|
*/
|
|
|
private String calculateAssistTime() {
|
|
|
String result = null;
|
|
|
double kzljsNum = Double.parseDouble(this.kzljsTextField.getText());
|
|
|
if (kzljsNum > 0){
|
|
|
double auxiliaryTimeNum = Double.parseDouble(this.auxiliaryTime);
|
|
|
double fixedTimeNum = Double.parseDouble(this.fixedTime);
|
|
|
|
|
|
double resultNum = Math.round((auxiliaryTimeNum + fixedTimeNum) / kzljsNum / 60 * 100.0) / 100.0;
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺"+auxiliaryTimeNum+"<22><><EFBFBD>̶<EFBFBD>ʱ<EFBFBD>䣺"+fixedTimeNum+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+kzljsNum);
|
|
|
result = String.valueOf(resultNum);
|
|
|
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC>ʱ
|
|
|
* @return
|
|
|
*/
|
|
|
private String calculateStandardTime() {
|
|
|
String result = null;
|
|
|
double kzljsNum = Double.parseDouble(this.kzljsTextField.getText());
|
|
|
if (kzljsNum > 0){
|
|
|
System.out.println("=========><3E><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ʱ<EFBFBD>䣺"+this.cuttingTime);
|
|
|
double cuttingTimeNum = Double.parseDouble(this.cuttingTime);
|
|
|
|
|
|
double resultNum = Math.round((cuttingTimeNum / kzljsNum / 60) * 100.0) / 100.0;
|
|
|
System.out.println("<22>и<EFBFBD>ʱ<EFBFBD>䣺"+cuttingTimeNum+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+kzljsNum);
|
|
|
result = String.valueOf(resultNum);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>ȡ<EFBFBD>ܶȺͽ<C8BA><CDBD><EFBFBD>
|
|
|
* @throws TCException
|
|
|
*/
|
|
|
private void getDensityAndCrossSection() throws TCException {
|
|
|
System.out.println("=========><3E><>ʼ<EFBFBD><CABC>ȡ<EFBFBD>ܶȺͺ<C8BA><CDBA><EFBFBD><EFBFBD>棺getDensityAndCrossSection");
|
|
|
|
|
|
// 1.<2E><>ȡ<EFBFBD><C8A1>ǰѡ<C7B0><D1A1>MEOP<4F><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D>
|
|
|
TCComponentMEOP meopItem = (TCComponentMEOP) meop.getItem();
|
|
|
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) this.session.getTypeComponent("BOMWindow");
|
|
|
TCComponentBOMWindow view = winType.create(null);
|
|
|
TCComponentBOMLine bomLine = view.setWindowTopLine(meopItem, meop, null, null);
|
|
|
// 2.<2E><><EFBFBD><EFBFBD>BOM<4F>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD><EFBFBD>͡<F1A1B1BA><CDA1><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ψһԭ<D2BB><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
|
|
throughBomline(bomLine);
|
|
|
|
|
|
view.close();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰbomline<6E>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>bom<6F><6D>Ӧ<EFBFBD><D3A6>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><F3A3ACB2><EFBFBD>ȡ<EFBFBD><C8A1>Ӧ<EFBFBD><D3A6><EFBFBD>ܶȺͺ<C8BA><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @param topBomLine <20><>ǰBOM<4F><4D>
|
|
|
*/
|
|
|
private void throughBomline(TCComponentBOMLine topBomLine) throws TCException{
|
|
|
// 3.<2E><>ȡԭ<C8A1><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶȺͺ<C8BA><CDBA><EFBFBD><EFBFBD><EFBFBD>
|
|
|
boolean hasChildren = topBomLine.hasChildren();
|
|
|
if (hasChildren) {
|
|
|
AIFComponentContext[] childrens = topBomLine.getChildren();
|
|
|
for (AIFComponentContext children : childrens) {
|
|
|
TCComponentBOMLine bomLine = (TCComponentBOMLine) children.getComponent();
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ǰbom<6F><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD>ǰbom<6F><6D>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
|
|
String propertyValue = bomLine.getProperty("bl_occ_type");
|
|
|
if ("Ͷ<><CDB6>".equals(propertyValue)) {
|
|
|
//ͨ<><CDA8>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ܶȺͺ<C8BA><CDBA><EFBFBD><EFBFBD><EFBFBD>
|
|
|
this.rawMaterialRevision = bomLine.getItemRevision();
|
|
|
String densityString = rawMaterialRevision.getProperty("ly6_density");
|
|
|
String crossSectionString = rawMaterialRevision.getProperty("ly6_crossSection");
|
|
|
System.out.println("==========<3D><><EFBFBD>ɹ<EFBFBD>ȡ<EFBFBD>õ<EFBFBD>ǰԭ<C7B0><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ܶȣ<DCB6>"+densityString+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棺"+crossSectionString);
|
|
|
|
|
|
this.density = densityString != null ? densityString : "";
|
|
|
this.crossSection = crossSectionString != null ? crossSectionString : "";
|
|
|
System.out.println("000");
|
|
|
break;
|
|
|
}
|
|
|
throughBomline(bomLine);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD>㵥<EFBFBD><E3B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @return
|
|
|
* @throws TCException
|
|
|
*/
|
|
|
private String calculateWeight(){
|
|
|
System.out.println("calculateWeight");
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ǰѡ<C7B0>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>bom<6F>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ܶȺͺ<C8BA><CDBA><EFBFBD><EFBFBD><EFBFBD>
|
|
|
try {
|
|
|
getDensityAndCrossSection();
|
|
|
} catch (TCException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶȡ<DCB6><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD>㵥<EFBFBD><E3B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
double crossSectionNum = Double.parseDouble(this.crossSection);
|
|
|
double densityNum = 0;
|
|
|
if (this.density.contentEquals("")) {
|
|
|
densityNum = 0;
|
|
|
}else {
|
|
|
densityNum = Double.parseDouble(this.density);
|
|
|
}
|
|
|
double siglengthNum = Double.parseDouble(this.djcdTextField.getText());
|
|
|
double result = crossSectionNum * densityNum * siglengthNum;
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD>棺"+crossSectionNum+"<22><><EFBFBD>ܶȣ<DCB6>"+densityNum+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>"+siglengthNum);
|
|
|
double kg = result / 10000.0;
|
|
|
String formattedKg = String.format("%.2f", kg);
|
|
|
return formattedKg;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>д<EFBFBD><D0B4><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>Ӧ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
* @throws TCException
|
|
|
*/
|
|
|
private void saveProperty() throws TCException {
|
|
|
try {
|
|
|
meop.setProperty("ly6_specifications", this.ggTextField.getText() == null ? "" : this.ggTextField.getText());
|
|
|
// rawMaterialRevision.setProperty("ly6_specifications", this.ggTextField.getText() == null ? "" : this.ggTextField.getText());
|
|
|
meop.setProperty("ly6_totalLenght", this.zcTextField.getText() == null ? "" : this.zcTextField.getText());
|
|
|
meop.setProperty("ly6_singleLength", this.djcdTextField.getText() == null ? "" : this.djcdTextField.getText());
|
|
|
meop.setProperty("ly6_weight", this.djzlTextField.getText() == null ? "" : this.djzlTextField.getText());
|
|
|
meop.setProperty("ly6_standardTime", this.bzgsTextField.getText() == null ? "" : this.bzgsTextField.getText());
|
|
|
meop.setProperty("ly6_auxiliaryTime", this.fzgsTextField.getText() == null ? "" : this.fzgsTextField.getText());
|
|
|
// rawMaterialRevision.setProperty("ly6_material", this.clphTextField.getText() == null ? "" : this.clphTextField.getText());
|
|
|
meop.setProperty("ly6_brandNum", this.clphTextField.getText() == null ? "" : this.clphTextField.getText());
|
|
|
meop.setProperty("ly6_outlineDiameter", this.zjdTextField.getText() == null ? "" : this.zjdTextField.getText());
|
|
|
meop.setProperty("ly6_outlineLength", this.lkcTextField.getText() == null ? "" : this.lkcTextField.getText());
|
|
|
meop.setProperty("ly6_cuttingLength", this.qdycdTextField.getText() == null ? "" : this.qdycdTextField.getText());
|
|
|
meop.setProperty("ly6_transverseLength", this.cdmycdTextField.getText()== null ? "" : this.cdmycdTextField.getText());
|
|
|
meop.setProperty("ly6_colletLength", this.jtycdTextField.getText() == null ? "" : this.jtycdTextField.getText());
|
|
|
meop.setProperty("ly6_manufacturableQuantity", this.kzljsTextField.getText() == null ? "" : this.kzljsTextField.getText());
|
|
|
}catch (Exception e){
|
|
|
System.out.println(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD>M<EFBFBD><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>
|
|
|
* @throws TCException
|
|
|
*/
|
|
|
private void checkMaterial() throws TCException {
|
|
|
try {
|
|
|
System.out.println("<22><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>M<EFBFBD><4D><EFBFBD><EFBFBD><EFBFBD>µĹ<C2B5><C4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
boolean isGZ=false;
|
|
|
TCComponent[] whereUsed = meop.whereUsed((short) 0);
|
|
|
for (TCComponent tcComponent : whereUsed) {
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-tcComponent
|
|
|
String mepRevisionType = tcComponent.getStringProperty("object_type");
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ѡ<EFBFBD><D1A1><EFBFBD>еĹ<D0B5><C4B9>ն<EFBFBD><D5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
|
|
TCSession session = (TCSession) this.application.getSession();
|
|
|
TCPreferenceService preferenceService = session.getPreferenceService();
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-C8MyPreference,<2C><>ȡ<EFBFBD><C8A1>ѡ<EFBFBD><D1A1>ֵ
|
|
|
String value = preferenceService.getStringValue("LY6_MEPType");
|
|
|
String[] strings = value.split(",");
|
|
|
for (int i = 0; i < whereUsed.length; i++) {
|
|
|
//<2F><><EFBFBD>ն<EFBFBD><D5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD>䣬<EFBFBD><E4A3AC><EFBFBD>У<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>ȶ<EFBFBD>
|
|
|
if (strings[i].equals(mepRevisionType)) {
|
|
|
System.out.println("========><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>ɹ<EFBFBD>");
|
|
|
if (tcComponent instanceof TCComponentItemRevision) {
|
|
|
System.out.println("====><3E><>ȡ<EFBFBD><C8A1><EFBFBD>Ĺ<EFBFBD><C4B9>ն<EFBFBD><D5B6><EFBFBD><EFBFBD><EFBFBD>"+tcComponent.getObjectString());
|
|
|
TCComponentItemRevision mepRevision = (TCComponentItemRevision) tcComponent;
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ն<EFBFBD><D5B6><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:relatedRevision\\relatedItem
|
|
|
TCComponent relatedComponent = mepRevision.getRelatedComponent("IMAN_METarget");
|
|
|
TCComponentItemRevision relatedRevision = (TCComponentItemRevision) relatedComponent;
|
|
|
TCComponentItem relatedItem = relatedRevision.getItem();
|
|
|
|
|
|
//<2F><><EFBFBD>鵱ǰ<E9B5B1><C7B0><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
|
|
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
|
|
TCComponentBOMWindow view = winType.create(null);
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>bomline
|
|
|
TCComponentBOMLine bomLine = view.setWindowTopLine(relatedItem, relatedRevision, null, null);
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bomline<6E><65><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
|
|
if (bomLine.hasChildren()) {
|
|
|
AIFComponentContext[] childrens = bomLine.getChildren();
|
|
|
for(AIFComponentContext children:childrens) {
|
|
|
TCComponentBOMLine childrenBomLine = (TCComponentBOMLine) children.getComponent();
|
|
|
TCComponentItemRevision itemRevision = childrenBomLine.getItemRevision();
|
|
|
String uidTag = itemRevision.getUid();
|
|
|
String materialRevUid = this.rawMaterialRevision.getUid();
|
|
|
if (uidTag.equals(materialRevUid)) {
|
|
|
System.out.println("M<><4D><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><F3A1A4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
//M<><4D><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
|
|
isGZ = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//M<><4D><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>й<EFBFBD><D0B9><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
|
|
if (!isGZ) {
|
|
|
System.out.println("M<><4D><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>й<EFBFBD><D0B9><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ء<EFBFBD><D8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
view.lock();
|
|
|
TCComponentItem materialItem = this.rawMaterialRevision.getItem();
|
|
|
bomLine.add(materialItem,this.rawMaterialRevision,null,false,"");
|
|
|
bomLine.save();
|
|
|
view.unlock();
|
|
|
}
|
|
|
// BOMWindow<6F><77><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رգ<D8B1>
|
|
|
view.close();
|
|
|
}else {
|
|
|
System.out.println("<22>ǰ汾<C7B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>쳣");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
System.out.println(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD>¼<EFBFBD>
|
|
|
*/
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
Object sourceObject = e.getSource();
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㡱<EFBFBD><E3A1B1>ť
|
|
|
if(sourceObject.equals(this.calculateButton)) {
|
|
|
try {
|
|
|
//<2F><><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>
|
|
|
this.zcTextField.setText(calculateTotalLength());
|
|
|
this.djcdTextField.setText(calculateSingleLength());
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
this.djzlTextField.setText(calculateWeight());
|
|
|
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|
|
getDataset();
|
|
|
// this.bzgsTextField.setText(calculateStandardTime());
|
|
|
// this.fzgsTextField.setText(calculateAssistTime());
|
|
|
}catch (Exception e1){
|
|
|
MessageBox.post("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ֶ<EFBFBD>ά<EFBFBD><CEAC>", "<22><>ʾ", MessageBox.ERROR);
|
|
|
e1.printStackTrace();
|
|
|
}
|
|
|
} else if (sourceObject.equals(this.syncButton)) {
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD>д
|
|
|
try {
|
|
|
saveProperty();
|
|
|
//<2F><><EFBFBD><EFBFBD>M<EFBFBD><4D><EFBFBD><EFBFBD>
|
|
|
checkMaterial();
|
|
|
MessageBox.post("ͬ<><CDAC><EFBFBD>ɹ<EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
|
|
|
|
|
|
this.setVisible(false);
|
|
|
this.dispose();
|
|
|
} catch (TCException e1) {
|
|
|
e1.printStackTrace();
|
|
|
}
|
|
|
}else {
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|
|
//<2F>ر<EFBFBD>
|
|
|
this.setVisible(false);
|
|
|
//<2F>ͷ<EFBFBD>
|
|
|
this.dispose();
|
|
|
}
|
|
|
}
|
|
|
}
|