|
|
|
@ -55,12 +55,14 @@ import com.langtech.plm.createProjectStruct.KUtil;
|
|
|
|
|
import com.teamcenter.rac.aif.AIFDesktop;
|
|
|
|
|
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.TCComponentForm;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentGroup;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentICO;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemType;
|
|
|
|
@ -72,6 +74,8 @@ 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.ics.ICSAdminClass;
|
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
|
|
|
|
|
@ -514,6 +518,7 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
HashMap<String, ArrayList<Object>> revMap = new HashMap<String, ArrayList<Object>>();// object_String
|
|
|
|
|
|
|
|
|
|
StringBuilder errMsg = new StringBuilder();
|
|
|
|
|
int tMnum = 0;//统计下列子项中,已经转换MPart的子项数量
|
|
|
|
|
for (int j = 0; j < children.length; j++) {
|
|
|
|
|
TCComponentBOMLine eLine = (TCComponentBOMLine) children[j].getComponent();
|
|
|
|
|
// 判断是否自制
|
|
|
|
@ -524,16 +529,17 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tcProperty.equals("自制")) {
|
|
|
|
|
// 判断e下面的m是否唯一
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先循环一遍判断有没有 mpart
|
|
|
|
|
ArrayList<TCComponentItemRevision> list = new ArrayList<TCComponentItemRevision>();
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < groupSplit.length; k++) {
|
|
|
|
|
//bomline子项的itemID
|
|
|
|
|
TCComponent[] search = session.search("_SearchMFKProperties",
|
|
|
|
|
new String[] { "ID", "工厂" }, new String[] { eId, groupSplit[k] });
|
|
|
|
|
|
|
|
|
|
if (search == null || search.length == 0){
|
|
|
|
|
System.out.println("当前bom对象["+eId+"]未通过[_SearchMFKProperties]查询到任何MPart信息!");
|
|
|
|
|
}
|
|
|
|
|
for (int l = 0; l < search.length; l++) {
|
|
|
|
|
TCComponentItem tempItem = (TCComponentItem) search[l];
|
|
|
|
|
list.add(tempItem.getLatestItemRevision());
|
|
|
|
@ -543,19 +549,28 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
if (list.size() == 0) {
|
|
|
|
|
errMsg.append(eId + "对象未创建MPart"+System.lineSeparator());
|
|
|
|
|
}else if (list.size() > 0){
|
|
|
|
|
System.out.println("当前子bom对象["+eId+"]已创建/派生了MPart");
|
|
|
|
|
if (allowedToMPart(topLine)){
|
|
|
|
|
tMnum ++;//放行,不禁止
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(errMsg.length() > 0) {
|
|
|
|
|
MessageBox.post(errMsg.toString(), "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
KUtil.setByPass(false);
|
|
|
|
|
return;
|
|
|
|
|
if (tMnum == 0){
|
|
|
|
|
if(errMsg.length() > 0) {
|
|
|
|
|
MessageBox.post(errMsg.toString(), "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
KUtil.setByPass(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 和对应版本
|
|
|
|
|
for (int j = 0; j < children.length; j++) {
|
|
|
|
|
|
|
|
|
@ -874,6 +889,56 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断派生MPart时,选中的bomline对象分类是否是半成品的砂芯(允许派生MPart)
|
|
|
|
|
* @param topLine 选中对象
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean allowedToMPart(TCComponentBOMLine topLine){
|
|
|
|
|
System.out.println("allowedToMPart开始执行!");
|
|
|
|
|
Integer[] keys;
|
|
|
|
|
String[] values;
|
|
|
|
|
try {
|
|
|
|
|
TCComponentItemRevision itemRevision = topLine.getItemRevision();
|
|
|
|
|
String itemID = itemRevision.getStringProperty("item_id");
|
|
|
|
|
// 获取分类信息
|
|
|
|
|
String classId = itemRevision.getClassificationClass();
|
|
|
|
|
TCClassificationService classificationService = session.getClassificationService();
|
|
|
|
|
if (classId != null) {//当前版本对象已经发送到分类
|
|
|
|
|
ICSAdminClass adminClass = classificationService.newICSAdminClass();
|
|
|
|
|
adminClass.load(classId);
|
|
|
|
|
String parentClassId = adminClass.getParent();
|
|
|
|
|
if (parentClassId != null) {
|
|
|
|
|
String currenteClassificationName = adminClass.getName();
|
|
|
|
|
System.out.println("当前分类["+currenteClassificationName+"]的父级分类ID="+parentClassId);
|
|
|
|
|
adminClass.load(parentClassId);
|
|
|
|
|
String parentClassificationName = adminClass.getName();
|
|
|
|
|
System.out.println("父级分类名称=["+parentClassificationName+"]");
|
|
|
|
|
if (currenteClassificationName.equals("砂芯") && parentClassificationName.equals("半成品")) {
|
|
|
|
|
System.out.println("true");
|
|
|
|
|
return true;
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("当前对象["+itemID+"]的分类不是半成品下的砂芯,返回false!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel getBtnPanel() {
|
|
|
|
|
JPanel topPanel = new JPanel();
|
|
|
|
|
topPanel.setLayout(new PropertyLayout());
|
|
|
|
|