diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/ChangeNoticePanel.fxml b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/ChangeNoticePanel.fxml
index a128940..c3003f1 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/ChangeNoticePanel.fxml
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/ChangeNoticePanel.fxml
@@ -238,7 +238,7 @@
-
+
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java
index aaa0b2b..d7a465f 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java
@@ -60,6 +60,7 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
+import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
@@ -72,6 +73,7 @@ import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane;
import javafx.scene.control.ToggleGroup;
+import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
@@ -92,6 +94,8 @@ public class CreateEcnController extends KFXPanelController {
@FXML
private TableView tableView;
@FXML
+ public TableView refTable;
+ @FXML
private StackPane stackPane;
@FXML
private DatePicker changeDate;
@@ -166,7 +170,7 @@ public class CreateEcnController extends KFXPanelController {
rb_formalChange.setToggleGroup(group);
rb_tempChange.setToggleGroup(group);
rb_formalChange.setSelected(true);
- referencePane.setExpanded(false);
+ referencePane.setExpanded(true);
ToggleGroup groupGc = new ToggleGroup(); //
rb_product.setToggleGroup(groupGc);
@@ -338,8 +342,14 @@ public class CreateEcnController extends KFXPanelController {
refTableBean.getMessage(), result, refTableBean.getUserVal() + ";" + refTableBean.getUserUUid(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
+ frame.dispose();
} catch (Exception e) {
e.printStackTrace();
+ Alert alert = new Alert(AlertType.ERROR);
+ //alert.setTitle("Ϣ");
+ //alert.setHeaderText("һϢԻ");
+ alert.setContentText("" + e.getMessage());
+ alert.showAndWait();
} finally {
SqlUtil.freeAll();
}
@@ -775,9 +785,9 @@ public class CreateEcnController extends KFXPanelController {
rowNum++;
EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j],
ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j],
- szVersionAft[j]);
+ szVersionAft[j], products, szProduct[j]);
ecnBeans.add(ecnBean);
- ecnBean.setProductSz(szProduct[j]);
+// ecnBean.setProductSz(szProduct[j]);
}
}
tableView.getItems().addAll(ecnBeans);
@@ -856,7 +866,7 @@ public class CreateEcnController extends KFXPanelController {
try {
dataset = (TCComponentDataset) session.stringToComponent(DatasetUid);
newDataset = dataset.saveAs(null);
- } catch (TCException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
@@ -956,15 +966,12 @@ public class CreateEcnController extends KFXPanelController {
tc_beforChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
tc_beforVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
- productSz.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
+ productSz.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); // 0.4
tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
}
- @FXML
- public TableView refTable;
-
/**
*
* @function Ӱݱ
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java
index b8e51f7..4d42c05 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java
@@ -1,10 +1,8 @@
package com.chint.plm.createEcn;
-import java.util.ArrayList;
import java.util.List;
import javafx.beans.property.SimpleIntegerProperty;
-import javafx.beans.property.SimpleStringProperty;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;
@@ -30,7 +28,7 @@ public class EcnBean {
this.productSz.getSelectionModel().select(productSz);
}
- EcnBean(int ind, List reasons, List wips, List products) {
+ public EcnBean(int ind, List reasons, List wips, List products) {
num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); // ComboBoxTextArea
drawNo.setPrefSize(200, 40);
@@ -58,9 +56,9 @@ public class EcnBean {
changeReason.getItems().addAll(reasons);
}
- EcnBean(int ind, List reasons, List wips, String drawNoVal, String markVal, String placesNo,
+ public EcnBean(int ind, List reasons, List wips, String drawNoVal, String markVal, String placesNo,
String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef,
- String szRevisionAft) {
+ String szRevisionAft, List products, String product) {
num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); // ComboBoxTextArea
drawNo.setPrefSize(200, 40);
@@ -94,6 +92,9 @@ public class EcnBean {
wipTreat.getSelectionModel().select(processType);
changeReason.getItems().addAll(reasons);
changeReason.getSelectionModel().select(reasonVal);
+ //lidy20240517
+ productSz.getItems().addAll(products);
+ productSz.getSelectionModel().select(product);
}
public Integer getNum() {
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnBean.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnBean.java
index 4e63b8e..778a829 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnBean.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnBean.java
@@ -4,12 +4,11 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import com.connor.chint.sap2.util.BomToSapUtil;
-import com.connor.chint.sap2.util.ChintPreferenceUtil;
import com.connor.chint.sap2.util.SqlUtil;
-import com.teamcenter.rac.util.MessageBox;
-
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ObservableList;
+import javafx.scene.control.Alert;
+import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.TableView;
@@ -76,12 +75,12 @@ public class RelateEcnBean {
String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");// FINAPRICEPRINCIPAL
String finaPal = read.getString("FINAPRICEPRINCIPAL");
String docuName = read.getString("DOCUNAME"); // ļż
- String designFile = read.getString("DESIGNFILE");// ȡж
+// String designFile = read.getString("DESIGNFILE");// ȡж
linkBtn.setOnAction(e -> {
try {
BomToSapUtil.browse2(link);
} catch (Exception e1) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e1.printStackTrace();
}
});
@@ -118,9 +117,14 @@ public class RelateEcnBean {
// ݿϢ
SqlUtil.update(controller.UPDATE_OA, new String[] { applyNo });
tableView.refresh();
- MessageBox.post("", "", MessageBox.INFORMATION);
+ //MessageBox.post("", "", MessageBox.INFORMATION);
+ Alert alert = new Alert(AlertType.INFORMATION);
+ alert.setTitle("ʾ");
+ alert.setHeaderText("");
+ //alert.setContentText("");
+ alert.showAndWait();
} catch (Exception e1) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e1.printStackTrace();
} finally {
SqlUtil.freeAll();
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnDialog.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnDialog.java
index 15febf7..2226e4f 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnDialog.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnDialog.java
@@ -2,19 +2,16 @@ package com.chint.plm.createEcn;
import java.io.IOException;
-import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCSession;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
-import javafx.scene.control.Button;
-import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class RelateEcnDialog extends Application {
- private String groupID;
+// private String groupID;
private TCSession session;
private CreateEcnController controller;
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createKjBom/KjController.java b/com.connor.chint.wuhan/src/com/chint/plm/createKjBom/KjController.java
index 22ceca0..4fe0dde 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createKjBom/KjController.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createKjBom/KjController.java
@@ -11,12 +11,9 @@ import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.transport.http.HTTPConstants;
-
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
@@ -24,12 +21,8 @@ import com.connor.chint.sap2.util.BomToSapUtil;
import com.connor.chint.sap2.util.ChintPreferenceUtil;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent;
-import com.connor.chint.sap2.util.SAPUtil;
-//import com.connor.ml.tcm.outfile.util.ClassProperty;
-import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
-import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
@@ -47,11 +40,9 @@ import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
import com.teamcenter.rac.kernel.TCComponentUser;
-import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService;
-import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
import com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureInputInfo;
import com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureResponse;
@@ -65,11 +56,11 @@ public class KjController {
private String projectDh = "";
private String projectId = "";
public KjController(AbstractAIFApplication app) {
- // TODO Auto-generated constructor stub
+ // Auto-generated constructor stub
this.app = app;
this.session = (TCSession) app.getSession();
}
- public boolean checkProject() throws TCException {
+ public boolean checkProject() throws Exception {
InterfaceAIFComponent target = app.getTargetComponent();
if (target == null || !(target instanceof TCComponent)) {
return false;
@@ -85,19 +76,19 @@ public class KjController {
}
return false;
}
- Map idName = new HashMap();
+ Map idName = new HashMap();
// ID-ļ
- private Map fMap = new HashMap<>();
- private Map nameUser = new HashMap<>();
+ private Map fMap = new HashMap<>();
+ private Map nameUser = new HashMap<>();
private TCComponentItem tqqgdItem;
- public List byqCCPFromProject;
- public boolean checkFolder(String kjBomId,KjBean kjBean,StringBuilder errBuff) throws TCException {
+ protected List byqCCPFromProject;
+ protected boolean checkFolder(String kjBomId, KjBean kjBean, StringBuilder errBuff) throws Exception {
boolean flag = true;
try {
//ȡѡļơжϵǰĿǷ
fMap.clear();
- Map fodlers = new HashMap<>();
+ Map fodlers = new HashMap<>();
TCComponentFolder xmzxFolder = KUtil.getXMZXFolderFromProject(project);
byqCCPFromProject = KUtil.getByqCCPFromProject(project,session);
AIFComponentContext[] childFolders = xmzxFolder.getChildren();
@@ -112,12 +103,12 @@ public class KjController {
}else if(cName.equals("1-")) {
dcsjFolder = (TCComponentFolder)c;
}
- fodlers.put(cName,(TCComponentFolder)c);
+ fodlers.put(cName, (TCComponentFolder)c);
}
}
if(bztFolder!=null) {
AIFComponentContext[] children = bztFolder.getChildren();
- for(AIFComponentContext cont:children) {
+ for(AIFComponentContext cont : children) {
InterfaceAIFComponent component = cont.getComponent();
String type = component.getType();
if(type.equals("ZT2_Requisition")) {
@@ -128,7 +119,7 @@ public class KjController {
TCComponentItem dcsjItem = null;;
if(dcsjFolder!=null) {
AIFComponentContext[] children = dcsjFolder.getChildren();
- for(AIFComponentContext cont:children) {
+ for(AIFComponentContext cont : children) {
InterfaceAIFComponent component = cont.getComponent();
String type = component.getType();
if(type.equals("ZT2_MainMat")) {
@@ -180,7 +171,6 @@ public class KjController {
idName.put(jsonObject.getString("taskname"),string2);
}
System.out.println(jsonObject.getString("taskname")+"====="+string2);
-
}
}
@@ -206,12 +196,12 @@ public class KjController {
}
System.out.println(nameUser.toString());
} catch (Exception e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
}
return flag;
}
- public static TCComponent getUserName(String userID, TCSession session) throws Exception {
+ private static TCComponent getUserName(String userID, TCSession session) throws Exception {
Map fields = new HashMap<>();
fields.put("û ID", userID);
TCComponentContextList quertList = KUtil.query(session, "__WEB_find_user", fields);
@@ -221,7 +211,7 @@ public class KjController {
}
return null;
}
- public String objectToJson(List props) {
+ private String objectToJson(List props) {
String str = null;
try {
net.sf.json.JSONArray json = net.sf.json.JSONArray.fromObject(props);// javaתΪjson
@@ -240,7 +230,8 @@ public class KjController {
private String kjBs;
// public
// private TCComponentItemType ccomponentitemtype;
- public boolean createKjBom(KjBean bean,MyProgressBarCompent comp) throws TCException {
+ @SuppressWarnings("deprecation")
+ protected boolean createKjBom(KjBean bean,MyProgressBarCompent comp) throws Exception {
StringBuilder builder = new StringBuilder("");
TCComponentItemType ccomponentitemtype = (TCComponentItemType)session.getTypeComponent("ZT2_Design3D");
TCComponentItem newItem = ccomponentitemtype.find(bean.getKjbomId());
@@ -258,21 +249,20 @@ public class KjController {
String item_id = kjBomRev.getProperty("item_id");
String replaceAll = item_id.replaceAll(kjBs, projectDh);
kjIdMap.put(kjBomRev, replaceAll);
- Map findMap = new HashMap();
+ Map findMap = new HashMap();
//ȡBOMID
List useLines = new ArrayList();
- createId(kjBomLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,1);
+ createId(kjBomLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
System.out.println(kjIdMap.toString());
- if(builder.length()>0) {
+ if(builder.length() > 0) {
// MessageBox.post(builder.toString(), "ʾ",2);
- Object[] options = {"",""};
+ Object[] options = { "", "" };
comp.setVisible(false);
builder.append("ǷҪ.");
- int response = JOptionPane.showOptionDialog(null, builder.toString(), "ѡ",JOptionPane.YES_OPTION,
+ int response = JOptionPane.showOptionDialog(null, builder.toString(), "ѡ", JOptionPane.YES_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
- if(response == -1 || response==1)
- {
+ if(response == -1 || response == 1) {
window.close();
return false;
}
@@ -280,13 +270,13 @@ public class KjController {
{
comp = new MyProgressBarCompent("", "ڴBOM......");
//ʼ¡BOM
- cloneOrUpdate(session,kjBomLine,copyLines,useLines);
+ cloneOrUpdate(session, kjBomLine, copyLines, useLines);
//ӵļ
- for(TCComponentItemRevision rev:oldkjIdMap.keySet()) {
+ for(TCComponentItemRevision rev : oldkjIdMap.keySet()) {
TCComponentItem find = oldkjIdMap.get(rev);
String id = find.getProperty("item_id");
String[] split = id.split("-");
- System.out.println("id==>"+id);
+ System.out.println("id==>" + id);
if(fMap.containsKey(split[0])) {
TCComponentFolder tcComponentFolder = fMap.get(split[0]);
try {
@@ -300,7 +290,7 @@ public class KjController {
System.out.println("fMap==>"+nameUser.toString());
for(TCComponentItemRevision rev:kjIdMap.keySet()) {
String id = kjIdMap.get(rev);
- TCComponentItem find = ccomponentitemtype.find(id);
+ TCComponentItem find = ccomponentitemtype.findItems(id)[0];
String[] split = id.split("-");
System.out.println("id==>"+split[0]);
if(fMap.containsKey(split[0])) {
@@ -316,12 +306,12 @@ public class KjController {
try {
changeOwners(find,tcComponentUser);
} catch (Exception e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
}
}
}
- TCComponentItem find = ccomponentitemtype.find(replaceAll);
+ TCComponentItem find = ccomponentitemtype.findItems(replaceAll)[0];
if(findMap.size()>0) {
// window.lock();
TCComponentBOMLine newTopline = window.setWindowTopLine(find, find.getLatestItemRevision(),null, null);
@@ -340,23 +330,23 @@ public class KjController {
find.getLatestItemRevision().add("representation_for", byqCCPFromProject);
}
List propList = new ArrayList();
- sendToClass(find.getUid(),"ICM230101",objectToJson(propList));
+ sendToClass(find.getUid(), "ICM230101", objectToJson(propList));
List listBoms = BomToSapUtil.listBoms(newTopline);
//ƶӦBOM
List bomBeans = new ArrayList<>();
- for(TCComponentBOMLine listBom:listBoms) {
+ for(TCComponentBOMLine listBom : listBoms) {
String name = listBom.getItemRevision().getProperty("object_name");
- bomBeans.add(new BomBean(name,listBom));
+ bomBeans.add(new BomBean(name, listBom));
}
- System.out.println("bomBeans==>"+bomBeans.toString());
+ System.out.println("bomBeans==>" + bomBeans.toString());
// Map> remarkMap = new HashMap>();
//BOMȡǰ빺BOM
- if(tqqgdItem!=null) {
+ if(tqqgdItem != null) {
TCComponentBOMWindow window2 = winType.create(null);
TCComponentBOMLine qgdBomline = window2.setWindowTopLine(tqqgdItem, tqqgdItem.getLatestItemRevision(), null, null);
AIFComponentContext[] children = qgdBomline.getChildren();
//ǰ빺 ݱעBOMӦλ
- for(int i=0;i findMap,Map bomLineTreeNodeSOA,String uid) throws TCException {
- // TODO Auto-generated method stub
+
+ @SuppressWarnings("deprecation")
+ private void updateKjBom(Map findMap, Map bomLineTreeNodeSOA, String uid) throws Exception {
+ // Auto-generated method stub
ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(uid);
for(ExpandPSData expandPSData:expandPSDatas) {
TCComponentBOMLine bomLine = expandPSData.bomLine;
TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine;
String itemId = itemRevOfBOMLine.getProperty("item_id");
- System.out.println("findMap===>"+findMap.toString());
- System.out.println("itemId===>"+itemId.toString());
+ System.out.println("findMap===>" + findMap.toString());
+ System.out.println("itemId===>" + itemId.toString());
if(findMap.containsKey(itemId)) {
TCComponentItem tcItem = findMap.get(itemId);
- System.out.println("tcItem===>"+tcItem.toString());
+ System.out.println("tcItem===>" + tcItem.toString());
TCComponentItemRevision lastRev = tcItem.getLatestItemRevision();
bomLine.replace(tcItem, lastRev, null);
bomLine.save();
- bomLine.unlock();
+// bomLine.unlock();
}
- updateKjBom(findMap,bomLineTreeNodeSOA,bomLine.getUid());//ExpandPSData[] expandPSDatas2 = bomLineTreeNodeSOA.get(bomLine.getUid());
+ updateKjBom(findMap, bomLineTreeNodeSOA, bomLine.getUid());//ExpandPSData[] expandPSDatas2 = bomLineTreeNodeSOA.get(bomLine.getUid());
}
}
- public static void changeOwners(TCComponentItem item, TCComponentUser user) throws Exception {
+ @SuppressWarnings("deprecation")
+ private static void changeOwners(TCComponentItem item, TCComponentUser user) throws Exception {
TCComponent[] revs = item.getRelatedComponents("revision_list");
TCComponentItemRevision rev;
TCComponentGroup group = (TCComponentGroup) user.getRelatedComponent("default_group");
@@ -481,19 +474,17 @@ public class KjController {
item.changeOwner(user, group);
item.save();
item.unlock();
-
}
- public void sendToClass(String wsoPUID, String classID, String json ) {
+
+ private void sendToClass(String wsoPUID, String classID, String json) {
// AbstractAIFApplication app;
// app=AIFUtility.getCurrentApplication();
// TCSession session;
// session=(TCSession) app.getSession();
- TCPreferenceService preferenceService;
- preferenceService=session.getPreferenceService();
- // String account=preferenceService.getStringValue("Autocode_PriverUser_ID");
- String url;
- url = preferenceService.getStringValue("Autocode_SendClassServer_URL");
try {
+ TCPreferenceService preferenceService = session.getPreferenceService();
+ // String account=preferenceService.getStringValue("Autocode_PriverUser_ID");
+ String url = preferenceService.getStringValue("Autocode_SendClassServer_URL");
ServiceClient sc = new ServiceClient();
Options opts = new Options();
// url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";
@@ -520,17 +511,16 @@ public class KjController {
OMElement res = sc.sendReceive(method);
res.getFirstElement().getText();
System.out.println(res.getFirstElement().getText());
- } catch (AxisFault e) {
+ } catch (Exception e) {
e.printStackTrace();
}
-
}
- public void createId(TCComponentBOMLine pLine,Map bomLineTreeNodeSOA,
- StringBuilder builder,TCComponentItemType ccomponentitemtype,
- Map findMap,List useLines,int type) throws TCException {
+ private void createId(TCComponentBOMLine pLine, Map bomLineTreeNodeSOA,
+ StringBuilder builder, TCComponentItemType ccomponentitemtype,
+ Map findMap, List useLines, int type) throws Exception {
ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(pLine.getUid());
- if(type != 0){
+ if(type != 0) {
copyLines.add(pLine);
}
for(ExpandPSData expandPSData : expandPSDatas) {
@@ -539,24 +529,22 @@ public class KjController {
if(cRev.getType().contains("ZT2_Design3D")) {
String item_id = cRev.getProperty("item_id");
String replaceAll = item_id.replaceAll(kjBs, projectDh);
- if(type==0) {
+ if(type == 0) {
useLines.add(cLine);
- createId(cLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,0);
+ createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
}else {
- TCComponentItem find = ccomponentitemtype.find(replaceAll);
- if(find!=null) {
+ TCComponentItem find = ccomponentitemtype.findItems(replaceAll)[0];
+ if(find != null) {
builder.append("ǰIDѾ:").append(replaceAll).append("\n");
findMap.put(item_id, find);
useLines.add(cLine);
oldkjIdMap.put(cRev, find);
- createId(cLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,0);
+ createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
}else {
kjIdMap.put(cRev, replaceAll);
- createId(cLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,1);
+ createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
}
}
-
-
}else {
copyLines.add(cLine);
}
@@ -564,8 +552,8 @@ public class KjController {
}
//
- public void cloneOrUpdate(TCSession session,TCComponentBOMLine puid,
- List bomLines,List useLines) {
+ private void cloneOrUpdate(TCSession session, TCComponentBOMLine puid,
+ List bomLines, List useLines) {
com.teamcenter.services.rac.structuremanagement.StructureService service =
com.teamcenter.services.rac.structuremanagement.StructureService.getService(session);
// idMapAdd.clear();
@@ -574,12 +562,12 @@ public class KjController {
infos[0] = new CloneStructureInputInfo();
// infos[0].bomline = puid;
- infos[0].cadOptions = new String[] {"PartFamilyMaster"};
+ infos[0].cadOptions = new String[] { "PartFamilyMaster" };
try {
infos[0].defaultFolder = session.getUser().getNewStuffFolder();
infos[0].cloneFlags = 2;
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureProjectInfo projectInfo
- = new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureProjectInfo();
+ = new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureProjectInfo();
projectInfo.assign = false;
projectInfo.validate = false;
infos[0].projects = projectInfo;
@@ -588,22 +576,22 @@ public class KjController {
TCComponentItemRevision[] revs = new TCComponentItemRevision[] { puid.getItemRevision() };
infos[0].topItemRevs = revs;
- System.out.println("Save class Partial bomLine -- "+bomLines.size());
+ System.out.println("Save class Partial bomLine -- " + bomLines.size());
List saveList = new ArrayList();
- for(TCComponentBOMLine subLine: bomLines) {
+ for(TCComponentBOMLine subLine : bomLines) {
CloneStructureSaveAsIn dataMap = null;
TCComponentItem item = subLine.getItem();
if(item.getType().equals("ZT2_Design3D")) {
// subLine.replace
- dataMap = getDataMap(subLine,0, session);
+ dataMap = getDataMap(subLine, 0, session);
}else {
- dataMap = getDataMap(subLine,1, session);
+ dataMap = getDataMap(subLine, 1, session);
}
saveList.add(dataMap);
}
- for(TCComponentBOMLine subLine: useLines) {
- CloneStructureSaveAsIn dataMap = getDataMap(subLine,1, session);
+ for(TCComponentBOMLine subLine : useLines) {
+ CloneStructureSaveAsIn dataMap = getDataMap(subLine, 1, session);
saveList.add(dataMap);
}
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureDefaultNaming naming =
@@ -612,61 +600,56 @@ public class KjController {
infos[0].dataMap = array;
naming.autogen = true;
infos[0].defaultName = naming;
- infos[0].topLines = new TCComponentBOMLine[] { puid};
+ infos[0].topLines = new TCComponentBOMLine[] { puid };
// TCComponentBOMLine.get
// puid.getr
- } catch (TCException e1) {
- // TODO Auto-generated catch block
+ } catch (Exception e1) {
+ // Auto-generated catch block
e1.printStackTrace();
}
CloneStructureResponse cloneStructure = service.cloneStructure(infos);
// infos[0].
// cloneStructureExpandOrUpdate.serviceData;
- if (cloneStructure.serviceData.sizeOfPartialErrors() > 0)
- {
- for (int i = 0; i < cloneStructure.serviceData
- .sizeOfPartialErrors(); i++)
- {
- System.out.println("Save class Partial Error -- "+cloneStructure.serviceData
+ if (cloneStructure.serviceData.sizeOfPartialErrors() > 0) {
+ for (int i = 0; i < cloneStructure.serviceData.sizeOfPartialErrors(); i++) {
+ System.out.println("Save class Partial Error -- " + cloneStructure.serviceData
.getPartialError(i).getMessages()[0]);
}
-
}
try {
- System.out.println("Save class Partial Error -- "+cloneStructure.serviceData.sizeOfUpdatedObjects());
+ System.out.println("Save class Partial Error -- " + cloneStructure.serviceData.sizeOfUpdatedObjects());
if(cloneStructure.serviceData.sizeOfUpdatedObjects()>0) {
TCComponent updatedObject = cloneStructure.serviceData.getUpdatedObject(0);
System.out.println(session.componentToString(updatedObject));
}
- for(int i = 0 ;i newItemRevinfo = new HashMap();
+ Map newItemRevinfo = new HashMap<>();
dataMap.cloneOperationType = type;
// dataMap.newItemRevinfo =
dataMap.origItemRevComp = rev;
- newItemRevinfo.put("sequence_limit", new String[] {"3"});
- newItemRevinfo.put("fnd0CheckoutOnSaveAs", new String[] {"false"});
- newItemRevinfo.put("item_revision_id", new String[] {""});
- newItemRevinfo.put("sequence_id", new String[] {"1"});
- newItemRevinfo.put("object_name", new String[] {rev.getStringProperty("object_name")});
+ newItemRevinfo.put("sequence_limit", new String[] { "3" });
+ newItemRevinfo.put("fnd0CheckoutOnSaveAs", new String[] { "false" });
+ newItemRevinfo.put("item_revision_id", new String[] { "" });
+ newItemRevinfo.put("sequence_id", new String[] { "1" });
+ newItemRevinfo.put("object_name", new String[] { rev.getStringProperty("object_name") });
if(type == 0) {
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.DeepCopyData[] copys =
new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.DeepCopyData[1];
@@ -680,13 +663,13 @@ public class KjController {
copy.operationInputTypeName = "";
copy.propertyName = "items_tag";
copy.propertyType = "Reference";
- Map operationInputs = new HashMap();
+ Map operationInputs = new HashMap<>();
- operationInputs.put("fnd0CheckoutOnSaveAs", new String[] {"false"});
- operationInputs.put("is_configuration_item", new String[] {"false"});
+ operationInputs.put("fnd0CheckoutOnSaveAs", new String[] { "false" });
+ operationInputs.put("is_configuration_item", new String[] { "false" });
String zt2Unit = rev.getItem().getTCProperty("zt2_unit").getStringValue();
// rev.getItem().get("zt2_unit");
- operationInputs.put("zt2_unit", new String[] {zt2Unit});
+ operationInputs.put("zt2_unit", new String[] { zt2Unit });
String newId = "";
try {
newId = kjIdMap.get(rev);
@@ -695,7 +678,7 @@ public class KjController {
e.printStackTrace();
}
- operationInputs.put("item_id", new String[] {newId}); // ȡ
+ operationInputs.put("item_id", new String[] { newId }); // ȡ
copy.operationInputs = operationInputs;
copys[0] = copy;