1、“物料请购SAP”功能成功后需发送飞书通知

2、编码申请功能查询时由搜索名称改成搜索物料号,后加*,前不需要加*
3、项目管理功能项目创建过程中,不允许关闭整个界面
pull/1/head
李冬阳 1 year ago
parent 68609b09fa
commit 8fce7bab0f

@ -32,10 +32,7 @@
<classpathentry kind="lib" path="soalib/S8SoaCustServerLoose_11000.2.0.jar"/>
<classpathentry kind="lib" path="soalib/S8SoaCustServerTypes_11000.2.0.jar"/>
<classpathentry kind="lib" path="lib/json-org.jar" sourcepath="C:/Users/86183/AppData/Local/Temp/.org.sf.feeling.decompiler1655087337931/source/json-20160212-sources.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaCoreStrong_10000.1.0.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaCoreTypes_10000.1.0.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaClient_10000.1.0.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaStrongModel_10000.1.0.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaStructureManagementStrong_10000.1.0.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaStructureManagementTypes_10000.1.0.jar"/>
<classpathentry kind="lib" path="soalib/TcSoaBomStrong_10000.1.0.jar"/>

@ -76,7 +76,9 @@ Bundle-ClassPath: .,
lib/swingx-1.6.1.jar,
lib/mysql-connector-java-8.0.12.jar,
poi/okhttp-2.7.4.jar,
poi/okio-1.13.0.jar
poi/okio-1.13.0.jar,
lib/json-org.jar,
lib/commons-dbcp2-2.8.0.jar
Export-Package: com.connor.chint.sap2,
com.connor.chint.sap2.assignfactoryno,
com.connor.chint.sap2.bombuilder,

@ -30,7 +30,8 @@ bin.includes = plugin.xml,\
lib/swingx-1.6.1.jar,\
lib/mysql-connector-java-8.0.12.jar,\
poi/okhttp-2.7.4.jar,\
poi/okio-1.13.0.jar
poi/okio-1.13.0.jar,\
lib/json-org.jar
src.includes = icons/,\
poi/jacob-1.20-x64.dll,\
poi/jacob-1.20-x86.dll,\

@ -25,7 +25,6 @@ import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentContextList;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
@ -50,11 +49,11 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
List<DT_BOM_PLM_REQLIST> list = new ArrayList<>();
List<DT_PROCESSROUTE_S4_REQLIST> proclist = new ArrayList<>();
String now;
private String txtName;
// private String txtName;
private String txtPath;
public WLQGSAPOperation(AbstractAIFApplication app) {
// TODO Auto-generated constructor stub
// Auto-generated constructor stub
session = (TCSession) app.getSession();
this.app = app;
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
@ -74,7 +73,7 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
@Override
public void executeOperation() throws Exception {
// TODO Auto-generated method stub
// Auto-generated method stub
MyProgressBarCompent pb = null;
try {
InterfaceAIFComponent target = app.getTargetComponent();// 必须选中版本
@ -95,9 +94,9 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
if(!groupID.equals("M060")){
TCComponent[] cjbhs = ((TCComponent) target).getRelatedComponents("ZT2_FactoryNumber");
for (int i = 0; i < cjbhs.length; i++) {
TCComponent zzt = null;
// TCComponent zzt = null;
Map<TCComponentItem, List<TCComponentItemRevision>> items2 = new HashMap<TCComponentItem, List<TCComponentItemRevision>>();
String type = cjbhs[i].getType();
// String type = cjbhs[i].getType();
TXTUtil.writeTXT(txtPath, "出厂编号[" + cjbhs[i] + "]");
AIFComponentContext[] refs = cjbhs[i].whereReferencedByTypeRelation(null, null);
boolean flag = false;
@ -108,7 +107,7 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
if (comp.getType().equals("ZT2_Design3DRevision")) {
String name = comp.getProperty("object_name");
if (name.contains("总装")) {
zzt = comp;
// zzt = comp;
String sap_state = comp.getProperty("zt2_SapState");
TXTUtil.writeTXT(txtPath, "总装图[" + comp + "]SAP状态:[" + sap_state + "]");
if (sap_state.equals("已传")) {
@ -118,7 +117,7 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
}
}
} else if (comp.getType().equals("Part Revision")) {
String name = comp.getProperty("object_name");
// String name = comp.getProperty("object_name");
TCComponentItem item = ((TCComponentItemRevision) comp).getItem();
if (items2.containsKey(item)) {
items2.get(item).add((TCComponentItemRevision) comp);
@ -223,7 +222,7 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
}
}
// 变压器和配电需要通知
if (groupID.equals("M005") || groupID.equals("M007")) {
if (groupID.equals("M060") || groupID.equals("M005") || groupID.equals("M007")) {//TODO
if (!KUtil.isEmpty(zt2_WBSNo)) {
Map<String, String> fields = new HashMap<String, String>();
fields.put("WBS号", zt2_WBSNo);
@ -236,7 +235,14 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
String txtPath = TXTUtil.createTxt("物料请购AM推送记录" + sdf.format(new Date()));
String currentUser = session.getUser().getProperty("user_name");
// String design_user= user.getProperty("user_name");
SAPUtil.sendWLQGAM8("", project, session, parts, currentUser, txtPath);
String type = "";
if (groupID.equals("M060"))
type = ((TCComponent) target).getType();
if(type.equals("ZT2_MainMatRevision"))
type = "Ö÷²Ä";
else if(type.equals("ZT2_RequisitionRevision"))
type = "ÌáǰÇ빺×é¼þ";
SAPUtil.sendWLQGAM8("", project, session, parts, currentUser, txtPath, type);
}
}
@ -262,7 +268,7 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
try {
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(itemR.getItem(), itemR, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
return componentbomline;
@ -415,10 +421,10 @@ public class WLQGSAPOperation extends AbstractAIFOperation {
}
}
private List<TCComponentItemRevision> getMaterial(TCComponent factoryNo) {
return null;
}
// private List<TCComponentItemRevision> getMaterial(TCComponent factoryNo) {
//
// return null;
// }
private void addLastRevisions(Map<TCComponentItem, List<TCComponentItemRevision>> items,
List<TCComponentItemRevision> cParts) throws TCException {

@ -17,7 +17,7 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.lang.reflect.InvocationTargetException;
import java.awt.event.WindowEvent;
import java.math.BigDecimal;
import java.text.Collator;
import java.util.ArrayList;
@ -44,8 +44,6 @@ import javax.swing.JTree;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeWillExpandListener;
@ -54,20 +52,15 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.TreePath;
import org.jgraph.JGraph;
import com.chint.plm.getGCTH.ProcessBarDialog;
import com.connor.chint.sap2.projcreate_formal.ConfirmDialog;
import com.connor.chint.sap2.projcreate_formal.TaskBean;
import com.connor.chint.sap2.projcreate_temp.TempProjCreateDialog;
import com.connor.chint.sap2.util.ConfirmDialogUtil;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent;
import com.connor.chint.sap2.util.POIUtil;
import com.connor.chint.sap2.util.ProgressBar;
import com.connor.chint.sap2.util.SqlUtil;
import com.connor.chint.sap2.util.ZYFactoryUtil;
import com.oracle.webservices.internal.api.databinding.Databinding.Builder;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCComponent;
@ -80,7 +73,11 @@ import com.teamcenter.rac.kernel.TCSession;
public class ProjectTestDialog extends AbstractAIFDialog {
private AbstractAIFApplication app;
/**
*
*/
private static final long serialVersionUID = 1L;
// private AbstractAIFApplication app;
private TCSession session;
protected TCComponent target = null;
@ -107,18 +104,18 @@ public class ProjectTestDialog extends AbstractAIFDialog {
protected HashMap<String, String> templateType = new HashMap<String, String>();
protected String groupID = "";
private ProjectBean projectBean = null;
// private ProjectBean projectBean = null;
private ProjectTestController controller;
protected Map<ProjectBean, List<WBSBean>> pro_wbs = new HashMap<ProjectBean, List<WBSBean>>(10);
protected Map<WBSBean, List<NetworkBean>> wbs_nets = new HashMap<WBSBean, List<NetworkBean>>(10);
protected List<CheckBoxTreeNode> selectNodes = new ArrayList<CheckBoxTreeNode>();
private Map<String, Integer> map_product_number = new HashMap<String, Integer>();
// private Map<String, Integer> map_product_number = new HashMap<String, Integer>();
private List<String> groupList = new ArrayList<String>();
private Map<String, ProductTotolBean> map_products = new HashMap<>();
public ProjectTestDialog(AbstractAIFApplication app) {
super(false);
this.app = app;
// this.app = app;
this.session = (TCSession) app.getSession();
this.controller = new ProjectTestController(app, this);
if (app.getTargetComponent() != null) {
@ -135,7 +132,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
return;
}
String prefs = session.getPreferenceService().getStringValue("CHINT_PROJECTCREATE");
if(prefs!=null) {
if(prefs != null) {
String[] split = prefs.split(";");
groupList = Arrays.asList(split);
System.out.println("groupList==>"+groupList.toString());
@ -146,7 +143,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
initData();
showDialog();
} catch (Exception e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
KUtil.error(this, "发生异常:" + e.getMessage());
} finally {
@ -172,6 +169,17 @@ public class ProjectTestDialog extends AbstractAIFDialog {
return name;
}
@Override
protected void processWindowEvent(WindowEvent e) {
if(e.getID() == WindowEvent.WINDOW_CLOSING) {
if(!isColsed) {//项目创建过程中,不允许关闭整个界面
return;
}
}
super.processWindowEvent(e);
}
protected void setCompEnabled(boolean b) {
b_cancel.setEnabled(b);
b_ok.setEnabled(b);
@ -183,6 +191,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
jf_proName.setEnabled(b);
b_update.setEnabled(b);
jcheck_Colsed.setEnabled(b);
isColsed = b;
}
private void addListeners() {
@ -242,7 +251,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
try {
pj.readPartsAndTasks();
} catch (Exception e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
}finally {
progress.close();
@ -341,7 +350,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
@Override
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
// TODO Auto-generated method stub
// Auto-generated method stub
}
});
@ -391,7 +400,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
@Override
public void mouseDragged(MouseEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
mouseMoved(e);
}
});
@ -437,13 +446,13 @@ public class ProjectTestDialog extends AbstractAIFDialog {
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
// int code = e.getKeyCode();
if (e.isControlDown() || e.isShiftDown()) {
TreePath[] paths = tree.getSelectionPaths();
if (paths != null) {
for (TreePath path : paths) {
CheckBoxTreeNode node = (CheckBoxTreeNode) path.getLastPathComponent();
int depth = node.getDepth();
// int depth = node.getDepth();
if (node != null) {
tree.setInvokesStopCellEditing(false);
// if (depth == 1 || depth == 2) {
@ -462,7 +471,6 @@ public class ProjectTestDialog extends AbstractAIFDialog {
}
}
}
}
}
}
@ -524,15 +532,13 @@ public class ProjectTestDialog extends AbstractAIFDialog {
});
b_ok.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
// Auto-generated method stub
setCompEnabled(false);
ProgressBar pb = new ProgressBar(ProjectTestDialog.this, new Dimension(250, 50));
try {
@ -551,10 +557,9 @@ public class ProjectTestDialog extends AbstractAIFDialog {
}
if (list.size() > 0) {
Collections.sort(list, new Comparator<ProductTotolBean>() {
@Override
public int compare(ProductTotolBean o1, ProductTotolBean o2) {
// TODO Auto-generated method stub
// Auto-generated method stub
if (o1.getWbsNo().equals(o2.getWbsNo())) {
Collator instance = Collator.getInstance(Locale.CHINA);
return instance.compare(o1.getProduct_name(), o2.getProduct_name());
@ -567,7 +572,6 @@ public class ProjectTestDialog extends AbstractAIFDialog {
setCompEnabled(true);
return;
}
}
KUtil.setByPass(true);
String strPro = (String) cb_template.getSelectedItem();
@ -611,10 +615,8 @@ public class ProjectTestDialog extends AbstractAIFDialog {
topNode.remove(projNode);
}
}
}
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
tree.updateUI();
@ -629,9 +631,9 @@ public class ProjectTestDialog extends AbstractAIFDialog {
pb.disposeDialog();
KUtil.error(ProjectTestDialog.this, "创建项目出错:" + e2.getMessage());
}
setCompEnabled(true);
}
}).start();
}
});
@ -711,19 +713,19 @@ public class ProjectTestDialog extends AbstractAIFDialog {
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
if (e.getKeyChar() == KeyEvent.VK_ENTER) // 按回车键执行相应操作;
{
b_query.doClick();
@ -735,19 +737,19 @@ public class ProjectTestDialog extends AbstractAIFDialog {
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
if (e.getKeyChar() == KeyEvent.VK_ENTER) // 按回车键执行相应操作;
{
b_query.doClick();
@ -759,7 +761,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
@Override
public void itemStateChanged(ItemEvent e) {
isColsed = jcheck_Colsed.isSelected();
// isColsed = jcheck_Colsed.isSelected();
}
});
@ -833,7 +835,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
this.topNode = new CheckBoxTreeNode("项目");
this.tree = new JTree(topNode);
Color color = new Color(255, 247, 145);
// Color color = new Color(255, 247, 145);
// tree.setBackground(color);
tree.setEditable(false);
tree.setRootVisible(true);
@ -861,7 +863,8 @@ public class ProjectTestDialog extends AbstractAIFDialog {
}
// 统计产成品
public void getProductCout(CheckBoxTreeNode node) {
/*
private void getProductCout(CheckBoxTreeNode node) {
Object obj = node.getUserObject();
String wbsNo = "";
String product_name = "";
@ -885,7 +888,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
// try {
// networkBean.readPartsAndTasks();
// } catch (Exception e) {
// // TODO Auto-generated catch block
// // Auto-generated catch block
// e.printStackTrace();
// }
// products = networkBean.getProducts();
@ -913,7 +916,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
// try {
// networkBean.readPartsAndTasks();
// } catch (Exception e) {
// // TODO Auto-generated catch block
// // Auto-generated catch block
// e.printStackTrace();
// }
// products = networkBean.getProducts();
@ -944,7 +947,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
// try {
// networkBean.readPartsAndTasks();
// } catch (Exception e) {
// // TODO Auto-generated catch block
// // Auto-generated catch block
// e.printStackTrace();
// }
// products = networkBean.getProducts();
@ -969,7 +972,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
// try {
// networkBean.readPartsAndTasks();
// } catch (Exception e) {
// // TODO Auto-generated catch block
// // Auto-generated catch block
// e.printStackTrace();
// }
// products = networkBean.getProducts();
@ -985,7 +988,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
// }
// }
// }
}
}*/
// 处理数据
private Map<CheckBoxTreeNode, List<CheckBoxTreeNode>> getData() {
@ -1045,7 +1048,7 @@ public class ProjectTestDialog extends AbstractAIFDialog {
try {
networkBean.readPartsAndTasks();
} catch (Exception e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
}
products = networkBean.getProducts();

@ -1,8 +1,6 @@
package com.connor.chint.sap2.sap_zy;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -15,7 +13,6 @@ import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import com.connor.chint.sap2.bean.ApplyCodeFactoryBean;
import com.connor.chint.sap2.sap_gy.GYCodeBean;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil;
@ -50,9 +47,9 @@ public class ZYApplyCodeControllerzt {
protected Vector<CodeBean> p_Applys = new Vector<CodeBean>(); // 待申请
// protected String type = "";
protected String name = "";
private String query_name = "";
// private String query_name = "";
protected TCComponentFolder folder;
private static String QUERY_NAMES[] = { "%一次规范书%", "%二次规范书%", "%结构方案%" };
// private static String QUERY_NAMES[] = { "%一次规范书%", "%二次规范书%", "%结构方案%" };
private static String SQL_QUERY_ALL = "select t.\"CompanyCodeStr\",t.\"GoodsCode\",t.\"GoodsName\",t.\"GoodsBpNo\","
+ "t.\"GoodsFullInfo\",t.\"GoodsTeRe\",t.\"GoodsUnitCode\",t.\"GoodsPmpcCode\" from CHINT_XBFAH t where ";
@ -68,12 +65,12 @@ public class ZYApplyCodeControllerzt {
private List<TCComponentItemRevision> revs = new ArrayList<TCComponentItemRevision>();
private String txtPath;
private String txtName;
// private String txtName;
Map<String,String> getFolders;
// private List<ApplyCodeFactoryBean> code_factoryNos = new ArrayList<>();
public ZYApplyCodeControllerzt(ZYApplyCodeDialogzt dialog, AbstractAIFApplication app, String actionInfo,Map<String,String> folders) {
// TODO Auto-generated constructor stub
// Auto-generated constructor stub
this.app = app;
this.dialog = dialog;
this.session = (TCSession) app.getSession();
@ -100,15 +97,14 @@ public class ZYApplyCodeControllerzt {
// }
}
@SuppressWarnings("deprecation")
public void syn() throws Exception {
TXTUtil.writeTXT(txtPath, "开始同步wbs号");
for (int i = 0; i < revs.size(); i++) {
TCComponentItemRevision rev = revs.get(i);
TXTUtil.writeTXT(txtPath, "->" + rev);
rev.lock();
rev.setProperty("zt2_WBSNo", wbsNo);
rev.save();
rev.unlock();
}
TXTUtil.writeTXT(txtPath, "同步结束");
// isAllHave = true;
@ -172,20 +168,20 @@ public class ZYApplyCodeControllerzt {
return false;
}
public boolean checkTargets(String nameLab, String code) throws Exception {
protected boolean checkTargets(String nameLab, String mtCode, String code) throws Exception {
if(nameLab.contains("一次")) {
type = FOLDER_NAME[0];
name = PART_NAME[0];
query_name = QUERY_NAMES[0];
// query_name = QUERY_NAMES[0];
}else if(nameLab.contains("二次")) {
type = FOLDER_NAME[1];
name = PART_NAME[1];
query_name = QUERY_NAMES[1];
// query_name = QUERY_NAMES[1];
}else if(nameLab.contains("结构方案")) {
type = FOLDER_NAME[2];
name = PART_NAME[2];
query_name = QUERY_NAMES[2];
// query_name = QUERY_NAMES[2];
}
// String foldName = getFolders.get(nameLab);
if(nameLab.contains("-")) {
@ -199,7 +195,9 @@ public class ZYApplyCodeControllerzt {
Map<String, String> field = new HashMap<String, String>();
field.clear();
// String[] split = name.split("-");
field.put("名称", "*"+name + "*");
//查询时由搜索名称改成搜索物料号,后加*,前不需要加*
//field.put("名称", "*"+name + "*");
field.put("materialno", mtCode + "*");
field.put("WBS号", wbsNo);
@ -421,6 +419,7 @@ public class ZYApplyCodeControllerzt {
//
// }
@SuppressWarnings("deprecation")
public void applyPart(CodeBean bean) throws TCException {
TCComponentItem item = null;
@ -443,17 +442,13 @@ public class ZYApplyCodeControllerzt {
rev_props.put("zt2_ClassificationCode", bean.getPmpcCode());
item = itemType.create(autoID, "A", "Part", object_name, null, null);
rev = item.getLatestItemRevision();
item.lock();
item.setProperties(item_props);
rev.lock();
rev.setProperties(rev_props);
rev.save();
item.save();
rev.unlock();
item.unlock();
bean.setRev(rev);
TCComponentUser user = session.getUser();
TCComponent target = (TCComponent) app.getTargetComponent();
// TCComponent target = (TCComponent) app.getTargetComponent();
//
if (folder == null) {
@ -466,6 +461,7 @@ public class ZYApplyCodeControllerzt {
}
// 新的方案编码申请
@SuppressWarnings("deprecation")
public void applyPart(CodeBean bean, List<TCComponentItemRevision> ccpIsUpdate, List<CodeBean> codeBeans)
throws TCException {
@ -489,14 +485,10 @@ public class ZYApplyCodeControllerzt {
rev_props.put("zt2_WBSNo", wbsNo);
rev_props.put("zt2_ClassificationCode", bean.getPmpcCode());
rev = item.getLatestItemRevision();
item.lock();
item.setProperties(item_props);
rev.lock();
rev.setProperties(rev_props);
rev.save();
item.save();
rev.unlock();
item.unlock();
bean.setRev(rev);
TCComponentUser user = session.getUser();
if (bean.folder == null) {
@ -505,7 +497,7 @@ public class ZYApplyCodeControllerzt {
} else {
bean.folder.add("contents", item);
}
TCComponent target = (TCComponent) app.getTargetComponent();
// TCComponent target = (TCComponent) app.getTargetComponent();
List<TCComponent> factosyNos = new ArrayList<>();
for (CodeBean codeBean : codeBeans) {
@ -658,8 +650,8 @@ public class ZYApplyCodeControllerzt {
}
return zt2_MaterialNo.compareTo(zt2_MaterialNo2);
} catch (TCException e) {
// TODO Auto-generated catch block
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
}

@ -49,9 +49,9 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
*
*/
private static final long serialVersionUID = 1L;
private AbstractAIFApplication app;
// private AbstractAIFApplication app;
private ZYApplyCodeControllerzt controller;
private CheckBoxTableHeaderRenderer tableHeaderRenderer;
// private CheckBoxTableHeaderRenderer tableHeaderRenderer;
private JButton addBtn;
private JButton removeBtn;
@ -98,10 +98,10 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
protected List<ApplyCodeFactoryBean> factoryNosIsAPPLY = new ArrayList<ApplyCodeFactoryBean>();
private TCSession session;
public ZYApplyCodeDialogzt(AbstractAIFApplication app, String actionInfo,ApplyMeBean bean) {
// TODO Auto-generated constructor stub
// Auto-generated constructor stub
super(false);
KUtil.setByPass(true);
this.app = app;
// this.app = app;
this.session = (TCSession) app.getSession();
this.controller = new ZYApplyCodeControllerzt(this, app, actionInfo,bean.getFolders());
@ -112,7 +112,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
@Override
public void run() {
// TODO Auto-generated method stub
// Auto-generated method stub
try {
if (!controller.checkProject()) {
MessageBox.post(this, "请选择项目文件夹对象", "", MessageBox.INFORMATION);
@ -149,13 +149,13 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
@Override
public void itemStateChanged(ItemEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
if (e.getStateChange() == ItemEvent.SELECTED) {
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
// Auto-generated method stub
String val = (String) jcm_types.getSelectedItem();
@ -165,7 +165,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
return;
}
} catch (Exception e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
}
if (!KUtil.isEmpty(val)) {
@ -176,7 +176,8 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
model4.removeAllElements();
String code = codes.get(val);
try {
controller.checkTargets(val, code);
//查询时由搜索名称改成搜索物料号,后加*,前不需要加*
controller.checkTargets(val, bean.getCodes().get(val), code);
for (int i = 0; i < apply_lists.size(); i++) {
model4.addElement(apply_lists.get(i));
}
@ -188,7 +189,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
list_jl2.addAll(controller.h_Applys);
list_jl4.addAll(apply_lists);
} catch (Exception e1) {
// TODO Auto-generated catch block
// Auto-generated catch block
MessageBox.post("获取方案编码时发生异常:" + e1.getMessage(), "", MessageBox.INFORMATION);
e1.printStackTrace();
}
@ -207,7 +208,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
try {
KUtil.setByPass(true);
controller.syn();
@ -298,7 +299,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
} catch (Exception e1) {
// TODO: handle exception
// : handle exception
e1.printStackTrace();
}
}
@ -422,7 +423,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
}
} catch (Exception e1) {
// TODO: handle exception
// : handle exception
e1.printStackTrace();
}
}
@ -432,7 +433,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
@Override
public void actionPerformed(ActionEvent e) {
int sels[] = jl3.getSelectedIndices();
boolean flag = false;
// boolean flag = false;
for (int i = sels.length - 1; i > -1; i--) {
CodeBean cloneBean = model3.get(sels[i]);
// 需要加入到可申请物料里的codeBean
@ -440,7 +441,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
ApplyCodeFactoryBean applyCodeBean = cloneBean.getApplyCodeBean();
if (applyCodeBean != null) {
factoryNosIsAPPLY.add(applyCodeBean);
flag = true;
// flag = true;
// tm_part.addRow(applyCodeBean.getRowData());
}
@ -485,13 +486,13 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
// Auto-generated method stub
MyProgressBarCompent my = null;
try {
if (model3.getSize() == 0) {
@ -543,7 +544,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
} catch (Exception e1) {
KUtil.setByPass(false);
my.setVisible(false);
// TODO Auto-generated catch block
// Auto-generated catch block
e1.printStackTrace();
MessageBox.post("方案生成异常:" + e1.getMessage(), "", MessageBox.INFORMATION);
}
@ -619,7 +620,7 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
// factoryNosIsAPPLY.removeAll(selects);
} catch (Exception e1) {
// TODO Auto-generated catch block
// Auto-generated catch block
e1.printStackTrace();
}
@ -847,8 +848,8 @@ public class ZYApplyCodeDialogzt extends AbstractAIFDialog {
JScrollPane scroll = new JScrollPane(t_part);
panel.add(BorderLayout.CENTER, scroll);
panel.setBorder(BorderFactory.createLoweredBevelBorder());
this.t_part.getTableHeader()
.setDefaultRenderer(this.tableHeaderRenderer = new CheckBoxTableHeaderRenderer(t_part, 0, false));
//this.tableHeaderRenderer =
this.t_part.getTableHeader().setDefaultRenderer(new CheckBoxTableHeaderRenderer(t_part, 0, false));
this.t_part.getTableHeader().setBackground(Color.blue);
return panel;
}

@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
import com.connor.chint.sap2.proc_by.BomBean;
import com.connor.chint.sap2.proc_by.BYProcBean;
import com.teamcenter.clientx.Session;
//import com.teamcenter.clientx.Session;
import com.teamcenter.rac.aif.AIFPortal;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
@ -126,9 +126,9 @@ import com.teamcenter.services.rac.workflow.WorkflowService;
import com.teamcenter.services.rac.workflow._2008_06.Workflow.ContextData;
import com.teamcenter.services.rac.workflow._2008_06.Workflow.InstanceInfo;
import com.teamcenter.soa.client.Connection;
import com.teamcenter.soa.client.model.strong.ItemRevision;
import com.teamcenter.soa.client.model.strong.User;
import com.teamcenter.soa.client.model.strong.WorkspaceObject;
//import com.teamcenter.soa.client.model.strong.ItemRevision;
//import com.teamcenter.soa.client.model.strong.User;
//import com.teamcenter.soa.client.model.strong.WorkspaceObject;
import com.teamcenter.soa.internal.client.Sender;
import com.teamcenter.soa.internal.client.model.PopulateModel;
import com.teamcenter.soa.internal.common.Monitor;

@ -3,7 +3,6 @@ package com.connor.chint.sap2.util;
import java.io.IOException;
import java.rmi.RemoteException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -52,10 +51,7 @@ import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCComponentListOfValues;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
import com.teamcenter.rac.kernel.TCComponentType;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
@ -251,7 +247,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
Map<String, ExpandPSData[]> bomLineTree2 = BomToSapUtil.getBomLineTreeNodeSOA(componentbomline);
@ -930,7 +926,7 @@ public class SAPUtil {
// 事业部发易发通知
public static void sendWLQGAM8(String ban, TCComponent project, TCSession session,
List<TCComponentItemRevision> revs, String design_user, String logPath) throws Exception {
List<TCComponentItemRevision> revs, String design_user, String logPath, String target) throws Exception {
long time0 = System.currentTimeMillis();
String groupID = SAPUtil.getGroupID(session);
String[] prefs = ChintPreferenceUtil.getPreferences(ChintPreferenceUtil.CHINT_Notify, session);
@ -976,9 +972,11 @@ public class SAPUtil {
});
List<String> isSend = new ArrayList<>();
String object_string = "";
String name = "";
String zt2_WBSNo = "";
if (project != null) {
object_string = project.getProperty("object_string");
name = project.getProperty("object_name");
zt2_WBSNo = project.getProperty("zt2_WBSNo");
}
@ -1007,8 +1005,16 @@ public class SAPUtil {
if (KUtil.isEmpty(ban)) {
if (map_type_users.size() == 0) {
if(groupID.equals("M060")) {//TODO
mess.append(zt2_WBSNo).append("-").append(name).append("的").append(target).append("BOM已成功传到SAP系统产成品信息为");
for(TCComponentItemRevision rev : revs) {
mess.append(rev.getProperty("object_string")).append(";");
}
mess.deleteCharAt(mess.length() - 1).append("。");
}else {
mess.append(object_string).append(" 的 ").append(" 物料提前请购单已传递到SAP,请及时处理! WBS:");
mess.append(zt2_WBSNo).append(";设计员:").append(design_user).append("。");
}
userIDs.append(user_else.get(0));
} else {
Map<String, String> user_message = new HashMap<String, String>();
@ -1291,7 +1297,7 @@ public class SAPUtil {
throws Exception {
double res = 0;
double dw = rev.getDoubleProperty("zt2_DesignWeight");
// TODO
//
String lylStr = KUtil.getICSProperty(material, codeMark, "材料利用率");
double lyl = -1;
System.out.println("计算组件用量:" + dw + "/" + lylStr);
@ -1315,7 +1321,7 @@ public class SAPUtil {
throws Exception {
double res = 0;
double dw = rev.getDoubleProperty("zt2_DesignWeight");
// TODO
//
String lylStr = KUtil.getICSProperty(material, codeMark, "材料利用率");
double lyl = -1;
System.out.println("计算组件用量:" + dw + "/" + lylStr);
@ -1340,7 +1346,7 @@ public class SAPUtil {
if (KUtil.isEmpty(zt2_MaterialNorm))
return String.format("%.3f", res);
double dw = Double.parseDouble(zt2_MaterialNorm);
// TODO
//
String lylStr = KUtil.getICSProperty(material, codeMark, "材料利用率");
double lyl = -1;
System.out.println("计算组件用量:" + dw + "/" + lylStr);
@ -1366,7 +1372,7 @@ public class SAPUtil {
// System.out.println("zt2_zt2_DesignWeight=["+zt2_zt2_DesignWeight+"]");
double dw = Double.parseDouble(zt2_zt2_DesignWeight);
// TODO
//
// String lylStr = "";
// if(codeMark.contains("DB")) {
//
@ -1399,7 +1405,7 @@ public class SAPUtil {
// System.out.println("zt2_zt2_DesignWeight=["+zt2_zt2_DesignWeight+"]");
double dw = Double.parseDouble(zt2_zt2_DesignWeight);
// TODO
//
String lylStr = "";
if(codeMark.contains("DB")) {
@ -1427,7 +1433,7 @@ public class SAPUtil {
throws Exception {
double res = 0;
double dw = Double.parseDouble(zt2_zt2_DesignWeight);
// TODO
//
String lylStr = KUtil.getICSProperty(material, codeMark, "材料利用率");
double lyl = -1;
System.out.println("计算组件用量:" + dw + "/" + lylStr);
@ -1641,12 +1647,12 @@ public class SAPUtil {
bean.setGroupID(groupId);
Map<String,String> codeMap = new HashMap<String,String>();
Map<String,String> folderMap = new HashMap<String,String>();
for(String pref:prefs) { //M033|Y|:9900000135|됴箕뱉렘갭긍쯤<EFBFBD>헝-미땍데禱|든폭<EB93A0>셕;9900000608|됴箕뱉렘갭긍쯤<EAB88D>헝-녜脛데禱|든폭<EB93A0>
for(String pref : prefs) { //M033|Y|:9900000135|低压柜方案编码申请-固定单元|电气设计;9900000608|低压柜方案编码申请-抽屉单元|电气设计
String[] split = pref.split(":");
String grpmes = split[0];
String[] split2 = grpmes.split("\\|");
System.out.println("groupID==>"+split2[0]+"bean"+groupId+"aaa"+split2[0]);
System.out.println("groupID==>" + split2[0] + "bean" + groupId + "aaa" + split2[0]);
if(split2[0].equals(groupId)) {
if(split2[1].equals("Y")) {
bean.setY(true);
@ -1655,10 +1661,10 @@ public class SAPUtil {
}
String codemes = split[1];
String[] codes = codemes.split(";");
System.out.println("codemes==>"+codemes);
for(String code:codes) {
System.out.println("codemes==>" + codemes);
for(String code : codes) {
String[] split3 = code.split("\\|");
if(split3.length==3) {
if(split3.length == 3) {
folderMap.put(split3[1], split3[2]);
}
@ -1712,7 +1718,7 @@ public class SAPUtil {
try {
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(itemR.getItem(), itemR, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
@ -1774,21 +1780,21 @@ public class SAPUtil {
* Collections.sort(materials, new Comparator<InterfaceAIFComponent>() {
*
* @Override public int compare(InterfaceAIFComponent o1, InterfaceAIFComponent
* o2) { // TODO Auto-generated method stub
* o2) { // Auto-generated method stub
*
* try { String zt2_MaterialNo1 = o1.getProperty("zt2_MaterialNo"); String
* zt2_MaterialNo2 = o2.getProperty("zt2_MaterialNo");
* if(zt2_MaterialNo1.startsWith("3")) { return -1; }else
* if(zt2_MaterialNo2.startsWith("3")) { return 1; }
*
* } catch (Exception e) { // TODO Auto-generated catch block
* } catch (Exception e) { // Auto-generated catch block
* e.printStackTrace(); } return 0; }
*
* }); for(int i=0;i<size;i++) { if(KUtil.isTCM((TCComponent) materials.get(i)))
* { return (TCComponentItemRevision) materials.get(i); } } } else {
* sb.append("缺少物料编码[找不到与通用件规格相匹配的物料];"); return null; } } if(parts.size()==1) {
* return parts.get(0); }else { sb.append("\n图纸["+comp+"]存在一图多料"); return
* parts.get(0); } //return pRev; } catch (Exception e) { // TODO Auto-generated
* parts.get(0); } //return pRev; } catch (Exception e) { // Auto-generated
* catch block e.printStackTrace(); } return null; }
*/
@ -1860,7 +1866,7 @@ public class SAPUtil {
Collections.sort(list, new Comparator<Map.Entry<Integer, List<FlowBean>>>() {
@Override
public int compare(Entry<Integer, List<FlowBean>> o1, Entry<Integer, List<FlowBean>> o2) {
// TODO Auto-generated method stub
// Auto-generated method stub
return o2.getKey().intValue() - o1.getKey().intValue();
}
});
@ -2174,7 +2180,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurZYZZSAP(componentbomline, partRev, partRev.getItem(), isStruct, session, level, groupName,
@ -2425,7 +2431,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurDYZZSAP(componentbomline, partRev, partRev.getItem(), isStruct, session, groupName, now,
@ -3093,7 +3099,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurDYGGSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
@ -3248,16 +3254,17 @@ public class SAPUtil {
}
// 指定对象指定所有者
@SuppressWarnings("deprecation")
public static void changeOwner(TCComponent comp, TCComponentUser user) throws TCException {
TCComponentUser o_user = (TCComponentUser) comp.getRelatedComponent("owning_user");
TCComponentGroup group = (TCComponentGroup) user.getRelatedComponent("default_group");
if (o_user != null && o_user.equals(user)) {
return;
}
comp.lock();
// comp.lock();
comp.changeOwner(user, group);
comp.save();
comp.unlock();
// comp.unlock();
}
@ -3703,9 +3710,9 @@ public class SAPUtil {
zt2_MaterialMark);
materials.put(zt2_MaterialMark, yclBean);
TCComponentItemType itemType = (TCComponentItemType) session.getTypeService().getTypeComponent("Item");
TCComponentItem item = itemType.find(materialno);
if(item!=null) {
comp = item.getLatestItemRevision();
TCComponentItem[] item = itemType.findItems(materialno);
if(item != null && item.length > 0) {
comp = item[0].getLatestItemRevision();
by_materials.put(zt2_MaterialMark,comp);
}else {
errMessage.append("tc中查询不到[ID]为[" + materialno + "]的原材料;");
@ -3741,8 +3748,8 @@ public class SAPUtil {
// return (TCComponentItemRevision) comp;
// }
// }
} catch (TCException e) {
// TODO Auto-generated catch block
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
errMessage.append(e.getMessage());
}
@ -3750,7 +3757,7 @@ public class SAPUtil {
}
// 根据材料标记获得物料
@SuppressWarnings("deprecation")
// @SuppressWarnings("deprecation")
public static TCComponentItemRevision getClassPart(TCComponentItemRevision rev, TCSession session,
String codeRemark, int icsId, Map<String, TCComponentItemRevision> by_materials, StringBuffer errMessage, Map<String, YCLMaterialBean> materials) throws Exception {
try {
@ -3761,7 +3768,7 @@ public class SAPUtil {
return null;
}
System.out.println("zt2_MaterialMark=[" + zt2_MaterialMark + "]");
YCLMaterialBean yclBean = null;
// YCLMaterialBean yclBean = null;
// String ycl_MatertialNo = "";
// if (by_materials.containsKey(zt2_MaterialMark)) {
// yclBean = materials.get(zt2_MaterialMark);
@ -3826,8 +3833,8 @@ public class SAPUtil {
return (TCComponentItemRevision) comp;
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
errMessage.append(e.getMessage());
}
@ -3910,7 +3917,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurZYKGSAP(componentbomline, partRev, partRev.getItem(), session, level, groupName, now,
@ -4083,7 +4090,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurBYBJSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
@ -4403,7 +4410,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurBYZZSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
@ -4694,7 +4701,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurZYGGSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
@ -4953,7 +4960,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurZYGGSAPNoProc(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
@ -5190,7 +5197,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurGYZZSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
@ -5348,7 +5355,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(meop.getItem(), meop, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
@ -5412,7 +5419,7 @@ public class SAPUtil {
}
} catch (Exception e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
}
return "";
@ -5426,7 +5433,7 @@ public class SAPUtil {
// try {
// rev = (TCComponentMEProcessRevision) session.stringToComponent(stringValue.replaceAll(groupId+":", ""));
// } catch (TCException e) {
// // TODO Auto-generated catch block
// // Auto-generated catch block
// e.printStackTrace();
// }
// break;
@ -5537,7 +5544,7 @@ public class SAPUtil {
TCComponentBOMWindowType bomWinType;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
win.lock();
// win.lock();
win.setWindowTopLine(partRev.getItem(), partRev, null, null);
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurGYZZSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session,
@ -5788,7 +5795,7 @@ public class SAPUtil {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
}
app = AIFUtility.getCurrentApplication();

@ -1,103 +0,0 @@
package com.teamcenter.clientx;
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException;
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException;
import com.teamcenter.soa.client.CredentialManager;
import com.teamcenter.soa.exceptions.CanceledOperationException;
/**
* The CredentialManager is used by the Teamcenter Services framework to get the
* user's credentials when challanged by the server. This can occur after a
* period of inactivity and the server has timed-out the user's session, at
* which time the client application will need to re-authenitcate. The framework
* will call one of the getCredentials methods (depending on circumstances) and
* will send the SessionService.login service request. Upon successfull
* completion of the login service request. The last service request (one that
* cuased the challange) will be resent.
*
* The framework will also call the setUserPassword setGroupRole methods when
* ever these credentials change, thus allowing this implementation of the
* CredentialManager to cache these values so prompting of the user is not
* requried for re-authentication.
*
*/
public class AppXCredentialManager implements CredentialManager {
private String name = null;
private String password = null;
private String group = ""; // default group
private String role = ""; // default role
private String discriminator = "SoaAppX"; // always connect same user
// to same instance of server
/**
* Return the type of credentials this implementation provides, standard
* (user/password) or Single-Sign-On. In this case Standard credentials are
* returned.
*
* @see com.teamcenter.soa.client.CredentialManager#getCredentialType()
*/
public int getCredentialType() {
return CredentialManager.CLIENT_CREDENTIAL_TYPE_STD;
}
/**
* Prompt's the user for credentials. This method will only be called by the
* framework when a login attempt has failed.
*
* @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException)
*/
public String[] getCredentials(InvalidCredentialsException e) throws CanceledOperationException {
System.out.println(e.getMessage());
return promptForCredentials(name, password);
}
/**
* Return the cached credentials. This method will be called when a service
* request is sent without a valid session ( session has expired on the server).
*
* @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException)
*/
public String[] getCredentials(InvalidUserException e) throws CanceledOperationException {
// Have not logged in yet, shoult not happen but just in case
if (name == null)
return promptForCredentials(name, password);
// Return cached credentials
String[] tokens = { name, password, group, role, discriminator };
return tokens;
}
/**
* Cache the group and role This is called after the
* SessionService.setSessionGroupMember service operation is called.
*
* @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String,
* java.lang.String)
*/
public void setGroupRole(String group, String role) {
this.group = group;
this.role = role;
}
/**
* Cache the User and Password This is called after the SessionService.login
* service operation is called.
*
* @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String,
* java.lang.String, java.lang.String)
*/
public void setUserPassword(String user, String password, String discriminator) {
this.name = user;
this.password = password;
this.discriminator = discriminator;
}
public String[] promptForCredentials(String user, String pw) throws CanceledOperationException {
name = user;
password = pw;
String[] tokens = { name, password, group, role, discriminator };
return tokens;
}
}

@ -1,27 +0,0 @@
package com.teamcenter.clientx;
import com.teamcenter.soa.client.model.DeleteListener;
/**
* Implementation of the DeleteListener, simply prints out list of all objects
* that are deleted.
*
*/
public class AppXDeletedObjectListener implements DeleteListener {
public void modelObjectDelete(String[] uids) {
if (uids.length == 0)
return;
System.out.println("");
System.out.println(
"Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete");
System.out.println(
"The following objects have been deleted from the server and removed from the client data model:");
for (int i = 0; i < uids.length; i++) {
System.out.println(" " + uids[i]);
}
}
}

@ -1,89 +0,0 @@
package com.teamcenter.clientx;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import com.teamcenter.schemas.soa._2006_03.exceptions.ConnectionException;
import com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException;
import com.teamcenter.schemas.soa._2006_03.exceptions.ProtocolException;
import com.teamcenter.soa.client.ExceptionHandler;
import com.teamcenter.soa.exceptions.CanceledOperationException;
/**
* Implementation of the ExceptionHandler. For ConnectionExceptions (server
* temporarily down .etc) prompts the user to retry the last request. For other
* exceptions convert to a RunTime exception.
*/
public class AppXExceptionHandler implements ExceptionHandler {
/*
* (non-Javadoc)
*
* @see
* com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.
* schemas.soa._2006_03.exceptions.InternalServerException)
*/
public void handleException(InternalServerException ise) {
System.out.println("");
System.out.println("*****");
System.out.println(
"Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException).");
LineNumberReader reader = new LineNumberReader(new InputStreamReader(System.in));
if (ise instanceof ConnectionException) {
// ConnectionException are typically due to a network error (server
// down .etc) and can be recovered from (the last request can be sent again,
// after the problem is corrected).
System.out.print("\nThe server returned an connection error.\n" + ise.getMessage()
+ "\nDo you wish to retry the last service request?[y/n]");
} else if (ise instanceof ProtocolException) {
// ProtocolException are typically due to programming errors
// (content of HTTP
// request is incorrect). These are generally can not be
// recovered from.
System.out.print("\nThe server returned an protocol error.\n" + ise.getMessage()
+ "\nThis is most likely the result of a programming error."
+ "\nDo you wish to retry the last service request?[y/n]");
} else {
System.out.println("\nThe server returned an internal server error.\n" + ise.getMessage()
+ "\nThis is most likely the result of a programming error."
+ "\nA RuntimeException will be thrown.");
throw new RuntimeException(ise.getMessage());
}
try {
String retry = reader.readLine();
// If yes, return to the calling SOA client framework, where the
// last service request will be resent.
if (retry.equalsIgnoreCase("y") || retry.equalsIgnoreCase("yes"))
return;
throw new RuntimeException("The user has opted not to retry the last request");
} catch (IOException e) {
System.err.println("Failed to read user response.\nA RuntimeException will be thrown.");
throw new RuntimeException(e.getMessage());
}
}
/*
* (non-Javadoc)
*
* @see
* com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa
* .exceptions.CanceledOperationException)
*/
public void handleException(CanceledOperationException coe) {
System.out.println("");
System.out.println("*****");
System.out.println(
"Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException).");
// Expecting this from the login tests with bad credentials, and the
// AnyUserCredentials class not
// prompting for different credentials
throw new RuntimeException(coe);
}
}

@ -1,51 +0,0 @@
package com.teamcenter.clientx;
import com.teamcenter.soa.client.model.ErrorStack;
import com.teamcenter.soa.client.model.ErrorValue;
import com.teamcenter.soa.client.model.PartialErrorListener;
/**
* Implementation of the PartialErrorListener. Print out any partial errors
* returned.
*
*/
public class AppXPartialErrorListener implements PartialErrorListener {
/*
* (non-Javadoc)
*
* @see
* com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.
* teamcenter.soa.client.model.ErrorStack[])
*/
public void handlePartialError(ErrorStack[] stacks) {
if (stacks.length == 0)
return;
System.out.println("");
System.out.println("*****");
System.out.println("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener.");
for (int i = 0; i < stacks.length; i++) {
ErrorValue[] errors = stacks[i].getErrorValues();
System.out.print("Partial Error for ");
// The different service implementation may optionally associate
// an ModelObject, client ID, or nothing, with each partial error
if (stacks[i].hasAssociatedObject()) {
System.out.println("object " + stacks[i].getAssociatedObject().getUid());
} else if (stacks[i].hasClientId()) {
System.out.println("client id " + stacks[i].getClientId());
} else if (stacks[i].hasClientIndex())
System.out.println("client index " + stacks[i].getClientIndex());
// Each Partial Error will have one or more contributing error messages
for (int j = 0; j < errors.length; j++) {
System.out.println(" Code: " + errors[j].getCode() + "\tSeverity: " + errors[j].getLevel() + "\t"
+ errors[j].getMessage());
}
}
}
}

@ -1,27 +0,0 @@
package com.teamcenter.clientx;
import com.teamcenter.soa.client.RequestListener;
/**
* This implemenation of the RequestListener, logs each service request to the
* console.
*
*/
public class AppXRequestListener implements RequestListener {
/**
* Called before each request is sent to the server.
*/
public void serviceRequest(final Info info) {
// will log the service name when done
}
/**
* Called after each response from the server. Log the service operation to the
* console.
*/
public void serviceResponse(final Info info) {
System.out.println(info.id + ": " + info.service + "." + info.operation);
}
}

@ -1,36 +0,0 @@
package com.teamcenter.clientx;
import com.teamcenter.soa.client.model.ChangeListener;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.exceptions.NotLoadedException;
/**
* Implementation of the ChangeListener. Print out all objects that have been
* updated.
*
*/
public class AppXUpdateObjectListener implements ChangeListener {
public void modelObjectChange(ModelObject[] objects) {
if (objects.length == 0)
return;
System.out.println("");
System.out.println(
"Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange");
System.out.println("The following objects have been updated in the client data model:");
for (int i = 0; i < objects.length; i++) {
String uid = objects[i].getUid();
String type = objects[i].getTypeObject().getName();
String name = "";
if (objects[i].getTypeObject().isInstanceOf("WorkspaceObject")) {
ModelObject wo = objects[i];
try {
name = wo.getPropertyObject("object_string").getStringValue();
} catch (NotLoadedException e) {
} // just ignore
}
System.out.println(" " + uid + " " + type + " " + name);
}
}
}

@ -1,240 +0,0 @@
package com.teamcenter.clientx;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import java.util.Vector;
import org.apache.commons.httpclient.HttpState;
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException;
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.services.strong.core.SessionService;
import com.teamcenter.services.strong.core._2006_03.Session.LoginResponse;
import com.teamcenter.soa.SoaConstants;
import com.teamcenter.soa.client.Connection;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.strong.User;
import com.teamcenter.soa.client.model.strong.WorkspaceObject;
import com.teamcenter.soa.exceptions.CanceledOperationException;
import com.teamcenter.soa.exceptions.NotLoadedException;
public class Session {
/**
* Single instance of the Connection object that is shared throughtout the
* application. This Connection object is needed whenever a Service stub is
* instantiated.
*/
private static Connection connection;
/**
* The credentialManager is used both by the Session class and the Teamcenter
* Services Framework to get user credentials.
*
*/
private static AppXCredentialManager credentialManager;
/**
* Create an instance of the Session with a connection to the specified server.
*
* Add implementations of the ExceptionHandler, PartialErrorListener,
* ChangeListener, and DeleteListeners.
*
* @param host Address of the host to connect to, http://serverName:port/tc
*/
public Session(String host) {
// Create an instance of the CredentialManager, this is used
// by the SOA Framework to get the user's credentials when
// challanged by the server (sesioin timeout on the web tier).
credentialManager = new AppXCredentialManager();
String protocol = (host.startsWith("http")) ? SoaConstants.HTTP : SoaConstants.IIOP;
// Create the Connection object, no contact is made with the server
// until a service request is made
connection = new Connection(host, new HttpState(), credentialManager, SoaConstants.REST, protocol, false);
// Add an ExceptionHandler to the Connection, this will handle any
// InternalServerException, communication errors, xml marshalling errors
// .etc
connection.setExceptionHandler(new AppXExceptionHandler());
// While the above ExceptionHandler is required, all of the following
// Listeners are optional. Client application can add as many or as few
// Listeners
// of each type that they want.
// Add a Partial Error Listener, this will be notified when ever a
// a service returns partial errors.
connection.getModelManager().addPartialErrorListener(new AppXPartialErrorListener());
// Add a Change Listener, this will be notified when ever a
// a service returns model objects that have been updated.
connection.getModelManager().addChangeListener(new AppXUpdateObjectListener());
// Add a Delete Listener, this will be notified when ever a
// a service returns objects that have been deleted.
connection.getModelManager().addDeleteListener(new AppXDeletedObjectListener());
// Add a Request Listener, this will be notified before and after each
// service request is sent to the server.
Connection.addRequestListener(new AppXRequestListener());
}
/**
* Get the single Connection object for the application
*
* @return connection
*/
public static Connection getConnection() {
return connection;
}
/**
* Login to the Teamcenter Server
*
*/
public User login(String user, String pw) {
// Get the service stub
SessionService sessionService = SessionService.getService(connection);
try {
// Prompt for credentials until they are right, or until user
// cancels
String[] credentials = credentialManager.promptForCredentials(user, pw);
for (int i = 0; i < credentials.length; i++) {
System.out.println("credentials:" + credentials[i]);
}
while (true) {
try {
// *****************************
// Execute the service operation
// *****************************
LoginResponse out = sessionService.login(credentials[0], credentials[1], credentials[2],
credentials[3], credentials[4]);
return out.user;
} catch (InvalidCredentialsException e) {
credentials = credentialManager.getCredentials(e);
}
}
}
// User canceled the operation, don't need to tell him again
catch (CanceledOperationException e) {
}
// Exit the application
System.exit(0);
return null;
}
/**
* Login to the Teamcenter Server
*
* @throws CanceledOperationException
* @throws InvalidCredentialsException
*
*/
public User login2(String user, String pw) throws CanceledOperationException, InvalidCredentialsException {
// Get the service stub
SessionService sessionService = SessionService.getService(connection);
String[] credentials = credentialManager.promptForCredentials(user, pw);
LoginResponse out = null;
out = sessionService.login(credentials[0], credentials[1], credentials[2], credentials[3], credentials[4]);
if (out != null)
return out.user;
else
return null;
}
/**
* Terminate the session with the Teamcenter Server
*
*/
public void logout() {
// Get the service stub
SessionService sessionService = SessionService.getService(connection);
try {
// *****************************
// Execute the service operation
// *****************************
sessionService.logout();
} catch (ServiceException e) {
}
}
/**
* Print some basic information for a list of objects
*
* @param objects
*/
public static void printObjects(ModelObject[] objects) {
if (objects == null)
return;
SimpleDateFormat format = new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US")); // Simple no time
// zone
// Ensure that the referenced User objects that we will use below are loaded
getUsers(objects);
System.out.println("Name\t\tOwner\t\tLast Modified");
System.out.println("====\t\t=====\t\t=============");
for (int i = 0; i < objects.length; i++) {
if (!(objects[i] instanceof WorkspaceObject))
continue;
WorkspaceObject wo = (WorkspaceObject) objects[i];
try {
String name = wo.get_object_string();
User owner = (User) wo.get_owning_user();
Calendar lastModified = wo.get_last_mod_date();
System.out.println(name + "\t" + owner.get_user_name() + "\t" + format.format(lastModified.getTime()));
} catch (NotLoadedException e) {
// Print out a message, and skip to the next item in the folder
// Could do a DataManagementService.getProperties call at this point
System.out.println(e.getMessage());
System.out.println(
"The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property.");
}
}
}
private static void getUsers(ModelObject[] objects) {
if (objects == null)
return;
DataManagementService dmService = DataManagementService.getService(Session.getConnection());
List unKnownUsers = new Vector();
for (int i = 0; i < objects.length; i++) {
if (!(objects[i] instanceof WorkspaceObject))
continue;
WorkspaceObject wo = (WorkspaceObject) objects[i];
User owner = null;
try {
owner = (User) wo.get_owning_user();
owner.get_user_name();
} catch (NotLoadedException e) {
if (owner != null)
unKnownUsers.add(owner);
}
}
User[] users = (User[]) unKnownUsers.toArray(new User[unKnownUsers.size()]);
String[] attributes = { "user_name" };
// *****************************
// Execute the service operation
// *****************************
dmService.getProperties(users, attributes);
}
}

@ -212,12 +212,15 @@ public class SI_BOM_PLM_OUT_SYNBindingStub extends org.apache.axis.client.Stub
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("", "SI_BOM_PLM_OUT_SYN"));
// MES测试 20200302
// MES测试 20200302
// _call.setUsername("shpodev");
// _call.setPassword("sap@2019");
// 正式系统
// 正式系统
_call.setUsername("shplm");
_call.setPassword("sap@2019");
//TODO 测试系统
// _call.setUsername("po_rfc");
// _call.setPassword("1qaz!QAZ");
setRequestHeaders(_call);
setAttachments(_call);
try {

@ -23,15 +23,15 @@ public class SI_BOM_PLM_OUT_SYNServiceLocator extends org.apache.axis.client.Ser
//20200509生产环境
//20200509生产环境
private java.lang.String HTTPS_Port_address = "https://10.10.101.219:50101/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
//MES测试 20200302添加
//MES测试 20200302添加
//private java.lang.String HTTPS_Port_address = "https://192.168.0.184:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
//300测试接口 20200910添加
//300测试接口 20200910添加
//private java.lang.String HTTPS_Port_address ="https://192.168.0.184:50101/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
@ -80,16 +80,16 @@ public class SI_BOM_PLM_OUT_SYNServiceLocator extends org.apache.axis.client.Ser
}
//20200509生产环境
//20200509生产环境
private java.lang.String HTTP_Port_address ="http://10.10.101.219:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
//MES测试 20200302添加
//private java.lang.String HTTP_Port_address ="http://192.168.0.184:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
//MES测试 20200302添加
// private java.lang.String HTTP_Port_address ="http://192.168.0.184:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
//300测试接口 20200910添加
//private java.lang.String HTTP_Port_address="http://192.168.0.184:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
//TODO 300测试接口 20200910添加
// private java.lang.String HTTP_Port_address="http://192.168.0.184:50100/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CHINT_ELECTRIC&receiverParty=&receiverService=&interface=SI_BOM_PLM_OUT_SYN&interfaceNamespace=urn%3Achintelectric.com%3Axi%3Aplm";
@Override
public java.lang.String getHTTP_PortAddress() {

Loading…
Cancel
Save