|
|
@ -8,10 +8,16 @@ import java.awt.event.ActionListener;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
@ -23,6 +29,7 @@ import javax.swing.JPanel;
|
|
|
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
|
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
@ -63,16 +70,18 @@ import com.teamcenter.rac.util.Registry;
|
|
|
|
public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
|
|
|
|
|
|
|
|
private PropertyTextField text;
|
|
|
|
private PropertyTextField text;
|
|
|
|
|
|
|
|
private PropertyTextField dirtext;
|
|
|
|
private PropertyTextField idtext;
|
|
|
|
private PropertyTextField idtext;
|
|
|
|
private PropertyTextField svppstext;
|
|
|
|
private PropertyTextField svppstext;
|
|
|
|
private PropertyTextField FCCtext;
|
|
|
|
private PropertyTextField FCCtext;
|
|
|
|
private PropertyTextField FCCDEStext;
|
|
|
|
private PropertyTextField FCCDEStext;
|
|
|
|
private PropertyTextField dongtaitext;
|
|
|
|
private PropertyTextField dongtaitext;
|
|
|
|
private PropertyTextField KCDStext;
|
|
|
|
private PropertyTextField KCDStext;
|
|
|
|
|
|
|
|
|
|
|
|
private JButton ok;
|
|
|
|
private JButton ok;
|
|
|
|
private JButton cancel;
|
|
|
|
private JButton cancel;
|
|
|
|
private JButton directory;
|
|
|
|
private JButton directory;
|
|
|
|
|
|
|
|
private JButton directory2;
|
|
|
|
// private Registry registry = Registry.getRegistry(AutoTransToolDialog.class);
|
|
|
|
// private Registry registry = Registry.getRegistry(AutoTransToolDialog.class);
|
|
|
|
private TCSession session;
|
|
|
|
private TCSession session;
|
|
|
|
private InterfaceAIFComponent target;
|
|
|
|
private InterfaceAIFComponent target;
|
|
|
@ -92,6 +101,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
private Map<String,StandardPartBean> StandardPartMap = new HashMap<>();//excel标准件
|
|
|
|
private Map<String,StandardPartBean> StandardPartMap = new HashMap<>();//excel标准件
|
|
|
|
private Map<String,List<SleeveBean>> SleeveMap = new HashMap<>();//excel套筒
|
|
|
|
private Map<String,List<SleeveBean>> SleeveMap = new HashMap<>();//excel套筒
|
|
|
|
private int times = 0;
|
|
|
|
private int times = 0;
|
|
|
|
|
|
|
|
private int row_num = 1;
|
|
|
|
public AutoTransToolDialog(Frame fm,InterfaceAIFComponent target,TCSession session) {
|
|
|
|
public AutoTransToolDialog(Frame fm,InterfaceAIFComponent target,TCSession session) {
|
|
|
|
super(fm);
|
|
|
|
super(fm);
|
|
|
|
this.target = target;
|
|
|
|
this.target = target;
|
|
|
@ -163,6 +173,16 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
directory = new JButton("...");
|
|
|
|
directory = new JButton("...");
|
|
|
|
northPane.add("7.3",directory);
|
|
|
|
northPane.add("7.3",directory);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
northPane.add("8.1.left",new JLabel("导出路径:"));
|
|
|
|
|
|
|
|
dirtext = new PropertyTextField();
|
|
|
|
|
|
|
|
dirtext.setColumns(30);
|
|
|
|
|
|
|
|
dirtext.setRequired(true);
|
|
|
|
|
|
|
|
dirtext.setEnabled(false);
|
|
|
|
|
|
|
|
northPane.add("8.2",dirtext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
directory2 = new JButton("...");
|
|
|
|
|
|
|
|
northPane.add("8.3",directory);
|
|
|
|
|
|
|
|
|
|
|
|
JPanel southpanel = new JPanel(new ButtonLayout());
|
|
|
|
JPanel southpanel = new JPanel(new ButtonLayout());
|
|
|
|
ok = new JButton("确定");
|
|
|
|
ok = new JButton("确定");
|
|
|
|
cancel = new JButton("取消");
|
|
|
|
cancel = new JButton("取消");
|
|
|
@ -178,6 +198,23 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
AutoTransToolDialog.this.dispose();
|
|
|
|
AutoTransToolDialog.this.dispose();
|
|
|
|
}});
|
|
|
|
}});
|
|
|
|
|
|
|
|
directory2.addActionListener(new ActionListener(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
|
|
|
JFileChooser filechooser = new JFileChooser();
|
|
|
|
|
|
|
|
filechooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
|
|
|
|
|
|
// FileNameExtensionFilter filter = new FileNameExtensionFilter(
|
|
|
|
|
|
|
|
// "所有Excel文件(*.xlsx)", new String[] { "xlsx" });
|
|
|
|
|
|
|
|
// filechooser.setFileFilter(filter);
|
|
|
|
|
|
|
|
int r = filechooser.showDialog(null, "选择");
|
|
|
|
|
|
|
|
if (r == 0) {
|
|
|
|
|
|
|
|
dirtext.setText(filechooser.getSelectedFile().getAbsolutePath());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (r == 1) {
|
|
|
|
|
|
|
|
dirtext.setText("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}});
|
|
|
|
directory.addActionListener(new ActionListener(){
|
|
|
|
directory.addActionListener(new ActionListener(){
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -190,14 +227,10 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
int r = filechooser.showDialog(null, "选择");
|
|
|
|
int r = filechooser.showDialog(null, "选择");
|
|
|
|
if (r == 0) {
|
|
|
|
if (r == 0) {
|
|
|
|
text.setText(filechooser.getSelectedFile().getAbsolutePath());
|
|
|
|
text.setText(filechooser.getSelectedFile().getAbsolutePath());
|
|
|
|
if (text.getText() != "")
|
|
|
|
|
|
|
|
ok.setEnabled(true);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
ok.setEnabled(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (r == 1) {
|
|
|
|
else if (r == 1) {
|
|
|
|
text.setText("");
|
|
|
|
text.setText("");
|
|
|
|
ok.setEnabled(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}});
|
|
|
|
}});
|
|
|
|
ok.addActionListener(new ActionListener(){
|
|
|
|
ok.addActionListener(new ActionListener(){
|
|
|
@ -205,14 +238,16 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
String path = text.getText();
|
|
|
|
String path = text.getText();
|
|
|
|
if( path != null && path.length() > 0) {
|
|
|
|
String path2 = dirtext.getText();
|
|
|
|
|
|
|
|
if( path != null && path.length() > 0 && path2 != null && path2.length() > 0) {
|
|
|
|
String idcol = idtext.getText();
|
|
|
|
String idcol = idtext.getText();
|
|
|
|
String svppscol = svppstext.getText();
|
|
|
|
String svppscol = svppstext.getText();
|
|
|
|
String fcccol = FCCtext.getText();
|
|
|
|
String fcccol = FCCtext.getText();
|
|
|
|
String fccdescol = FCCDEStext.getText();
|
|
|
|
String fccdescol = FCCDEStext.getText();
|
|
|
|
String dongtaicol = dongtaitext.getText();
|
|
|
|
String dongtaicol = dongtaitext.getText();
|
|
|
|
String kcdscol = KCDStext.getText();
|
|
|
|
String kcdscol = KCDStext.getText();
|
|
|
|
File excel = new File(path);
|
|
|
|
|
|
|
|
|
|
|
|
final File excel = new File(path);
|
|
|
|
if(!excel.exists()) {
|
|
|
|
if(!excel.exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"文件路径不存在", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"文件路径不存在", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -261,69 +296,89 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) session.stringToComponent(rule_pref[0]);
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) session.stringToComponent(rule_pref[0]);
|
|
|
|
File[] files = dataset.getFiles("excel");
|
|
|
|
File[] files = dataset.getFiles("excel");
|
|
|
|
if(files != null || files.length == 0 || !files[0].exists()) {
|
|
|
|
if(files == null || files.length == 0 || !files[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_rule_excel对应的规则数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_rule_excel对应的规则数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentDataset cust_electric_exceldataset = (TCComponentDataset) session.stringToComponent(cust_electric_excel[0]);
|
|
|
|
TCComponentDataset cust_electric_exceldataset = (TCComponentDataset) session.stringToComponent(cust_electric_excel[0]);
|
|
|
|
File[] cust_electric_excelfiles = cust_electric_exceldataset.getFiles("excel");
|
|
|
|
File[] cust_electric_excelfiles = cust_electric_exceldataset.getFiles("excel");
|
|
|
|
if(cust_electric_excelfiles != null || cust_electric_excelfiles.length == 0 || !cust_electric_excelfiles[0].exists()) {
|
|
|
|
if(cust_electric_excelfiles == null || cust_electric_excelfiles.length == 0 || !cust_electric_excelfiles[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_electric_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_electric_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentDataset cust_battery_exceldataset = (TCComponentDataset) session.stringToComponent(cust_battery_excel[0]);
|
|
|
|
TCComponentDataset cust_battery_exceldataset = (TCComponentDataset) session.stringToComponent(cust_battery_excel[0]);
|
|
|
|
File[] cust_battery_exceldatasetfiles = cust_battery_exceldataset.getFiles("excel");
|
|
|
|
File[] cust_battery_exceldatasetfiles = cust_battery_exceldataset.getFiles("excel");
|
|
|
|
if(cust_battery_exceldatasetfiles != null || cust_battery_exceldatasetfiles.length == 0 || !cust_battery_exceldatasetfiles[0].exists()) {
|
|
|
|
if(cust_battery_exceldatasetfiles == null || cust_battery_exceldatasetfiles.length == 0 || !cust_battery_exceldatasetfiles[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_battery_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_battery_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentDataset cust_pneumatic_exceldataset = (TCComponentDataset) session.stringToComponent(cust_pneumatic_excel[0]);
|
|
|
|
TCComponentDataset cust_pneumatic_exceldataset = (TCComponentDataset) session.stringToComponent(cust_pneumatic_excel[0]);
|
|
|
|
File[] cust_pneumatic_excelfiles = cust_pneumatic_exceldataset.getFiles("excel");
|
|
|
|
File[] cust_pneumatic_excelfiles = cust_pneumatic_exceldataset.getFiles("excel");
|
|
|
|
if(cust_pneumatic_excelfiles != null || cust_pneumatic_excelfiles.length == 0 || !cust_pneumatic_excelfiles[0].exists()) {
|
|
|
|
if(cust_pneumatic_excelfiles == null || cust_pneumatic_excelfiles.length == 0 || !cust_pneumatic_excelfiles[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_pneumatic_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_pneumatic_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentDataset cust_manual_exceldataset = (TCComponentDataset) session.stringToComponent(cust_manual_excel[0]);
|
|
|
|
TCComponentDataset cust_manual_exceldataset = (TCComponentDataset) session.stringToComponent(cust_manual_excel[0]);
|
|
|
|
File[] cust_manual_excelfiles = cust_manual_exceldataset.getFiles("excel");
|
|
|
|
File[] cust_manual_excelfiles = cust_manual_exceldataset.getFiles("excel");
|
|
|
|
if(cust_manual_excelfiles != null || cust_manual_excelfiles.length == 0 || !cust_manual_excelfiles[0].exists()) {
|
|
|
|
if(cust_manual_excelfiles == null || cust_manual_excelfiles.length == 0 || !cust_manual_excelfiles[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_manual_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_manual_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentDataset cust_standardpart_exceldataset = (TCComponentDataset) session.stringToComponent(cust_standardpart_excel[0]);
|
|
|
|
TCComponentDataset cust_standardpart_exceldataset = (TCComponentDataset) session.stringToComponent(cust_standardpart_excel[0]);
|
|
|
|
File[] cust_standardpart_excelfiles = cust_standardpart_exceldataset.getFiles("excel");
|
|
|
|
File[] cust_standardpart_excelfiles = cust_standardpart_exceldataset.getFiles("excel");
|
|
|
|
if(cust_standardpart_excelfiles != null || cust_standardpart_excelfiles.length == 0 || !cust_standardpart_excelfiles[0].exists()) {
|
|
|
|
if(cust_standardpart_excelfiles == null || cust_standardpart_excelfiles.length == 0 || !cust_standardpart_excelfiles[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_standardpart_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_standardpart_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentDataset cust_sleeve_exceldataset = (TCComponentDataset) session.stringToComponent(cust_sleeve_excel[0]);
|
|
|
|
TCComponentDataset cust_sleeve_exceldataset = (TCComponentDataset) session.stringToComponent(cust_sleeve_excel[0]);
|
|
|
|
File[] cust_sleeve_excelfiles = cust_sleeve_exceldataset.getFiles("excel");
|
|
|
|
File[] cust_sleeve_excelfiles = cust_sleeve_exceldataset.getFiles("excel");
|
|
|
|
if(cust_sleeve_excelfiles != null || cust_sleeve_excelfiles.length == 0 || !cust_sleeve_excelfiles[0].exists()) {
|
|
|
|
if(cust_sleeve_excelfiles == null || cust_sleeve_excelfiles.length == 0 || !cust_sleeve_excelfiles[0].exists()) {
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_sleeve_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post(AutoTransToolDialog.this,"请检查自定义首选项cust_sleeve_excel对应的数据集中的文件", "Message", MessageBox.INFORMATION);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
File excelfile = files[0];
|
|
|
|
final File excelfile = files[0];
|
|
|
|
File electricfile = cust_electric_excelfiles[0];
|
|
|
|
final File electricfile = cust_electric_excelfiles[0];
|
|
|
|
File batteryfile = cust_battery_exceldatasetfiles[0];
|
|
|
|
final File batteryfile = cust_battery_exceldatasetfiles[0];
|
|
|
|
File pneumaticfile = cust_pneumatic_excelfiles[0];
|
|
|
|
final File pneumaticfile = cust_pneumatic_excelfiles[0];
|
|
|
|
File manualfile = cust_manual_excelfiles[0];
|
|
|
|
final File manualfile = cust_manual_excelfiles[0];
|
|
|
|
File standardpartfile = cust_standardpart_excelfiles[0];
|
|
|
|
final File standardpartfile = cust_standardpart_excelfiles[0];
|
|
|
|
File sleevefile = cust_sleeve_excelfiles[0];
|
|
|
|
final File sleevefile = cust_sleeve_excelfiles[0];
|
|
|
|
if(isValidExcelColumn(idcol) && isValidExcelColumn(svppscol) && isValidExcelColumn(fcccol)
|
|
|
|
if(isValidExcelColumn(idcol) && isValidExcelColumn(svppscol) && isValidExcelColumn(fcccol)
|
|
|
|
&& isValidExcelColumn(fccdescol) && isValidExcelColumn(dongtaicol) && isValidExcelColumn(kcdscol)) {
|
|
|
|
&& isValidExcelColumn(fccdescol) && isValidExcelColumn(dongtaicol) && isValidExcelColumn(kcdscol)) {
|
|
|
|
op_nodesignmap.clear();
|
|
|
|
op_nodesignmap.clear();
|
|
|
|
no_load.clear();
|
|
|
|
no_load.clear();
|
|
|
|
DesignPartBeanMap.clear();
|
|
|
|
DesignPartBeanMap.clear();
|
|
|
|
int idcol2 = columnToNumber(idcol.toUpperCase());
|
|
|
|
final int idcol2 = columnToNumber(idcol.toUpperCase());
|
|
|
|
int svppscol2 = columnToNumber(svppscol.toUpperCase());
|
|
|
|
final int svppscol2 = columnToNumber(svppscol.toUpperCase());
|
|
|
|
int fcccol2 = columnToNumber(fcccol.toUpperCase());
|
|
|
|
final int fcccol2 = columnToNumber(fcccol.toUpperCase());
|
|
|
|
int fccdescol2 = columnToNumber(fccdescol.toUpperCase());
|
|
|
|
final int fccdescol2 = columnToNumber(fccdescol.toUpperCase());
|
|
|
|
int dongtaicol2 = columnToNumber(dongtaicol.toUpperCase());
|
|
|
|
final int dongtaicol2 = columnToNumber(dongtaicol.toUpperCase());
|
|
|
|
int kcdscol2 = columnToNumber(kcdscol.toUpperCase());
|
|
|
|
final int kcdscol2 = columnToNumber(kcdscol.toUpperCase());
|
|
|
|
Thread thread = new Thread(){
|
|
|
|
Thread thread = new Thread(){
|
|
|
|
public void run(){
|
|
|
|
public void run(){
|
|
|
|
ProgressCustomDialog.lbStatus.setText("正在创建 ....");
|
|
|
|
ProgressCustomDialog.lbStatus.setText("正在创建 ....");
|
|
|
|
|
|
|
|
Workbook workbook = null;
|
|
|
|
|
|
|
|
FileOutputStream outputStream = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd HHmmssSSS");
|
|
|
|
|
|
|
|
String time = fm.format(new Date());
|
|
|
|
|
|
|
|
outputStream = new FileOutputStream(path2+"/匹配工具表导出"+time+".xlsx");
|
|
|
|
|
|
|
|
workbook = new XSSFWorkbook();
|
|
|
|
|
|
|
|
Sheet sheet = workbook.createSheet("Data");
|
|
|
|
|
|
|
|
// 创建表头
|
|
|
|
|
|
|
|
Row headerRow = sheet.createRow(0);
|
|
|
|
|
|
|
|
headerRow.createCell(0).setCellValue("工序信息");
|
|
|
|
|
|
|
|
headerRow.createCell(1).setCellValue("紧固件号");
|
|
|
|
|
|
|
|
headerRow.createCell(2).setCellValue("SVPPS");
|
|
|
|
|
|
|
|
headerRow.createCell(3).setCellValue("FCC");
|
|
|
|
|
|
|
|
headerRow.createCell(4).setCellValue("动态扭矩");
|
|
|
|
|
|
|
|
headerRow.createCell(5).setCellValue("KCDS");
|
|
|
|
|
|
|
|
headerRow.createCell(6).setCellValue("头部形式");
|
|
|
|
|
|
|
|
headerRow.createCell(7).setCellValue("头部尺寸");
|
|
|
|
|
|
|
|
headerRow.createCell(8).setCellValue("工具组合");
|
|
|
|
|
|
|
|
headerRow.createCell(9).setCellValue("工具");
|
|
|
|
|
|
|
|
headerRow.createCell(10).setCellValue("工具套筒");
|
|
|
|
//读取自定义的表
|
|
|
|
//读取自定义的表
|
|
|
|
if(times == 0) {
|
|
|
|
if(times == 0) {
|
|
|
|
readRuleExcel(excelfile);
|
|
|
|
readRuleExcel(excelfile);
|
|
|
@ -335,13 +390,13 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
readsleevefile(sleevefile,1);
|
|
|
|
readsleevefile(sleevefile,1);
|
|
|
|
times = 1;
|
|
|
|
times = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
row_num = 1;
|
|
|
|
//读取EXCEL
|
|
|
|
//读取EXCEL
|
|
|
|
readExcel(excel,2,idcol2,svppscol2,fcccol2,fccdescol2,dongtaicol2,kcdscol2);
|
|
|
|
readExcel(excel,2,idcol2,svppscol2,fcccol2,fccdescol2,dongtaicol2,kcdscol2);
|
|
|
|
//先处理选中对象层级有design的工序,获取没有design的工序
|
|
|
|
//先处理选中对象层级有design的工序,获取没有design的工序
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
opBOMLineData(target);
|
|
|
|
opBOMLineData(target,sheet);
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
TCComponentBOMLine parent = null;
|
|
|
|
TCComponentBOMLine parent = null;
|
|
|
|
|
|
|
|
|
|
|
@ -365,10 +420,20 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(parent != null) {
|
|
|
|
if(parent != null) {
|
|
|
|
System.out.println(parent.getClass()+parent.getProperty("bl_indented_title"));
|
|
|
|
System.out.println(parent.getClass()+parent.getProperty("bl_indented_title"));
|
|
|
|
getparent(parent);
|
|
|
|
getparent(parent,sheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
System.out.println("整个结构没有匹配的紧固件");
|
|
|
|
System.out.println("整个结构没有匹配的紧固件");
|
|
|
|
|
|
|
|
for(String key:op_nodesignmap.keySet()) {
|
|
|
|
|
|
|
|
TCComponentMfgBvrOperation op = op_nodesignmap.get(key);
|
|
|
|
|
|
|
|
String bl_indented_title = op.getProperty("bl_indented_title");
|
|
|
|
|
|
|
|
Row row = sheet.createRow(row_num);
|
|
|
|
|
|
|
|
row_num ++;
|
|
|
|
|
|
|
|
Cell optitle_cell = row.createCell(0);
|
|
|
|
|
|
|
|
optitle_cell.setCellValue(bl_indented_title);
|
|
|
|
|
|
|
|
Cell des_cell = row.createCell(1);
|
|
|
|
|
|
|
|
des_cell.setCellValue("无紧固件");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -376,6 +441,17 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
e1.printStackTrace();
|
|
|
|
e1.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
finally {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
workbook.write(outputStream);
|
|
|
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
|
|
|
if(outputStream != null)outputStream.close();
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -416,7 +492,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
return column != null && column.toUpperCase().matches("[A-Z]+");
|
|
|
|
return column != null && column.toUpperCase().matches("[A-Z]+");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//先处理选中对象层级有design的工序
|
|
|
|
//先处理选中对象层级有design的工序
|
|
|
|
private void opBOMLineData(InterfaceAIFComponent parent) throws Exception {
|
|
|
|
private void opBOMLineData(InterfaceAIFComponent parent,Sheet sheet) throws Exception {
|
|
|
|
AIFComponentContext[] children = parent.getChildren();
|
|
|
|
AIFComponentContext[] children = parent.getChildren();
|
|
|
|
for(AIFComponentContext child:children) {
|
|
|
|
for(AIFComponentContext child:children) {
|
|
|
|
InterfaceAIFComponent childcom = child.getComponent();
|
|
|
|
InterfaceAIFComponent childcom = child.getComponent();
|
|
|
@ -424,15 +500,17 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
|
|
|
|
|
|
|
|
TCComponentMfgBvrOperation op = (TCComponentMfgBvrOperation) childcom;
|
|
|
|
TCComponentMfgBvrOperation op = (TCComponentMfgBvrOperation) childcom;
|
|
|
|
String bl_rev_object_name = op.getProperty("bl_rev_object_name");
|
|
|
|
String bl_rev_object_name = op.getProperty("bl_rev_object_name");
|
|
|
|
|
|
|
|
|
|
|
|
if(bl_rev_object_name.contains("预紧") || bl_rev_object_name.contains("终紧")
|
|
|
|
if(bl_rev_object_name.contains("预紧") || bl_rev_object_name.contains("终紧")
|
|
|
|
|| bl_rev_object_name.contains("紧固")|| bl_rev_object_name.contains("拧紧")
|
|
|
|
|| bl_rev_object_name.contains("紧固")|| bl_rev_object_name.contains("拧紧")
|
|
|
|
|| bl_rev_object_name.contains("接地")|| bl_rev_object_name.contains("搭铁")) {
|
|
|
|
|| bl_rev_object_name.contains("接地")|| bl_rev_object_name.contains("搭铁")) {
|
|
|
|
|
|
|
|
String bl_indented_title = op.getProperty("bl_indented_title");
|
|
|
|
AIFComponentContext[] design_children = op.getChildren();
|
|
|
|
AIFComponentContext[] design_children = op.getChildren();
|
|
|
|
boolean hasdesign = false;
|
|
|
|
boolean hasdesign = false;
|
|
|
|
for(AIFComponentContext designchild:design_children) {
|
|
|
|
for(AIFComponentContext designchild:design_children) {
|
|
|
|
InterfaceAIFComponent designchildcom = designchild.getComponent();
|
|
|
|
InterfaceAIFComponent designchildcom = designchild.getComponent();
|
|
|
|
if(designchildcom instanceof TCComponentMfgBvrPart) {
|
|
|
|
String bl_item_object_type = op.getProperty("bl_item_object_type");
|
|
|
|
|
|
|
|
if("Design Part".equalsIgnoreCase(bl_item_object_type)) {
|
|
|
|
hasdesign = true;
|
|
|
|
hasdesign = true;
|
|
|
|
//获取符合的数据
|
|
|
|
//获取符合的数据
|
|
|
|
Map<String,List<ToolBean>> Tool = new HashMap<>();
|
|
|
|
Map<String,List<ToolBean>> Tool = new HashMap<>();
|
|
|
@ -442,6 +520,13 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
.replaceAll("终紧", "")
|
|
|
|
.replaceAll("终紧", "")
|
|
|
|
.replaceAll("紧固", "")
|
|
|
|
.replaceAll("紧固", "")
|
|
|
|
.replaceAll("拧紧", "");
|
|
|
|
.replaceAll("拧紧", "");
|
|
|
|
|
|
|
|
Row row = sheet.createRow(row_num);
|
|
|
|
|
|
|
|
row_num ++;
|
|
|
|
|
|
|
|
Cell optitle_cell = row.createCell(0);
|
|
|
|
|
|
|
|
optitle_cell.setCellValue(bl_indented_title);
|
|
|
|
|
|
|
|
Cell designid_cell = row.createCell(1);
|
|
|
|
|
|
|
|
designid_cell.setCellValue(designid);
|
|
|
|
|
|
|
|
|
|
|
|
String key = designid+"|"+newname;
|
|
|
|
String key = designid+"|"+newname;
|
|
|
|
System.out.println("看design是否匹配:"+key);
|
|
|
|
System.out.println("看design是否匹配:"+key);
|
|
|
|
if(DesignPartBeanMap.containsKey(key)) {
|
|
|
|
if(DesignPartBeanMap.containsKey(key)) {
|
|
|
@ -457,7 +542,14 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cell svpps_cell = row.createCell(2);
|
|
|
|
|
|
|
|
svpps_cell.setCellValue(bean.getSVPPS());
|
|
|
|
|
|
|
|
Cell fcc_cell = row.createCell(3);
|
|
|
|
|
|
|
|
fcc_cell.setCellValue(bean.getFCC());
|
|
|
|
|
|
|
|
Cell dongtai_cell = row.createCell(4);
|
|
|
|
|
|
|
|
dongtai_cell.setCellValue(bean.getDongtai());
|
|
|
|
|
|
|
|
Cell kcds_cell = row.createCell(5);
|
|
|
|
|
|
|
|
kcds_cell.setCellValue(bean.getKCDS());
|
|
|
|
//优先执行特殊工艺规则和电动工具新型号规则,若无匹配全量跑后续规则
|
|
|
|
//优先执行特殊工艺规则和电动工具新型号规则,若无匹配全量跑后续规则
|
|
|
|
boolean processrule = false;
|
|
|
|
boolean processrule = false;
|
|
|
|
for(int i = 0; i< processrules.size(); i++) {
|
|
|
|
for(int i = 0; i< processrules.size(); i++) {
|
|
|
@ -621,9 +713,11 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!autotoolrule) {
|
|
|
|
if(!autotoolrule) {
|
|
|
|
//看读取哪个表
|
|
|
|
|
|
|
|
Map<String,Integer> excelname = new HashMap<>();
|
|
|
|
Map<String,String> resourcename = new HashMap<>();
|
|
|
|
//拧紧性质规则
|
|
|
|
//拧紧性质规则
|
|
|
|
|
|
|
|
//看读取哪个表
|
|
|
|
|
|
|
|
Map<String,Integer> Tightenexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< Tightenrules.size(); i++) {
|
|
|
|
for(int i = 0; i< Tightenrules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = Tightenrules.get(i);
|
|
|
|
CustRuleBean rulebean = Tightenrules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -670,19 +764,21 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(Tightenexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
//
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
Tightenexcelname.put(re, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//KCDS
|
|
|
|
//KCDS
|
|
|
|
|
|
|
|
//看读取哪个表
|
|
|
|
|
|
|
|
Map<String,Integer> KCDSexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< KCDSrules.size(); i++) {
|
|
|
|
for(int i = 0; i< KCDSrules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = KCDSrules.get(i);
|
|
|
|
CustRuleBean rulebean = KCDSrules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -711,19 +807,19 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(KCDSexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
KCDSexcelname.put(re, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//拧紧方式
|
|
|
|
//拧紧方式
|
|
|
|
|
|
|
|
Map<String,Integer> TightenMethodexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< TightenMethodrules.size(); i++) {
|
|
|
|
for(int i = 0; i< TightenMethodrules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = TightenMethodrules.get(i);
|
|
|
|
CustRuleBean rulebean = TightenMethodrules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -769,20 +865,19 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(TightenMethodexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
TightenMethodexcelname.put(re, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//扭矩值
|
|
|
|
//扭矩值
|
|
|
|
|
|
|
|
Map<String,Integer> Torqueexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< Torquerules.size(); i++) {
|
|
|
|
for(int i = 0; i< Torquerules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = Torquerules.get(i);
|
|
|
|
CustRuleBean rulebean = Torquerules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -829,27 +924,47 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(Torqueexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
}
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
else {
|
|
|
|
|
|
|
|
Torqueexcelname.put(re, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(resourceName != null && resourceName.length() > 0) {
|
|
|
|
|
|
|
|
String[] res = resourceName.split("\\|", -1);
|
|
|
|
|
|
|
|
for(String re:res) {
|
|
|
|
|
|
|
|
if(resourcename.containsKey(re)) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
resourcename.put(re, re);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 将所有 Map 放入一个列表
|
|
|
|
|
|
|
|
// List<Map<String, Integer>> maps = Arrays.asList(Tightenexcelname, KCDSexcelname, TightenMethodexcelname, Torqueexcelname);
|
|
|
|
|
|
|
|
Set<String> commonKeys = new HashSet<>(Tightenexcelname.keySet());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保留 map2、map3、map4 中也有的键
|
|
|
|
|
|
|
|
commonKeys.retainAll(KCDSexcelname.keySet());
|
|
|
|
|
|
|
|
commonKeys.retainAll(TightenMethodexcelname.keySet());
|
|
|
|
|
|
|
|
commonKeys.retainAll(Torqueexcelname.keySet());
|
|
|
|
|
|
|
|
|
|
|
|
//读取工具excel数据
|
|
|
|
//读取工具excel数据
|
|
|
|
for(String name:excelname.keySet()) {
|
|
|
|
for(String name:commonKeys) {
|
|
|
|
if("电动工具".equals(name)){
|
|
|
|
if("电动工具".equals(name)){
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
range = range.replace("|", "-");
|
|
|
|
range = range.replace("|", "-");
|
|
|
@ -877,12 +992,20 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).add(toolbean);
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).add(toolbean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if("手动工具".equals(name)){
|
|
|
|
else if("手动工具".equals(name)){
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).addAll(toolbeans);
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).add(toolbean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).addAll(toolbeans);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if("气动工具".equals(name)){
|
|
|
|
else if("气动工具".equals(name)){
|
|
|
@ -891,6 +1014,8 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
range = range.replace("|", "-");
|
|
|
|
range = range.replace("|", "-");
|
|
|
@ -920,12 +1045,15 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if("电池工具".equals(name)){
|
|
|
|
else if("电池工具".equals(name)){
|
|
|
|
for(String resourceType:batteryTool.keySet()) {
|
|
|
|
for(String resourceType:batteryTool.keySet()) {
|
|
|
|
List<ToolBean> toolbeans = batteryTool.get(resourceType);
|
|
|
|
List<ToolBean> toolbeans = batteryTool.get(resourceType);
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
range = range.replace("|", "-");
|
|
|
|
range = range.replace("|", "-");
|
|
|
@ -957,6 +1085,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
System.out.println("匹配的工具有哪些");
|
|
|
|
System.out.println("匹配的工具有哪些");
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
@ -971,10 +1100,16 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
StandardPartBean stdbean = StandardPartMap.get(designid);
|
|
|
|
StandardPartBean stdbean = StandardPartMap.get(designid);
|
|
|
|
String headform = stdbean.getHeadform();
|
|
|
|
String headform = stdbean.getHeadform();
|
|
|
|
String headsize = stdbean.getHeadsize();
|
|
|
|
String headsize = stdbean.getHeadsize();
|
|
|
|
|
|
|
|
Cell headform_cell = row.createCell(6);
|
|
|
|
|
|
|
|
headform_cell.setCellValue(headform);
|
|
|
|
|
|
|
|
Cell headsize_cell = row.createCell(7);
|
|
|
|
|
|
|
|
headsize_cell.setCellValue(headsize);
|
|
|
|
String key2 = headsize+"|"+headform;
|
|
|
|
String key2 = headsize+"|"+headform;
|
|
|
|
System.out.println("寻找套筒 头部尺寸|头部形式:"+key2);
|
|
|
|
System.out.println("寻找套筒 头部尺寸|头部形式:"+key2);
|
|
|
|
if(SleeveMap.containsKey(key2)) {
|
|
|
|
if(SleeveMap.containsKey(key2)) {
|
|
|
|
System.out.println("找到匹配");
|
|
|
|
System.out.println("找到匹配");
|
|
|
|
|
|
|
|
Cell all_cell = row.createCell(8);
|
|
|
|
|
|
|
|
String all = "";
|
|
|
|
List<SleeveBean> SleeveBeans = SleeveMap.get(key2);
|
|
|
|
List<SleeveBean> SleeveBeans = SleeveMap.get(key2);
|
|
|
|
for(SleeveBean sleevebean:SleeveBeans) {
|
|
|
|
for(SleeveBean sleevebean:SleeveBeans) {
|
|
|
|
String inputsize = sleevebean.getInputSize();
|
|
|
|
String inputsize = sleevebean.getInputSize();
|
|
|
@ -983,19 +1118,35 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
//后续工具与套筒匹配
|
|
|
|
//后续工具与套筒匹配
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
|
|
|
|
|
// Cell toolresourceType_cell = row.createCell(8);
|
|
|
|
|
|
|
|
// toolresourceType_cell.setCellValue(resourcetype);
|
|
|
|
|
|
|
|
boolean has = false;
|
|
|
|
for(ToolBean toolbean:toolsbean) {
|
|
|
|
for(ToolBean toolbean:toolsbean) {
|
|
|
|
String outsize = toolbean.getOutSize();
|
|
|
|
String outsize = toolbean.getOutSize();
|
|
|
|
if(outsize != null && outsize.length() > 0 && inputsize != null && inputsize.length() > 0) {
|
|
|
|
if(outsize != null && outsize.length() > 0 && inputsize != null && inputsize.length() > 0) {
|
|
|
|
if(outsize.equals(inputsize)) {
|
|
|
|
if(outsize.equals(inputsize)) {
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
|
|
|
|
has = true;
|
|
|
|
|
|
|
|
all = all+resourcetype+"-"+resourceType;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((outsize == null || outsize.length() == 0) && (inputsize == null || inputsize.length() == 0)){
|
|
|
|
else if((outsize == null || outsize.length() == 0) && (inputsize == null || inputsize.length() == 0)){
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all = all+resourcetype+"-"+resourceType;
|
|
|
|
|
|
|
|
has = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(has) {
|
|
|
|
|
|
|
|
// Cell resourceType_cell = row.createCell(9);
|
|
|
|
|
|
|
|
// resourceType_cell.setCellValue(resourceType);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
all_cell.setCellValue(all);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
System.out.println("没有找到匹配");
|
|
|
|
System.out.println("没有找到匹配");
|
|
|
@ -1003,6 +1154,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
System.out.println("未找到匹配的");
|
|
|
|
System.out.println("未找到匹配的");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1020,7 +1172,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(childcom instanceof TCComponentMfgBvrProcessStation || childcom instanceof TCComponentMfgBvrProcessLine
|
|
|
|
else if(childcom instanceof TCComponentMfgBvrProcessStation || childcom instanceof TCComponentMfgBvrProcessLine
|
|
|
|
|| childcom instanceof TCComponentMfgBvrPlantBOP) {
|
|
|
|
|| childcom instanceof TCComponentMfgBvrPlantBOP) {
|
|
|
|
opBOMLineData(childcom);
|
|
|
|
opBOMLineData(childcom,sheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1029,7 +1181,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* no_load:已经加载过的数据id下次就不加载了
|
|
|
|
* no_load:已经加载过的数据id下次就不加载了
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
private void getparent(TCComponentBOMLine parent)throws Exception{
|
|
|
|
private void getparent(TCComponentBOMLine parent,Sheet sheet)throws Exception{
|
|
|
|
|
|
|
|
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
String parentid = parent.getProperty("bl_item_item_id");
|
|
|
|
String parentid = parent.getProperty("bl_item_item_id");
|
|
|
@ -1047,6 +1199,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
|
|
|
|
|
|
|
|
TCComponentMfgBvrOperation op = (TCComponentMfgBvrOperation) childcom;
|
|
|
|
TCComponentMfgBvrOperation op = (TCComponentMfgBvrOperation) childcom;
|
|
|
|
final String bl_rev_object_name = op.getProperty("bl_rev_object_name");
|
|
|
|
final String bl_rev_object_name = op.getProperty("bl_rev_object_name");
|
|
|
|
|
|
|
|
String bl_indented_title = op.getProperty("bl_indented_title");
|
|
|
|
Set<String> keys = op_nodesignmap.keySet();
|
|
|
|
Set<String> keys = op_nodesignmap.keySet();
|
|
|
|
boolean found = false;
|
|
|
|
boolean found = false;
|
|
|
|
String haskey = "";
|
|
|
|
String haskey = "";
|
|
|
@ -1062,9 +1215,9 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
boolean hasdesign = false;
|
|
|
|
boolean hasdesign = false;
|
|
|
|
for(AIFComponentContext designchild:design_children) {
|
|
|
|
for(AIFComponentContext designchild:design_children) {
|
|
|
|
InterfaceAIFComponent designchildcom = designchild.getComponent();
|
|
|
|
InterfaceAIFComponent designchildcom = designchild.getComponent();
|
|
|
|
if(designchildcom instanceof TCComponentMfgBvrPart) {
|
|
|
|
String bl_item_object_type = op.getProperty("bl_item_object_type");
|
|
|
|
|
|
|
|
if("Design Part".equalsIgnoreCase(bl_item_object_type)) {
|
|
|
|
hasdesign = true;
|
|
|
|
hasdesign = true;
|
|
|
|
//获取design
|
|
|
|
|
|
|
|
//获取符合的数据
|
|
|
|
//获取符合的数据
|
|
|
|
Map<String,List<ToolBean>> Tool = new HashMap<>();
|
|
|
|
Map<String,List<ToolBean>> Tool = new HashMap<>();
|
|
|
|
//获取design
|
|
|
|
//获取design
|
|
|
@ -1073,6 +1226,13 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
.replaceAll("终紧", "")
|
|
|
|
.replaceAll("终紧", "")
|
|
|
|
.replaceAll("紧固", "")
|
|
|
|
.replaceAll("紧固", "")
|
|
|
|
.replaceAll("拧紧", "");
|
|
|
|
.replaceAll("拧紧", "");
|
|
|
|
|
|
|
|
Row row = sheet.createRow(row_num);
|
|
|
|
|
|
|
|
row_num ++;
|
|
|
|
|
|
|
|
Cell optitle_cell = row.createCell(0);
|
|
|
|
|
|
|
|
optitle_cell.setCellValue(bl_indented_title);
|
|
|
|
|
|
|
|
Cell designid_cell = row.createCell(1);
|
|
|
|
|
|
|
|
designid_cell.setCellValue(designid);
|
|
|
|
|
|
|
|
|
|
|
|
String key = designid+"|"+newname;
|
|
|
|
String key = designid+"|"+newname;
|
|
|
|
System.out.println("看design是否匹配:"+key);
|
|
|
|
System.out.println("看design是否匹配:"+key);
|
|
|
|
if(DesignPartBeanMap.containsKey(key)) {
|
|
|
|
if(DesignPartBeanMap.containsKey(key)) {
|
|
|
@ -1088,7 +1248,14 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cell svpps_cell = row.createCell(2);
|
|
|
|
|
|
|
|
svpps_cell.setCellValue(bean.getSVPPS());
|
|
|
|
|
|
|
|
Cell fcc_cell = row.createCell(3);
|
|
|
|
|
|
|
|
fcc_cell.setCellValue(bean.getFCC());
|
|
|
|
|
|
|
|
Cell dongtai_cell = row.createCell(4);
|
|
|
|
|
|
|
|
dongtai_cell.setCellValue(bean.getDongtai());
|
|
|
|
|
|
|
|
Cell kcds_cell = row.createCell(5);
|
|
|
|
|
|
|
|
kcds_cell.setCellValue(bean.getKCDS());
|
|
|
|
//优先执行特殊工艺规则和电动工具新型号规则,若无匹配全量跑后续规则
|
|
|
|
//优先执行特殊工艺规则和电动工具新型号规则,若无匹配全量跑后续规则
|
|
|
|
boolean processrule = false;
|
|
|
|
boolean processrule = false;
|
|
|
|
for(int i = 0; i< processrules.size(); i++) {
|
|
|
|
for(int i = 0; i< processrules.size(); i++) {
|
|
|
@ -1252,9 +1419,11 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!autotoolrule) {
|
|
|
|
if(!autotoolrule) {
|
|
|
|
//看读取哪个表
|
|
|
|
|
|
|
|
Map<String,Integer> excelname = new HashMap<>();
|
|
|
|
Map<String,String> resourcename = new HashMap<>();
|
|
|
|
//拧紧性质规则
|
|
|
|
//拧紧性质规则
|
|
|
|
|
|
|
|
//看读取哪个表
|
|
|
|
|
|
|
|
Map<String,Integer> Tightenexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< Tightenrules.size(); i++) {
|
|
|
|
for(int i = 0; i< Tightenrules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = Tightenrules.get(i);
|
|
|
|
CustRuleBean rulebean = Tightenrules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -1301,19 +1470,21 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(Tightenexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
//
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
Tightenexcelname.put(re, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//KCDS
|
|
|
|
//KCDS
|
|
|
|
|
|
|
|
//看读取哪个表
|
|
|
|
|
|
|
|
Map<String,Integer> KCDSexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< KCDSrules.size(); i++) {
|
|
|
|
for(int i = 0; i< KCDSrules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = KCDSrules.get(i);
|
|
|
|
CustRuleBean rulebean = KCDSrules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -1342,19 +1513,19 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(KCDSexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
KCDSexcelname.put(re, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//拧紧方式
|
|
|
|
//拧紧方式
|
|
|
|
|
|
|
|
Map<String,Integer> TightenMethodexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< TightenMethodrules.size(); i++) {
|
|
|
|
for(int i = 0; i< TightenMethodrules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = TightenMethodrules.get(i);
|
|
|
|
CustRuleBean rulebean = TightenMethodrules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -1400,20 +1571,19 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(TightenMethodexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
TightenMethodexcelname.put(re, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//扭矩值
|
|
|
|
//扭矩值
|
|
|
|
|
|
|
|
Map<String,Integer> Torqueexcelname = new HashMap<>();
|
|
|
|
for(int i = 0; i< Torquerules.size(); i++) {
|
|
|
|
for(int i = 0; i< Torquerules.size(); i++) {
|
|
|
|
CustRuleBean rulebean = Torquerules.get(i);
|
|
|
|
CustRuleBean rulebean = Torquerules.get(i);
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
|
String rule_svpps = rulebean.getSVPPS();
|
|
|
@ -1460,27 +1630,47 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
if(resourceType != null && resourceType.length() > 0) {
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
String[] res = resourceType.split("\\|", -1);
|
|
|
|
for(String re:res) {
|
|
|
|
for(String re:res) {
|
|
|
|
if(excelname.containsKey(re)) {
|
|
|
|
if(Torqueexcelname.containsKey(re)) {
|
|
|
|
int count = excelname.get(re);
|
|
|
|
|
|
|
|
excelname.put(re, count+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
excelname.put(re, 1);
|
|
|
|
Torqueexcelname.put(re, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(resourceName != null && resourceName.length() > 0) {
|
|
|
|
|
|
|
|
String[] res = resourceName.split("\\|", -1);
|
|
|
|
|
|
|
|
for(String re:res) {
|
|
|
|
|
|
|
|
if(resourcename.containsKey(re)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
resourcename.put(re, re);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 将所有 Map 放入一个列表
|
|
|
|
|
|
|
|
// List<Map<String, Integer>> maps = Arrays.asList(Tightenexcelname, KCDSexcelname, TightenMethodexcelname, Torqueexcelname);
|
|
|
|
|
|
|
|
Set<String> commonKeys = new HashSet<>(Tightenexcelname.keySet());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保留 map2、map3、map4 中也有的键
|
|
|
|
|
|
|
|
commonKeys.retainAll(KCDSexcelname.keySet());
|
|
|
|
|
|
|
|
commonKeys.retainAll(TightenMethodexcelname.keySet());
|
|
|
|
|
|
|
|
commonKeys.retainAll(Torqueexcelname.keySet());
|
|
|
|
|
|
|
|
|
|
|
|
//读取工具excel数据
|
|
|
|
//读取工具excel数据
|
|
|
|
for(String name:excelname.keySet()) {
|
|
|
|
for(String name:commonKeys) {
|
|
|
|
if("电动工具".equals(name)){
|
|
|
|
if("电动工具".equals(name)){
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
range = range.replace("|", "-");
|
|
|
|
range = range.replace("|", "-");
|
|
|
@ -1508,12 +1698,20 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).add(toolbean);
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).add(toolbean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if("手动工具".equals(name)){
|
|
|
|
else if("手动工具".equals(name)){
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
for(String resourceType:eleTool.keySet()) {
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
List<ToolBean> toolbeans = eleTool.get(resourceType);
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).addAll(toolbeans);
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
|
|
|
|
Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).add(toolbean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tool.computeIfAbsent(resourceType, key2 -> new ArrayList<>()).addAll(toolbeans);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if("气动工具".equals(name)){
|
|
|
|
else if("气动工具".equals(name)){
|
|
|
@ -1522,6 +1720,8 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
range = range.replace("|", "-");
|
|
|
|
range = range.replace("|", "-");
|
|
|
@ -1551,12 +1751,15 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if("电池工具".equals(name)){
|
|
|
|
else if("电池工具".equals(name)){
|
|
|
|
for(String resourceType:batteryTool.keySet()) {
|
|
|
|
for(String resourceType:batteryTool.keySet()) {
|
|
|
|
List<ToolBean> toolbeans = batteryTool.get(resourceType);
|
|
|
|
List<ToolBean> toolbeans = batteryTool.get(resourceType);
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
for(ToolBean toolbean:toolbeans) {
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String range = toolbean.getRange();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
String outSize = toolbean.getOutSize();
|
|
|
|
|
|
|
|
String resourceName = toolbean.getResourceName();
|
|
|
|
|
|
|
|
if(resourcename.containsKey(resourceName)) {
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
boolean isWithinRange = false;
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
if(range!= null && range.length() > 0 && niuju != null && niuju.length() > 0) {
|
|
|
|
range = range.replace("|", "-");
|
|
|
|
range = range.replace("|", "-");
|
|
|
@ -1588,6 +1791,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
System.out.println("匹配的工具有哪些");
|
|
|
|
System.out.println("匹配的工具有哪些");
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
@ -1602,10 +1806,16 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
StandardPartBean stdbean = StandardPartMap.get(designid);
|
|
|
|
StandardPartBean stdbean = StandardPartMap.get(designid);
|
|
|
|
String headform = stdbean.getHeadform();
|
|
|
|
String headform = stdbean.getHeadform();
|
|
|
|
String headsize = stdbean.getHeadsize();
|
|
|
|
String headsize = stdbean.getHeadsize();
|
|
|
|
|
|
|
|
Cell headform_cell = row.createCell(6);
|
|
|
|
|
|
|
|
headform_cell.setCellValue(headform);
|
|
|
|
|
|
|
|
Cell headsize_cell = row.createCell(7);
|
|
|
|
|
|
|
|
headsize_cell.setCellValue(headsize);
|
|
|
|
String key2 = headsize+"|"+headform;
|
|
|
|
String key2 = headsize+"|"+headform;
|
|
|
|
System.out.println("寻找套筒 头部尺寸|头部形式:"+key2);
|
|
|
|
System.out.println("寻找套筒 头部尺寸|头部形式:"+key2);
|
|
|
|
if(SleeveMap.containsKey(key2)) {
|
|
|
|
if(SleeveMap.containsKey(key2)) {
|
|
|
|
System.out.println("找到匹配");
|
|
|
|
System.out.println("找到匹配");
|
|
|
|
|
|
|
|
Cell all_cell = row.createCell(8);
|
|
|
|
|
|
|
|
String all = "";
|
|
|
|
List<SleeveBean> SleeveBeans = SleeveMap.get(key2);
|
|
|
|
List<SleeveBean> SleeveBeans = SleeveMap.get(key2);
|
|
|
|
for(SleeveBean sleevebean:SleeveBeans) {
|
|
|
|
for(SleeveBean sleevebean:SleeveBeans) {
|
|
|
|
String inputsize = sleevebean.getInputSize();
|
|
|
|
String inputsize = sleevebean.getInputSize();
|
|
|
@ -1614,26 +1824,43 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
//后续工具与套筒匹配
|
|
|
|
//后续工具与套筒匹配
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
for(String resourcetype:Tool.keySet()) {
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
|
List<ToolBean> toolsbean = Tool.get(resourcetype);
|
|
|
|
|
|
|
|
// Cell toolresourceType_cell = row.createCell(8);
|
|
|
|
|
|
|
|
// toolresourceType_cell.setCellValue(resourcetype);
|
|
|
|
|
|
|
|
boolean has = false;
|
|
|
|
for(ToolBean toolbean:toolsbean) {
|
|
|
|
for(ToolBean toolbean:toolsbean) {
|
|
|
|
String outsize = toolbean.getOutSize();
|
|
|
|
String outsize = toolbean.getOutSize();
|
|
|
|
if(outsize != null && outsize.length() > 0 && inputsize != null && inputsize.length() > 0) {
|
|
|
|
if(outsize != null && outsize.length() > 0 && inputsize != null && inputsize.length() > 0) {
|
|
|
|
if(outsize.equals(inputsize)) {
|
|
|
|
if(outsize.equals(inputsize)) {
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
|
|
|
|
has = true;
|
|
|
|
|
|
|
|
all = all+resourcetype+"-"+resourceType;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((outsize == null || outsize.length() == 0) && (inputsize == null || inputsize.length() == 0)){
|
|
|
|
else if((outsize == null || outsize.length() == 0) && (inputsize == null || inputsize.length() == 0)){
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all = all+resourcetype+"-"+resourceType;
|
|
|
|
|
|
|
|
has = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(has) {
|
|
|
|
|
|
|
|
// Cell resourceType_cell = row.createCell(9);
|
|
|
|
|
|
|
|
// resourceType_cell.setCellValue(resourceType);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
all_cell.setCellValue(all);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
System.out.println("没有找到匹配");
|
|
|
|
System.out.println("没有找到匹配");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
System.out.println("未找到匹配的");
|
|
|
|
System.out.println("未找到匹配的");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1647,7 +1874,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
else if(childcom instanceof TCComponentMfgBvrProcessStation || childcom instanceof TCComponentMfgBvrProcessLine
|
|
|
|
else if(childcom instanceof TCComponentMfgBvrProcessStation || childcom instanceof TCComponentMfgBvrProcessLine
|
|
|
|
|| childcom instanceof TCComponentMfgBvrPlantBOP) {
|
|
|
|
|| childcom instanceof TCComponentMfgBvrPlantBOP) {
|
|
|
|
|
|
|
|
|
|
|
|
getparent((TCComponentBOMLine)childcom);
|
|
|
|
getparent((TCComponentBOMLine)childcom,sheet);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
@ -1661,7 +1888,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
if(op_nodesignmap.size() > 0) {
|
|
|
|
no_load.put(parentid, parentid);
|
|
|
|
no_load.put(parentid, parentid);
|
|
|
|
if(parent.parent() != null)
|
|
|
|
if(parent.parent() != null)
|
|
|
|
getparent(parent.parent());
|
|
|
|
getparent(parent.parent(),sheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1894,12 +2121,14 @@ public class AutoTransToolDialog extends AbstractAIFDialog {
|
|
|
|
String ResourceType = ExcelUtil.getStringCellValue(row.getCell(1));
|
|
|
|
String ResourceType = ExcelUtil.getStringCellValue(row.getCell(1));
|
|
|
|
String Torque = ExcelUtil.getStringCellValue(row.getCell(6));
|
|
|
|
String Torque = ExcelUtil.getStringCellValue(row.getCell(6));
|
|
|
|
String outSize = ExcelUtil.getStringCellValue(row.getCell(8));
|
|
|
|
String outSize = ExcelUtil.getStringCellValue(row.getCell(8));
|
|
|
|
|
|
|
|
String resourceName = ExcelUtil.getStringCellValue(row.getCell(2));
|
|
|
|
|
|
|
|
|
|
|
|
if(ResourceType != null && ResourceType.length() > 0) {
|
|
|
|
if(ResourceType != null && ResourceType.length() > 0) {
|
|
|
|
// 使用 computeIfAbsent 简化操作
|
|
|
|
// 使用 computeIfAbsent 简化操作
|
|
|
|
ToolBean tool = new ToolBean();
|
|
|
|
ToolBean tool = new ToolBean();
|
|
|
|
tool.setOutSize(outSize);
|
|
|
|
tool.setOutSize(outSize);
|
|
|
|
tool.setRange(Torque);
|
|
|
|
tool.setRange(Torque);
|
|
|
|
|
|
|
|
tool.setResourceName(resourceName);
|
|
|
|
eleTool.computeIfAbsent(ResourceType, key -> new ArrayList<>()).add(tool);
|
|
|
|
eleTool.computeIfAbsent(ResourceType, key -> new ArrayList<>()).add(tool);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|