|
|
|
@ -22,7 +22,7 @@ import org.dom4j.Document;
|
|
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
|
|
import org.dom4j.Element;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
|
//import com.alibaba.fastjson2.JSONArray;
|
|
|
|
|
//import com.connor.chint.sap2.sap.SAPPushBOMBean;
|
|
|
|
|
//import com.connor.chint.sap2.sap_by.SAPBYOperation;
|
|
|
|
|
//import com.connor.chint.sap2.sap_zy.PartBean;
|
|
|
|
@ -41,6 +41,7 @@ import com.squareup.okhttp.Request;
|
|
|
|
|
import com.squareup.okhttp.RequestBody;
|
|
|
|
|
import com.squareup.okhttp.Response;
|
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
|
|
import com.teamcenter.rac.kernel.ListOfValuesInfo;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
|
@ -512,27 +513,42 @@ public class BomSendSapController {
|
|
|
|
|
String dataTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
|
|
String zt2_WBSNo = project.getStringProperty("zt2_WBSNo");
|
|
|
|
|
String object_name = project.getStringProperty("object_name");
|
|
|
|
|
String code = BomUtilWh.getCode().toString();
|
|
|
|
|
|
|
|
|
|
List<PartBean> selectedParts = getSelectedParts();
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
StringBuilder uids = new StringBuilder("");
|
|
|
|
|
// JSONArray array = new JSONArray();
|
|
|
|
|
// StringBuilder uids = new StringBuilder("");
|
|
|
|
|
HashMap<String, StringBuilder> uids = new HashMap<>();
|
|
|
|
|
for (int i = 0; i < selectedParts.size(); i++) {
|
|
|
|
|
String uid = selectedParts.get(i).getPart().getUid();
|
|
|
|
|
array.add(uid);
|
|
|
|
|
uids.append(uid).append(":");
|
|
|
|
|
//lidy20240528图纸不同的零件使用不同的批次号写入数据库
|
|
|
|
|
TCComponentItemRevision part = selectedParts.get(i).getPart();
|
|
|
|
|
AIFComponentContext[] designs = BomToSapUtil.getPseudoFolder(part, "TC_Is_Represented_By").getChildren();
|
|
|
|
|
String uid = part.getUid();
|
|
|
|
|
// array.add(uid);
|
|
|
|
|
//uids.append(uid).append(":");
|
|
|
|
|
if(designs == null || designs.length == 0) {
|
|
|
|
|
uids.put("" + i, new StringBuilder(uid));
|
|
|
|
|
}else {
|
|
|
|
|
String design = ((TCComponentItemRevision)designs[0].getComponent()).getItem().getLatestItemRevision().getUid();
|
|
|
|
|
if(uids.containsKey(design))
|
|
|
|
|
uids.get(design).append(":").append(uid);
|
|
|
|
|
else
|
|
|
|
|
uids.put(design, new StringBuilder(uid));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(StringBuilder uid : uids.values()) {
|
|
|
|
|
String code = BomUtilWh.getCode().toString();
|
|
|
|
|
// obj.put("uid", array);
|
|
|
|
|
// OkHttpClient client = new OkHttpClient();
|
|
|
|
|
String substring = uids.substring(0, uids.length() - 1);
|
|
|
|
|
// 新增字段 项目UID,执行人,改成定时执行,不调用接口
|
|
|
|
|
String serverHostname = session.getServerHostname();
|
|
|
|
|
System.out.println("serverHostname===>" + serverHostname);
|
|
|
|
|
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-ddhh24:mi:ss')" + ",?,?,'等待组织','未处理',?,?,'未返回',?,?,?)"; // to_date(?,'yyyy-mm-ddhh24:mi:ss')
|
|
|
|
|
SqlUtil.write(sql, new String[] { code + "", "M060", userName, dataTime, zt2_WBSNo, object_name,
|
|
|
|
|
"产成品", substring, project.getUid(), serverHostname, userId });
|
|
|
|
|
// String substring = uids.substring(0, uids.length() - 1);
|
|
|
|
|
// 新增字段 项目UID,执行人,改成定时执行,不调用接口
|
|
|
|
|
String serverHostname = session.getServerHostname();
|
|
|
|
|
System.out.println("serverHostname===>" + serverHostname);
|
|
|
|
|
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-ddhh24:mi:ss')" + ",?,?,'等待组织','未处理',?,?,'未返回',?,?,?)"; // to_date(?,'yyyy-mm-ddhh24:mi:ss')
|
|
|
|
|
SqlUtil.write(sql, new String[] { code + "", "M060", userName, dataTime, zt2_WBSNo, object_name,
|
|
|
|
|
"产成品", uid.toString(), project.getUid(), serverHostname, userId });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageBox.post(dialog, "传递请求已记录,请等待飞书通知.", "", MessageBox.INFORMATION);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|