|
|
|
@ -2,11 +2,8 @@ package com.chint.plm.createGGBom;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.rmi.RemoteException;
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
@ -36,13 +33,10 @@ import com.connor.chint.sap2.util.HttpUtil;
|
|
|
|
|
//import com.connor.chint.sap2.operation.SelfMPartBean;
|
|
|
|
|
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.PartSqlUtil;
|
|
|
|
|
import com.connor.chint.sap2.util.SAPMessageUtil;
|
|
|
|
|
import com.connor.chint.sap2.util.SAPUtil;
|
|
|
|
|
import com.connor.chint.sap2.util.SqlUtil;
|
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentContextList;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentFolder;
|
|
|
|
@ -63,15 +57,10 @@ import com.teamcenter.services.rac.cad._2007_01.StructureManagement.CreateOrUpda
|
|
|
|
|
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.RelOccInfo;
|
|
|
|
|
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.RelativeStructureChildInfo;
|
|
|
|
|
import com.teamcenter.services.rac.core.DataManagementService;
|
|
|
|
|
import com.teamcenter.services.rac.core.ReservationService;
|
|
|
|
|
import com.teamcenter.services.rac.core._2006_03.DataManagement.Relationship;
|
|
|
|
|
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn;
|
|
|
|
|
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 com.teamcenter.services.strong.cad._2007_01.StructureManagement;
|
|
|
|
|
import com.teamcenter.soa.client.model.ModelObject;
|
|
|
|
|
import com.teamcenter.soa.client.model.ServiceData;
|
|
|
|
|
import com.teamcenter.soaictstubs.ICCTReservationService;
|
|
|
|
|
|
|
|
|
|
import nc.itf.chintwebservices.msg.ISendMsgServices.ISendMsgServices;
|
|
|
|
@ -81,11 +70,11 @@ import net.sf.json.JSONArray;
|
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
public class GGBomController {
|
|
|
|
|
private AbstractAIFApplication app;
|
|
|
|
|
// private AbstractAIFApplication app;
|
|
|
|
|
private TCSession session;
|
|
|
|
|
private TCComponent project;
|
|
|
|
|
private String wbsNo = "";
|
|
|
|
|
private String projectDh = "";
|
|
|
|
|
// private TCComponent project;
|
|
|
|
|
// private String wbsNo = "";
|
|
|
|
|
// private String projectDh = "";
|
|
|
|
|
public Map<String,List<String>> phMap = new HashMap<String,List<String>>();
|
|
|
|
|
private TCComponentItemType itemType;
|
|
|
|
|
public List<String> pkList = new ArrayList<String>();
|
|
|
|
@ -99,8 +88,8 @@ public class GGBomController {
|
|
|
|
|
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,to_date(?,'yyyy-mm-dd HH24:mi:ss'),?,?)";
|
|
|
|
|
Map<String,SelfMPartBean> idBeanMap = new HashMap<String,SelfMPartBean>();
|
|
|
|
|
public GGBomController(AbstractAIFApplication app) {
|
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
|
this.app = app;
|
|
|
|
|
// Auto-generated constructor stub
|
|
|
|
|
// this.app = app;
|
|
|
|
|
this.session = (TCSession) app.getSession();
|
|
|
|
|
try {
|
|
|
|
|
TCComponentUser user = session.getUser();
|
|
|
|
@ -112,7 +101,7 @@ public class GGBomController {
|
|
|
|
|
itemType = (TCComponentItemType) this.session.getTypeComponent("Part");
|
|
|
|
|
dcproxy = KUtil.getUser("dcproxy", session);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
// Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -155,7 +144,7 @@ public class GGBomController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
// Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}finally {
|
|
|
|
|
SqlUtil.freeAll();
|
|
|
|
@ -206,7 +195,7 @@ public class GGBomController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
// Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}finally {
|
|
|
|
|
SqlUtil.freeAll();
|
|
|
|
@ -234,16 +223,16 @@ public class GGBomController {
|
|
|
|
|
String companyCode = groupID;
|
|
|
|
|
String mp = "P";
|
|
|
|
|
String bpNo = "";//properties[0];//rev.getProperty("item_id"); // 非必填
|
|
|
|
|
String zt2_DrawingNo = "";//properties[2];//rev.getProperty("zt2_DrawingNo");
|
|
|
|
|
// String zt2_DrawingNo = "";//properties[2];//rev.getProperty("zt2_DrawingNo");
|
|
|
|
|
// if (!KUtil.isEmpty(zt2_DrawingNo)) {
|
|
|
|
|
// if (!bpNo.equals(zt2_DrawingNo))
|
|
|
|
|
// bpNo = zt2_DrawingNo;
|
|
|
|
|
// }
|
|
|
|
|
String zt2_ProductModel = "";//properties[4];//rev.getProperty("zt2_ProductModel");
|
|
|
|
|
// String zt2_ProductModel = "";//properties[4];//rev.getProperty("zt2_ProductModel");
|
|
|
|
|
String teRe = "";
|
|
|
|
|
String state = ""; // 申请时为空
|
|
|
|
|
String wbs = "";
|
|
|
|
|
String product = "";
|
|
|
|
|
// String wbs = "";
|
|
|
|
|
// String product = "";
|
|
|
|
|
String user = userID;
|
|
|
|
|
String time = now;
|
|
|
|
|
String condition = "审核中";// 默认审核中
|
|
|
|
@ -598,7 +587,7 @@ public class GGBomController {
|
|
|
|
|
drequests.clear();
|
|
|
|
|
send(ph,ggbean.getPk());
|
|
|
|
|
System.out.println("申请物料"+drequests.toString());
|
|
|
|
|
List<CreateIn> cIList = new ArrayList();
|
|
|
|
|
List<CreateIn> cIList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < self_lists.size(); i++) {
|
|
|
|
|
int t = i+1;
|
|
|
|
|
System.out.println("正在创建第"+t+"个物料!");
|
|
|
|
@ -695,8 +684,8 @@ public class GGBomController {
|
|
|
|
|
build.append("当前产品无自动校验规则,请人工二次校验.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}finally {
|
|
|
|
|
SqlUtil.freeAll();
|
|
|
|
@ -716,24 +705,22 @@ public class GGBomController {
|
|
|
|
|
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) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
// TXTUtil.writeTXT(logPath, "AM消息推送结束");
|
|
|
|
|
}
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
|
public void createBomChild(TCComponentItemRevision parentRev,Map<TCComponentItemRevision,String> childMap ) {
|
|
|
|
|
ICCTReservationService reservationService = new ICCTReservationService(
|
|
|
|
|
session.getSoaConnection());
|
|
|
|
|
try {
|
|
|
|
|
ICCTReservationService reservationService = new ICCTReservationService(session.getSoaConnection());
|
|
|
|
|
TCComponent[] strustRevs = parentRev.getReferenceListProperty("structure_revisions");
|
|
|
|
|
try {
|
|
|
|
|
if(strustRevs!=null && strustRevs.length>0) {
|
|
|
|
|
reservationService.reserve(new String[] {strustRevs[0].getUid()}, "true", "true", (short) 2);
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception e) {
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
RelOccInfo occInfo;
|
|
|
|
|
AttributesInfo attr;
|
|
|
|
@ -790,10 +777,11 @@ public class GGBomController {
|
|
|
|
|
reservationService.unReserve(new String[] {strustRevs[0].getUid()}, false);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
// Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
|
public void createBomChild(TCComponentItemRevision parentRev,List<TCComponentItemRevision> childs,List<String> nums) {
|
|
|
|
|
ICCTReservationService reservationService = new ICCTReservationService(
|
|
|
|
|
session.getSoaConnection());
|
|
|
|
@ -845,7 +833,7 @@ public class GGBomController {
|
|
|
|
|
reservationService.unReserve(new String[] {strustRevs[0].getUid()}, false);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
// Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|