|
|
|
@ -9,6 +9,8 @@ import java.io.OutputStream;
|
|
|
|
|
import java.net.HttpURLConnection;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
@ -42,8 +44,10 @@ import com.connor.chint.sap2.util.BomUtilWh;
|
|
|
|
|
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.connor.plm.CostListManagement.pojo.GzxqBean;
|
|
|
|
|
import com.squareup.okhttp.Credentials;
|
|
|
|
|
import com.squareup.okhttp.MediaType;
|
|
|
|
|
import com.squareup.okhttp.OkHttpClient;
|
|
|
|
@ -78,9 +82,15 @@ import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
|
|
import javafx.collections.FXCollections;
|
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
|
import javafx.scene.control.Alert;
|
|
|
|
|
import javafx.scene.control.Alert.AlertType;
|
|
|
|
|
|
|
|
|
|
public class ZxjcController {
|
|
|
|
|
|
|
|
|
|
// 存在相同的物料 如果用j做序号不对
|
|
|
|
|
private int count = 1;//物料个数
|
|
|
|
|
public static final String TYPE_REV_PART = "Part Revision";
|
|
|
|
|
public TCComponent project; // 项目信息
|
|
|
|
|
public String groupName;
|
|
|
|
@ -381,8 +391,7 @@ public class ZxjcController {
|
|
|
|
|
System.out.println("tzBoms.size=====================" + tzBomsList.size());
|
|
|
|
|
// 根据图纸获取物料 排除重复物料
|
|
|
|
|
|
|
|
|
|
// 存在相同的物料 如果用j做序号不对
|
|
|
|
|
int count = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取流水号的首选项
|
|
|
|
|
String[] lsmPref = session.getPreferenceService().getStringValues("CHINT_MATERIAL_VIRTUAL_RULE");
|
|
|
|
@ -396,6 +405,19 @@ public class ZxjcController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取数据库物料的首选项
|
|
|
|
|
String[] sqlMaterialPref = session.getPreferenceService().getStringValues("CHINT_WMS_DEFAULT_MATERIAL_RULE");
|
|
|
|
|
String sqlMaterialStr = "";
|
|
|
|
|
for (int i = 0; i < sqlMaterialPref.length; i++) {
|
|
|
|
|
String[] split = lsmPref[i].split(":");
|
|
|
|
|
// 判断当前组织与首选项是否相同
|
|
|
|
|
if (split[0].equals(groupName)) {
|
|
|
|
|
sqlMaterialStr = split[1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < tzBomsList.size(); i++) {
|
|
|
|
|
TCComponentBOMLine tcComponentBOMLine = tzBomsList.get(i);
|
|
|
|
|
String tzType = tcComponentBOMLine.getStringProperty("fnd0bl_line_object_type");
|
|
|
|
@ -954,20 +976,26 @@ public class ZxjcController {
|
|
|
|
|
String zt2_MaterialNo = "";
|
|
|
|
|
String object_desc = wlRev.getStringProperty("object_desc");
|
|
|
|
|
System.out.println("object_desc================================================"+object_desc);
|
|
|
|
|
//String zt2_Specifications = wlRev.getStringProperty("zt2_Specifications");
|
|
|
|
|
//2、物料型号规格取物料描述第一个空格后的数据
|
|
|
|
|
String zt2_Specifications = "";
|
|
|
|
|
|
|
|
|
|
//2、物料型号规格取物料描述第一个空格后的数据
|
|
|
|
|
|
|
|
|
|
//String object_desc = wlRev.getStringProperty("object_desc");
|
|
|
|
|
// if(object_desc != null && !object_desc.isEmpty()) {
|
|
|
|
|
// // 查找第一个空格的位置
|
|
|
|
|
// int spaceIndex = object_desc.indexOf(' ');
|
|
|
|
|
//
|
|
|
|
|
// // 检查是否找到了空格
|
|
|
|
|
// if (spaceIndex != -1) {
|
|
|
|
|
// // 提取空格之后的字符串
|
|
|
|
|
// zt2_Specifications = object_desc.substring(spaceIndex + 1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if(object_desc != null && !object_desc.isEmpty()) {
|
|
|
|
|
// 查找第一个空格的位置
|
|
|
|
|
int spaceIndex = object_desc.indexOf(' ');
|
|
|
|
|
|
|
|
|
|
// 检查是否找到了空格
|
|
|
|
|
if (spaceIndex != -1) {
|
|
|
|
|
// 提取空格之后的字符串
|
|
|
|
|
zt2_Specifications = object_desc.substring(spaceIndex + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(zt2_Specifications != null && zt2_Specifications.isEmpty()) {
|
|
|
|
|
zt2_Specifications = wlRev.getStringProperty("zt2_Specifications");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("zt2_Specifications=================================================="+zt2_Specifications);
|
|
|
|
|
zt2_MaterialNo = wlRev.getStringProperty("zt2_MaterialNo");
|
|
|
|
|
// 是否查到流水码
|
|
|
|
@ -1226,6 +1254,9 @@ public class ZxjcController {
|
|
|
|
|
JSONArray ccpArray = new JSONArray();
|
|
|
|
|
// 获取产成品revs
|
|
|
|
|
List<List> ccp_revs = map.getValue();
|
|
|
|
|
|
|
|
|
|
//获取其中一个产成品名称
|
|
|
|
|
String ccpName = "";
|
|
|
|
|
for (int j = 0; j < ccp_revs.size(); j++) {
|
|
|
|
|
JSONObject ccp_temp_Json = new JSONObject();
|
|
|
|
|
TCComponentItemRevision ccp_rev = (TCComponentItemRevision) ccp_revs.get(j).get(0);
|
|
|
|
@ -1236,6 +1267,7 @@ public class ZxjcController {
|
|
|
|
|
// 手动填写属性
|
|
|
|
|
ccp_temp_Json.put("factoryno", ccp_revs.get(j).get(1));
|
|
|
|
|
ccpArray.put(ccp_temp_Json);
|
|
|
|
|
ccpName = ccp_rev.getStringProperty("object_name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 物料信息array
|
|
|
|
@ -1254,6 +1286,40 @@ public class ZxjcController {
|
|
|
|
|
wlArray.put(wl_temp_Json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//首选项取到对应的产成品名称 是否匹配
|
|
|
|
|
boolean isDelivery = true;
|
|
|
|
|
if(sqlMaterialStr != null && !sqlMaterialStr.isEmpty()) {
|
|
|
|
|
String[] split = sqlMaterialStr.split(";");
|
|
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
|
|
//产成品名称匹配首选项 ,匹配到就不传数据库里的物料
|
|
|
|
|
if(ccpName.contains(split[i])) {
|
|
|
|
|
isDelivery = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//去数据库查对应组织的物料
|
|
|
|
|
if(isDelivery) {
|
|
|
|
|
//连接数据库查询出对应组织物料
|
|
|
|
|
String sql = "SELECT * FROM CHINT_WMS_DEFAULT_MATERIAL_RULE WHERE FACTORY = '" + groupName + "'";
|
|
|
|
|
SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
System.out.println("查询语句:" + sql.toString());
|
|
|
|
|
ResultSet rs = SqlUtil.read(sql.toString());
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
|
|
JSONObject wl_temp_Json = new JSONObject();
|
|
|
|
|
wl_temp_Json.put("no", count+"");
|
|
|
|
|
wl_temp_Json.put("materialno", rs.getString("DRAWINGNO"));
|
|
|
|
|
wl_temp_Json.put("objectdesc", rs.getString("OBJECTNAME"));
|
|
|
|
|
wl_temp_Json.put("specifications", rs.getString("SPECIFICATIONS"));
|
|
|
|
|
wl_temp_Json.put("quantity", rs.getInt("QUANTITY"));
|
|
|
|
|
wl_temp_Json.put("unit", rs.getString("UNIT"));
|
|
|
|
|
wl_temp_Json.put("remark", rs.getString("REMARK"));
|
|
|
|
|
wlArray.put(wl_temp_Json);
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
top.put("projectname", project_object_name);
|
|
|
|
|
top.put("projectno", project_zt2_ProjectNo);
|
|
|
|
|
top.put("wbsno", project_zt2_WBSNo);
|
|
|
|
@ -1266,7 +1332,8 @@ public class ZxjcController {
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
System.out.println("top========" + top.toString());
|
|
|
|
|
|
|
|
|
|
//组织完一次 count 清空
|
|
|
|
|
count = 1;
|
|
|
|
|
// 发送接口
|
|
|
|
|
String[] url = session.getPreferenceService().getStringValues("CHINT_ZXJC_URL");
|
|
|
|
|
String strUrl = url[0];
|
|
|
|
|