diff --git a/com.connor.chint.wuhan/plugin.xml b/com.connor.chint.wuhan/plugin.xml index 329e2c9..d4a177f 100644 --- a/com.connor.chint.wuhan/plugin.xml +++ b/com.connor.chint.wuhan/plugin.xml @@ -13,6 +13,7 @@ + @@ -59,6 +60,7 @@ + @@ -492,6 +494,29 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/ZxjcController.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/ZxjcController.java index 0930149..73cbfdb 100644 --- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/ZxjcController.java +++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/ZxjcController.java @@ -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 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); } + //ѡȡӦIJƷ Ƿƥ + 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];