|
|
|
@ -62,6 +62,7 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
return rev2;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TCComponentItemRevision getTopZzItem(TCComponentItemRevision rev) {
|
|
|
|
|
// Auto-generated method stub
|
|
|
|
|
// item = null;
|
|
|
|
@ -99,8 +100,13 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AssignProcess(AbstractAIFApplication app, String commandId, String actionInfo) {
|
|
|
|
|
super(app, commandId, actionInfo);
|
|
|
|
|
|
|
|
|
|
long time20 = System.nanoTime();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
|
|
|
|
try {
|
|
|
|
|
TCSession session = (TCSession) app.getSession();
|
|
|
|
@ -129,10 +135,20 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
try {
|
|
|
|
|
TCPreferenceService service = session.getPreferenceService();
|
|
|
|
|
// TCComponentItemRevision pRevision = getPRevision(rev);
|
|
|
|
|
long time5 = System.nanoTime();
|
|
|
|
|
TCComponentItemRevision topZzItem = getTopZzItem(rev);
|
|
|
|
|
long time6 = System.nanoTime();
|
|
|
|
|
System.out.println(
|
|
|
|
|
"getTopZzItem=========================================: " + (time6 - time5) / 1000000L);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long time7 = System.nanoTime();
|
|
|
|
|
|
|
|
|
|
String name = rev.getProperty("object_name");
|
|
|
|
|
String property = topZzItem.getProperty("zt2_ifpbom");
|
|
|
|
|
if(!property.equals("P") && topZzItem.getStringProperty("object_desc").contains("1ZDB300000P")) {
|
|
|
|
|
if (!property.equals("P")
|
|
|
|
|
&& topZzItem.getStringProperty("object_desc").contains("1ZDB300000P")) {
|
|
|
|
|
MessageBox.post("请选择PBOM对象", "", MessageBox.ERROR);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -153,11 +169,16 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
if (isback)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
TCComponentItemRevision desginRev = (TCComponentItemRevision) topZzItem.getRelatedComponent("TC_Is_Represented_By");
|
|
|
|
|
TCComponentItemRevision desginRev = (TCComponentItemRevision) topZzItem
|
|
|
|
|
.getRelatedComponent("TC_Is_Represented_By");
|
|
|
|
|
System.out.println("topZzItem==" + topZzItem.toString() + ">>" + isback);
|
|
|
|
|
if (isback) {
|
|
|
|
|
AIFComponentContext[] folders = topZzItem.getItem()
|
|
|
|
|
.whereReferencedByTypeRelation(new String[] { "ZT2_ProjectFolder" }, null);//new String[] { "contents" }
|
|
|
|
|
.whereReferencedByTypeRelation(new String[] { "ZT2_ProjectFolder" }, null);// new
|
|
|
|
|
// String[]
|
|
|
|
|
// {
|
|
|
|
|
// "contents"
|
|
|
|
|
// }
|
|
|
|
|
if (folders.length == 0) {
|
|
|
|
|
MessageBox.post("未找到产成品文件夹,请检查.", "提示", MessageBox.WARNING);
|
|
|
|
|
return;
|
|
|
|
@ -166,23 +187,39 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
System.out.println(folders[0].getComponent() + "==>" + ccps.length);
|
|
|
|
|
for (AIFComponentContext aifcc : ccps) {
|
|
|
|
|
TCComponentItem item = (TCComponentItem) aifcc.getComponent();
|
|
|
|
|
desginRev = (TCComponentItemRevision) item.getLatestItemRevision().getRelatedComponent("TC_Is_Represented_By");
|
|
|
|
|
desginRev = (TCComponentItemRevision) item.getLatestItemRevision()
|
|
|
|
|
.getRelatedComponent("TC_Is_Represented_By");
|
|
|
|
|
System.out.println(item + "==>" + desginRev);
|
|
|
|
|
if (desginRev != null)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long time8 = System.nanoTime();
|
|
|
|
|
System.out.println(
|
|
|
|
|
"检查逻辑=========================================: " + (time8 - time7) / 1000000L);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (desginRev == null) {
|
|
|
|
|
MessageBox.post("存在顶层P物料没有关联图纸,请检查.", "提示", MessageBox.WARNING);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<String, String> classificationAttributes = desginRev.getItem().getClassificationAttributes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long time3 = System.nanoTime();
|
|
|
|
|
Map<String, String> classificationAttributes = desginRev.getItem()
|
|
|
|
|
.getClassificationAttributes();
|
|
|
|
|
System.out.println(classificationAttributes.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String key : classificationAttributes.keySet()) {
|
|
|
|
|
if (key.equals("产品型号")) {
|
|
|
|
|
String cphx = classificationAttributes.get(key);
|
|
|
|
|
String sql = "SELECT \"ProductZu\" FROM \"CHINT_WORKHOUR_WhProductXH\" where \"ProductXH\" = '"+cphx+"'";
|
|
|
|
|
String sql = "SELECT \"ProductZu\" FROM \"CHINT_WORKHOUR_WhProductXH\" where \"ProductXH\" = '"
|
|
|
|
|
+ cphx + "'";
|
|
|
|
|
String[] prefs = service.getStringValues("database_tc");
|
|
|
|
|
SqlUtil.getTCDataConnection(prefs);
|
|
|
|
|
ResultSet read2 = SqlUtil.read(sql);
|
|
|
|
@ -195,24 +232,32 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
}
|
|
|
|
|
System.out.println(productZuList.toString());
|
|
|
|
|
String[] array = productZuList.toArray(new String[] {});
|
|
|
|
|
Object showInputDialog = JOptionPane.showInputDialog(null,"当前产品型号未维护,请选择对应产品族.","提示",JOptionPane.QUESTION_MESSAGE,null,array,array[0]);
|
|
|
|
|
Object showInputDialog = JOptionPane.showInputDialog(null, "当前产品型号未维护,请选择对应产品族.",
|
|
|
|
|
"提示", JOptionPane.QUESTION_MESSAGE, null, array, array[0]);
|
|
|
|
|
if (showInputDialog == null) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("showInputDialog:" + showInputDialog.toString());
|
|
|
|
|
String insertSql = "INSERT INTO \"CHINT_WORKHOUR_WhProductXH\" "
|
|
|
|
|
+ "(\"ProductXH\",\"ProductZu\",\"COMPANYCODE\") "
|
|
|
|
|
+ "VALUES (?,?,?)";
|
|
|
|
|
SqlUtil.write(insertSql, new Object[] {cphx,showInputDialog.toString(),"M060"});
|
|
|
|
|
+ "(\"ProductXH\",\"ProductZu\",\"COMPANYCODE\") " + "VALUES (?,?,?)";
|
|
|
|
|
SqlUtil.write(insertSql,
|
|
|
|
|
new Object[] { cphx, showInputDialog.toString(), "M060" });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long time4 = System.nanoTime();
|
|
|
|
|
System.out.println(
|
|
|
|
|
"sql==========================================: " + (time4 - time3) / 1000000L);
|
|
|
|
|
comp = new MyProgressBarCompent("", "正在进行一键指派工艺路线......");
|
|
|
|
|
TCUserService userService = (TCUserService) session.getUserService();
|
|
|
|
|
long time1 = System.nanoTime();
|
|
|
|
|
Object call = userService.call("CloneTempProcess", new Object[] { rev.getUid() });
|
|
|
|
|
long time2 = System.nanoTime();
|
|
|
|
|
System.out.println(
|
|
|
|
|
"调用call==========================================: " + (time2 - time1) / 1000000L);
|
|
|
|
|
String string = call.toString();
|
|
|
|
|
comp.setVisible(false);
|
|
|
|
|
System.out.println(string);
|
|
|
|
@ -253,5 +298,10 @@ public class AssignProcess extends KCommand {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long time21 = System.nanoTime();
|
|
|
|
|
System.out.println(
|
|
|
|
|
"总时长==========================================: " + (time21 - time20) / 1000000L);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|