Compare commits

...

2 Commits

Author SHA1 Message Date
郭宇航 14239c9627 commit
4 years ago
郭宇航 8597a52997 commit
4 years ago

1
bin/.gitignore vendored

@ -1,2 +1 @@
/com/ /com/
/syn/

@ -231,6 +231,7 @@
<command name="导出变更单报表" id="com.connor.dfl.plm.dfl040.Dfl038Handler"/> <command name="导出变更单报表" id="com.connor.dfl.plm.dfl040.Dfl038Handler"/>
<command name="创建标准Bom" id="com.connor.dfl.plm.dfl041.Dfl041Handler"/> <command name="创建标准Bom" id="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<command name="ERP队列" id="com.connor.dfl.plm.dfl042.Dfl042Handler"/> <command name="ERP队列" id="com.connor.dfl.plm.dfl042.Dfl042Handler"/>
<command name="自动填写作业编号" id="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
</extension> </extension>
<!--handlers--> <!--handlers-->
<extension point="org.eclipse.ui.handlers"> <extension point="org.eclipse.ui.handlers">
@ -445,6 +446,7 @@
<handler commandId="com.connor.dfl.plm.dfl040.Dfl038Handler" class="com.connor.dfl.plm.dfl040.Dfl038Handler"/> <handler commandId="com.connor.dfl.plm.dfl040.Dfl038Handler" class="com.connor.dfl.plm.dfl040.Dfl038Handler"/>
<handler commandId="com.connor.dfl.plm.dfl041.Dfl041Handler" class="com.connor.dfl.plm.dfl041.Dfl041Handler"/> <handler commandId="com.connor.dfl.plm.dfl041.Dfl041Handler" class="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<handler commandId="com.connor.dfl.plm.dfl042.Dfl042Handler" class="com.connor.dfl.plm.dfl042.Dfl042Handler"/> <handler commandId="com.connor.dfl.plm.dfl042.Dfl042Handler" class="com.connor.dfl.plm.dfl042.Dfl042Handler"/>
<handler commandId="com.connor.dfl.plm.dfl043.Dfl043Handler" class="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
<!-- <!--
<handler commandId="com.connor.dfl.plm.dfl030.Dfl030Handler" class="com.connor.dfl.plm.dfl030.Dfl030Handler"/> <handler commandId="com.connor.dfl.plm.dfl030.Dfl030Handler" class="com.connor.dfl.plm.dfl030.Dfl030Handler"/>
@ -761,6 +763,19 @@
</and> </and>
</visibleWhen> </visibleWhen>
</command> </command>
<command commandId="com.connor.dfl.plm.dfl043.Dfl043Handler" id="com.connor.dfl.plm.dfl043.Dfl043Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl027.Dfl027Handler" id="com.connor.dfl.plm.dfl027.Dfl027Handler"> <command commandId="com.connor.dfl.plm.dfl027.Dfl027Handler" id="com.connor.dfl.plm.dfl027.Dfl027Handler">
<visibleWhen> <visibleWhen>
<and> <and>

@ -73,6 +73,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
String accountSet; String accountSet;
private String zhangtao; private String zhangtao;
private AutoSign as = null; private AutoSign as = null;
private List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
String zong; String zong;
@ -210,37 +211,37 @@ public class Dfl020Operation extends AbstractAIFOperation{
//TCProperty tcProperty = rev.getTCProperty("fnd0MyWorkflowTasks"); //TCProperty tcProperty = rev.getTCProperty("fnd0MyWorkflowTasks");
TCProperty tcProperty = rev.getTCProperty("fnd0MyWorkflowTasks"); TCProperty tcProperty = rev.getTCProperty("fnd0MyWorkflowTasks");
TCComponent[] targets = tcProperty.getReferenceValueArray(); TCComponent[] targets = tcProperty.getReferenceValueArray();
if(targets != null && targets.length>0) { // if(targets != null && targets.length>0) {
// MessageBox.post("您选中的版本对象没有在流程中","提示",MessageBox.INFORMATION); // MessageBox.post("您选中的版本对象没有在流程中","提示",MessageBox.INFORMATION);
// return; // return;
for(int i = 0;i<targets.length;i++) { // for(int i = 0;i<targets.length;i++) {
String ss =targets[i].getStringProperty("current_name"); // String ss =targets[i].getStringProperty("current_name");
System.out.println("ss======"+ss); // System.out.println("ss======"+ss);
if("传递ERP".equals(ss)) { // if("传递ERP".equals(ss)) {
uid = targets[i].getUid(); // uid = targets[i].getUid();
}else { // }else {
MessageBox.post("您当前所在的流程不能执行传递ERP","提示",MessageBox.INFORMATION); // MessageBox.post("您当前所在的流程不能执行传递ERP","提示",MessageBox.INFORMATION);
return; // return;
} // }
} // }
} // }
}else if(comp[0] instanceof TCComponentTask){ }else if(comp[0] instanceof TCComponentTask){
TCComponentTask task = (TCComponentTask) comp[0]; TCComponentTask task = (TCComponentTask) comp[0];
String ss = task.getStringProperty("object_name"); String ss = task.getStringProperty("object_name");
System.out.println("ss==========="+ss); System.out.println("ss==========="+ss);
if("传递ERP".equals(ss)) { // if("传递ERP".equals(ss)) {
uid = comp[0].getUid(); // uid = comp[0].getUid();
TCComponent[] targets = task.getReferenceListProperty("root_target_attachments"); // TCComponent[] targets = task.getReferenceListProperty("root_target_attachments");
for (int i = 0; i < targets.length; i++) { // for (int i = 0; i < targets.length; i++) {
if(targets[i] instanceof TCComponentItemRevision) { // if(targets[i] instanceof TCComponentItemRevision) {
rev = (TCComponentItemRevision) targets[i]; // rev = (TCComponentItemRevision) targets[i];
break; // break;
} // }
} // }
}else { // }else {
MessageBox.post("您当前所在的流程不能执行传递ERP","提示",MessageBox.INFORMATION); // MessageBox.post("您当前所在的流程不能执行传递ERP","提示",MessageBox.INFORMATION);
return; // return;
} // }
}else { }else {
MessageBox.post("您选中的不是版本对象 或者BOM行","提示",MessageBox.INFORMATION); MessageBox.post("您选中的不是版本对象 或者BOM行","提示",MessageBox.INFORMATION);
return; return;
@ -266,8 +267,11 @@ public class Dfl020Operation extends AbstractAIFOperation{
as.AutoSignServer(uid,session); as.AutoSignServer(uid,session);
} }
MessageBox.post("BOM数据存储成功准备传递ERP", MessageBox.post("BOM数据存储成功准备传递ERP",
"提示", MessageBox.WARNING); "提示", MessageBox.WARNING);
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
MessageBox.post("BOM数据存储失败请检查后重新传递", MessageBox.post("BOM数据存储失败请检查后重新传递",
@ -280,12 +284,12 @@ public class Dfl020Operation extends AbstractAIFOperation{
protected void createXMLFile(TCComponentBOMLine line ,String zhangtao) throws TCException, IOException { protected void createXMLFile(TCComponentBOMLine line ,String zhangtao) throws TCException, IOException {
List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>(); //List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
StringBuilder uidSB = new StringBuilder(); StringBuilder uidSB = new StringBuilder();
try { try {
getBOMValue(line,list); getBOMValue(line,list);
if(list.size() <=0) { if(list.size() <=0) {
MessageBox.post("您传递的BOM都已经传递到ERP,请检查", "提示", MessageBox.post("BOM 传递失败请检查BOM行是否正确", "提示",
MessageBox.INFORMATION); MessageBox.INFORMATION);
return; return;
} }
@ -476,10 +480,11 @@ public class Dfl020Operation extends AbstractAIFOperation{
num = childLine.getStringProperty( "T2_DesignQuantity");//设计用量 num = childLine.getStringProperty( "T2_DesignQuantity");//设计用量
if(num==null||"".equals(num.trim())) { if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "bl_quantity");//用量 num = childLine.getStringProperty( "bl_quantity");//用量
// if(num==null||"".equals(num.trim())) { if(num==null||"".equals(num.trim())) {
// int num1=1; MessageBox.post("BOM行数量为空请填写数量",
// num =String.valueOf(num1);//默认为1 "提示", MessageBox.ERROR);
// } break;
}
} }
} }
System.out.println("num=============="+num); System.out.println("num=============="+num);
@ -555,9 +560,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
if(Quantity==null||"".equals(Quantity.trim())) { if(Quantity==null||"".equals(Quantity.trim())) {
Quantity = childLine.getStringProperty( "bl_quantity");//用量 Quantity = childLine.getStringProperty( "bl_quantity");//用量
if(Quantity==null||"".equals(Quantity.trim())) { if(Quantity==null||"".equals(Quantity.trim())) {
return;
Quantity =1+"";//默认为1 }
}
} }
} }
System.out.println("Quantity=============="+Quantity); System.out.println("Quantity=============="+Quantity);

@ -51,6 +51,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
private FileInputStream fis; private FileInputStream fis;
private FileOutputStream fos; private FileOutputStream fos;
private JPanel btnPanel1; private JPanel btnPanel1;
private JPanel btnPanel2;
private JPanel btnPanel3;
private String hzm; private String hzm;
public Dfl028AIFDialog(AbstractAIFApplication arg0){ public Dfl028AIFDialog(AbstractAIFApplication arg0){
@ -181,16 +183,48 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
//界面初始化 //界面初始化
private void init(){ private void init(){
this.setLayout(new PropertyLayout()); this.setLayout(new PropertyLayout());
this.setPreferredSize(new Dimension(550, 150)); this.setPreferredSize(new Dimension(650, 260));
FileSystemView fsv = FileSystemView.getFileSystemView(); FileSystemView fsv = FileSystemView.getFileSystemView();
String deskPath = fsv.getHomeDirectory().getPath(); String deskPath = fsv.getHomeDirectory().getPath();
//第一行:图纸类型
btnPanel1 = new JPanel(); btnPanel1 = new JPanel();
JLabel drawingtype = new JLabel("图纸类型:");
JCheckBox checkBox1 = new JCheckBox("DWG"); JCheckBox checkBox1 = new JCheckBox("DWG");
JCheckBox checkBox2 = new JCheckBox("PDF"); JCheckBox checkBox2 = new JCheckBox("idw");//new
JCheckBox checkBox3 = new JCheckBox("STP"); JCheckBox checkBox3 = new JCheckBox("PDF");
JCheckBox checkBox4 = new JCheckBox("ipt");//new
JCheckBox checkBox5 = new JCheckBox("iam");//new
JCheckBox checkBox6 = new JCheckBox("STP");
JCheckBox checkBox7 = new JCheckBox("STEP");//new
//btnPanel1.add(drawingtype);
btnPanel1.add(checkBox1); btnPanel1.add(checkBox1);
btnPanel1.add(checkBox2); btnPanel1.add(checkBox2);
btnPanel1.add(checkBox3); btnPanel1.add(checkBox3);
btnPanel1.add(checkBox4);
btnPanel1.add(checkBox5);
btnPanel1.add(checkBox6);
btnPanel1.add(checkBox7);
//第二行:零件类型
btnPanel2 = new JPanel();
JLabel itemtype = new JLabel("零件类型:");
JCheckBox checkBox11 = new JCheckBox("全部");
JCheckBox checkBox12 = new JCheckBox("外购件");
JCheckBox checkBox13 = new JCheckBox("外协件");
JCheckBox checkBox14 = new JCheckBox("虚拟件");
//btnPanel2.add(itemtype);
btnPanel2.add(checkBox11);
btnPanel2.add(checkBox12);
btnPanel2.add(checkBox13);
btnPanel2.add(checkBox14);
//第三行附加条件
btnPanel3 = new JPanel();
JLabel additional = new JLabel("附加筛选:");
JCheckBox checkBox21 = new JCheckBox("外协件/外购件打包下载");
JCheckBox checkBox22 = new JCheckBox("仅下载已发布图纸");
//btnPanel3.add(additional);
btnPanel3.add(checkBox21);
btnPanel3.add(checkBox22);
//第四行下载选项
jLabel = new JLabel("下载路径:"); jLabel = new JLabel("下载路径:");
jtf.setText(deskPath); jtf.setText(deskPath);
jButton = new JButton("..."); jButton = new JButton("...");
@ -203,8 +237,14 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
panel.add("1.3.left.top",jButton); panel.add("1.3.left.top",jButton);
panel.add("2.1.left.top",okBut); panel.add("2.1.left.top",okBut);
panel.add("2.2.left.top",celBut); panel.add("2.2.left.top",celBut);
this.add("1.1.left.top",btnPanel1);
this.add("2.1.left.top",panel); this.add("1.1.left.top",drawingtype);
this.add("1.2.left.top",btnPanel1);
this.add("2.1.left.top",itemtype);
this.add("2.2.left.top",btnPanel2);
this.add("3.1.left.top",additional);
this.add("3.2.left.top",btnPanel3);
this.add("4.1.left.top",panel);
this.setResizable(false); this.setResizable(false);
this.setBounds(5, 5, 5, 5); this.setBounds(5, 5, 5, 5);
this.centerToScreen(); this.centerToScreen();
@ -243,7 +283,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
this.centerToScreen(); this.centerToScreen();
this.showDialog(); this.showDialog();
} }
//获取图纸类型
public void getTypes() { public void getTypes() {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
Component[] jcbs = btnPanel1.getComponents();//将勾选的内容存入数组 Component[] jcbs = btnPanel1.getComponents();//将勾选的内容存入数组
@ -258,20 +298,37 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
list.add("stp"); list.add("stp");
}else if("PDF".equals(jcb.getText())) { }else if("PDF".equals(jcb.getText())) {
list.add("pdf"); list.add("pdf");
}else if("idw".equals(jcb.getText())) {
list.add("idw");
}else if ("ipt".equals(jcb.getText())) {
list.add("ipt");
}else if ("iam".equals(jcb.getText())) {
list.add("iam");
}else if ("STEP".equals(jcb.getText())) {
list.add("STEP");
} }
} }
} }
//判断list的大小大小小于等于0则全部加上
if(list.size() <= 0) { if(list.size() <= 0) {
list.add("DWG"); list.add("DWG");
list.add("dwg"); list.add("dwg");
list.add("pdf"); list.add("pdf");
list.add("stp"); list.add("stp");
list.add("idw");
list.add("iam");
list.add("STEP");
} }
try { try {
for (int i = 0; i < targets.length; i++) { for (int i = 0; i < targets.length; i++) {
if(targets[i] instanceof TCComponentBOMLine){ if(targets[i] instanceof TCComponentBOMLine){
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
//定义bom行
TCComponentBOMLine line = (TCComponentBOMLine) targets[i]; TCComponentBOMLine line = (TCComponentBOMLine) targets[i];
TCComponentItemRevision rev = line.getItemRevision(); TCComponentItemRevision rev = line.getItemRevision();
String revtype = rev.getStringProperty("object_type");
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) { for (int j = 0; j < datasets.length; j++) {
@ -279,14 +336,18 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
TCComponentDataset dataset01 = (TCComponentDataset) datasets[j]; TCComponentDataset dataset01 = (TCComponentDataset) datasets[j];
//执行获取后缀名的方法 //执行获取后缀名的方法
gethzm(dataset01); gethzm(dataset01);
System.out.println("9.07test后缀名"+hzm); System.out.println("9.07test后缀名"+hzm);
//如果list包含hzm字符串的值 //执行获取零件类型的方法
if(list.contains(hzm)) { itemlist = getitemType();
//获取数据集数据
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j]; //判断list包含hzm字符串的值 且 itemlist包含revtype的值
//执行getload方法 if(itemlist.contains(revtype)) {
getload(dataset02); if(list.contains(hzm)) {
//获取数据集数据
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
//执行getload方法
getload(dataset02);
}
} }
} }
for (int j = 0; j < datasets2.length; j++) { for (int j = 0; j < datasets2.length; j++) {
@ -295,25 +356,36 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
//执行获取后缀名的方法 //执行获取后缀名的方法
gethzm(dataset02); gethzm(dataset02);
String type2 = datasets2[j].getType(); String type2 = datasets2[j].getType();
if(list.contains(hzm)) { //判断是否为所需要的零件类型
TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; if(itemlist.contains(revtype)) {
getload(dataset); if(list.contains(hzm)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset);
}
} }
} }
} }
else if(targets[i] instanceof TCComponentItemRevision){ else if(targets[i] instanceof TCComponentItemRevision){
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
TCComponentItemRevision rev = (TCComponentItemRevision) targets[i]; TCComponentItemRevision rev = (TCComponentItemRevision) targets[i];
String revtype = rev.getStringProperty("object_type");
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) { for (int j = 0; j < datasets.length; j++) {
//获取数据集数组 //获取数据集数组
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j]; TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
//执行获取后缀名的方法 //执行获取后缀名的方法
gethzm(dataset02); gethzm(dataset02);
if(list.contains(hzm)) { //判断零件类型
TCComponentDataset dataset = (TCComponentDataset) datasets[j]; if(itemlist.contains(revtype)) {
System.out.println("下载文件"); if(list.contains(hzm)) {
getload(dataset); TCComponentDataset dataset = (TCComponentDataset) datasets[j];
System.out.println("下载文件");
getload(dataset);
}
} }
} }
for (int j = 0; j < datasets2.length; j++) { for (int j = 0; j < datasets2.length; j++) {
@ -321,17 +393,24 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j]; TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
//执行获取后缀名的方法 //执行获取后缀名的方法
gethzm(dataset02); gethzm(dataset02);
if(list.contains(hzm)) { //判断零件类型
TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; if (itemlist.contains(revtype)) {
getload(dataset); if(list.contains(hzm)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset);
}
} }
} }
}else if(targets[i] instanceof TCComponentDataset) { }else if(targets[i] instanceof TCComponentDataset) {
TCComponentDataset dataset = (TCComponentDataset) targets[i]; TCComponentDataset dataset = (TCComponentDataset) targets[i];
getload(dataset); getload(dataset);
}else if(targets[i] instanceof TCComponentItem){ }else if(targets[i] instanceof TCComponentItem){
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
TCComponentItem item = (TCComponentItem) targets[i]; TCComponentItem item = (TCComponentItem) targets[i];
TCComponentItemRevision rev = item.getLatestItemRevision(); TCComponentItemRevision rev = item.getLatestItemRevision();
String revtype = rev.getStringProperty("object_type");
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) { for (int j = 0; j < datasets.length; j++) {
@ -339,9 +418,11 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j]; TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
//执行获取后缀名的方法 //执行获取后缀名的方法
gethzm(dataset02); gethzm(dataset02);
if(list.contains(hzm)) { if(itemlist.contains(revtype)) {
TCComponentDataset dataset = (TCComponentDataset) datasets[j]; if(list.contains(hzm)) {
getload(dataset); TCComponentDataset dataset = (TCComponentDataset) datasets[j];
getload(dataset);
}
} }
} }
for (int j = 0; j < datasets2.length; j++) { for (int j = 0; j < datasets2.length; j++) {
@ -349,9 +430,11 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j]; TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
//执行获取后缀名的方法 //执行获取后缀名的方法
gethzm(dataset02); gethzm(dataset02);
if(list.contains(hzm)) { if(itemlist.contains(revtype)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; if(list.contains(hzm)) {
getload(dataset); TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset);
}
} }
} }
}else { }else {
@ -363,5 +446,31 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// TODO: handle exception // TODO: handle exception
} }
} }
//获取零件类型
public List<String> getitemType() {
List<String> itemlist = new ArrayList<String>();
Component[] jcbs = btnPanel2.getComponents();//将勾选的内容存入数组
//遍历勾选的内容
for(Component component : jcbs) {
JCheckBox jcb = (JCheckBox) component;
//判断元素是否被选中
if(jcb.isSelected()) {
itemlist.add(jcb.getText());
itemlist.add(jcb.getText());
if("全部".equals(jcb.getText())) {
itemlist.add("T2_VirtualRevision");
itemlist.add("T2_OutBuyPartRevision");
itemlist.add("T2_outsourceRevision");
}else if ("外协件".equals(jcb.getText())) {
itemlist.add("T2_outsourceRevision");
}else if ("外购件".equals(jcb.getText())) {
itemlist.add("T2_OutBuyPartRevision");
}else if ("虚拟件".equals(jcb.getText())) {
itemlist.add("T2_VirtualRevision");
}
}
}
return itemlist;
}
} }

@ -0,0 +1,34 @@
package com.connor.dfl.plm.dfl043;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.connor.dfl.plm.dfl031.ExportDialog;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService;
import com.teamcenter.rac.util.MessageBox;
public class Dfl043Handler extends AbstractHandler {
private AbstractAIFUIApplication app;
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
this.app = AIFUtility.getCurrentApplication();
TCSession session = (TCSession) app.getSession();
InterfaceAIFComponent[] comps = app.getTargetComponents();
Dfl043Operation operation = new Dfl043Operation(comps,session);
session.queueOperation(operation);
return null;
}
}

@ -0,0 +1,225 @@
package com.connor.dfl.plm.dfl043;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.filechooser.FileSystemView;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.ClassPropBean;
import com.connor.dfl.plm.dfl019.ItemBean;
import com.connor.dfl.plm.dfl019.ParseXMLUtil;
import com.connor.dfl.plm.exportBOM.ChangeDbomUtil;
import com.connor.dfl.plm.util.ClassValueBean;
import com.connor.dfl.plm.util.ClassValueUtil;
import com.connor.dfl.plm.util.ProgressBarThread;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCClassificationService;
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.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.util.MessageBox;
public class Dfl043Operation extends AbstractAIFOperation{
private InterfaceAIFComponent[] comps;
private TCSession session;
private List<String> attrList;
private List<String> errList = new ArrayList<String>();
private ProgressBarThread wait;
/**
*
* @param app
* @param lattetTime
* @param EarlyTime
* @param pathRoute
*/
public Dfl043Operation(InterfaceAIFComponent[] comps,TCSession session) {
super();
this.comps = comps;
this.session = session;
}
@Override
public void executeOperation() throws Exception {
try {
System.out.println("开旁路");
ChangeDbomUtil.setByPass(true);
//System.out.println("9.17数量为====="+comps.length);
for (int i = 0; i < comps.length; i++) {
InterfaceAIFComponent comp = comps[i];
wait = new ProgressBarThread("填写作业编号中", "执行中,请稍等...");
wait.start();// 开启进度条
if(comp instanceof TCComponentBOMLine) {
TCComponentBOMLine line = (TCComponentBOMLine) comp;
setworknum(line);
wait.setBool(true);// 关闭进度条
MessageBox.post("已自动填写作业编号!", "WARNING",
MessageBox.WARNING);
}else if(comp instanceof TCComponentItemRevision){
TCComponentItemRevision revision = (TCComponentItemRevision) comp;
try {
//TCComponentItemRevision rev = (TCComponentItemRevision) comp;
//通过版本获取bomline
TCTypeService service = session.getTypeService();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
TCComponentBOMWindow view = winType.create(null);
TCComponentItem item = revision.getItem();
TCComponentBOMLine line1 = view.setWindowTopLine(item,revision, null, null);
setworknum(line1);
wait.setBool(true);// 关闭进度条
MessageBox.post("已自动填写作业编号!", "WARNING",
MessageBox.WARNING);
} catch (Exception e) {
// TODO: handle exception
}
}else {
MessageBox.post("选中的对象中有非版本对象或BOM行对象,请检查!", "WARNING",
MessageBox.WARNING);
}
}
ChangeDbomUtil.setByPass(false);
System.out.println("关旁路");
} catch (Exception e) {
// TODO: handle exception
MessageBox.post("自动填写作业编号失败!!!,请检查!", "WARNING",
MessageBox.WARNING);
}
}
//在bom中设置将作业编号发放给结构下面所有的物料
private void setworknum(TCComponentBOMLine line) {
//System.out.println("9.17.19.519.17.19.51");
if(line instanceof TCComponentBOMLine) {
//System.out.println("9.17.19.479.17.19.47");
TCComponentItemRevision rev;
try {
//System.out.println("9.17.19.479.17.19.47");
//刷新bomline
line.refresh();
rev = line.getItemRevision();
TCProperty tcProperty = rev.getTCProperty("release_status_list");
TCComponent[] targets = tcProperty.getReferenceValueArray();
String jobid = line.getStringProperty("T2_JobNumber"); //获取作业编号
//System.out.println("9.17jobid====="+jobid);
String itemid = rev.getStringProperty("item_id"); //获取itemid
//System.out.println("9.17itemid====="+itemid);
//判断是否发布了
if(targets.length>=0) {
//判断是否有作业编号
if(jobid != null || !"".equals(jobid)) {
//判断是否有子件
AIFComponentContext[] childs = line.getChildren();
//System.out.println("9.17子级个数====="+childs.length);
if(childs != null && childs.length > 0 ) {
//循环遍历子级对象
for (int j = 0;j < childs.length;j++) {
//获取子级对象
InterfaceAIFComponent childcomp = childs[j].getComponent();
//获取子级bomline
TCComponentBOMLine childline = (TCComponentBOMLine) childcomp;
//根据自己bomline获取版本
TCComponentItemRevision childrev = ((TCComponentBOMLine) childline).getItemRevision();
//获取子级的id
String childid = childrev.getStringProperty("item_id");
//System.out.println("9.17子级id====="+childid);
//获取子级的版本类型
String childtype = childrev.getStringProperty("object_type");
//System.out.println("9.17子级版本类型====="+childtype);
//获取子级的作业编号
String childjobid = childline.getStringProperty("T2_JobNumber");
//System.out.println("9.17子级作业编号====="+childjobid);
if("T2_outsourceRevision".equals(childtype) || "T2_OutBuyPartRevision".equals(childtype) || "T2_VirtualRevision".equals(childtype)) {
//System.out.println("9.17.19.21");
//判断有没有作业编号
if(childjobid == null || "".equals(childjobid) || " ".equals(childjobid)) {
//没有则设置作业编号
childline.setStringProperty("T2_JobNumber", jobid);
if("T2_VirtualRevision".equals(childtype)) {
//是虚拟件版本则递归
setworknum(childline);
//System.out.println("递归方法9.17(1)");
}else {
//不是则跳出循环,进入下一个循环
continue;
}
}else {
//有作业编号 则跳出循环,进入下一个循环
//判断是不是虚拟件版本
if("T2_VirtualRevision".equals(childtype)) {
//是虚拟件版本则递归
setworknum(childline);
//System.out.println("递归方法9.17(2)");
}else {
//不是则跳出循环,进入下一个循环
continue;
}
}
}
}
}
}else {
//如果父级没有就去找子级的作业编号
AIFComponentContext[] childs2 = line.getChildren();
//System.out.println("9.17子级个数2====="+childs2.length);
if(childs2 != null && childs2.length > 0 ) {
for (int j = 0;j < childs2.length;j++) {
//获取子级对象
InterfaceAIFComponent childcomp2 = childs2[j].getComponent();
//获取子级bomline
TCComponentBOMLine childline2 = (TCComponentBOMLine) childcomp2;
//递归此方法
setworknum(childline2);
//System.out.println("递归方法9.17(3)");
}
}
}
}else {
MessageBox.post(itemid+"已发布,不可修改!", "WARNING",
MessageBox.WARNING);
}
} catch (TCException e) {
MessageBox.post("setworknum运行失败", "WARNING",
MessageBox.WARNING);
}
}
}
}

@ -13,6 +13,7 @@ import java.util.Map;
import javax.swing.filechooser.FileSystemView; import javax.swing.filechooser.FileSystemView;
import org.apache.commons.lang.ObjectUtils.Null;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
@ -29,6 +30,7 @@ import com.connor.dfl.plm.util.ProgressBarThread;
import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFOperation; import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.IPreferenceService;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.*; import com.teamcenter.rac.kernel.*;
@ -40,6 +42,7 @@ import com.teamcenter.rac.psebase.AbstractBOMLineViewerApplication;
import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable; import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable;
import com.teamcenter.rac.treetable.TreeTableNode; import com.teamcenter.rac.treetable.TreeTableNode;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
public class BOMExportOperation extends AbstractAIFOperation { public class BOMExportOperation extends AbstractAIFOperation {
private AbstractAIFApplication app; private AbstractAIFApplication app;
@ -47,10 +50,11 @@ public class BOMExportOperation extends AbstractAIFOperation {
private ProgressBarThread wait; private ProgressBarThread wait;
private List<String> attrList; private List<String> attrList;
private List<List> list = new ArrayList<List>(); private List<List> list = new ArrayList<List>();
private List<String> idlist = new ArrayList<String>();
private List<String> errList = new ArrayList<String>(); private List<String> errList = new ArrayList<String>();
private String xuninum = "0"; private String xuninum = "0";
private String xuanzhongid = null;
private String item_id1 = "";//品号 item_id private String item_id1 = "";//品号 item_id
private String name1 = "";//名称 object_name private String name1 = "";//名称 object_name
@ -58,6 +62,8 @@ public class BOMExportOperation extends AbstractAIFOperation {
private String unit1 = "";//单位 t2_unit private String unit1 = "";//单位 t2_unit
private String design_num1;//设计用量 bl_quantity private String design_num1;//设计用量 bl_quantity
private String brand1 = "";//品牌 private String brand1 = "";//品牌
private String group1 = "";//分群码
private String source1 = "";//来源码
private String weihao1 = "";//编号 T2_weihao private String weihao1 = "";//编号 T2_weihao
private String importance1 = "";//重要度 t2_BOMImportance private String importance1 = "";//重要度 t2_BOMImportance
private int xuhao1 ; private int xuhao1 ;
@ -80,7 +86,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
} }
try { try {
System.out.println("开始获取BOM模板"); System.out.println("开始获取BOM模板");
String puid = session.getPreferenceService().getStringValue("DFL_BOM_UID"); String puid = session.getPreferenceService().getStringValue("DFL_BOM_UID2");
System.out.println("puid======================"+puid); System.out.println("puid======================"+puid);
if (puid == null||"".equals(puid)) { if (puid == null||"".equals(puid)) {
MessageBox.post("首选项DFL_BOM_UID未配置,请联系管理员!!", MessageBox.post("首选项DFL_BOM_UID未配置,请联系管理员!!",
@ -94,21 +100,22 @@ public class BOMExportOperation extends AbstractAIFOperation {
FileSystemView fsv = FileSystemView.getFileSystemView(); FileSystemView fsv = FileSystemView.getFileSystemView();
String pathRoute = fsv.getHomeDirectory().getPath() + File.separator + "BOM汇总表" + time + ".xlsx"; String pathRoute = fsv.getHomeDirectory().getPath() + File.separator + "BOM汇总表" + time + ".xlsx";
String pathRoute1 = fsv.getHomeDirectory().getPath() + File.separator + "BOM对照表" + time + ".xlsx"; String pathRoute1 = fsv.getHomeDirectory().getPath() + File.separator + "BOM对照表" + time + ".xlsx";
wait = new ProgressBarThread("导出汇总表和对照表", "执行中,请稍等..."); wait = new ProgressBarThread("导出对照表", "执行中,请稍等...");
wait.start();// 开启进度条 wait.start();// 开启进度条
TCComponentBOMLine line = (TCComponentBOMLine) app.getTargetComponent(); TCComponentBOMLine line = (TCComponentBOMLine) app.getTargetComponent();
xuanzhongid = line.getStringProperty("awb0BomLineItemId");
try { try {
int level = 0; int level = 0;
int num = 0; int num = 0;
getAndSetValue(line,level,num); //getAndSetValue(line,level,num);
writeToExcel(file,pathRoute); //writeToExcel(file,pathRoute);
System.out.println("8.10(1)====="+list); //System.out.println("8.10(1)====="+list);
list.clear(); list.clear();
System.out.println("8.10(2)====="+list); //System.out.println("8.10(2)====="+list);
getAndSetValue1(line,level,num); getAndSetValue1(line,level,num);
writeToExcel(file,pathRoute1); writeToExcel(file,pathRoute1);
System.out.println("9.15(3)====="+list); //System.out.println("9.15(3)====="+list);
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -132,16 +139,30 @@ public class BOMExportOperation extends AbstractAIFOperation {
} }
} }
//对照表的获取方法 //对照表的获取方法
private void getAndSetValue1(TCComponentBOMLine bomLine,int level,int num) { private void getAndSetValue1(TCComponentBOMLine bomLine,int level,int num) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { try {
//通过解包方法来解包 //通过解包方法来解包
Unpack(bomLine); Unpack(bomLine);
System.out.println("level================"+level); //System.out.println("level================"+level);
String firstnum = "";
//TCComponentItemRevision eqrev = bomLine.getItemRevision();
String firstid = bomLine.getStringProperty("awb0BomLineItemId");
//判断是不是第一层级
if(xuanzhongid.equals(firstid)) {
firstnum = "1";
}else {
getItemValue1(bomLine,level,num);
firstnum =design_num1;
System.out.println("9.22.19.32第一层级数量====="+firstnum);
}
//获得子级对象 //获得子级对象
AIFComponentContext[] childs = bomLine.getChildren(); AIFComponentContext[] childs = bomLine.getChildren();
// //判断是否有子级
if(childs != null && childs.length > 0 ) { if(childs != null && childs.length > 0 ) {
//层级+1 //层级+1
//level++; //level++;
@ -153,16 +174,22 @@ public class BOMExportOperation extends AbstractAIFOperation {
TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision();
String type = rev.getStringProperty("object_type"); String type = rev.getStringProperty("object_type");
String occType = bomLine.getStringProperty("TCAI_OCC_TYPE"); String occType = bomLine.getStringProperty("TCAI_OCC_TYPE");
//判断数量是否为0
if("0".equals(firstnum)) {
break;
}
//判断是否属于bomline //判断是否属于bomline
if(comp instanceof TCComponentBOMLine) { if(comp instanceof TCComponentBOMLine) {
//如果版本类型是外购件版本或者外协件版本则获取属性 //如果版本类型是外购件版本或者外协件版本则获取属性
if (!"Reference".equals(occType))
{
if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) { if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) {
//序号+1 //序号+1
num++; num++;
//判断是否为无需传递的物料 //判断是否为无需传递的物料
if (!"Reference".equals(occType))
{
List<String> beanList1 = new ArrayList<String>(); List<String> beanList1 = new ArrayList<String>();
//将遍历的对象强转类型为bomline //将遍历的对象强转类型为bomline
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
getItemValue1(ziLine,level,num); getItemValue1(ziLine,level,num);
@ -171,9 +198,10 @@ public class BOMExportOperation extends AbstractAIFOperation {
System.out.println("a--915======"+a); System.out.println("a--915======"+a);
double b = Double.valueOf(design_num1).doubleValue(); double b = Double.valueOf(design_num1).doubleValue();
System.out.println("b--915======"+b); System.out.println("b--915======"+b);
double c = a*b; double c = Double.valueOf(firstnum).doubleValue();
System.out.println("c--915======"+c); System.out.println("c--915======"+c);
design_num1 = ""+c; double d = a*b;
design_num1 = ""+d;
System.out.println("design_num9.15======"+design_num1); System.out.println("design_num9.15======"+design_num1);
String xuhao2 = xuhao1+""; String xuhao2 = xuhao1+"";
//添加属性到字符串集合中 //添加属性到字符串集合中
@ -185,39 +213,96 @@ public class BOMExportOperation extends AbstractAIFOperation {
beanList1.add(unit1); beanList1.add(unit1);
beanList1.add(design_num1); beanList1.add(design_num1);
beanList1.add(brand1); beanList1.add(brand1);
beanList1.add(group1);
beanList1.add(source1);
beanList1.add(weihao1); beanList1.add(weihao1);
beanList1.add(importance1); beanList1.add(importance1);
System.out.println("beanList19.15====="+beanList1); System.out.println("beanList19.15====="+beanList1);
//先做布尔逻辑判断
boolean include=idlist.contains(item_id1);//true
//System.out.println("测试是否包含9.18====="+include);
boolean panduan = true;
//再将id存放在idlist
idlist.add(item_id1);
//System.out.println("idlist9.18====="+idlist);
//添加字符串集合到集合中 //添加字符串集合到集合中
list.add(beanList1); if (include == panduan) {
System.out.println("list9.15====="+list); //遍历集合list
for (int j = 0; j < list.size(); j++) {
int m = list.size();
//System.out.println("9.18list的长度"+m);
List<String> beanList2 = new ArrayList<String>();
beanList2 = list.get(j);
//System.out.println("9.18beanList2====="+beanList2);
boolean include1=beanList2.contains(item_id1);//true
//如果为真,则修改数量
if(include1 == panduan) {
String numString = null;
for(int k = 0 ; k<=beanList2.size() ; k++) {
numString = beanList2.get(5);
System.out.println("数量9.18====="+numString);
}
double before = Double.valueOf(numString).doubleValue();
double add = Double.valueOf(design_num1).doubleValue();
double sum = before+add;
//String sum = ""+before+add;
System.out.println("9.18sum====="+sum);
beanList2.set(5, ""+sum);
list.set(j, beanList2);
}
}
}else if(include!=panduan){
list.add(beanList1);
System.out.println("list9.15====="+list);
}
} }
}
//如果不是外购外协件则递归此方法 //如果不是外购外协件则递归此方法
else { else {
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
String xuniid = ziLine.getStringProperty("awb0BomLineItemId");
//判断如果没有该虚拟件下没有物料,则跳出此循环
AIFComponentContext[] childs23 = ziLine.getChildren();
int geshu = childs23.length;
System.out.println("个数为9.22====="+geshu+"====="+xuniid);
if (childs23.length <= 0 ) {
System.out.println("9.22执行跳出操作");
continue;
}
//System.out.println("9.22虚拟件id === ==="+xuniid);
design_num1 = "1"; design_num1 = "1";
//先将虚拟件(xuninum)的值设为获取到的值 //先将虚拟件(xuninum)的值设为获取到的值
xuninum = design_num1; xuninum = design_num1;
System.out.println("8.12虚拟件数量"+xuninum); System.out.println("8.12虚拟件数量"+xuninum+"===9.22虚拟件id==="+xuniid);
//设置虚拟件数量为double类型a //设置虚拟件数量为double类型a
double a = Double.valueOf(xuninum).doubleValue(); double a = Double.valueOf(xuninum).doubleValue();
System.out.println("8.12虚拟件的double数量a"+a); System.out.println("8.12虚拟件的double数量a"+a+"===9.22虚拟件id==="+xuniid);
getItemValue1(ziLine,level,xuhao1); getItemValue1(ziLine,level,xuhao1);
//设置获取的数量为double类型b //设置获取的数量为double类型b
System.out.println("9.22运行方法后获得design_num1的值====="+design_num1);
double b = Double.valueOf(design_num1).doubleValue(); double b = Double.valueOf(design_num1).doubleValue();
System.out.println("8.12虚拟件的double数量b"+b); System.out.println("8.12虚拟件的double数量b"+b+"===9.22虚拟件id==="+xuniid);
//double c = a*b;
double c = Double.valueOf(firstnum).doubleValue();
System.out.println("c--915======"+c);
//得到相乘的数量 //得到相乘的数量
double c = a*b; double d = a*b*c;
System.out.println("8.12虚拟件的double数量c"+c); System.out.println("8.12虚拟件的double数量c"+d+"===9.22虚拟件id==="+xuniid);
design_num1 = ""+c; design_num1 = ""+d;
//而后获得一个乘积的值赋予给xuninum //而后获得一个乘积的值赋予给xuninum
xuninum = design_num1; xuninum = design_num1;
System.out.println("8.12第一个虚拟件"+xuninum); System.out.println("8.12第一个虚拟件"+xuninum+"===9.22虚拟件id==="+xuniid);
//递归 //递归
getAndSetValue1(ziLine,level,xuhao1); getAndSetValue1(ziLine,level,xuhao1);
} }
}
} }
} }
//level--; //level--;
} }
@ -452,6 +537,8 @@ public class BOMExportOperation extends AbstractAIFOperation {
String unit = "";//单位 t2_unit String unit = "";//单位 t2_unit
String design_num = "";//设计用量 bl_quantity String design_num = "";//设计用量 bl_quantity
String brand = "";//品牌 String brand = "";//品牌
String group = "";//分群码
String source = "";//来源码
String weihao = "";//编号 T2_weihao String weihao = "";//编号 T2_weihao
String importance = "";//重要度 t2_BOMImportance String importance = "";//重要度 t2_BOMImportance
String xuhao = num + ""; String xuhao = num + "";
@ -469,6 +556,8 @@ public class BOMExportOperation extends AbstractAIFOperation {
} }
} }
String type = rev.getStringProperty("object_type"); String type = rev.getStringProperty("object_type");
group = rev.getStringProperty("t2_groupCode");
source = rev.getStringProperty("t2_sourceCode");
weihao = comp.getStringProperty("T2_weihao"); weihao = comp.getStringProperty("T2_weihao");
importance = comp.getStringProperty("t2_BOMImportance"); importance = comp.getStringProperty("t2_BOMImportance");
item_id = rev.getStringProperty("item_id"); item_id = rev.getStringProperty("item_id");
@ -567,6 +656,8 @@ public class BOMExportOperation extends AbstractAIFOperation {
beanList.add(unit); beanList.add(unit);
beanList.add(design_num); beanList.add(design_num);
beanList.add(brand); beanList.add(brand);
beanList.add(group);
beanList.add(source);
beanList.add(weihao); beanList.add(weihao);
beanList.add(importance); beanList.add(importance);
list.add(beanList); list.add(beanList);
@ -577,6 +668,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
//lev1 = level + ""; //lev1 = level + "";
TCComponentItemRevision rev = comp.getItemRevision(); TCComponentItemRevision rev = comp.getItemRevision();
try { try {
design_num1 = comp.getStringProperty("T2_ActualConsumption"); design_num1 = comp.getStringProperty("T2_ActualConsumption");
//如果实际用量是打包的,则解包再判断 //如果实际用量是打包的,则解包再判断
@ -598,12 +690,16 @@ public class BOMExportOperation extends AbstractAIFOperation {
else if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { else if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) {
design_num1 = comp.getStringProperty("bl_quantity"); design_num1 = comp.getStringProperty("bl_quantity");
if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) {
design_num1 = "1"; design_num1 = "0";
} }
} }
} }
String type = rev.getStringProperty("object_type"); String type = rev.getStringProperty("object_type");
group1 = rev.getStringProperty("t2_groupCode");
getgroup();
source1 = rev.getStringProperty("t2_sourceCode");
getsource();
weihao1 = comp.getStringProperty("T2_weihao"); weihao1 = comp.getStringProperty("T2_weihao");
importance1 = comp.getStringProperty("t2_BOMImportance"); importance1 = comp.getStringProperty("t2_BOMImportance");
item_id1 = rev.getStringProperty("item_id"); item_id1 = rev.getStringProperty("item_id");
@ -665,6 +761,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
//选中的对象的版本 //选中的对象的版本
TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision();
String type = rev.getStringProperty("object_type"); String type = rev.getStringProperty("object_type");
String occType = unpackLine.getStringProperty("TCAI_OCC_TYPE"); String occType = unpackLine.getStringProperty("TCAI_OCC_TYPE");
//判断是否属于bomline //判断是否属于bomline
if(comp instanceof TCComponentBOMLine) { if(comp instanceof TCComponentBOMLine) {
@ -698,5 +795,150 @@ public class BOMExportOperation extends AbstractAIFOperation {
e.printStackTrace(); e.printStackTrace();
} }
} }
//匹配分群码
private void getgroup() {
if("F10".equals(group1)) {
group1 = "机电设备";
}
if("F11".equals(group1)) {
group1 = "换热分离设备";
}
if("F12".equals(group1)) {
group1 = "阀类";
}
if("F13".equals(group1)) {
group1 = "过滤器类";
}
if("F14".equals(group1)) {
group1 = "密封类";
}
if("F15".equals(group1)) {
group1 = "传动轨道类";
}
if("F16".equals(group1)) {
group1 = "视觉类";
}
if("F17".equals(group1)) {
group1 = "电器控制类";
}
if("F18".equals(group1)) {
group1 = "仪器仪表类";
}
if("F19".equals(group1)) {
group1 = "原材料类";
}
if("F20".equals(group1)) {
group1 = "化学品/油品类";
}
if("F21".equals(group1)) {
group1 = "五金类";
}
if("F22".equals(group1)) {
group1 = "辅料";
}
if("F23".equals(group1)) {
group1 = "药用包材";
}
if("F24".equals(group1)) {
group1 = "医用耗材";
}
if("F99".equals(group1)) {
group1 = "工具";
}
if("F50".equals(group1)) {
group1 = "企标件";
}
if("F51".equals(group1)) {
group1 = "冻干机";
}
if("F52".equals(group1)) {
group1 = "进出料";
}
if("F53".equals(group1)) {
group1 = "隔离器";
}
if("F54".equals(group1)) {
group1 = "配液";
}
if("F55".equals(group1)) {
group1 = "洗瓶机";
}
if("F56".equals(group1)) {
group1 = "烘箱";
}
if("F57".equals(group1)) {
group1 = "灌装机";
}
if("F58".equals(group1)) {
group1 = "轧盖机";
}
if("F60".equals(group1)) {
group1 = "灭菌柜";
}
if("F61".equals(group1)) {
group1 = "灯检机";
}
if("F62".equals(group1)) {
group1 = "包装线";
}
if("F63".equals(group1)) {
group1 = "医疗装备";
}
if("F64".equals(group1)) {
group1 = "制水";
}
if("F65".equals(group1)) {
group1 = "BFS";
}
if("F66".equals(group1)) {
group1 = "原料药 精干包项目";
}
if("F67".equals(group1)) {
group1 = "原料药 工程项目";
}
if("F68".equals(group1)) {
group1 = "固体制剂";
}
if("F69".equals(group1)) {
group1 = "基础制造";
}
if("F70".equals(group1)) {
group1 = "生物工程";
}
if("F71".equals(group1)) {
group1 = "预灌封";
}
if("F72".equals(group1)) {
group1 = "清洗机";
}
if("F73".equals(group1)) {
group1 = "食品装备";
}
if("F74".equals(group1)) {
group1 = "医用包材";
}
if("F75".equals(group1)) {
group1 = "总控外协";
}
if("F76".equals(group1)) {
group1 = "冻融机";
}
}
//匹配来源码
private void getsource() {
//M 自制件
if("M".equals(source1)){
source1 = "自制件";
}
//P 采购件
if("P".equals(source1)){
source1 = "采购件";
}
//X 虚拟件
if("X".equals(source1)) {
source1 = "虚拟件";
}
System.out.println("调用方法source1==9.22====="+source1);
}
} }

Loading…
Cancel
Save