20241129代码上传

master
李冬阳 7 months ago
parent 84cbfec1ef
commit 121a73b2e6

@ -4711,7 +4711,7 @@
</and>
</visibleWhen>
</command>
<!-->
<!--><!-->
<command commandId = "com.connor.chint.sap2.commands.SAPBJYBCommand" id = "com.connor.chint.sap2.menu.SAPBJYBCommand">
<visibleWhen>
<and>
@ -4733,7 +4733,7 @@
</and>
</visibleWhen>
</command>
<!-->
<command commandId = "com.chint.plm.createEcn.CreateEcnCommond" id = "com.chint.plm.createEcn.CreateEcnCommond">
<visibleWhen>

@ -2,14 +2,8 @@ package com.chint.plm.getGCTH;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
@ -31,19 +25,11 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.TreePath;
import org.jdesktop.swingx.decorator.HighlighterFactory;
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
import org.jdesktop.swingx.treetable.TreeTableNode;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.SoaUtils;
import com.connor.chint.sap2.util.SqlUtil;
@ -63,6 +49,10 @@ import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData
public class GCTHDialog extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JComboBox<String> xxdbhComb=new JComboBox<String>();
private List<String> nameList =new ArrayList<String>();
@ -72,20 +62,20 @@ public class GCTHDialog extends JFrame {
private TCSession session;
private SoaUtils soaUtil;
private ProcessBarDialog progress1;
private Boolean jzFlag = false;
private Map<String, ExpandPSData[]> bomLineTreeNodeSOA;
// private Boolean jzFlag = false;
// private Map<String, ExpandPSData[]> bomLineTreeNodeSOA;
JFrame frame;
private List<HF04NodeBean> beanList = new ArrayList<HF04NodeBean>();
public GCTHDialog(AbstractAIFApplication app,DefaultMutableTreeTableNode rootNode,
TCComponentBOMLine line,ProcessBarDialog progress,Map<String, ExpandPSData[]> bomLineTreeNodeSOA,List<HF04NodeBean> beanList) {
// TODO Auto-generated constructor stub
// Auto-generated constructor stub
this.app = app;
this.rootNode = rootNode;
this.line = line;
this.session = (TCSession) app.getSession();
String ip = session.getLoginInfo().getPreviousSessionLoginIP();
System.out.println("ip==>"+ip);
this.bomLineTreeNodeSOA = bomLineTreeNodeSOA;
// this.bomLineTreeNodeSOA = bomLineTreeNodeSOA;
this.beanList = beanList;
soaUtil = new SoaUtils(line);
this.progress1 = progress;
@ -102,7 +92,7 @@ public class GCTHDialog extends JFrame {
private String[] header = new String[] { "对象ID", "选择派生","" };
// @Override
public void initUI() {
// TODO Auto-generated method stub
// Auto-generated method stub
try {
TCSession session = (TCSession)app.getSession();
String strs[] = session.getPreferenceService().getStringValues("database_tc");
@ -150,86 +140,80 @@ public class GCTHDialog extends JFrame {
private JButton btn;
private String xxd = "";
private JPanel getBtnPanel() {
// TODO Auto-generated method stub
// Auto-generated method stub
JPanel topPanel = new JPanel();
btn = new JButton("开始执行");
topPanel.add(btn);
btn.addActionListener(new ActionListener() {
@Override
@Override
public void actionPerformed(ActionEvent param1ActionEvent) {
new Thread() {
@Override
public void run() {
try {
String text = jText.getText();
System.out.println("text===>"+text);
if(!nameList.contains(text)) {
MessageBox.post("系统中无此信息单,请检查!","提示",2);
return;
}
KUtil.setByPass(true);
ProcessBarDialog progress = new ProcessBarDialog("正在执行申请工程图号...");
progress.open();
// init_pb.show();
// int rowCount = table.getRowCount();
getAllNodes(rootNode);
//BOM复制
soaUtil.cloneOrUpdate(session,line,bomLine,jText.getText().trim());
line.window().close();
try {
//剪切
TCComponentItem tcComponentById = (TCComponentItem) soaUtil.getTCComponentById(session, soaUtil.topItemId);
TCComponentItemRevision latestItemRevision = tcComponentById.getLatestItemRevision();
TCTypeService service = session.getTypeService();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
TCComponentBOMWindow window = winType.create(null);
TCComponentBOMLine newTopline = window.setWindowTopLine(latestItemRevision.getItem(), latestItemRevision, null, null);
xxd = jText.getText().trim().replaceAll("YHX", "");
changeAllDs(newTopline);
window.close();
// init_pb.disposeDialog();
progress.close();
KUtil.setByPass(true);
// session.getUser().getNewStuffFolder().cutOperation("contents", new TCComponent[] { tcComponentById});
btn.setEnabled(false);
MessageBox.post(GCTHDialog.this, "申请工程图号完成,新的图号为:"+soaUtil.topItemId +"-"+tcComponentById.getStringProperty("object_name"), "提示", 2);
frame.dispose();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
MessageBox.post(GCTHDialog.this, "申请工程图号时发生异常:" + e.getMessage(), "提示", 2);
}finally {
progress.close();
}
}
catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}.start();
new Thread() {
@Override
public void run() {
try {
String text = jText.getText();
System.out.println("text===>"+text);
if(!nameList.contains(text)) {
MessageBox.post("系统中无此信息单,请检查!","提示",2);
return;
}
KUtil.setByPass(true);
ProcessBarDialog progress = new ProcessBarDialog("正在执行申请工程图号...");
progress.open();
// init_pb.show();
// int rowCount = table.getRowCount();
getAllNodes(rootNode);
//BOM复制
soaUtil.cloneOrUpdate(session,line,bomLine,jText.getText().trim());
line.window().close();
try {
//剪切
TCComponentItem tcComponentById = (TCComponentItem) soaUtil.getTCComponentById(session, soaUtil.topItemId);
TCComponentItemRevision latestItemRevision = tcComponentById.getLatestItemRevision();
TCTypeService service = session.getTypeService();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
TCComponentBOMWindow window = winType.create(null);
TCComponentBOMLine newTopline = window.setWindowTopLine(latestItemRevision.getItem(), latestItemRevision, null, null);
xxd = jText.getText().trim().replaceAll("YHX", "");
changeAllDs(newTopline);
window.close();
// init_pb.disposeDialog();
progress.close();
KUtil.setByPass(true);
// session.getUser().getNewStuffFolder().cutOperation("contents", new TCComponent[] { tcComponentById});
btn.setEnabled(false);
MessageBox.post(GCTHDialog.this, "申请工程图号完成,新的图号为:"+soaUtil.topItemId +"-"+tcComponentById.getStringProperty("object_name"), "提示", 2);
frame.dispose();
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
MessageBox.post(GCTHDialog.this, "申请工程图号时发生异常:" + e.getMessage(), "提示", 2);
}finally {
progress.close();
}
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
}finally {
KUtil.setByPass(false);
}
}
}.start();
}
});
});
return topPanel;
}
//改变数据集名称
protected void changeAllDs(TCComponentBOMLine newTopline) throws TCException {
// TODO Auto-generated method stub
// Auto-generated method stub
Map<String, String> idMap = soaUtil.getIdMap();
AIFComponentContext[] children = newTopline.getChildren();
@ -242,12 +226,10 @@ public class GCTHDialog extends JFrame {
for(AIFComponentContext context:children) {
TCComponentBOMLine component = (TCComponentBOMLine) context.getComponent();
changeAllDs(component);
}
}
protected void getAllNodes(DefaultMutableTreeTableNode rootNode2) {
// TODO Auto-generated method stub
// Auto-generated method stub
for (int i = 0; i < rootNode2.getChildCount(); i++) {
DefaultMutableTreeTableNode childAt = (DefaultMutableTreeTableNode) rootNode2.getChildAt(i);
// 获取第二层的对象
@ -260,7 +242,7 @@ public class GCTHDialog extends JFrame {
selected = "0";
}
bomLine.put(subLine, Integer.valueOf(selected));
boolean bzt = true;
// boolean bzt = true;
//工程图、标准图
// if(childBean.getGctSelect().equals("1")) {
// bzt = false;
@ -277,23 +259,19 @@ public class GCTHDialog extends JFrame {
private Map<String,List<Integer>> rowMap = new HashMap<>();
private Integer currentRow = 0;
private JPanel getTopPanel() {
// TODO Auto-generated method stub
// Auto-generated method stub
try {
ResultSet rs = SqlUtil.read(sqlStr);
while (rs.next()) {
String item_id = rs.getString("PITEM_ID");
nameList.add(item_id);
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
// Auto-generated catch block
e1.printStackTrace();
}
JPanel topPanel = new JPanel();
xxdbhComb.setEditable(true);
@ -302,19 +280,19 @@ public class GCTHDialog extends JFrame {
@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
addSelect(e,xxdbhComb,jText,nameList);
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
});
@ -349,13 +327,13 @@ public class GCTHDialog extends JFrame {
jButton4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
// 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
table.expandAll();
String text = jTextQry.getText();
if(!text.isEmpty()) {
@ -384,13 +362,13 @@ public class GCTHDialog extends JFrame {
jButton3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
// 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
table.expandAll();
String text = jTextQry.getText();
if(!text.isEmpty()) {
@ -419,13 +397,13 @@ public class GCTHDialog extends JFrame {
jButton5.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
// 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
table.expandAll();
String text = jTextQry.getText();
if(!text.isEmpty()) {
@ -478,13 +456,13 @@ public class GCTHDialog extends JFrame {
jButton2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
// 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
// new Thread() {
// @Override
@ -516,13 +494,13 @@ public class GCTHDialog extends JFrame {
jButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
// 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
try {
String text = jText.getText();
System.out.println("text===>"+text);
@ -573,7 +551,7 @@ public class GCTHDialog extends JFrame {
}
private JScrollPane getTablePanel() {
// TODO Auto-generated method stub
// Auto-generated method stub
table = getJTreeTable(null, null, header, null);
// table.getModel().addTableModelListener(table);
table.setRowHeight(30);
@ -591,31 +569,31 @@ public class GCTHDialog extends JFrame {
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
// Auto-generated method stub
int selectColumn = table.getTableHeader().columnAtPoint(e.getPoint());
int selectedRow = table.rowAtPoint(e.getPoint());
System.out.println("selectColumn==>"+selectColumn);
@ -661,7 +639,7 @@ public class GCTHDialog extends JFrame {
int rowCount = myTable.getRowCount();
Enumeration columns = myTable.getColumnModel().getColumns();
Enumeration<TableColumn> columns = myTable.getColumnModel().getColumns();
while (columns.hasMoreElements()) {
TableColumn column = (TableColumn) columns.nextElement();
@ -713,7 +691,7 @@ public class GCTHDialog extends JFrame {
}
protected void addSelect(KeyEvent e, JComboBox<String> combox, JTextField jtext, List<String> cpxList) {
// TODO Auto-generated method stub
// Auto-generated method stub
Object obj = e.getSource();
int keyCode = e.getKeyCode();
if (obj == jtext) {

@ -13,7 +13,6 @@ import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
@ -81,9 +80,6 @@ import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServices;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServicesLocator;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServicesPortType;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@ -939,9 +935,9 @@ public class MaterialNoDialog extends AbstractAIFDialog {
}
StringBuilder build = new StringBuilder("");
build.append(userName).append("已申请物料,请及时审批。");
System.out.println("userId==》"+userId);
System.out.println("userId==》" + userId);
if(!userId.equals("")) {
sendMsg(build.toString(),userId);
SAPUtil.sendMsg(build.toString(), userId);
}
}
@ -1405,29 +1401,29 @@ public class MaterialNoDialog extends AbstractAIFDialog {
}
StringBuilder build = new StringBuilder("");
build.append(userName).append("已申请物料,请及时审批。");
System.out.println("userId==》"+userId);
System.out.println("userId==》" + userId);
if(!userId.equals("")) {
sendMsg(build.toString(),userId);
SAPUtil.sendMsg(build.toString(), userId);
}
jcb_blank.setSelected(false);
}
public static void sendMsg(String mess, String userID) throws IOException {
try {
// TXTUtil.writeTXT(logPath, "开始AM消息推送");
// TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
ISendMsgServices service2 = new ISendMsgServicesLocator();
ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
// TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
System.out.println("返回信息:" + mess2);
} catch (javax.xml.rpc.ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
// TXTUtil.writeTXT(logPath, "AM消息推送结束");
}
// private static void sendMsg(String mess, String userID) throws IOException {
// try {
//// TXTUtil.writeTXT(logPath, "开始AM消息推送");
//// TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
// ISendMsgServices service2 = new ISendMsgServicesLocator();
// ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
// String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
//// TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
// System.out.println("返回信息:" + mess2);
// } catch (javax.xml.rpc.ServiceException e) {
// e.printStackTrace();
// } catch (RemoteException e) {
// e.printStackTrace();
// }
//// TXTUtil.writeTXT(logPath, "AM消息推送结束");
// }
@SuppressWarnings("deprecation")
private void createBOM(TCComponentItemRevision parent, TCComponentItemRevision child) throws Exception {
if (parent == null || child == null) {

@ -58,10 +58,6 @@ import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput;
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateOut;
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServices;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServicesLocator;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServicesPortType;
/**
*
*
@ -684,7 +680,7 @@ public class SelfMPartNoBatchOperation extends AbstractAIFOperation {
build.append(userName).append("已申请物料,请及时审批。");
System.out.println("userId==》" + userId);
if(!userId.equals("")) {
sendMsg(build.toString(), userId);
SAPUtil.sendMsg(build.toString(), userId);
}
} catch (Exception e1) {
@ -706,21 +702,6 @@ public class SelfMPartNoBatchOperation extends AbstractAIFOperation {
}
}
public void sendMsg(String mess, String userID) throws Exception {
try {
// TXTUtil.writeTXT(logPath, "开始AM消息推送");
// TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
ISendMsgServices service2 = new ISendMsgServicesLocator();
ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
// TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
System.out.println("返回信息:\n" + mess2);
TXTUtil.writeTXT(txtPath, "返回信息:\n" + mess2);
} catch (Exception e) {
e.printStackTrace();
}
// TXTUtil.writeTXT(logPath, "AM消息推送结束");
}
// List<TCComponentItemRevision> tzList = new ArrayList<TCComponentItemRevision>();
public CreateIn createMaterialYH(SelfMPartBean bean, String companyCode,
String zt2_Specifications, String code) throws TCException, ServiceException {

@ -52,22 +52,21 @@ public class CreateProcXBController {
private TCSession session;
// 节点与表格对象
protected Map<XBBomBean, XBProcBean> maps_tree_table = new HashMap<>(64);
protected Map<XBBomBean, XBProcBean> maps_tree_table;
// 表格与节点关系
protected Map<XBProcBean, DefaultMutableTreeNode> maps_table_tree = new HashMap<XBProcBean, DefaultMutableTreeNode>(
64);
protected Map<XBProcBean, DefaultMutableTreeNode> maps_table_tree;
// 表格与BOM视图的关系
protected Map<XBProcBean, TCComponentBOMLine> maps_table_line_maps = new HashMap<>(64);
protected Map<XBProcBean, TCComponentBOMLine> maps_table_line_maps;
protected Map<TCComponentBOMLine, XBProcBean> map_line_table_maps = new HashMap<TCComponentBOMLine, XBProcBean>();
protected Map<TCComponentBOMLine, XBProcBean> map_line_table_maps;
// 版本-表格
protected Map<TCComponentItemRevision, List<XBProcBean>> list_rev_procBean = new HashMap<>(64);
protected Map<TCComponentItemRevision, List<XBProcBean>> list_rev_procBean;
// table数据集合
protected List<XBProcBean> procBeanList = new ArrayList<>(64);
protected List<XBProcBean> procBeanList;
// 需要重新获取子项的节点
protected List<DefaultMutableTreeNode> node_need_expands = new ArrayList<>();
protected List<DefaultMutableTreeNode> node_need_expands;
protected TCComponentBOMLine topLine;
private TCComponentBOMWindowType bomWinType;
@ -76,7 +75,7 @@ public class CreateProcXBController {
protected boolean isCanExpand = false;
// 展开的节点
protected Vector<TreePath> expandPaths = new Vector<>();
protected Vector<TreePath> expandPaths;
private String group;
private Map<String, ExpandPSData[]> bomLineTree;
@ -85,6 +84,15 @@ public class CreateProcXBController {
this.app = app;
this.session = (TCSession) app.getSession();
this.dialog = dialog;
maps_tree_table = new HashMap<>();
maps_table_tree = new HashMap<XBProcBean, DefaultMutableTreeNode>();
maps_table_line_maps = new HashMap<>();
map_line_table_maps = new HashMap<TCComponentBOMLine, XBProcBean>();
list_rev_procBean = new HashMap<>();
procBeanList = new ArrayList<>();
node_need_expands = new ArrayList<>();
expandPaths = new Vector<>();
}
public void initBOMWindow(TCSession session) throws TCException {

@ -98,7 +98,7 @@ public class CreateProcXBDialog extends AbstractAIFDialog {
public static final int[] HEADERWIDTH = new int[] { 80, 300, 120, 120, 200, 200, 200 };
// 当前版本对象
private TCComponentItemRevision bomRev = null;
private TCComponentItemRevision bomRev;
// 变压器工序
private List<TCComponent> byq_gx_lists;
@ -107,11 +107,11 @@ public class CreateProcXBDialog extends AbstractAIFDialog {
private String codeRemark_Technology = "ICM120202"; // 工艺分类库编码
private CreateProcController cpController;
protected Map<TCComponentItemRevision, List<XBProcBean>> rev_Beans = new HashMap<>();
protected Map<TCComponentItemRevision, List<XBProcBean>> rev_Beans;
private String groupID;
private Map<String, String> value_strings = null;
private Map<String, String> value_strings;
public CreateProcXBDialog(AbstractAIFApplication app, String actionInfo) {
super(false);
@ -119,6 +119,7 @@ public class CreateProcXBDialog extends AbstractAIFDialog {
this.session = (TCSession) app.getSession();
this.controller = new CreateProcXBController(this, app);
this.cpController = new CreateProcController();
rev_Beans = new HashMap<>();
try {
groupID = SAPUtil.getGroupID(session);
if (groupID.equalsIgnoreCase("dba")) {

@ -1,24 +1,21 @@
package com.connor.chint.sap2.sap_by;
import java.io.IOException;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.connor.chint.sap2.create_proc.CreateProcBean;
import com.connor.chint.sap2.create_proc.CreateProcController;
import com.connor.chint.sap2.sap_zy.SAPZYOperation;
import com.connor.chint.sap2.util.ChintPreferenceUtil;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent;
import com.connor.chint.sap2.util.SAPMessageUtil;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil;
import com.connor.chint.sap2.util.TXTUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFOperation;
@ -29,9 +26,6 @@ import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentBOPWindow;
import com.teamcenter.rac.kernel.TCComponentBOPWindowType;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentItem;
@ -40,7 +34,6 @@ import com.teamcenter.rac.kernel.TCComponentListOfValues;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
@ -51,9 +44,6 @@ import plm.xi.com.chintelectric.DT_BOM_PLM_RSP;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQ;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQBASEINFO;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLIST;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTHEAD;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTITEMSITEM;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTITEMSITEMSUBITEMSSUBITEM;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSP;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYN;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYNService;
@ -100,36 +90,34 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
}
private void getMessageUsers() {
TCPreferenceService preService = session.getPreferenceService();
String notifies[] = preService.getStringValues("CHINT_M005_Notify");
for (String no : notifies) {
if (!KUtil.isEmpty(no)) {
userID.append(no);
}
}
}
// private void getMessageUsers() {
// TCPreferenceService preService = session.getPreferenceService();
// String notifies[] = preService.getStringValues("CHINT_M005_Notify");
// for (String no : notifies) {
// if (!KUtil.isEmpty(no)) {
// userID.append(no);
// }
// }
// }
public void getSapState() throws TCException {
TCComponentListOfValues unitLov = KUtil.getLov(session, "zt2_SapState");
if (unitLov != null) {
ListOfValuesInfo listOfValues = unitLov.getListOfValues();
String[] realval = listOfValues.getStringListOfValues();
boolean flag = false;
// boolean flag = false;
for (int i = 0; i < realval.length; i++) {
String disval = listOfValues.getDisplayableValue(realval[i]);
System.out.println("显示值:" + disval + ";真实值:" + realval[i]);
if (disval.equals("已传")) {
flag = true;
// flag = true;
sapState = realval[i];
}
}
}
}
@SuppressWarnings("deprecation")
@Override
public void executeOperation() throws Exception {
@ -174,7 +162,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
Map<String, TCComponent> gy_meops = new HashMap<>(32);
List<TCComponentMEProcessRevision> needTCM_meops = new ArrayList<TCComponentMEProcessRevision>();
List<String> bomIsExist = new ArrayList<String>();
StringBuffer errMessage = new StringBuffer();
// StringBuffer errMessage = new StringBuffer();
// SAPUtil.recurBYBJBomline(bomline, null, null, gy_meops, needTCM_meops,
// session,
// groupName, list, proclist, txtPath, now,bomIsExist, "ICM0802", icsId,
@ -190,7 +178,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
String[] prefs = ChintPreferenceUtil.getPreferences("M005_WBSBOM", session);
List<String> kjBomIds = new ArrayList<String>();
for(String pref:prefs) {
for(String pref : prefs) {
String[] split = pref.split("\\|");
kjBomIds.add(split[0]);
}
@ -200,15 +188,15 @@ public class SAPBYOperation extends AbstractAIFOperation {
if(property.contains("-")) {
endFix = property.split("-")[1];
}
TCComponentItem top = getTopZzItem(rev,endFix);
TCComponentItem top = getTopZzItem(rev, endFix);
if(top == null) {
top = rev.getItem();
}
System.out.println("top===>"+top);
System.out.println("top===>" + top);
AIFComponentContext[] tzFolder = top.whereReferenced();
String projWbsNo = "";
System.out.println("tzFolder.length:" + tzFolder.length );
for(int t = 0;t<tzFolder.length ;t++) {
for(int t = 0; t < tzFolder.length; t++) {
if(tzFolder[t].getComponent().getType().equals("ZT2_ProjectFolder")) {
TCComponentFolder folder1 = (TCComponentFolder)tzFolder[t].getComponent();
System.out.println("folder1:" + folder1.toString());
@ -230,11 +218,37 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
}
System.out.println("kjBomIds:" + kjBomIds.toString());
System.out.println("projWbsNo:" + projWbsNo);
//TODO
String zzId = "1ZDB300000P-" + endFix;
TCComponent[] zzItem = session.search("零组件 ID", new String[] { "零组件 ID" }, new String[] { zzId });
HashMap<String, ArrayList<String[]>> flMap = new HashMap<>();
if(zzItem.length > 0) {
String strs[] = session.getPreferenceService().getStringValues("database_tc");
if (SqlUtil.getTCDataConnection(strs) == null) {
MessageBox.post("数据库连接失败,请检查首选项<database_tc>", "", 2);
return;
}
Map<String, String> classMap = ((TCComponentItem)zzItem[0]).getClassificationAttributes();//.getLatestItemRevision()
String flfz = classMap.get("辅料分组");
String sql = "select \"flno\",\"tuhao\",\"gx\" from CHINT_GYFL_M005 where \"group\"='" + flfz + "'";
System.out.println("sql:" + sql);
ResultSet rs = SqlUtil.read(sql);
while(rs.next()) {
String tuhao = rs.getString(2);
tuhao = tuhao.substring(0, tuhao.indexOf("-"));
if(!flMap.containsKey(tuhao)) {
flMap.put(tuhao, new ArrayList<>());
}
flMap.get(tuhao).add(new String[] { rs.getString(1), rs.getString(3) });
}
SqlUtil.freeAll();
}
System.out.println("flMap:" + flMap);
SAPUtil.recurBYBJSAP(bomline, rev, partRev, gy_meops, needTCM_meops, session, groupName, list, proclist,
txtPath, now, bomIsExist, "ICM0802", icsId, by_materials, errMess, buff, material_revs,bean.getMatr(),
kjBomIds,projWbsNo);
txtPath, now, bomIsExist, "ICM0802", icsId, by_materials, errMess, buff, material_revs,
bean.getMatr(), kjBomIds, projWbsNo, flMap);
SAPUtil.removeNull(list);
System.out.println("Error:" + errMess.toString());
@ -376,7 +390,6 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
}
}
}
}
TCComponentDataset dataset = TXTUtil.createDataset(txtPath, txtName, session);
@ -386,13 +399,12 @@ public class SAPBYOperation extends AbstractAIFOperation {
comp.setVisible(false);
} catch (Exception e) {
// TODO: handle exception
// : handle exception
comp.setVisible(false);
e.printStackTrace();
} finally {
KUtil.setByPass(false);
}
}
} catch (Exception e) {
comp.setVisible(false);
@ -402,7 +414,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
private TCComponentItem getTopZzItem(TCComponentItemRevision rev,String endFix) {
// TODO Auto-generated method stub
// Auto-generated method stub
// item = null;
try {
TCComponent[] whereUsed = rev.whereUsed((short)0);
@ -418,15 +430,15 @@ public class SAPBYOperation extends AbstractAIFOperation {
return item;
}
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
}
return null;
}
@SuppressWarnings("deprecation")
public TCComponentBOMLine getNewBOMLine(TCComponentItemRevision itemR) {
TCComponentBOMWindowType bomWinType;
try {
@ -443,6 +455,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
// 20200422注释
/*
private void readBopInfo(TCComponentMEProcessRevision rev, TCComponent part) throws Exception {
System.out.println("===读取工艺信息===" + rev);
TCComponentBOPWindowType bopWindowType = (TCComponentBOPWindowType) session.getTypeComponent("BOPWindow");
@ -503,12 +516,12 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
TXTUtil.writeTXT(txtPath, "结束打印工艺路线");
/*
* TCComponent[] successors =
* gxLine1.getReferenceListProperty("Mfg0successors");
* if(successors==null||successors.length==0) {//ÎÞPERT }else {//ÓÐPERT
* Mfg0predecessors }
*/
// * TCComponent[] successors =
// * gxLine1.getReferenceListProperty("Mfg0successors");
// * if(successors==null||successors.length==0) {//无PERT }else {//有PERT
// * Mfg0predecessors }
// *
proclist.add(
new DT_PROCESSROUTE_S4_REQLIST(head, gxInfo.toArray(new DT_PROCESSROUTE_S4_REQLISTITEMSITEM[] {})));
window.clearCache();
@ -538,7 +551,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
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();
}
});
@ -619,10 +632,10 @@ public class SAPBYOperation extends AbstractAIFOperation {
boolean inBx = bean.flow_split == null;
for (int i = 0; i < cnt; i++) {
TCComponentBOMLine gxLine = bean.flowList.get(i);
/*
* if(gxLine.equals(bean.flow_end)) { if(bean.flow_end!=null) {
* item.setVORNR2(getGXNR(bean.flow_end));//ºóÖÃ } break; }
*/
// *
// * if(gxLine.equals(bean.flow_end)) { if(bean.flow_end!=null) {
// * item.setVORNR2(getGXNR(bean.flow_end));//后置 } break; }
// *
if (bx) {
if (gxLine.equals(bean.flow_combine)) {
@ -677,6 +690,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
return String.format("%04d", seqI);
}
private class FlowBean {
List<TCComponentBOMLine> flowList = new ArrayList<>();
TCComponentBOMLine flow_split;
@ -747,7 +761,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
readGXFlow((TCComponentBOMLine) suc[i], flowBeans, newFlow, false);
}
readGXFlow((TCComponentBOMLine) suc[0], flowBeans, currentFlow, false);
}
}*/
public static TCComponentItemRevision getPart(TCComponent comp) {
if (comp.getType().equals("Part Revision")) {
@ -778,7 +792,7 @@ public class SAPBYOperation extends AbstractAIFOperation {
}
// return pRev;
} catch (Exception e) {
// TODO Auto-generated catch block
// Auto-generated catch block
e.printStackTrace();
}
return null;

@ -344,7 +344,7 @@ public class SAPZZDialog extends AbstractAIFDialog {
panel.add(b_check);
panel.add(b_bom);
//TODO
// panel.add(b_qr3);
panel.add(b_qr3);
// panel.add(pushBOM_btn);
// 变压器BOM确认调整
JPanel panelt = new JPanel(new BorderLayout());

@ -205,6 +205,11 @@ public class SAPZZDialogController {
MessageBox.post(dialog, "请选择要传递的对象信息", "", MessageBox.INFORMATION);
return;
}
String strs[] = session.getPreferenceService().getStringValues("database_tc");
if (SqlUtil.getTCDataConnection(strs) == null) {
MessageBox.post("数据库连接失败,请检查首选项<database_tc>", "", 2);
return;
}
gy_meops.clear();
needTCM_meops.clear();
@ -215,8 +220,26 @@ public class SAPZZDialogController {
mp = new MyProgressBarCompent("传递", "总装图信息传递中......");
for (int i = 0; i < len; i++) {
try {
new SAPZZOperation(app, selectedParts.get(i), dists, SAPZZDialogController.this).executeOperation();
TCComponentItemRevision rev = selectedParts.get(i).getZzDesignRev();
//TODO lidy20241112 BOM传递SAP时拼接辅料BOM
Map<String, String> classMap = rev.getItem().getClassificationAttributes();
String flfz = classMap.get("辅料分组");
String sql = "select \"flno\",\"tuhao\",\"gx\" from CHINT_GYFL_M005 where \"group\"='" + flfz + "'";
System.out.println("sql:" + sql);
ResultSet rs = SqlUtil.read(sql);
HashMap<String, ArrayList<String[]>> flMap = new HashMap<>();
while(rs.next()) {
String tuhao = rs.getString(2);
tuhao = tuhao.substring(0, tuhao.indexOf("-"));
if(!flMap.containsKey(tuhao)) {
flMap.put(tuhao, new ArrayList<>());
}
flMap.get(tuhao).add(new String[] { rs.getString(1), rs.getString(3) });
}
new SAPZZOperation(app, selectedParts.get(i), dists, SAPZZDialogController.this, flMap)
.executeOperation();
if (KUtil.isEmpty(userName) && rev != null) {
TCComponentUser user = (TCComponentUser) rev.getRelatedComponent("owning_user");
userName = user.getProperty("user_name");
@ -238,6 +261,7 @@ public class SAPZZDialogController {
mp.setVisible(false);
e.printStackTrace();
}
SqlUtil.freeAll();
if (errorMsee.toString().length() > 0) {
new SAPMessageUtil(dialog, "", "传递异常:" + errorMsee.toString());
} else {

@ -1,63 +1,36 @@
package com.connor.chint.sap2.sap_by;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.connor.chint.sap2.sap_zy.PartBean;
import com.connor.chint.sap2.sap_zy.SAPZYDialogControllerzt;
import com.connor.chint.sap2.sap_zy.SAPZYOperation;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.TXTUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentBOPWindow;
import com.teamcenter.rac.kernel.TCComponentBOPWindowType;
import com.teamcenter.rac.kernel.TCComponentContextList;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQ;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQBASEINFO;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLIST;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLISTHEAD;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLISTITEMSITEM;
import plm.xi.com.chintelectric.DT_BOM_PLM_RSP;
import plm.xi.com.chintelectric.DT_BOM_PLM_RSPRSP_BASEINFO;
import plm.xi.com.chintelectric.DT_BOM_PLM_RSPZTABLE_RETURN;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQ;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQBASEINFO;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLIST;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTHEAD;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTITEMSITEM;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTITEMSITEMSUBITEMSSUBITEM;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSP;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSPRSP_BASEINFO;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSPZTABLE_RETURN;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYN;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYNService;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYNServiceLocator;
@ -96,10 +69,7 @@ public class SAPZZNewOp extends AbstractAIFOperation {
try {
txtName = format2.format(new Date()) + getUserName(session);
txtPath = TXTUtil.createTxt(txtName);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -146,7 +116,7 @@ public class SAPZZNewOp extends AbstractAIFOperation {
SAPUtil.recurBYZZSAP(bomline, zzRev, partRev, controller.gy_meops, controller.needTCM_meops, session,
controller.groupName, list, proclist, txtPath, now, bomIsExist, controller.codeMark,
controller.icsId, controller.materials, errMess, buff, controller.dists, 1, controller.material_revs,
set_meops,type,new ArrayList<String>(),"");
set_meops,type, new ArrayList<String>(), "", new HashMap<String, ArrayList<String[]>>());
SAPUtil.removeNull(list);
if (errMess.toString().length() > 0) {

@ -1,21 +1,13 @@
package com.connor.chint.sap2.sap_by;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.connor.chint.sap2.sap_zy.SAPZYOperation;
import com.connor.chint.sap2.util.ChintPreferenceUtil;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.SAPUtil;
@ -26,38 +18,21 @@ import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentBOPWindow;
import com.teamcenter.rac.kernel.TCComponentBOPWindowType;
import com.teamcenter.rac.kernel.TCComponentContextList;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQ;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQBASEINFO;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLIST;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLISTHEAD;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLISTITEMSITEM;
import plm.xi.com.chintelectric.DT_BOM_PLM_RSP;
import plm.xi.com.chintelectric.DT_BOM_PLM_RSPRSP_BASEINFO;
import plm.xi.com.chintelectric.DT_BOM_PLM_RSPZTABLE_RETURN;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQ;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQBASEINFO;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLIST;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTHEAD;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTITEMSITEM;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_REQLISTITEMSITEMSUBITEMSSUBITEM;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSP;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSPRSP_BASEINFO;
import plm.xi.com.chintelectric.DT_PROCESSROUTE_S4_RSPZTABLE_RETURN;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYN;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYNService;
import plm.xi.com.chintelectric.SI_BOM_PLM_OUT_SYNServiceLocator;
@ -68,36 +43,35 @@ import plm.xi.com.chintelectric.SI_PROCESSROUTE_PLM_OUT_SYNServiceLocator;
public class SAPZZOperation extends AbstractAIFOperation {
public static boolean flag = false;
TCSession session;
AbstractAIFApplication app;
List<DT_BOM_PLM_REQLIST> list = new ArrayList<>();
List<DT_PROCESSROUTE_S4_REQLIST> proclist = new ArrayList<>();
String now;
private TCSession session;
// private AbstractAIFApplication app;
private List<DT_BOM_PLM_REQLIST> list = new ArrayList<>();
private List<DT_PROCESSROUTE_S4_REQLIST> proclist = new ArrayList<>();
private String now;
private ZZPartBean partBean;
List<String> dists;
// private List<String> dists;
private String txtPath = "";
private String txtName = "";
private SAPZZDialogController controller;
private HashMap<String, ArrayList<String[]>> flMap;
public SAPZZOperation(AbstractAIFApplication app, ZZPartBean partBean, List<String> dists,
SAPZZDialogController controller) {
SAPZZDialogController controller, HashMap<String, ArrayList<String[]>> flMap) {
session = (TCSession) app.getSession();
this.app = app;
// this.app = app;
this.controller = controller;
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
now = format.format(new Date());
this.partBean = partBean;
this.dists = dists;
// this.dists = dists;
this.flMap = flMap;
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd-HH£ºmm£ºss");
try {
txtName = format2.format(new Date()) + getUserName(session);
txtPath = TXTUtil.createTxt(txtName);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
}
@ -159,7 +133,7 @@ public class SAPZZOperation extends AbstractAIFOperation {
SAPUtil.recurBYZZSAP(bomline, zzRev, partRev, controller.gy_meops, controller.needTCM_meops, session,
controller.groupName, list, proclist, txtPath, now, bomIsExist, controller.dialog.materialCode,
controller.icsID, controller.materials, errMess, buff, controller.dists, 1, controller.material_revs,
set_meops,"B",kjBomIds,projWbsNo);
set_meops,"B",kjBomIds,projWbsNo, flMap);
SAPUtil.removeNull(list);
if (errMess.toString().length() > 0) {

@ -49,6 +49,7 @@ import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
import java.util.Arrays;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQ;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQBASEINFO;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLIST;
@ -390,9 +391,9 @@ public class SAPGYController {
String serverHostname = session.getServerHostname();
String sql = "insert into CHINT_BOM_TO_SAP_SUM (code,factory,\"USER\",starttime,wbsno,projectno,taskstauts"
+ ",plmresult,transfer,keymsg,sapresult,PROJECTUID,SERVERHOST,USERID) values "
+ "(?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss')" + ",?,?,'等待组织','未处理',?,?,'未返回',?,?,?)"; // to_date(?,'yyyy-mm-ddhh24:mi:ss')
+ "(?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss')" + ",?,?,'组织完成','已飞书通知',?,?,'全部成功',?,?,?)"; // to_date(?,'yyyy-mm-ddhh24:mi:ss')
SqlUtil.write(sql, new String[] { code + "", groupName, userName, dataTime, zt2_WBSNo, object_name,
"高压", substring, project.getUid(), serverHostname, userId });
"高压开关", substring, project.getUid(), serverHostname, userId });
}
process_boms.clear();
process_jg.clear();
@ -587,7 +588,43 @@ public class SAPGYController {
if (list.size() > 0) {
// BOM传递写入数据库
try {
SI_BOM_PLM_OUT_SYNService service = new SI_BOM_PLM_OUT_SYNServiceLocator();
SI_BOM_PLM_OUT_SYNService service;
if(yb) {
//TODO BOM传递写入数据库
for(DT_BOM_PLM_REQLIST bomMsg : list) {
// String topUid = bomMsg.getHEAD().getSTKTX();
DT_BOM_PLM_REQLISTHEAD head = bomMsg.getHEAD();
DT_BOM_PLM_REQLISTITEMSITEM[] items = bomMsg.getITEMS();
for(DT_BOM_PLM_REQLISTITEMSITEM item : items) {
head.getSTKTX();
item.getMEINS();
}
String matnr = bomMsg.getHEAD().getMATNR();
// System.out.println("matnr" + matnr);
// System.out.println("materialMap" + materialMap);
TCComponent top = materialMap.get(matnr);
if(top == null) {
top = ccp;
}
String detials = "insert into CHINT_BOM_TO_SAP_DETIALS (code,batchnumber,plmsendstatus,"
+ "plmsendstarttime,factory,productmaterialno,pitemid,puid,materialno,wbsno,"
+ "plmstatus,plmalterstatus) "
+ "VALUES (?,?,'PLM开始传递',SYSDATE,?,?,?,?,?,?,'未处理',?)";
// System.out.println("ccpMap" + ccpMap);
// System.out.println("top" + top);
String[] sql = new String[] { code + "",
code + "-" + String.format("%05d", batchNum++), groupName, ccpMap.get(matnr),
top.getProperty("item_id"), top.getUid(), matnr, zt2_WBSNo, plmalterstatus };
System.out.println("sql" + Arrays.toString(sql));
SqlUtil.write(detials, sql);
}
String[] urls = ChintPreferenceUtil.getPreferences("CHINT_BomUrl_YB", session);
service = new SI_BOM_PLM_OUT_SYNServiceLocator(urls[2]);
System.out.println("异步1" + urls[2]);
}else {
System.out.println("同步1");
service = new SI_BOM_PLM_OUT_SYNServiceLocator();
}
SI_BOM_PLM_OUT_SYN stub = service.getHTTP_Port();
String REQ_TRACE_ID = "123456";
DT_BOM_PLM_REQBASEINFO baseInfo = new DT_BOM_PLM_REQBASEINFO(REQ_TRACE_ID);
@ -940,7 +977,7 @@ public class SAPGYController {
List<String> bomISExist = new ArrayList<String>();
// StringBuffer buff = new StringBuffer();
StringBuffer errMess = new StringBuffer();
StringBuffer errMess = new StringBuffer("");
String txtName = format2.format(new Date()) + userName;
String txtPath = TXTUtil.createTxt(txtName);
TCComponent meopRev = null;
@ -1035,42 +1072,65 @@ public class SAPGYController {
throw new Exception(errMess.toString());
}
TXTUtil.writeTXT(txtPath, "----------BOM传递(自身传递)-----------");
System.out.println("----------BOM传递(自身传递)-----------");
TXTUtil.writeTXT(txtPath, "----------BOM传递(自身传递)-----------1");
System.out.println("----------BOM传递(自身传递)-----------2");
List<String> matnrs = null;
// 变压器BOM传递SAP
if (list.size() > 0) {
try {
SI_BOM_PLM_OUT_SYNService service;
String REQ_TRACE_ID = "123456";
if(yb) {
//TODO BOM传递写入数据库
REQ_TRACE_ID = code + "-" + String.format("%05d", batchNum++);
for(DT_BOM_PLM_REQLIST bomMsg : list) {
// String topUid = bomMsg.getHEAD().getSTKTX();
DT_BOM_PLM_REQLISTHEAD head = bomMsg.getHEAD();
DT_BOM_PLM_REQLISTITEMSITEM[] items = bomMsg.getITEMS();
for(DT_BOM_PLM_REQLISTITEMSITEM item : items) {
head.getSTKTX();
item.getMEINS();
}
String matnr = bomMsg.getHEAD().getMATNR();
// System.out.println("matnr" + matnr);
// System.out.println("materialMap" + materialMap);
TCComponent top = materialMap.get(matnr);
String detials = "insert into CHINT_BOM_TO_SAP_DETIALS (code,batchnumber,plmsendstatus,plmsendstarttime,factory,productmaterialno,pitemid,puid,materialno,wbsno,plmstatus,plmalterstatus) "
if(top == null) {
top = bean.getPartRev();
}
String detials = "insert into CHINT_BOM_TO_SAP_DETIALS (code,batchnumber,plmsendstatus,"
+ "plmsendstarttime,factory,productmaterialno,pitemid,puid,materialno,wbsno,"
+ "plmstatus,plmalterstatus) "
+ "VALUES (?,?,'PLM开始传递',SYSDATE,?,?,?,?,?,?,'未处理',?)";
SqlUtil.write(detials, new String[] { code + "", code + "-" + String.format("%05d", batchNum++), groupName, ccpMap.get(matnr), top.getProperty("item_id"), top.getUid(), matnr, zt2_WBSNo, plmalterstatus });
//materialNoTmp.c_str(), itemId, topUid, bomMsg.HEAD.MATNR, wbsNo, alterstatus
// System.out.println("ccpMap" + ccpMap);
// System.out.println("top" + top);
String[] sql = new String[] { code + "", REQ_TRACE_ID, groupName, ccpMap.get(matnr),
top.getProperty("item_id"), top.getUid(), matnr, zt2_WBSNo, plmalterstatus };
System.out.println("sql" + Arrays.toString(sql));
SqlUtil.write(detials, sql);
}
String[] urls = ChintPreferenceUtil.getPreferences("CHINT_BomUrl_YB", session);
System.out.println("异步2" + urls[2]);
service = new SI_BOM_PLM_OUT_SYNServiceLocator(urls[2]);
}else {
SI_BOM_PLM_OUT_SYNService service = new SI_BOM_PLM_OUT_SYNServiceLocator();
SI_BOM_PLM_OUT_SYN stub = service.getHTTP_Port();
String REQ_TRACE_ID = "123456";
DT_BOM_PLM_REQBASEINFO baseInfo = new DT_BOM_PLM_REQBASEINFO(REQ_TRACE_ID);
DT_BOM_PLM_REQLIST[] request = list.toArray(new DT_BOM_PLM_REQLIST[list.size()]);
System.out.println("request:");
TXTUtil.writeTXT(txtPath, "BOM数据传递开始");
for (int i = 0; i < request.length; i++) {
TXTUtil.writeTXT(txtPath, request[i]);
}
DT_BOM_PLM_REQ req = new DT_BOM_PLM_REQ(baseInfo, request);
DT_BOM_PLM_RSP resp = stub.SI_BOM_PLM_OUT_SYN(req);
System.out.println("执行结束4");
TXTUtil.writeTXT(txtPath, "BOM数据传递结束");
matnrs = SAPUtil.printResp(resp, txtPath);
System.out.println("同步2");
service = new SI_BOM_PLM_OUT_SYNServiceLocator();
}
SI_BOM_PLM_OUT_SYN stub = service.getHTTP_Port();
DT_BOM_PLM_REQBASEINFO baseInfo = new DT_BOM_PLM_REQBASEINFO(REQ_TRACE_ID);
DT_BOM_PLM_REQLIST[] request = list.toArray(new DT_BOM_PLM_REQLIST[list.size()]);
System.out.println("request:");
TXTUtil.writeTXT(txtPath, "BOM数据传递开始");
for (int i = 0; i < request.length; i++) {
TXTUtil.writeTXT(txtPath, request[i]);
}
DT_BOM_PLM_REQ req = new DT_BOM_PLM_REQ(baseInfo, request);
DT_BOM_PLM_RSP resp = stub.SI_BOM_PLM_OUT_SYN(req);
System.out.println("执行结束4");
TXTUtil.writeTXT(txtPath, "BOM数据传递结束");
matnrs = SAPUtil.printResp(resp, txtPath);
} catch (Exception e) {
errMess.append("\n[" + rev + "]产成品发送BOM时发生异常" + e.getMessage());
TXTUtil.writeTXT(txtPath, "[" + rev + "]产成品发送BOM时发生异常" + e.getMessage());

@ -1131,26 +1131,6 @@ public class SAPZYDialogController {
return selectedParts;
}
public static void sendMsg(String mess, String userID, String logPath) throws IOException {
try {
TXTUtil.writeTXT(logPath, "开始AM消息推送");
TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
ISendMsgServices service2 = new ISendMsgServicesLocator();
ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
System.out.println("返回信息:" + mess2);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
TXTUtil.writeTXT(logPath, "AM消息推送结束");
}
private void sendSapKT(MyProgressBarCompent my, boolean isCheckProduct) throws Exception {
List<PartBean> selectedParts = getSelectedParts();
int len = selectedParts == null ? 0 : selectedParts.size();

@ -1428,26 +1428,6 @@ public class SAPZYDialogControllerzt {
return selectedParts;
}
public static void sendMsg(String mess, String userID, String logPath) throws IOException {
try {
TXTUtil.writeTXT(logPath, "开始AM消息推送");
TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
ISendMsgServices service2 = new ISendMsgServicesLocator();
ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
System.out.println("返回信息:" + mess2);
} catch (ServiceException e) {
// Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// Auto-generated catch block
e.printStackTrace();
}
TXTUtil.writeTXT(logPath, "AM消息推送结束");
}
private void sendSapKT(MyProgressBarCompent my, boolean isCheckProduct) throws Exception {
List<PartBean> selectedParts = getSelectedParts();
int len = selectedParts == null ? 0 : selectedParts.size();

@ -881,15 +881,20 @@ public class KUtil {
if (parent == null) {
return;
}
TreeNode node = (TreeNode) parent.getLastPathComponent();
if (node.getChildCount() >= 0) {
for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
TreeNode n = (TreeNode) e.nextElement();
TreePath path = parent.pathByAddingChild(n);
expandTree(tree, path);
try {
System.out.println("parent£º" + Arrays.toString(parent.getPath()));
TreeNode node = (TreeNode) parent.getLastPathComponent();
if (node.getChildCount() > 0) {
for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
TreeNode n = (TreeNode) e.nextElement();
TreePath path = parent.pathByAddingChild(n);
expandTree(tree, path);
}
}
tree.expandPath(parent);
}catch(Exception e) {
e.printStackTrace();
}
tree.expandPath(parent);
}
public static void newRow(JPanel panel, Component comp, GridBagConstraints s, int width) {

@ -3,7 +3,6 @@ package com.connor.chint.sap2.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.rmi.RemoteException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
@ -20,8 +19,6 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import javax.xml.rpc.ServiceException;
import com.connor.chint.sap2.bean.ApplyMeBean;
import com.connor.chint.sap2.bom.core.BOMInfo;
import com.connor.chint.sap2.bom.core.Component;
@ -79,9 +76,6 @@ import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServices;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServicesLocator;
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServicesPortType;
import net.sf.json.JSONObject;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLIST;
import plm.xi.com.chintelectric.DT_BOM_PLM_REQLISTHEAD;
@ -3395,21 +3389,73 @@ public class SAPUtil {
* @param logPath AM
* @throws IOException
*/
public static void sendMsg(String mess, String userID, String logPath) throws IOException {
// public static void sendMsg(String mess, String userID, String logPath) throws IOException {
// try {
// TXTUtil.writeTXT(logPath, "开始AM消息推送");
// TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
// ISendMsgServices service2 = new ISendMsgServicesLocator();
// ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
// String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
// TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
// System.out.println("返回信息:" + mess2);
// } catch (ServiceException e) {
// e.printStackTrace();
// } catch (RemoteException e) {
// e.printStackTrace();
// }
// TXTUtil.writeTXT(logPath, "AM消息推送结束");
// }
public static void sendMsg(String mess, String userID, String logPath) {
TXTUtil.writeTXT(logPath, "开始AM消息推送");
TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
String mess2 = sendMsg(mess, userID);
TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
TXTUtil.writeTXT(logPath, "AM消息推送结束");
}
public static String sendMsg(String mess, String userID) {
String mess2 = "";
try {
TXTUtil.writeTXT(logPath, "开始AM消息推送");
TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
ISendMsgServices service2 = new ISendMsgServicesLocator();
/*ISendMsgServices service2 = new ISendMsgServicesLocator();
ISendMsgServicesPortType stub2 = service2.getISendMsgServicesSOAP11port_http();
String mess2 = stub2.chintSendMsgServices(userID, "", mess, "PLM");
TXTUtil.writeTXT(logPath, "返回信息:" + mess2);
String mess2 = stub2.chintSendMsgServices(userID, "", mess, "");//(userID, "", mess, "PLM");*/
//TODO lidy20240829新接口 先获取token再组织数据
String msgJson = "{\"emails\":[\"" + userID + "\"],\"mobiles\": [],\"content\": \"" + mess + "\"}";
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(null, new byte[0]);
Request request = new Request.Builder()
.url("https://pub.chintelec.com/api/getToken?appId=zt_plm&appSecret=RA5KfdZtj37zpVsmgKeSxWncEIT8npVf")
.post(body)
.build();
Response response = client.newCall(request).execute();
String res = response.body().string();
org.json.JSONObject jsonObject = new org.json.JSONObject(res);
// System.out.println(res);
if(!jsonObject.getBoolean("success")) {
System.out.println(res);
return res;
}
String token = jsonObject.getString("data");
client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
body = RequestBody.create(mediaType, msgJson);
request = new Request.Builder()
.url("https://pub.chintelec.com/api/open/Feishu/sendMessages")
.post(body)
.addHeader("Authorization", token)
.addHeader("Content-Type", "application/json")
.build();
response = client.newCall(request).execute();
mess2 = response.body().string();
System.out.println("返回信息:" + mess2);
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
} catch (Exception e) {
// Auto-generated catch block
e.printStackTrace();
}
TXTUtil.writeTXT(logPath, "AM消息推送结束");
return mess2;
}
// 清楚为空的子项
@ -4034,8 +4080,7 @@ public class SAPUtil {
List<DT_BOM_PLM_REQLIST> list, List<DT_PROCESSROUTE_S4_REQLIST> proclist, String txtPath, String now,
List<String> bomISExist, String codeRemark, int icsId, Map<String, TCComponentItemRevision> by_materials,
StringBuffer errMess, StringBuffer buff, Map<String, TCComponentItemRevision> material_revs,String matr,
List<String> kjBomIds,String projWbsNo)
throws Exception {
List<String> kjBomIds, String projWbsNo, HashMap<String, ArrayList<String[]>> flMap) throws Exception {
// 若来源为外购BOM不继续向下展开 20191227
try {
line.refresh();
@ -4070,7 +4115,7 @@ public class SAPUtil {
boolean equals = rev.getProperty("zt2_Source").equals("外购");
if (partRev != null) {
if (meops.length == 0) {
if(!equals && line.getChildrenCount() > 0) {
if(!equals && rev.getType().equals("ZT2_Design3DRevision")) {// && line.getChildrenCount() > 0
String groupID = SAPUtil.getGroupID(session);
TCComponentMEProcessRevision mrProcess = getMrProcess(groupID,session);
if(mrProcess!=null) {
@ -4107,7 +4152,7 @@ public class SAPUtil {
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurBYBJSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
list, proclist, txtPath, now, bomISExist, codeRemark, icsId, by_materials, errMess, buff,
material_revs,matr,kjBomIds, projWbsNo);
material_revs,matr,kjBomIds, projWbsNo, flMap);
win.refresh();
win.close();
@ -4125,17 +4170,20 @@ public class SAPUtil {
bomISExist.add(zt2_MaterialNo);
}
}
String idCut = "";
if(item_id.indexOf("-") > 0)
idCut = item_id.substring(0, item_id.indexOf("-"));
if (contexts.length == 0) {
if (contexts.length == 0 && !flMap.containsKey(idCut)) {
if (rev.getType().equals("ZT2_Design3DRevision") && rev.getProperty("zt2_Source").equals("自制")) {
buff.setLength(0);
TCComponentItemRevision comp = null;
String sortno = "";
Map<String, YCLMaterialBean> materials = new HashMap<String, YCLMaterialBean>();
if(matr!=null && matr.equals("DB")) {
comp = SAPUtil.getClassPartDB(rev, session, codeRemark, icsId, by_materials, buff,materials);
comp = SAPUtil.getClassPartDB(rev, session, codeRemark, icsId, by_materials, buff, materials);
}else {
comp = SAPUtil.getClassPart(rev, session, codeRemark, icsId, by_materials, buff,materials);
comp = SAPUtil.getClassPart(rev, session, codeRemark, icsId, by_materials, buff, materials);
}
// 原材料展开时投料工序获取父项的工艺首工序改为获取父项的投料工序
sortno = line.getProperty("ZT2_ClassificationNo");
@ -4253,7 +4301,26 @@ public class SAPUtil {
head.setBMENG("1");
head.setWERKS(groupName);
head.setDATUV(now);
DT_BOM_PLM_REQLISTITEMSITEM[] items = new DT_BOM_PLM_REQLISTITEMSITEM[contexts.length];
int start = contexts.length;
DT_BOM_PLM_REQLISTITEMSITEM[] items = new DT_BOM_PLM_REQLISTITEMSITEM[start];
ArrayList<AIFComponentContext> fls = new ArrayList<>();
ArrayList<String> gxs = new ArrayList<>();
if (flMap.containsKey(idCut)) {
for(String[] fl : flMap.get(idCut)) {
TCComponent[] flnoItem = session.search("零组件 ID", new String[] { "零组件 ID" },
new String[] { fl[0] });
if(flnoItem.length > 0) {
TCComponentItemRevision flno = ((TCComponentItem)flnoItem[0]).getLatestItemRevision();
TCComponentBOMLine flnoBOM = SAPUtil.getNewBOMLine(flno, session);
for(AIFComponentContext c : flnoBOM.getChildren()) {
fls.add(c);
gxs.add(fl[1]);
}
}
}
items = new DT_BOM_PLM_REQLISTITEMSITEM[start + fls.size()];
}
int seq = 0;
System.out.println("len:" + items.length);
if (buff.length() > 0 && !errMess.toString().contains(item_id + "-" + object_name + ":" + buff.toString())) {
errMess.append("\n" + item_id + "-" + object_name + ":" + buff.toString());
@ -4286,13 +4353,17 @@ public class SAPUtil {
item.setIDNRK(zt2_materialNo);
item.setMEINS(partRev2.getItem().getTCProperty("zt2_unit").getStringValue().toUpperCase());
String zt2_State = partRev2.getProperty("zt2_State");
if(zt2_State.equals("封存")||zt2_State.equals("D1")) {
if(zt2_State.equals("封存") || zt2_State.equals("D1")) {
buff.append("物料:").append(zt2_materialNo).append("已封存,无法传递SAP");
}
}
item.setDATUV(now);
item.setPOSTP("L");
item.setPOSNR(line2.getProperty("bl_sequence_no"));
String seqs = line2.getProperty("bl_sequence_no");
item.setPOSNR(seqs);
int bl_sequence_no = Integer.parseInt(seqs.isEmpty() ? "0" : seqs);
if(bl_sequence_no > seq)
seq = bl_sequence_no;
String sortno = line2.getProperty("ZT2_ClassificationNo");
item.setMENGE(SAPUtil.getSAPMENGE(rev2, null, line2, false, codeRemark, buff));
item.setSORTF(sortno);
@ -4303,10 +4374,9 @@ public class SAPUtil {
items[i] = item;
String item_id2 = rev2.getProperty("item_id");
String object_name2 = rev2.getProperty("object_name");
if (buff.length() > 0 && !errMess.toString().contains(
item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):" + buff.toString())) {
errMess.append("\n" + item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):"
+ buff.toString());
String mess = item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):" + buff.toString();
if (buff.length() > 0 && !errMess.toString().contains(mess)) {
errMess.append("\n" + mess);
}
if (rev2.getProperty("zt2_SapState").equals("已传") && isContinue)
continue;
@ -4314,14 +4384,49 @@ public class SAPUtil {
material_revs.put(zt2_materialNo, partRev2);
}
SAPUtil.recurBYBJSAP(line2, rev2, partRev2, gy_meops, needTCM_meops, session, groupName, list, proclist,
txtPath, now, bomISExist, codeRemark, icsId, by_materials, errMess, buff, material_revs,matr,
kjBomIds,projWbsNo);
txtPath, now, bomISExist, codeRemark, icsId, by_materials, errMess, buff, material_revs, matr,
kjBomIds, projWbsNo, flMap);
}
//
if (flMap.containsKey(idCut)) {
for(int i = 0; i < fls.size(); i++) {
DT_BOM_PLM_REQLISTITEMSITEM item = new DT_BOM_PLM_REQLISTITEMSITEM();
TCComponentBOMLine line2 = (TCComponentBOMLine) fls.get(i).getComponent();
TCComponentItemRevision rev2 = line2.getItemRevision();
TCComponentItemRevision partRev2 = SAPUtil.getSAPPart(line2, session, groupName, buff);
System.out.println("fl:" + item_id + ">>" + line2);
String zt2_MaterialNo = "";
if (partRev2 != null) {
zt2_MaterialNo = partRev2.getProperty("zt2_MaterialNo");
item.setIDNRK(zt2_MaterialNo);
item.setMEINS(partRev2.getItem().getTCProperty("zt2_unit").getStringValue().toUpperCase());
String zt2_State = partRev2.getProperty("zt2_State");
if(zt2_State.equals("封存") || zt2_State.equals("D1")) {
buff.append("物料:").append(zt2_MaterialNo).append("已封存,无法传递SAP");
}
}
item.setDATUV(now);
item.setPOSTP("L");
seq += 10;
item.setPOSNR("" + seq);
item.setMENGE(SAPUtil.getSAPMENGE(rev2, null, line2, false, codeRemark, buff));
item.setSORTF(gxs.get(i));
item.setPOTX1(line2.getProperty("ZT2_Remark"));
items[start + i] = item;
String item_id2 = rev2.getProperty("item_id");
String object_name2 = rev2.getProperty("object_name");
String mess = item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):" + buff.toString();
if (buff.length() > 0 && !errMess.toString().contains(mess)) {
errMess.append("\n" + mess);
}
}
}
list.add(new DT_BOM_PLM_REQLIST(head, items));
}
/*
* SAP
* TODO SAP
*/
public static void recurBYZZSAP(TCComponentBOMLine line, TCComponentItemRevision rev,
TCComponentItemRevision partRev, Map<String, TCComponent> gy_meops,
@ -4330,7 +4435,7 @@ public class SAPUtil {
List<String> bomISExist, String codeRemark, int icsId, Map<String, TCComponentItemRevision> by_materials,
StringBuffer errMess, StringBuffer buff, List<String> dists, int level,
Map<String, TCComponentItemRevision> material_revs, Set<TCComponent> set_meops,String type1,
List<String> kjBomIds ,String projWbsNo ) throws Exception {
List<String> kjBomIds, String projWbsNo, HashMap<String, ArrayList<String[]>> flMap) throws Exception {
try {
line.refresh();
}catch(Exception e) {
@ -4352,7 +4457,7 @@ public class SAPUtil {
partRev = SAPUtil.getSAPPart(line, session, groupName, buff);
}
TCComponentMEProcessRevision meop = null;
for(int i=0;i<meops.length;i++){
for(int i = 0; i < meops.length; i++){
TCComponent comp = (TCComponent) meops[i].getComponent();
TCComponent mpComp = SAPUtil.getSameGroupProcYH(comp, session);
if(mpComp!=null) {
@ -4366,7 +4471,8 @@ public class SAPUtil {
// if (meops.length > 0 && !KUtil.isTCM((TCComponent) meops[0].getComponent())) {
// set_meops.add((TCComponent) meops[0].getComponent());
// }
// 如果图纸下没有物料判断此图纸版本上的属性zt2_Diagram属性如果此属性为是LOV值真实值为Y),则不传递此图纸,物料检查也不要报错,跳过此图纸以及子件
// 如果图纸下没有物料判断此图纸版本上的属性zt2_Diagram属性
//如果此属性为是LOV值真实值为Y),则不传递此图纸,物料检查也不要报错,跳过此图纸以及子件
if (rev.getType().equals("ZT2_Design3DRevision") && partRev == null) {
String zt2_Diagram = rev.getTCProperty("zt2_Diagram").getStringValue();
if (zt2_Diagram.equals("Y") || zt2_Diagram.equals("是")) {
@ -4377,34 +4483,31 @@ public class SAPUtil {
System.out.println("rev:" + rev + " partRev:" + partRev + " length:" + contexts.length);
if (partRev != null) {
System.out.println("查询工艺路线:" + rev);
if (partRev != null) {
if (meop == null) {
if(!equals && (type1.equals("C")||type1.equals("E") && line.getChildrenCount() > 0)) {
String groupID = SAPUtil.getGroupID(session);
TCComponentMEProcessRevision mrProcess = getMrProcess(groupID,session);
if(mrProcess!=null) {
if (level == 1) {
SAPUtil.readBopInfo1(mrProcess, partRev, session, now,
txtPath, proclist, groupName, gy_meops, needTCM_meops, false);
} else {
SAPUtil.readBopInfo1(mrProcess, partRev, session, now,
txtPath, proclist, groupName, gy_meops, needTCM_meops, false);
}
if (meop == null) {
if(!equals && rev.getType().equals("ZT2_Design3DRevision")) {
//&& (type1.equals("C") || (type1.equals("B") || type1.equals("E")) && line.getChildrenCount() > 0)
String groupID = SAPUtil.getGroupID(session);
TCComponentMEProcessRevision mrProcess = getMrProcess(groupID,session);
if(mrProcess!=null) {
if (level == 1) {
SAPUtil.readBopInfo1(mrProcess, partRev, session, now,
txtPath, proclist, groupName, gy_meops, needTCM_meops, false);
} else {
SAPUtil.readBopInfo1(mrProcess, partRev, session, now,
txtPath, proclist, groupName, gy_meops, needTCM_meops, false);
}
}else {
TXTUtil.writeTXT(txtPath, "图纸[" + rev + "]无工艺信息");
}
}else {
TXTUtil.writeTXT(txtPath, "图纸[" + rev + "]无工艺信息");
}
} else {
TXTUtil.writeTXT(txtPath, "图纸[" + rev + "]工艺信息:" + meop);
if (level == 1) {
SAPUtil.readBopInfo1(meop, partRev, session,
now, txtPath, proclist, groupName, gy_meops, needTCM_meops, false);
} else {
TXTUtil.writeTXT(txtPath, "图纸[" + rev + "]工艺信息:" + meop);
if (level == 1) {
SAPUtil.readBopInfo1(meop, partRev, session,
now, txtPath, proclist, groupName, gy_meops, needTCM_meops, false);
} else {
SAPUtil.readBopInfo1(meop, partRev, session,
now, txtPath, proclist, groupName, gy_meops, needTCM_meops, true);
}
SAPUtil.readBopInfo1(meop, partRev, session,
now, txtPath, proclist, groupName, gy_meops, needTCM_meops, true);
}
}
}
@ -4427,7 +4530,7 @@ public class SAPUtil {
TCComponentBOMLine componentbomline = win.getTopBOMLine();
SAPUtil.recurBYZZSAP(componentbomline, partRev, partRev, gy_meops, needTCM_meops, session, groupName,
list, proclist, txtPath, now, bomISExist, codeRemark, icsId, by_materials, errMess, buff, dists,
level, material_revs, set_meops,type1,kjBomIds, projWbsNo );
level, material_revs, set_meops,type1,kjBomIds, projWbsNo, flMap);
win.refresh();
win.close();
@ -4443,8 +4546,11 @@ public class SAPUtil {
bomISExist.add(zt2_MaterialNo);
}
}
String idCut = "";
if(item_id.indexOf("-") > 0)
idCut = item_id.substring(0, item_id.indexOf("-"));
if (contexts.length == 0) {
if (contexts.length == 0 && !flMap.containsKey(idCut)) {
int index = item_id.lastIndexOf("-");
String item_id_cut = "";
if (index != -1) {
@ -4570,12 +4676,31 @@ public class SAPUtil {
head.setBMENG("1");
head.setWERKS(groupName);
head.setDATUV(now);
DT_BOM_PLM_REQLISTITEMSITEM[] items = new DT_BOM_PLM_REQLISTITEMSITEM[contexts.length];
int start = contexts.length;
DT_BOM_PLM_REQLISTITEMSITEM[] items = new DT_BOM_PLM_REQLISTITEMSITEM[start];
ArrayList<AIFComponentContext> fls = new ArrayList<>();
ArrayList<String> gxs = new ArrayList<>();
if (flMap.containsKey(idCut)) {
for(String[] fl : flMap.get(idCut)) {
TCComponent[] flnoItem = session.search("零组件 ID", new String[] { "零组件 ID" },
new String[] { fl[0] });
if(flnoItem.length > 0) {
TCComponentItemRevision flno = ((TCComponentItem)flnoItem[0]).getLatestItemRevision();
TCComponentBOMLine flnoBOM = SAPUtil.getNewBOMLine(flno, session);
for(AIFComponentContext c : flnoBOM.getChildren()) {
fls.add(c);
gxs.add(fl[1]);
}
}
}
items = new DT_BOM_PLM_REQLISTITEMSITEM[start + fls.size()];
}
int seq = 0;
System.out.println("len:" + items.length);
if (buff.length() > 0 && !errMess.toString().contains(item_id + "-" + object_name + ":" + buff.toString())) {
errMess.append("\n" + item_id + "-" + object_name + ":" + buff.toString());
}
for (int i = 0; i < contexts.length; i++) {
for (int i = 0; i < start; i++) {
buff.setLength(0);
DT_BOM_PLM_REQLISTITEMSITEM item = new DT_BOM_PLM_REQLISTITEMSITEM();
TCComponentBOMLine line2 = (TCComponentBOMLine) contexts[i].getComponent();
@ -4605,13 +4730,17 @@ public class SAPUtil {
item.setIDNRK(zt2_MaterialNo);
item.setMEINS(partRev2.getItem().getTCProperty("zt2_unit").getStringValue().toUpperCase());
String zt2_State = partRev2.getProperty("zt2_State");
if(zt2_State.equals("封存")||zt2_State.equals("D1")) {
if(zt2_State.equals("封存") || zt2_State.equals("D1")) {
buff.append("物料:").append(zt2_MaterialNo).append("已封存,无法传递SAP");
}
}
item.setDATUV(now);
item.setPOSTP("L");
item.setPOSNR(line2.getProperty("bl_sequence_no"));
String seqs = line2.getProperty("bl_sequence_no");
item.setPOSNR(seqs);
int bl_sequence_no = Integer.parseInt(seqs.isEmpty() ? "0" : seqs);
if(bl_sequence_no > seq)
seq = bl_sequence_no;
String sortno = line2.getProperty("ZT2_ClassificationNo");
item.setMENGE(SAPUtil.getSAPMENGE(rev2, null, line2, false, codeRemark, buff));
item.setSORTF(sortno);
@ -4622,10 +4751,9 @@ public class SAPUtil {
items[i] = item;
String item_id2 = rev2.getProperty("item_id");
String object_name2 = rev2.getProperty("object_name");
if (buff.length() > 0 && !errMess.toString().contains(
item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):" + buff.toString())) {
errMess.append("\n" + item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):"
+ buff.toString());
String mess = item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):" + buff.toString();
if (buff.length() > 0 && !errMess.toString().contains(mess)) {
errMess.append("\n" + mess);
}
if (rev2.getProperty("zt2_SapState").equals("已传") && isContinue)
continue;
@ -4634,7 +4762,41 @@ public class SAPUtil {
}
SAPUtil.recurBYZZSAP(line2, rev2, partRev2, gy_meops, needTCM_meops, session, groupName, list, proclist,
txtPath, now, bomISExist, codeRemark, icsId, by_materials, errMess, buff, dists, level + 1,
material_revs, set_meops,type1,kjBomIds,projWbsNo);
material_revs, set_meops,type1,kjBomIds,projWbsNo, flMap);
}
//
if (flMap.containsKey(idCut)) {
for(int i = 0; i < fls.size(); i++) {
DT_BOM_PLM_REQLISTITEMSITEM item = new DT_BOM_PLM_REQLISTITEMSITEM();
TCComponentBOMLine line2 = (TCComponentBOMLine) fls.get(i).getComponent();
TCComponentItemRevision rev2 = line2.getItemRevision();
TCComponentItemRevision partRev2 = SAPUtil.getSAPPart(line2, session, groupName, buff);
String zt2_MaterialNo = "";
if (partRev2 != null) {
zt2_MaterialNo = partRev2.getProperty("zt2_MaterialNo");
item.setIDNRK(zt2_MaterialNo);
item.setMEINS(partRev2.getItem().getTCProperty("zt2_unit").getStringValue().toUpperCase());
String zt2_State = partRev2.getProperty("zt2_State");
if(zt2_State.equals("封存") || zt2_State.equals("D1")) {
buff.append("物料:").append(zt2_MaterialNo).append("已封存,无法传递SAP");
}
}
item.setDATUV(now);
item.setPOSTP("L");
seq += 10;
item.setPOSNR("" + seq);
item.setMENGE(SAPUtil.getSAPMENGE(rev2, null, line2, false, codeRemark, buff));
item.setSORTF(gxs.get(i));
item.setPOTX1(line2.getProperty("ZT2_Remark"));
items[start + i] = item;
String item_id2 = rev2.getProperty("item_id");
String object_name2 = rev2.getProperty("object_name");
String mess = item_id2 + "-" + object_name2 + "(父项:" + item_id + "-" + object_name + "):" + buff.toString();
if (buff.length() > 0 && !errMess.toString().contains(mess)) {
errMess.append("\n" + mess);
}
}
}
list.add(new DT_BOM_PLM_REQLIST(head, items));
}
@ -5645,6 +5807,7 @@ public class SAPUtil {
head.setBMENG("1");
head.setWERKS(groupName);
head.setDATUV(now);
head.setSTKTX(partRev.getUid());
DT_BOM_PLM_REQLISTITEMSITEM[] items = new DT_BOM_PLM_REQLISTITEMSITEM[1];
DT_BOM_PLM_REQLISTITEMSITEM item = new DT_BOM_PLM_REQLISTITEMSITEM();
@ -5684,6 +5847,7 @@ public class SAPUtil {
head.setBMENG("1");
head.setWERKS(groupName);
head.setDATUV(now);
head.setSTKTX(partRev.getUid());
Composite Root = (Composite) root;
int length = Root.getChildren().size();
DT_BOM_PLM_REQLISTITEMSITEM[] items = new DT_BOM_PLM_REQLISTITEMSITEM[length];

@ -12,6 +12,15 @@ public class SI_BOM_PLM_OUT_SYNServiceLocator extends org.apache.axis.client.Ser
public SI_BOM_PLM_OUT_SYNServiceLocator() {
}
/*
* lidy20241127
*
* @param url
*/
public SI_BOM_PLM_OUT_SYNServiceLocator(String url) {
HTTPS_Port_address = url;
}
public SI_BOM_PLM_OUT_SYNServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);

Loading…
Cancel
Save