bom优化 #2

Merged
lijh merged 1 commits from ljh into master 1 year ago

@ -27,6 +27,7 @@ import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -607,121 +608,290 @@ public class DYStandardBOMController {
database_tc = ChintPreferenceUtil.getPreferences("database_tc", session); database_tc = ChintPreferenceUtil.getPreferences("database_tc", session);
} }
public void readData(ProgressBar pb, List<TCComponentItemRevision> revs) throws Exception { // public void readData(ProgressBar pb, List<TCComponentItemRevision> revs) throws Exception {
pb.startProgress(); // pb.startProgress();
pb.setText("加载数据..."); // pb.setText("加载数据...");
DYStandardBomBean topBean; // DYStandardBomBean topBean;
TCComponentItemRevision rev; // TCComponentItemRevision rev;
TCComponentBOMWindow win = bomWinType.create(null); // TCComponentBOMWindow win = bomWinType.create(null);
TCComponent[] factoryNos; // TCComponent[] factoryNos;
DefaultMutableTreeNode topTreeNode, childNode; // DefaultMutableTreeNode topTreeNode, childNode;
TCComponentBOMLine topLine; // TCComponentBOMLine topLine;
List<TreePath> paths = new ArrayList<>(); // List<TreePath> paths = new ArrayList<>();
TreePath path; // TreePath path;
//
//
try { // try {
Connection connection2 = SqlUtil.getConnection2(); // Connection connection2 = SqlUtil.getConnection2();
Statement state = connection2.createStatement(); // Statement state = connection2.createStatement();
for (int i = 0, len = revs.size(); i < len; i++) { // for (int i = 0, len = revs.size(); i < len; i++) {
rev = revs.get(i); // rev = revs.get(i);
win.setWindowTopLine(rev.getItem(), rev, null, null); // win.setWindowTopLine(rev.getItem(), rev, null, null);
topLine = win.getTopBOMLine(); // topLine = win.getTopBOMLine();
topBean = new DYStandardBomBean(rev, topLine, 1); // topBean = new DYStandardBomBean(rev, topLine, 1);
// if (KUtil.isTCM(rev)) { //// if (KUtil.isTCM(rev)) {
// topBean.setIsTCM("已发布"); //// topBean.setIsTCM("已发布");
// } //// }
////
//// //20240401优化速度 用sql查询id
////
////
//// factoryNos = rev.getRelatedComponents("ZT2_FactoryNumber");
//// if (factoryNos != null && factoryNos.length > 0) {
//// for (int j = 0, len2 = factoryNos.length; j < len2; j++) {
//// topBean.addFactoryID(factoryNos[j].getProperty("item_id"));
//// }
//// }
// //
// //20240401优化速度 用sql查询id //
// String uid = rev.getUid();
// //
// //
// factoryNos = rev.getRelatedComponents("ZT2_FactoryNumber"); // //表创建了视图
// if (factoryNos != null && factoryNos.length > 0) { //// CREATE VIEW CHINT_FACTORY_NUMBER_VIEW AS
// for (int j = 0, len2 = factoryNos.length; j < len2; j++) { //// (Select R.RPRIMARY_OBJECTU,R.RSECONDARY_OBJECTU,T.PTYPE_NAME,I.PITEM_ID,R2.PZT2_WEBNO,W.PDATE_RELEASED from PIMANRELATION R
// topBean.addFactoryID(factoryNos[j].getProperty("item_id")); //// INNER JOIN PIMANTYPE T
// } //// ON R.RRELATION_TYPEU = T.PUID AND T.PTYPE_NAME = 'ZT2_FactoryNumber' AND R.RPRIMARY_OBJECTU = 'BAmV5Bsjpof3PC'
// } //// INNER JOIN PITEM I
//// ON I.PUID = R.RSECONDARY_OBJECTU
//// INNER JOIN PPART_0_REVISION_ALT R2
String uid = rev.getUid(); //// ON R.RPRIMARY_OBJECTU = R2.PUID
//// INNER JOIN PWORKSPACEOBJECT W
//// ON W.PUID = RPRIMARY_OBJECTU)
//表创建了视图
// CREATE VIEW CHINT_FACTORY_NUMBER_VIEW AS
// (Select R.RPRIMARY_OBJECTU,R.RSECONDARY_OBJECTU,T.PTYPE_NAME,I.PITEM_ID,R2.PZT2_WEBNO,W.PDATE_RELEASED from PIMANRELATION R
// INNER JOIN PIMANTYPE T
// ON R.RRELATION_TYPEU = T.PUID AND T.PTYPE_NAME = 'ZT2_FactoryNumber' AND R.RPRIMARY_OBJECTU = 'BAmV5Bsjpof3PC'
// INNER JOIN PITEM I
// ON I.PUID = R.RSECONDARY_OBJECTU
// INNER JOIN PPART_0_REVISION_ALT R2
// ON R.RPRIMARY_OBJECTU = R2.PUID
// INNER JOIN PWORKSPACEOBJECT W
// ON W.PUID = RPRIMARY_OBJECTU)
// String sql = "Select I.PITEM_ID from 'PIMANRELATION' R\r\n" +
// " INNER JOIN 'PIMANTYPE' T\r\n" +
// " ON R.RRELATION_TYPEU = T.PUID AND T.PTYPE_NAME = 'ZT2_FactoryNumber' AND R.RPRIMARY_OBJECTU = '";
// sql += uid+"'\r\n" +
// " INNER JOIN PITEM I\r\n" +
// " ON I.PUID = R.RSECONDARY_OBJECTU";
String sql = "SELECT PITEM_ID,PZT2_WEBNO,PDATE_RELEASED FROM CHINT_FACTORY_NUMBER_VIEW WHERE PTYPE_NAME = 'ZT2_FactoryNumber' AND RPRIMARY_OBJECTU = '";
sql += uid+"'";
System.out.println("查询语句:" + sql.toString());
ResultSet rs = SqlUtil.read(sql.toString());
while (rs.next()) {
String itemId = rs.getString(1);
String webNo = rs.getString(2);
String release = rs.getString(3);
// if(release != null && !release.isEmpty()) {
// topBean.setIsTCM("已发布");
// }
topBean.setIsTCM(release == null ? "":"已发布");
topBean.setStatus_BOM(webNo == null ? "":webNo);
topBean.addFactoryID(itemId == null ? "":itemId);
}
// //
// if(rs != null) {
// rs.close();
// rs = null;
// System.out.println("111111111111111111111111111111111111111111111111111111111111111111111");
// }
// if(state != null) {
// state.close();
// }
// //
//// String sql = "Select I.PITEM_ID from 'PIMANRELATION' R\r\n" +
topBean.getFactoryNo(); //// " INNER JOIN 'PIMANTYPE' T\r\n" +
topTreeNode = new DefaultMutableTreeNode(topBean); //// " ON R.RRELATION_TYPEU = T.PUID AND T.PTYPE_NAME = 'ZT2_FactoryNumber' AND R.RPRIMARY_OBJECTU = '";
if (topLine.hasChildren()) { //// sql += uid+"'\r\n" +
childNode = new DefaultMutableTreeNode(new DYStandardBomBean(rev, topLine, 1)); //// " INNER JOIN PITEM I\r\n" +
topTreeNode.add(childNode); //// " ON I.PUID = R.RSECONDARY_OBJECTU";
path = new TreePath(topTreeNode); //
paths.add(path); // String sql = "SELECT PITEM_ID,PZT2_WEBNO,PDATE_RELEASED FROM CHINT_FACTORY_NUMBER_VIEW WHERE PTYPE_NAME = 'ZT2_FactoryNumber' AND RPRIMARY_OBJECTU = '";
} // sql += uid+"'";
dialog.parent_nodes.add(topBean); //
dialog.topNode.add(topTreeNode); // System.out.println("查询语句:" + sql.toString());
dialog.rev_nodes.put(rev, topTreeNode); // ResultSet rs = SqlUtil.read(sql.toString());
dialog.node_status.put(topTreeNode, "0"); //
} // while (rs.next()) {
}catch(Exception e) { // String itemId = rs.getString(1);
e.printStackTrace(); // String webNo = rs.getString(2);
}finally { // String release = rs.getString(3);
SqlUtil.freeAll(); //// if(release != null && !release.isEmpty()) {
} //// topBean.setIsTCM("已发布");
for (int i = 0; i < paths.size(); i++) { //// }
dialog.tree.collapsePath(paths.get(i)); //
} // topBean.setIsTCM(release == null ? "":"已发布");
dialog.t_model.reload(dialog.topNode); // topBean.setStatus_BOM(webNo == null ? "":webNo);
win.refresh(); // topBean.addFactoryID(itemId == null ? "":itemId);
win.close(); //
} // }
////
//// if(rs != null) {
//// rs.close();
//// rs = null;
//// System.out.println("111111111111111111111111111111111111111111111111111111111111111111111");
//// }
//// if(state != null) {
//// state.close();
//// }
////
//
// topBean.getFactoryNo();
// topTreeNode = new DefaultMutableTreeNode(topBean);
// if (topLine.hasChildren()) {
// childNode = new DefaultMutableTreeNode(new DYStandardBomBean(rev, topLine, 1));
// topTreeNode.add(childNode);
// path = new TreePath(topTreeNode);
// paths.add(path);
// }
// dialog.parent_nodes.add(topBean);
// dialog.topNode.add(topTreeNode);
// dialog.rev_nodes.put(rev, topTreeNode);
// dialog.node_status.put(topTreeNode, "0");
// }
// }catch(Exception e) {
// e.printStackTrace();
// }finally {
// SqlUtil.freeAll();
// }
// for (int i = 0; i < paths.size(); i++) {
// dialog.tree.collapsePath(paths.get(i));
// }
// dialog.t_model.reload(dialog.topNode);
// win.refresh();
// win.close();
// }
public void readData(ProgressBar pb, String folderUid)
throws Exception
{
pb.startProgress();
pb.setText("加载数据...");
TCComponentBOMWindow win = this.bomWinType.create(null);
List<TreePath> paths = new ArrayList();
try
{
Connection connection2 = SqlUtil.getConnection2();
connection2.createStatement();
String sql = "SELECT RPRIMARY_OBJECTU,PITEM_ID,PZT2_WEBNO,PDATE_RELEASED FROM CHINT_FACTORY_NUMBER_VIEW WHERE PTYPE_NAME = 'ZT2_FactoryNumber' AND FOLDERUID = '";
sql = sql + folderUid + "'";
System.out.println("sql2====================" + sql);
ResultSet rs = SqlUtil.read(sql.toString());
Map<String, DYStandardBomBean> beanMap = new LinkedHashMap();
String itemId;
while (rs.next())
{
String uid = rs.getString(1);
itemId = rs.getString(2);
String webNo = rs.getString(3);
String release = rs.getString(4);
System.out.println("itemId==" + itemId);
if (!beanMap.containsKey(uid))
{
TCComponentItemRevision rev = (TCComponentItemRevision)this.session.stringToComponent(uid);
win.setWindowTopLine(rev.getItem(), rev, null, null);
TCComponentBOMLine topLine = win.getTopBOMLine();
DYStandardBomBean topBean = new DYStandardBomBean(rev, topLine, 1);
topBean.setIsTCM(release == null ? "" : "已发布");
topBean.setStatus_BOM(webNo == null ? "" : webNo);
topBean.addFactoryID(itemId == null ? "" : itemId);
beanMap.put(uid, topBean);
}
else
{
DYStandardBomBean topBean = (DYStandardBomBean)beanMap.get(uid);
topBean.addFactoryID(itemId == null ? "" : itemId);
}
}
System.out.println("beanMap=================" + beanMap.toString());
for (Map.Entry<String, DYStandardBomBean> entry : beanMap.entrySet())
{
DYStandardBomBean topBean = (DYStandardBomBean)entry.getValue();
topBean.getFactoryNo();
DefaultMutableTreeNode topTreeNode = new DefaultMutableTreeNode(topBean);
TCComponentBOMLine topLine = topBean.getLine();
TCComponentItemRevision rev = topBean.getRev();
if (topLine.hasChildren())
{
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(new DYStandardBomBean(rev, topLine, 1));
topTreeNode.add(childNode);
TreePath path = new TreePath(topTreeNode);
paths.add(path);
}
this.dialog.parent_nodes.add(topBean);
this.dialog.topNode.add(topTreeNode);
this.dialog.rev_nodes.put(rev, topTreeNode);
this.dialog.node_status.put(topTreeNode, "0");
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
SqlUtil.freeAll();
}
for (int i = 0; i < paths.size(); i++) {
this.dialog.tree.collapsePath((TreePath)paths.get(i));
}
this.dialog.t_model.reload(this.dialog.topNode);
win.refresh();
win.close();
}
public void readData(ProgressBar pb, List<TCComponentItemRevision> revs)
throws Exception
{
pb.startProgress();
pb.setText("加载数据...");
TCComponentBOMWindow win = this.bomWinType.create(null);
List<TreePath> paths = new ArrayList();
try
{
Connection connection2 = SqlUtil.getConnection2();
connection2.createStatement();
int i = 0;
for (int len = revs.size(); i < len; i++)
{
TCComponentItemRevision rev = (TCComponentItemRevision)revs.get(i);
win.setWindowTopLine(rev.getItem(), rev, null, null);
TCComponentBOMLine topLine = win.getTopBOMLine();
DYStandardBomBean topBean = new DYStandardBomBean(rev, topLine, 1);
String uid = rev.getUid();
String sql = "SELECT PITEM_ID,PZT2_WEBNO,PDATE_RELEASED FROM CHINT_FACTORY_NUMBER_VIEW WHERE PTYPE_NAME = 'ZT2_FactoryNumber' AND RPRIMARY_OBJECTU = '";
sql = sql + uid + "'";
System.out.println("查询语句:" + sql.toString());
ResultSet rs = SqlUtil.read(sql.toString());
while (rs.next())
{
String itemId = rs.getString(1);
System.out.println("itemId==" + itemId);
String webNo = rs.getString(2);
String release = rs.getString(3);
topBean.setIsTCM(release == null ? "" : "已发布");
topBean.setStatus_BOM(webNo == null ? "" : webNo);
topBean.addFactoryID(itemId == null ? "" : itemId);
}
topBean.getFactoryNo();
DefaultMutableTreeNode topTreeNode = new DefaultMutableTreeNode(topBean);
if (topLine.hasChildren())
{
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(new DYStandardBomBean(rev, topLine, 1));
topTreeNode.add(childNode);
TreePath path = new TreePath(topTreeNode);
paths.add(path);
}
this.dialog.parent_nodes.add(topBean);
this.dialog.topNode.add(topTreeNode);
this.dialog.rev_nodes.put(rev, topTreeNode);
this.dialog.node_status.put(topTreeNode, "0");
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
SqlUtil.freeAll();
}
for (int i = 0; i < paths.size(); i++) {
this.dialog.tree.collapsePath((TreePath)paths.get(i));
}
this.dialog.t_model.reload(this.dialog.topNode);
win.refresh();
win.close();
}
// Éý°æÐÞ¸Ä // Éý°æÐÞ¸Ä
private List<StandardBOMBean> recureBOM(TCComponentBOMLine line, DefaultMutableTreeNode treeNode, private List<StandardBOMBean> recureBOM(TCComponentBOMLine line, DefaultMutableTreeNode treeNode,
List<StandardBOMBean> beans) throws Exception { List<StandardBOMBean> beans) throws Exception {

@ -20,6 +20,8 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -63,14 +65,17 @@ import com.connor.chint.sap2.util.ConfirmDialogUtil;
import com.connor.chint.sap2.util.KUtil; import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.POIUtil; import com.connor.chint.sap2.util.POIUtil;
import com.connor.chint.sap2.util.ProgressBar; import com.connor.chint.sap2.util.ProgressBar;
import com.connor.chint.sap2.util.SqlUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog; import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentFolder; import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentItem; import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
public class DYStandardBOMDialog extends AbstractAIFDialog { public class DYStandardBOMDialog extends AbstractAIFDialog {
@ -100,7 +105,9 @@ public class DYStandardBOMDialog extends AbstractAIFDialog {
protected JTextField jtf_num; // 数量 protected JTextField jtf_num; // 数量
private TCComponentItemRevision select_rev; private TCComponentItemRevision select_rev;
private DYStandardBOMController controller; private DYStandardBOMController controller;
protected String folderUid = "";
private TCSession session;
protected List<String> revUidList = new ArrayList(32);
public static final String[] HEADER = new String[] { "序号", "物料编码", "代号", "物料描述", "技术要求", "单位", "数量", "备注" }; public static final String[] HEADER = new String[] { "序号", "物料编码", "代号", "物料描述", "技术要求", "单位", "数量", "备注" };
public static final int[] HEADERWIDTH = new int[] { 60, 180, 120, 400, 180, 60, 60, 120 }; public static final int[] HEADERWIDTH = new int[] { 60, 180, 120, 400, 180, 60, 60, 120 };
@ -127,6 +134,7 @@ public class DYStandardBOMDialog extends AbstractAIFDialog {
public DYStandardBOMDialog(AbstractAIFApplication app) { public DYStandardBOMDialog(AbstractAIFApplication app) {
super(false); super(false);
this.app = app; this.app = app;
this.session = ((TCSession)app.getSession());
} }
@Override @Override
@ -208,63 +216,103 @@ public class DYStandardBOMDialog extends AbstractAIFDialog {
return panel; return panel;
} }
@Override public void run()
public void run() { {
try { try
InterfaceAIFComponent comp = app.getTargetComponent(); {
if (comp instanceof TCComponentItemRevision) { long time1 = System.nanoTime();
revs.add((TCComponentItemRevision) comp);
} else {
folder = (TCComponentFolder) comp; InterfaceAIFComponent comp = this.app.getTargetComponent();
AIFComponentContext[] children = folder.getChildren(); if ((comp instanceof TCComponentItemRevision))
TCComponentItem item; {
TCComponentItemRevision rev; this.revs.add((TCComponentItemRevision)comp);
for (int i = 0, len = children.length; i < len; i++) { }
if (children[i].getComponent() instanceof TCComponentItem) { else
item = (TCComponentItem) children[i].getComponent(); {
rev = item.getLatestItemRevision(); Connection connection2 = SqlUtil.getConnection2();
if (!revs.contains(rev)) { connection2.createStatement();
revs.add(rev); this.folderUid = comp.getUid();
} String sql = "SELECT RPRIMARY_OBJECTU FROM CHINT_FACTORY_NUMBER_VIEW WHERE PTYPE_NAME = 'ZT2_FactoryNumber' AND FOLDERUID = '";
} else if (children[i].getComponent() instanceof TCComponentItemRevision) { sql = sql + this.folderUid + "'";
rev = (TCComponentItemRevision) children[i].getComponent(); System.out.println("查询语句:" + sql.toString());
if (!revs.contains(rev)) { ResultSet rs = SqlUtil.read(sql.toString());
revs.add(rev); while (rs.next())
} {
} String revId = rs.getString(1);
} if (!this.revUidList.contains(revId)) {
} this.revUidList.add(revId);
if (revs.size() == 0) { }
MessageBox.post("未在文件夹中找到版本对象,请检查", "", 2); }
return; System.out.println("revUidList.SIZZ=============" + this.revUidList.size());
} if (connection2 != null) {
controller = new DYStandardBOMController(DYStandardBOMDialog.this, app); SqlUtil.freeAll();
controller.initUI(); }
initUI(); TCComponent[] revsArray =
test(); session.stringToComponent(
addListener(); (String[])this.revUidList.toArray(new String[this.revUidList.size()]));
new Thread(new Runnable() { for (TCComponent tcComponent : revsArray) {
@Override if ((tcComponent instanceof TCComponentItemRevision)) {
public void run() { this.revs.add((TCComponentItemRevision)tcComponent);
ProgressBar pb = new ProgressBar(DYStandardBOMDialog.this, new Dimension(250, 50)); }
try { }
controller.readData(pb, revs); System.out.println("revs.SIZZ=============" + this.revs.size());
pb.disposeDialog(); }
} catch (Exception e) { if (this.revs.size() == 0)
pb.disposeDialog(); {
e.printStackTrace(); MessageBox.post("未在文件夹中找到版本对象,请检查", "", 2);
MessageBox.post(DYStandardBOMDialog.this, "异常:" + e.getMessage(), "", 2); return;
disposeDialog(); }
} long time2 = System.nanoTime();
} System.out.println("fold========================================== " + (time2 - time1) / 1000000L);
}).start();
showDialog();
} catch (Exception e) { long time5 = System.nanoTime();
e.printStackTrace(); this.controller = new DYStandardBOMController(this, this.app);
MessageBox.post("异常:" + e.getMessage(), "", 2); this.controller.initUI();
} initUI();
test();
} addListener();
long time6 = System.nanoTime();
System.out.println("initUI========================================== " + (time6 - time5) / 1000000L);
new Thread(new Runnable()
{
public void run()
{
ProgressBar pb = new ProgressBar(DYStandardBOMDialog.this, new Dimension(250, 50));
try
{
long time3 = System.nanoTime();
if (DYStandardBOMDialog.this.folderUid.equals(""))
{
DYStandardBOMDialog.this.controller.readData(pb, DYStandardBOMDialog.this.revs);
}
else
{
System.out.println("111111111111111111111111111111111111111");
DYStandardBOMDialog.this.controller.readData(pb, DYStandardBOMDialog.this.folderUid);
}
long time4 = System.nanoTime();
System.out.println("data========================================== " + (time4 - time3) / 1000000L);
pb.disposeDialog();
}
catch (Exception e)
{
pb.disposeDialog();
e.printStackTrace();
MessageBox.post(DYStandardBOMDialog.this, "异常:" + e.getMessage(), "", 2);
DYStandardBOMDialog.this.disposeDialog();
}
}
}).start();
showDialog();
}
catch (Exception e)
{
e.printStackTrace();
MessageBox.post("异常:" + e.getMessage(), "", 2);
}
}
private void addListener() { private void addListener() {

@ -1,146 +1,153 @@
package com.connor.chint.sap2.StandardBOM; package com.connor.chint.sap2.StandardBOM;
import java.util.ArrayList;
import java.util.List;
import com.connor.chint.sap2.util.KUtil; import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.ZYFactoryUtil; import com.connor.chint.sap2.util.ZYFactoryUtil;
import com.teamcenter.rac.kernel.TCComponent; import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine; import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCException;
import java.util.ArrayList;
import java.util.List;
public class DYStandardBomBean { public class DYStandardBomBean
{
private TCComponentItemRevision rev; private TCComponentItemRevision rev;
private List<DYStandardBomBean> children = new ArrayList<>(); private TCComponentBOMLine line;
private int index; private List<DYStandardBomBean> children = new ArrayList();
private int index;
private List<TCComponent> factoryNos = new ArrayList<>(); private List<TCComponent> factoryNos = new ArrayList();
private List<String> factoryIDs = new ArrayList<>(); private List<String> factoryIDs = new ArrayList();
public String factoryID = "";
public String factoryID = ""; private String status_BOM = "";
private String status_BOM = ""; private String isTCM = "";
private String isTCM = "";
public String getIsTCM()
public String getIsTCM() { {
return isTCM; return this.isTCM;
} }
public void setIsTCM(String isTCM) { public void setIsTCM(String isTCM)
this.isTCM = isTCM; {
} this.isTCM = isTCM;
}
public void changeBOMStatus() throws TCException {
if (KUtil.isEmpty(status_BOM) || "Íê³É".equals(status_BOM)) { public void changeBOMStatus()
status_BOM = "δÍê³É"; throws TCException
} else { {
status_BOM = "Íê³É"; if ((KUtil.isEmpty(this.status_BOM)) || ("Íê³É".equals(this.status_BOM))) {
} this.status_BOM = "δÍê³É";
} else {
rev.setProperty("zt2_WebNo", status_BOM); this.status_BOM = "Íê³É";
}
// System.out.println("status_BOM:"+status_BOM); this.rev.setProperty("zt2_WebNo", this.status_BOM);
} }
public DYStandardBomBean(TCComponentItemRevision rev, TCComponentBOMLine line, int index) { public DYStandardBomBean(TCComponentItemRevision rev, TCComponentBOMLine line, int index)
this.rev = rev; {
this.index = index; this.rev = rev;
// try { this.line = line;
// status_BOM = rev.getProperty("zt2_WebNo"); this.index = index;
// } catch (TCException e) { }
// e.printStackTrace();
// } public void getFactoryNo()
{
} if (this.factoryIDs.size() > 0) {
this.factoryID = ZYFactoryUtil.getFactory(this.factoryIDs, 4);
public void getFactoryNo() { }
if (factoryIDs.size() > 0) { }
factoryID = ZYFactoryUtil.getFactory(factoryIDs, 4);
} public String toString()
{
} if ("Íê³É".equals(this.status_BOM))
{
/* String text = "";
* public DYStandardBomBean getClone() { DYStandardBomBean bean = new if (KUtil.isEmpty(this.factoryID)) {
* DYStandardBomBean(rev, line, index); bean.setChildren(children); text = this.status_BOM + " " + this.rev.toString();
* bean.setFactoryIDs(factoryIDs); bean.status_BOM = status_BOM; return bean; } } else {
*/ text = this.status_BOM + " " + this.rev.toString() + " (" + this.factoryID + ")";
}
@Override return KUtil.getRedText(text);
public String toString() { }
if (KUtil.isEmpty(this.factoryID)) {
if ("Íê³É".equals(status_BOM)) { return this.status_BOM + " " + this.rev.toString();
}
String text = ""; return this.status_BOM + " " + this.rev.toString() + " (" + this.factoryID + ")";
if (KUtil.isEmpty(factoryID)) { }
text = status_BOM + " " + rev.toString();
} else { public List<DYStandardBomBean> getChildren()
text = status_BOM + " " + rev.toString() + " (" + factoryID + ")"; {
} return this.children;
return KUtil.getRedText(text); }
} else {
if (KUtil.isEmpty(factoryID)) { public void setChildren(List<DYStandardBomBean> children)
return status_BOM + " " + rev.toString(); {
} else { this.children = children;
return status_BOM + " " + rev.toString() + " (" + factoryID + ")"; }
}
} public int getIndex()
} {
return this.index;
public List<DYStandardBomBean> getChildren() { }
return children;
} public void setIndex(int index)
{
public void setChildren(List<DYStandardBomBean> children) { this.index = index;
this.children = children; }
}
public TCComponentItemRevision getRev()
public int getIndex() { {
return index; return this.rev;
} }
public void setIndex(int index) { public void setRev(TCComponentItemRevision rev)
this.index = index; {
} this.rev = rev;
}
public TCComponentItemRevision getRev() {
return rev; public List<TCComponent> getFactoryNos()
} {
return this.factoryNos;
public void setRev(TCComponentItemRevision rev) { }
this.rev = rev;
} public void setFactoryNos(List<TCComponent> factoryNos)
{
public List<TCComponent> getFactoryNos() { this.factoryNos = factoryNos;
return factoryNos; }
}
public List<String> getFactoryIDs()
public void setFactoryNos(List<TCComponent> factoryNos) { {
this.factoryNos = factoryNos; return this.factoryIDs;
} }
public List<String> getFactoryIDs() { public void setFactoryIDs(List<String> factoryIDs)
return factoryIDs; {
} this.factoryIDs = factoryIDs;
}
public void setFactoryIDs(List<String> factoryIDs) {
this.factoryIDs = factoryIDs; public void addFactoryID(String factoryID)
} {
if (!this.factoryIDs.contains(factoryID)) {
public void addFactoryID(String factoryID) { this.factoryIDs.add(factoryID);
if (!factoryIDs.contains(factoryID)) { }
factoryIDs.add(factoryID); }
}
} public String getStatus_BOM()
{
public String getStatus_BOM() { return this.status_BOM;
return status_BOM; }
}
public void setStatus_BOM(String status_BOM)
public void setStatus_BOM(String status_BOM) { {
this.status_BOM = status_BOM; this.status_BOM = status_BOM;
} }
public TCComponentBOMLine getLine()
{
return this.line;
}
public void setLine(TCComponentBOMLine line)
{
this.line = line;
}
} }

Loading…
Cancel
Save