创建更改通知单问题修改

pull/10/head
李冬阳 1 year ago
parent 3f2c541044
commit ca895bb822

@ -238,7 +238,7 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<TitledPane fx:id="referencePane" animated="false" text="影响分析:"> <TitledPane fx:id="referencePane" animated="false" text="影响分析(会签)">
<GridPane.margin> <GridPane.margin>
<Insets top="5.0" /> <Insets top="5.0" />
</GridPane.margin> </GridPane.margin>

@ -60,6 +60,7 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
@ -72,6 +73,7 @@ import javafx.scene.control.TextArea;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane; import javafx.scene.control.TitledPane;
import javafx.scene.control.ToggleGroup; import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.FlowPane; import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
@ -92,6 +94,8 @@ public class CreateEcnController extends KFXPanelController {
@FXML @FXML
private TableView<EcnBean> tableView; private TableView<EcnBean> tableView;
@FXML @FXML
public TableView<RefTableBean> refTable;
@FXML
private StackPane stackPane; private StackPane stackPane;
@FXML @FXML
private DatePicker changeDate; private DatePicker changeDate;
@ -166,7 +170,7 @@ public class CreateEcnController extends KFXPanelController {
rb_formalChange.setToggleGroup(group); rb_formalChange.setToggleGroup(group);
rb_tempChange.setToggleGroup(group); rb_tempChange.setToggleGroup(group);
rb_formalChange.setSelected(true); rb_formalChange.setSelected(true);
referencePane.setExpanded(false); referencePane.setExpanded(true);
ToggleGroup groupGc = new ToggleGroup(); // 变更类型组 ToggleGroup groupGc = new ToggleGroup(); // 变更类型组
rb_product.setToggleGroup(groupGc); rb_product.setToggleGroup(groupGc);
@ -338,8 +342,14 @@ public class CreateEcnController extends KFXPanelController {
refTableBean.getMessage(), result, refTableBean.getUserVal() + ";" + refTableBean.getUserUUid(), refTableBean.getMessage(), result, refTableBean.getUserVal() + ";" + refTableBean.getUserUUid(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
frame.dispose();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Alert alert = new Alert(AlertType.ERROR);
//alert.setTitle("信息");
//alert.setHeaderText("这是一个信息对话框");
alert.setContentText("" + e.getMessage());
alert.showAndWait();
} finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
@ -775,9 +785,9 @@ public class CreateEcnController extends KFXPanelController {
rowNum++; rowNum++;
EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j], EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j],
ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j], ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j],
szVersionAft[j]); szVersionAft[j], products, szProduct[j]);
ecnBeans.add(ecnBean); ecnBeans.add(ecnBean);
ecnBean.setProductSz(szProduct[j]); // ecnBean.setProductSz(szProduct[j]);
} }
} }
tableView.getItems().addAll(ecnBeans); tableView.getItems().addAll(ecnBeans);
@ -856,7 +866,7 @@ public class CreateEcnController extends KFXPanelController {
try { try {
dataset = (TCComponentDataset) session.stringToComponent(DatasetUid); dataset = (TCComponentDataset) session.stringToComponent(DatasetUid);
newDataset = dataset.saveAs(null); newDataset = dataset.saveAs(null);
} catch (TCException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -956,15 +966,12 @@ public class CreateEcnController extends KFXPanelController {
tc_beforChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); tc_beforChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
tc_beforVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_beforVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); 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_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); // 0.4 tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); // 0.4
tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
} }
@FXML
public TableView<RefTableBean> refTable;
/** /**
* *
* @function * @function

@ -1,10 +1,8 @@
package com.chint.plm.createEcn; package com.chint.plm.createEcn;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
@ -30,7 +28,7 @@ public class EcnBean {
this.productSz.getSelectionModel().select(productSz); this.productSz.getSelectionModel().select(productSz);
} }
EcnBean(int ind, List<String> reasons, List<String> wips, List<String> products) { public EcnBean(int ind, List<String> reasons, List<String> wips, List<String> products) {
num = new SimpleIntegerProperty(ind); num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); // ComboBoxTextArea drawNo = new TextArea(); // ComboBoxTextArea
drawNo.setPrefSize(200, 40); drawNo.setPrefSize(200, 40);
@ -58,9 +56,9 @@ public class EcnBean {
changeReason.getItems().addAll(reasons); changeReason.getItems().addAll(reasons);
} }
EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal, String placesNo, public EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal, String placesNo,
String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef, String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef,
String szRevisionAft) { String szRevisionAft, List<String> products, String product) {
num = new SimpleIntegerProperty(ind); num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); // ComboBoxTextArea drawNo = new TextArea(); // ComboBoxTextArea
drawNo.setPrefSize(200, 40); drawNo.setPrefSize(200, 40);
@ -94,6 +92,9 @@ public class EcnBean {
wipTreat.getSelectionModel().select(processType); wipTreat.getSelectionModel().select(processType);
changeReason.getItems().addAll(reasons); changeReason.getItems().addAll(reasons);
changeReason.getSelectionModel().select(reasonVal); changeReason.getSelectionModel().select(reasonVal);
//lidy20240517
productSz.getItems().addAll(products);
productSz.getSelectionModel().select(product);
} }
public Integer getNum() { public Integer getNum() {

@ -4,12 +4,11 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import com.connor.chint.sap2.util.BomToSapUtil; import com.connor.chint.sap2.util.BomToSapUtil;
import com.connor.chint.sap2.util.ChintPreferenceUtil;
import com.connor.chint.sap2.util.SqlUtil; import com.connor.chint.sap2.util.SqlUtil;
import com.teamcenter.rac.util.MessageBox;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
@ -76,12 +75,12 @@ public class RelateEcnBean {
String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");// FINAPRICEPRINCIPAL String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");// FINAPRICEPRINCIPAL
String finaPal = read.getString("FINAPRICEPRINCIPAL"); String finaPal = read.getString("FINAPRICEPRINCIPAL");
String docuName = read.getString("DOCUNAME"); // 文件代号及名称 String docuName = read.getString("DOCUNAME"); // 文件代号及名称
String designFile = read.getString("DESIGNFILE");// 获取行动内容 // String designFile = read.getString("DESIGNFILE");// 获取行动内容
linkBtn.setOnAction(e -> { linkBtn.setOnAction(e -> {
try { try {
BomToSapUtil.browse2(link); BomToSapUtil.browse2(link);
} catch (Exception e1) { } catch (Exception e1) {
// TODO Auto-generated catch block // Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
}); });
@ -118,9 +117,14 @@ public class RelateEcnBean {
// 更新数据库信息 // 更新数据库信息
SqlUtil.update(controller.UPDATE_OA, new String[] { applyNo }); SqlUtil.update(controller.UPDATE_OA, new String[] { applyNo });
tableView.refresh(); 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) { } catch (Exception e1) {
// TODO Auto-generated catch block // Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();

@ -2,19 +2,16 @@ package com.chint.plm.createEcn;
import java.io.IOException; import java.io.IOException;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.kernel.TCSession;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage; import javafx.stage.Stage;
public class RelateEcnDialog extends Application { public class RelateEcnDialog extends Application {
private String groupID; // private String groupID;
private TCSession session; private TCSession session;
private CreateEcnController controller; private CreateEcnController controller;

@ -11,12 +11,9 @@ import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options; import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient; import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; 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.ChintPreferenceUtil;
import com.connor.chint.sap2.util.KUtil; import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent; 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.OkHttpClient;
import com.squareup.okhttp.Request; import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response; import com.squareup.okhttp.Response;
import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext; 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.TCComponentItemType;
import com.teamcenter.rac.kernel.TCComponentRevisionRule; import com.teamcenter.rac.kernel.TCComponentRevisionRule;
import com.teamcenter.rac.kernel.TCComponentUser; import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService; import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService; 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.cad._2007_01.StructureManagement.ExpandPSData;
import com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureInputInfo; import com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureInputInfo;
import com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureResponse; import com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureResponse;
@ -65,11 +56,11 @@ public class KjController {
private String projectDh = ""; private String projectDh = "";
private String projectId = ""; private String projectId = "";
public KjController(AbstractAIFApplication app) { public KjController(AbstractAIFApplication app) {
// TODO Auto-generated constructor stub // Auto-generated constructor stub
this.app = app; this.app = app;
this.session = (TCSession) app.getSession(); this.session = (TCSession) app.getSession();
} }
public boolean checkProject() throws TCException { public boolean checkProject() throws Exception {
InterfaceAIFComponent target = app.getTargetComponent(); InterfaceAIFComponent target = app.getTargetComponent();
if (target == null || !(target instanceof TCComponent)) { if (target == null || !(target instanceof TCComponent)) {
return false; return false;
@ -85,19 +76,19 @@ public class KjController {
} }
return false; return false;
} }
Map<String,String> idName = new HashMap<String,String>(); Map<String, String> idName = new HashMap<String, String>();
//存放 ID-文件夹 //存放 ID-文件夹
private Map<String,TCComponentFolder> fMap = new HashMap<>(); private Map<String, TCComponentFolder> fMap = new HashMap<>();
private Map<String,TCComponentUser> nameUser = new HashMap<>(); private Map<String, TCComponentUser> nameUser = new HashMap<>();
private TCComponentItem tqqgdItem; private TCComponentItem tqqgdItem;
public List<TCComponentItemRevision> byqCCPFromProject; protected List<TCComponentItemRevision> byqCCPFromProject;
public boolean checkFolder(String kjBomId,KjBean kjBean,StringBuilder errBuff) throws TCException { protected boolean checkFolder(String kjBomId, KjBean kjBean, StringBuilder errBuff) throws Exception {
boolean flag = true; boolean flag = true;
try { try {
//获取首选项里的文件夹名称、判断当前项目是否存在 //获取首选项里的文件夹名称、判断当前项目是否存在
fMap.clear(); fMap.clear();
Map<String,TCComponentFolder> fodlers = new HashMap<>(); Map<String, TCComponentFolder> fodlers = new HashMap<>();
TCComponentFolder xmzxFolder = KUtil.getXMZXFolderFromProject(project); TCComponentFolder xmzxFolder = KUtil.getXMZXFolderFromProject(project);
byqCCPFromProject = KUtil.getByqCCPFromProject(project,session); byqCCPFromProject = KUtil.getByqCCPFromProject(project,session);
AIFComponentContext[] childFolders = xmzxFolder.getChildren(); AIFComponentContext[] childFolders = xmzxFolder.getChildren();
@ -112,12 +103,12 @@ public class KjController {
}else if(cName.equals("1-电磁设计")) { }else if(cName.equals("1-电磁设计")) {
dcsjFolder = (TCComponentFolder)c; dcsjFolder = (TCComponentFolder)c;
} }
fodlers.put(cName,(TCComponentFolder)c); fodlers.put(cName, (TCComponentFolder)c);
} }
} }
if(bztFolder!=null) { if(bztFolder!=null) {
AIFComponentContext[] children = bztFolder.getChildren(); AIFComponentContext[] children = bztFolder.getChildren();
for(AIFComponentContext cont:children) { for(AIFComponentContext cont : children) {
InterfaceAIFComponent component = cont.getComponent(); InterfaceAIFComponent component = cont.getComponent();
String type = component.getType(); String type = component.getType();
if(type.equals("ZT2_Requisition")) { if(type.equals("ZT2_Requisition")) {
@ -128,7 +119,7 @@ public class KjController {
TCComponentItem dcsjItem = null;; TCComponentItem dcsjItem = null;;
if(dcsjFolder!=null) { if(dcsjFolder!=null) {
AIFComponentContext[] children = dcsjFolder.getChildren(); AIFComponentContext[] children = dcsjFolder.getChildren();
for(AIFComponentContext cont:children) { for(AIFComponentContext cont : children) {
InterfaceAIFComponent component = cont.getComponent(); InterfaceAIFComponent component = cont.getComponent();
String type = component.getType(); String type = component.getType();
if(type.equals("ZT2_MainMat")) { if(type.equals("ZT2_MainMat")) {
@ -180,7 +171,6 @@ public class KjController {
idName.put(jsonObject.getString("taskname"),string2); idName.put(jsonObject.getString("taskname"),string2);
} }
System.out.println(jsonObject.getString("taskname")+"====="+string2); System.out.println(jsonObject.getString("taskname")+"====="+string2);
} }
} }
@ -206,12 +196,12 @@ public class KjController {
} }
System.out.println(nameUser.toString()); System.out.println(nameUser.toString());
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
return flag; return flag;
} }
public static TCComponent getUserName(String userID, TCSession session) throws Exception { private static TCComponent getUserName(String userID, TCSession session) throws Exception {
Map<String, String> fields = new HashMap<>(); Map<String, String> fields = new HashMap<>();
fields.put("用户 ID", userID); fields.put("用户 ID", userID);
TCComponentContextList quertList = KUtil.query(session, "__WEB_find_user", fields); TCComponentContextList quertList = KUtil.query(session, "__WEB_find_user", fields);
@ -221,7 +211,7 @@ public class KjController {
} }
return null; return null;
} }
public String objectToJson(List<ClassProperty> props) { private String objectToJson(List<ClassProperty> props) {
String str = null; String str = null;
try { try {
net.sf.json.JSONArray json = net.sf.json.JSONArray.fromObject(props);// 将java对象转换为json对象 net.sf.json.JSONArray json = net.sf.json.JSONArray.fromObject(props);// 将java对象转换为json对象
@ -240,7 +230,8 @@ public class KjController {
private String kjBs; private String kjBs;
// public // public
// private TCComponentItemType ccomponentitemtype; // 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(""); StringBuilder builder = new StringBuilder("");
TCComponentItemType ccomponentitemtype = (TCComponentItemType)session.getTypeComponent("ZT2_Design3D"); TCComponentItemType ccomponentitemtype = (TCComponentItemType)session.getTypeComponent("ZT2_Design3D");
TCComponentItem newItem = ccomponentitemtype.find(bean.getKjbomId()); TCComponentItem newItem = ccomponentitemtype.find(bean.getKjbomId());
@ -258,21 +249,20 @@ public class KjController {
String item_id = kjBomRev.getProperty("item_id"); String item_id = kjBomRev.getProperty("item_id");
String replaceAll = item_id.replaceAll(kjBs, projectDh); String replaceAll = item_id.replaceAll(kjBs, projectDh);
kjIdMap.put(kjBomRev, replaceAll); kjIdMap.put(kjBomRev, replaceAll);
Map<String, TCComponentItem> findMap = new HashMap<String,TCComponentItem>(); Map<String, TCComponentItem> findMap = new HashMap<String, TCComponentItem>();
//遍历获取BOM新ID //遍历获取BOM新ID
List<TCComponentBOMLine> useLines = new ArrayList<TCComponentBOMLine>(); List<TCComponentBOMLine> useLines = new ArrayList<TCComponentBOMLine>();
createId(kjBomLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,1); createId(kjBomLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
System.out.println(kjIdMap.toString()); System.out.println(kjIdMap.toString());
if(builder.length()>0) { if(builder.length() > 0) {
// MessageBox.post(builder.toString(), "提示",2); // MessageBox.post(builder.toString(), "提示",2);
Object[] options = {"ÊÇ","·ñ"}; Object[] options = { "ÊÇ", "·ñ" };
comp.setVisible(false); comp.setVisible(false);
builder.append("是否要继续生成."); 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]); JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
if(response == -1 || response==1) if(response == -1 || response == 1) {
{
window.close(); window.close();
return false; return false;
} }
@ -280,13 +270,13 @@ public class KjController {
{ {
comp = new MyProgressBarCompent("", "正在创建框架BOM......"); comp = new MyProgressBarCompent("", "正在创建框架BOM......");
//开始克隆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); TCComponentItem find = oldkjIdMap.get(rev);
String id = find.getProperty("item_id"); String id = find.getProperty("item_id");
String[] split = id.split("-"); String[] split = id.split("-");
System.out.println("id==>"+id); System.out.println("id==>" + id);
if(fMap.containsKey(split[0])) { if(fMap.containsKey(split[0])) {
TCComponentFolder tcComponentFolder = fMap.get(split[0]); TCComponentFolder tcComponentFolder = fMap.get(split[0]);
try { try {
@ -300,7 +290,7 @@ public class KjController {
System.out.println("fMap==>"+nameUser.toString()); System.out.println("fMap==>"+nameUser.toString());
for(TCComponentItemRevision rev:kjIdMap.keySet()) { for(TCComponentItemRevision rev:kjIdMap.keySet()) {
String id = kjIdMap.get(rev); String id = kjIdMap.get(rev);
TCComponentItem find = ccomponentitemtype.find(id); TCComponentItem find = ccomponentitemtype.findItems(id)[0];
String[] split = id.split("-"); String[] split = id.split("-");
System.out.println("id==>"+split[0]); System.out.println("id==>"+split[0]);
if(fMap.containsKey(split[0])) { if(fMap.containsKey(split[0])) {
@ -316,12 +306,12 @@ public class KjController {
try { try {
changeOwners(find,tcComponentUser); changeOwners(find,tcComponentUser);
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
TCComponentItem find = ccomponentitemtype.find(replaceAll); TCComponentItem find = ccomponentitemtype.findItems(replaceAll)[0];
if(findMap.size()>0) { if(findMap.size()>0) {
// window.lock(); // window.lock();
TCComponentBOMLine newTopline = window.setWindowTopLine(find, find.getLatestItemRevision(),null, null); TCComponentBOMLine newTopline = window.setWindowTopLine(find, find.getLatestItemRevision(),null, null);
@ -340,23 +330,23 @@ public class KjController {
find.getLatestItemRevision().add("representation_for", byqCCPFromProject); find.getLatestItemRevision().add("representation_for", byqCCPFromProject);
} }
List<ClassProperty> propList = new ArrayList<ClassProperty>(); List<ClassProperty> propList = new ArrayList<ClassProperty>();
sendToClass(find.getUid(),"ICM230101",objectToJson(propList)); sendToClass(find.getUid(), "ICM230101", objectToJson(propList));
List<TCComponentBOMLine> listBoms = BomToSapUtil.listBoms(newTopline); List<TCComponentBOMLine> listBoms = BomToSapUtil.listBoms(newTopline);
//存放名称对应的BOM行 //存放名称对应的BOM行
List<BomBean> bomBeans = new ArrayList<>(); List<BomBean> bomBeans = new ArrayList<>();
for(TCComponentBOMLine listBom:listBoms) { for(TCComponentBOMLine listBom : listBoms) {
String name = listBom.getItemRevision().getProperty("object_name"); 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<String,List<TCComponentBOMLine>> remarkMap = new HashMap<String,List<TCComponentBOMLine>>(); // Map<String,List<TCComponentBOMLine>> remarkMap = new HashMap<String,List<TCComponentBOMLine>>();
//拆分BOM逻辑获取物料提前请购单的BOM //拆分BOM逻辑获取物料提前请购单的BOM
if(tqqgdItem!=null) { if(tqqgdItem != null) {
TCComponentBOMWindow window2 = winType.create(null); TCComponentBOMWindow window2 = winType.create(null);
TCComponentBOMLine qgdBomline = window2.setWindowTopLine(tqqgdItem, tqqgdItem.getLatestItemRevision(), null, null); TCComponentBOMLine qgdBomline = window2.setWindowTopLine(tqqgdItem, tqqgdItem.getLatestItemRevision(), null, null);
AIFComponentContext[] children = qgdBomline.getChildren(); AIFComponentContext[] children = qgdBomline.getChildren();
//遍历物料提前请购单 根据备注添加BOM到对应位置 //遍历物料提前请购单 根据备注添加BOM到对应位置
for(int i=0;i<children.length;i++) { for(int i = 0; i < children.length; i++) {
TCComponentBOMLine wlLine = (TCComponentBOMLine) children[i].getComponent(); TCComponentBOMLine wlLine = (TCComponentBOMLine) children[i].getComponent();
TCComponentItem item = wlLine.getItem(); TCComponentItem item = wlLine.getItem();
if(item.getType().equals("ZT2_MainMat")) { if(item.getType().equals("ZT2_MainMat")) {
@ -366,8 +356,8 @@ public class KjController {
String object_name = wlLine2.getProperty("ZT2_Remark"); String object_name = wlLine2.getProperty("ZT2_Remark");
String objName = wlLine2.getItem().getProperty("object_name"); String objName = wlLine2.getItem().getProperty("object_name");
System.out.println(object_name); System.out.println(object_name);
System.out.println(objName+"gg"); System.out.println(objName + "gg");
if(!object_name.equals("")&&bomBeans.contains(new BomBean(object_name))) { if(!object_name.equals("") && bomBeans.contains(new BomBean(object_name))) {
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name))); BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name)));
bomBean.bomLine.add(wlLine2, false); bomBean.bomLine.add(wlLine2, false);
bomBean.bomLine.save(); bomBean.bomLine.save();
@ -387,7 +377,7 @@ public class KjController {
String object_name = wlLine.getProperty("ZT2_Remark"); String object_name = wlLine.getProperty("ZT2_Remark");
System.out.println(object_name); System.out.println(object_name);
String objName = wlLine.getItem().getProperty("object_name"); String objName = wlLine.getItem().getProperty("object_name");
if(!object_name.equals("")&&bomBeans.contains(new BomBean(object_name))) { if(!object_name.equals("") && bomBeans.contains(new BomBean(object_name))) {
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name))); BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name)));
bomBean.bomLine.add(wlLine, false); bomBean.bomLine.add(wlLine, false);
bomBean.bomLine.save(); bomBean.bomLine.save();
@ -413,36 +403,39 @@ public class KjController {
window.close(); window.close();
comp.setVisible(false); comp.setVisible(false);
return true; return true;
} }
public static void changePrivilege(TCSession session,TCComponent dataset) throws TCException {
private static void changePrivilege(TCSession session, TCComponent dataset) throws Exception {
KUtil.setByPass(true); KUtil.setByPass(true);
TCAccessControlService accessControlService = session.getTCAccessControlService(); TCAccessControlService accessControlService = session.getTCAccessControlService();
TCComponentUser user = session.getUser(); TCComponentUser user = session.getUser();
accessControlService.grantPrivilege(dataset, user, new String[]{"WRITE","READ"}); accessControlService.grantPrivilege(dataset, user, new String[]{"WRITE","READ"});
KUtil.setByPass(false); KUtil.setByPass(false);
} }
private void updateKjBom(Map<String, TCComponentItem> findMap,Map<String, ExpandPSData[]> bomLineTreeNodeSOA,String uid) throws TCException {
// TODO Auto-generated method stub @SuppressWarnings("deprecation")
private void updateKjBom(Map<String, TCComponentItem> findMap, Map<String, ExpandPSData[]> bomLineTreeNodeSOA, String uid) throws Exception {
// Auto-generated method stub
ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(uid); ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(uid);
for(ExpandPSData expandPSData:expandPSDatas) { for(ExpandPSData expandPSData:expandPSDatas) {
TCComponentBOMLine bomLine = expandPSData.bomLine; TCComponentBOMLine bomLine = expandPSData.bomLine;
TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine; TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine;
String itemId = itemRevOfBOMLine.getProperty("item_id"); String itemId = itemRevOfBOMLine.getProperty("item_id");
System.out.println("findMap===>"+findMap.toString()); System.out.println("findMap===>" + findMap.toString());
System.out.println("itemId===>"+itemId.toString()); System.out.println("itemId===>" + itemId.toString());
if(findMap.containsKey(itemId)) { if(findMap.containsKey(itemId)) {
TCComponentItem tcItem = findMap.get(itemId); TCComponentItem tcItem = findMap.get(itemId);
System.out.println("tcItem===>"+tcItem.toString()); System.out.println("tcItem===>" + tcItem.toString());
TCComponentItemRevision lastRev = tcItem.getLatestItemRevision(); TCComponentItemRevision lastRev = tcItem.getLatestItemRevision();
bomLine.replace(tcItem, lastRev, null); bomLine.replace(tcItem, lastRev, null);
bomLine.save(); 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"); TCComponent[] revs = item.getRelatedComponents("revision_list");
TCComponentItemRevision rev; TCComponentItemRevision rev;
TCComponentGroup group = (TCComponentGroup) user.getRelatedComponent("default_group"); TCComponentGroup group = (TCComponentGroup) user.getRelatedComponent("default_group");
@ -481,19 +474,17 @@ public class KjController {
item.changeOwner(user, group); item.changeOwner(user, group);
item.save(); item.save();
item.unlock(); item.unlock();
} }
public void sendToClass(String wsoPUID, String classID, String json ) {
private void sendToClass(String wsoPUID, String classID, String json) {
// AbstractAIFApplication app; // AbstractAIFApplication app;
// app=AIFUtility.getCurrentApplication(); // app=AIFUtility.getCurrentApplication();
// TCSession session; // TCSession session;
// session=(TCSession) app.getSession(); // 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 { try {
TCPreferenceService preferenceService = session.getPreferenceService();
// String account=preferenceService.getStringValue("Autocode_PriverUser_ID");
String url = preferenceService.getStringValue("Autocode_SendClassServer_URL");
ServiceClient sc = new ServiceClient(); ServiceClient sc = new ServiceClient();
Options opts = new Options(); Options opts = new Options();
// url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";
@ -520,17 +511,16 @@ public class KjController {
OMElement res = sc.sendReceive(method); OMElement res = sc.sendReceive(method);
res.getFirstElement().getText(); res.getFirstElement().getText();
System.out.println(res.getFirstElement().getText()); System.out.println(res.getFirstElement().getText());
} catch (AxisFault e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void createId(TCComponentBOMLine pLine,Map<String, ExpandPSData[]> bomLineTreeNodeSOA, private void createId(TCComponentBOMLine pLine, Map<String, ExpandPSData[]> bomLineTreeNodeSOA,
StringBuilder builder,TCComponentItemType ccomponentitemtype, StringBuilder builder, TCComponentItemType ccomponentitemtype,
Map<String, TCComponentItem> findMap,List<TCComponentBOMLine> useLines,int type) throws TCException { Map<String, TCComponentItem> findMap, List<TCComponentBOMLine> useLines, int type) throws Exception {
ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(pLine.getUid()); ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(pLine.getUid());
if(type != 0){ if(type != 0) {
copyLines.add(pLine); copyLines.add(pLine);
} }
for(ExpandPSData expandPSData : expandPSDatas) { for(ExpandPSData expandPSData : expandPSDatas) {
@ -539,24 +529,22 @@ public class KjController {
if(cRev.getType().contains("ZT2_Design3D")) { if(cRev.getType().contains("ZT2_Design3D")) {
String item_id = cRev.getProperty("item_id"); String item_id = cRev.getProperty("item_id");
String replaceAll = item_id.replaceAll(kjBs, projectDh); String replaceAll = item_id.replaceAll(kjBs, projectDh);
if(type==0) { if(type == 0) {
useLines.add(cLine); useLines.add(cLine);
createId(cLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,0); createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
}else { }else {
TCComponentItem find = ccomponentitemtype.find(replaceAll); TCComponentItem find = ccomponentitemtype.findItems(replaceAll)[0];
if(find!=null) { if(find != null) {
builder.append("当前ID已经存在:").append(replaceAll).append("\n"); builder.append("当前ID已经存在:").append(replaceAll).append("\n");
findMap.put(item_id, find); findMap.put(item_id, find);
useLines.add(cLine); useLines.add(cLine);
oldkjIdMap.put(cRev, find); oldkjIdMap.put(cRev, find);
createId(cLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,0); createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
}else { }else {
kjIdMap.put(cRev, replaceAll); kjIdMap.put(cRev, replaceAll);
createId(cLine,bomLineTreeNodeSOA,builder,ccomponentitemtype,findMap,useLines,1); createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
} }
} }
}else { }else {
copyLines.add(cLine); copyLines.add(cLine);
} }
@ -564,8 +552,8 @@ public class KjController {
} }
//批量复制 //批量复制
public void cloneOrUpdate(TCSession session,TCComponentBOMLine puid, private void cloneOrUpdate(TCSession session, TCComponentBOMLine puid,
List<TCComponentBOMLine> bomLines,List<TCComponentBOMLine> useLines) { List<TCComponentBOMLine> bomLines, List<TCComponentBOMLine> useLines) {
com.teamcenter.services.rac.structuremanagement.StructureService service = com.teamcenter.services.rac.structuremanagement.StructureService service =
com.teamcenter.services.rac.structuremanagement.StructureService.getService(session); com.teamcenter.services.rac.structuremanagement.StructureService.getService(session);
// idMapAdd.clear(); // idMapAdd.clear();
@ -574,12 +562,12 @@ public class KjController {
infos[0] = new CloneStructureInputInfo(); infos[0] = new CloneStructureInputInfo();
// infos[0].bomline = puid; // infos[0].bomline = puid;
infos[0].cadOptions = new String[] {"PartFamilyMaster"}; infos[0].cadOptions = new String[] { "PartFamilyMaster" };
try { try {
infos[0].defaultFolder = session.getUser().getNewStuffFolder(); infos[0].defaultFolder = session.getUser().getNewStuffFolder();
infos[0].cloneFlags = 2; infos[0].cloneFlags = 2;
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureProjectInfo projectInfo 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.assign = false;
projectInfo.validate = false; projectInfo.validate = false;
infos[0].projects = projectInfo; infos[0].projects = projectInfo;
@ -588,22 +576,22 @@ public class KjController {
TCComponentItemRevision[] revs = new TCComponentItemRevision[] { puid.getItemRevision() }; TCComponentItemRevision[] revs = new TCComponentItemRevision[] { puid.getItemRevision() };
infos[0].topItemRevs = revs; infos[0].topItemRevs = revs;
System.out.println("Save class Partial bomLine -- "+bomLines.size()); System.out.println("Save class Partial bomLine -- " + bomLines.size());
List<CloneStructureSaveAsIn> saveList = new ArrayList<CloneStructureSaveAsIn>(); List<CloneStructureSaveAsIn> saveList = new ArrayList<CloneStructureSaveAsIn>();
for(TCComponentBOMLine subLine: bomLines) { for(TCComponentBOMLine subLine : bomLines) {
CloneStructureSaveAsIn dataMap = null; CloneStructureSaveAsIn dataMap = null;
TCComponentItem item = subLine.getItem(); TCComponentItem item = subLine.getItem();
if(item.getType().equals("ZT2_Design3D")) { if(item.getType().equals("ZT2_Design3D")) {
// subLine.replace // subLine.replace
dataMap = getDataMap(subLine,0, session); dataMap = getDataMap(subLine, 0, session);
}else { }else {
dataMap = getDataMap(subLine,1, session); dataMap = getDataMap(subLine, 1, session);
} }
saveList.add(dataMap); saveList.add(dataMap);
} }
for(TCComponentBOMLine subLine: useLines) { for(TCComponentBOMLine subLine : useLines) {
CloneStructureSaveAsIn dataMap = getDataMap(subLine,1, session); CloneStructureSaveAsIn dataMap = getDataMap(subLine, 1, session);
saveList.add(dataMap); saveList.add(dataMap);
} }
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureDefaultNaming naming = com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureDefaultNaming naming =
@ -612,61 +600,56 @@ public class KjController {
infos[0].dataMap = array; infos[0].dataMap = array;
naming.autogen = true; naming.autogen = true;
infos[0].defaultName = naming; infos[0].defaultName = naming;
infos[0].topLines = new TCComponentBOMLine[] { puid}; infos[0].topLines = new TCComponentBOMLine[] { puid };
// TCComponentBOMLine.get // TCComponentBOMLine.get
// puid.getr // puid.getr
} catch (TCException e1) { } catch (Exception e1) {
// TODO Auto-generated catch block // Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
CloneStructureResponse cloneStructure = service.cloneStructure(infos); CloneStructureResponse cloneStructure = service.cloneStructure(infos);
// infos[0]. // infos[0].
// cloneStructureExpandOrUpdate.serviceData; // cloneStructureExpandOrUpdate.serviceData;
if (cloneStructure.serviceData.sizeOfPartialErrors() > 0) if (cloneStructure.serviceData.sizeOfPartialErrors() > 0) {
{ for (int i = 0; i < cloneStructure.serviceData.sizeOfPartialErrors(); i++) {
for (int i = 0; i < cloneStructure.serviceData System.out.println("Save class Partial Error -- " + cloneStructure.serviceData
.sizeOfPartialErrors(); i++)
{
System.out.println("Save class Partial Error -- "+cloneStructure.serviceData
.getPartialError(i).getMessages()[0]); .getPartialError(i).getMessages()[0]);
} }
} }
try { 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) { if(cloneStructure.serviceData.sizeOfUpdatedObjects()>0) {
TCComponent updatedObject = cloneStructure.serviceData.getUpdatedObject(0); TCComponent updatedObject = cloneStructure.serviceData.getUpdatedObject(0);
System.out.println(session.componentToString(updatedObject)); System.out.println(session.componentToString(updatedObject));
} }
for(int i = 0 ;i<cloneStructure.serviceData.sizeOfCreatedObjects();i++) { for(int i = 0; i < cloneStructure.serviceData.sizeOfCreatedObjects(); i++) {
TCComponent plainObject = cloneStructure.serviceData.getCreatedObject(i); TCComponent plainObject = cloneStructure.serviceData.getCreatedObject(i);
System.out.println(session.componentToString(plainObject)); System.out.println(session.componentToString(plainObject));
} }
for(int i = 0 ;i<cloneStructure.serviceData.sizeOfPlainObjects();i++) { for(int i = 0; i < cloneStructure.serviceData.sizeOfPlainObjects(); i++) {
TCComponent plainObject = cloneStructure.serviceData.getPlainObject(i); TCComponent plainObject = cloneStructure.serviceData.getPlainObject(i);
System.out.println(session.componentToString(plainObject)); System.out.println(session.componentToString(plainObject));
} }
} catch (TCException e) { } catch (Exception e) {
// TODO Auto-generated catch block // Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
private CloneStructureSaveAsIn getDataMap(TCComponentBOMLine child,int type private CloneStructureSaveAsIn getDataMap(TCComponentBOMLine child, int type, TCSession session) throws Exception {
,TCSession session) throws TCException {
TCComponentItemRevision rev = child.getItemRevision(); TCComponentItemRevision rev = child.getItemRevision();
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureSaveAsIn dataMap = com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureSaveAsIn dataMap =
new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureSaveAsIn(); new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureSaveAsIn();
Map<String, String[]> newItemRevinfo = new HashMap(); Map<String, String[]> newItemRevinfo = new HashMap<>();
dataMap.cloneOperationType = type; dataMap.cloneOperationType = type;
// dataMap.newItemRevinfo = // dataMap.newItemRevinfo =
dataMap.origItemRevComp = rev; dataMap.origItemRevComp = rev;
newItemRevinfo.put("sequence_limit", new String[] {"3"}); newItemRevinfo.put("sequence_limit", new String[] { "3" });
newItemRevinfo.put("fnd0CheckoutOnSaveAs", new String[] {"false"}); newItemRevinfo.put("fnd0CheckoutOnSaveAs", new String[] { "false" });
newItemRevinfo.put("item_revision_id", new String[] {""}); newItemRevinfo.put("item_revision_id", new String[] { "" });
newItemRevinfo.put("sequence_id", new String[] {"1"}); newItemRevinfo.put("sequence_id", new String[] { "1" });
newItemRevinfo.put("object_name", new String[] {rev.getStringProperty("object_name")}); newItemRevinfo.put("object_name", new String[] { rev.getStringProperty("object_name") });
if(type == 0) { if(type == 0) {
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.DeepCopyData[] copys = com.teamcenter.services.rac.structuremanagement._2014_10.Structure.DeepCopyData[] copys =
new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.DeepCopyData[1]; new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.DeepCopyData[1];
@ -680,13 +663,13 @@ public class KjController {
copy.operationInputTypeName = ""; copy.operationInputTypeName = "";
copy.propertyName = "items_tag"; copy.propertyName = "items_tag";
copy.propertyType = "Reference"; copy.propertyType = "Reference";
Map<String, String[]> operationInputs = new HashMap(); Map<String, String[]> operationInputs = new HashMap<>();
operationInputs.put("fnd0CheckoutOnSaveAs", new String[] {"false"}); operationInputs.put("fnd0CheckoutOnSaveAs", new String[] { "false" });
operationInputs.put("is_configuration_item", new String[] {"false"}); operationInputs.put("is_configuration_item", new String[] { "false" });
String zt2Unit = rev.getItem().getTCProperty("zt2_unit").getStringValue(); String zt2Unit = rev.getItem().getTCProperty("zt2_unit").getStringValue();
// rev.getItem().get("zt2_unit"); // rev.getItem().get("zt2_unit");
operationInputs.put("zt2_unit", new String[] {zt2Unit}); operationInputs.put("zt2_unit", new String[] { zt2Unit });
String newId = ""; String newId = "";
try { try {
newId = kjIdMap.get(rev); newId = kjIdMap.get(rev);
@ -695,7 +678,7 @@ public class KjController {
e.printStackTrace(); e.printStackTrace();
} }
operationInputs.put("item_id", new String[] {newId}); // »ñÈ¡¹æÔò operationInputs.put("item_id", new String[] { newId }); // »ñÈ¡¹æÔò
copy.operationInputs = operationInputs; copy.operationInputs = operationInputs;
copys[0] = copy; copys[0] = copy;

Loading…
Cancel
Save