Browse Source

订单接口更新物料属性字段

zengtx 2 years ago
parent
commit
6f59f36fa2

+ 182 - 32
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/JsonChangeUtils.java

@@ -64,7 +64,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
      */
     public static List<JSONObject> toMoMainJson(Map<String, Object> result) {
         List<JSONObject> pljf = new ArrayList<JSONObject>();// 表数据json集合
-        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         JSONObject jf = new JSONObject();
        // for (int i = 0; i < result.size(); i++) {
             Map<String, Object> map = result;//.get(i);
@@ -80,11 +80,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
             }
             if(oConvertUtils.isNotEmpty(map.get("customerDemandDate"))){
                 String customerDemandDate = sf.format(map.get("customerDemandDate"));
-                jf.put("customerDemandDate",customerDemandDate+" 00:00:00");
+                jf.put("customerDemandDate",customerDemandDate);
             }
             if(oConvertUtils.isNotEmpty(map.get("headerAttributeDatetime1"))){
                 String headerAttributeDatetime1 = sf.format(map.get("headerAttributeDatetime1"));
-                jf.put("headerAttributeDatetime1",headerAttributeDatetime1+" 00:00:00");
+                jf.put("headerAttributeDatetime1",headerAttributeDatetime1);
 
             }
 
@@ -102,7 +102,8 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',case when mo.iSum is null then '0' else mo.iSum end as amount,ex.cbdefine2 as lineAttributeString7,ex.cbdefine3 as lineAttributeString8," +
                         "mo.cDefine28 as 'lineAttributeString1',mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3'," +
                         "mo.cDefine30 as 'lineAttributeString4',mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8," +
-                        "cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
+                        "mo.cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10,"+
                         "'' as externalLineNum,'' as itemAttrId,'"+map.get("moId")+"' as poId  from OM_MODetails mo  " +
                         "left join Inventory inv  on mo.cInvCode = inv.cInvCode "+
                         "left join OM_MOdetails_extradefine ex on mo.MODetailsID = ex.MODetailsID "+
@@ -130,7 +131,8 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',case when mo.iSum is null then '0' else mo.iSum end as amount,ex.cbdefine2 as lineAttributeString7,ex.cbdefine3 as lineAttributeString8," +
                         "mo.cDefine28 as 'lineAttributeString1',mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3'," +
                         "mo.cDefine30 as 'lineAttributeString4',mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8," +
-                        "cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
+                        "mo.cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10,"+
                         "'' as externalLineNum,'' as itemAttrId,'"+map.get("moId")+"' as poId  from OM_MODetails mo  " +
                         "left join Inventory inv  on mo.cInvCode = inv.cInvCode "+
                         "left join OM_MOdetails_extradefine ex on mo.MODetailsID = ex.MODetailsID "+
@@ -159,7 +161,8 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',case when mo.iSum is null then '0' else mo.iSum end as amount,ex.cbdefine2 as lineAttributeString7,ex.cbdefine3 as lineAttributeString8," +
                         "mo.cDefine28 as 'lineAttributeString1',mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3'," +
                         "mo.cDefine30 as 'lineAttributeString4',mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8," +
-                        "cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
+                        "mo.cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10,"+
                         "'' as externalLineNum,'' as itemAttrId,'"+map.get("moId")+"' as poId  from OM_MODetails mo  " +
                         "left join Inventory inv  on mo.cInvCode = inv.cInvCode "+
                         "left join OM_MOdetails_extradefine ex on mo.MODetailsID = ex.MODetailsID "+
@@ -194,7 +197,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
      */
     public static List<JSONObject> toPoMainJson(Map<String, Object> result) {
         List<JSONObject> pljf = new ArrayList<JSONObject>();// 表数据json集合
-        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
         JSONObject jf = new JSONObject();
         //for (int i = 0; i < result.size(); i++) {
@@ -210,11 +213,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
             }
             if(oConvertUtils.isNotEmpty(map.get("customerDemandDate"))){
                 String customerDemandDate = sf.format(map.get("customerDemandDate"));
-                jf.put("customerDemandDate",customerDemandDate+" 00:00:00");
+                jf.put("customerDemandDate",customerDemandDate);
             }
             if(oConvertUtils.isNotEmpty(map.get("headerAttributeDatetime1"))){
                 String headerAttributeDatetime1 = sf.format(map.get("headerAttributeDatetime1"));
-                jf.put("headerAttributeDatetime1",headerAttributeDatetime1+" 00:00:00");
+                jf.put("headerAttributeDatetime1",headerAttributeDatetime1);
 
             }
 //            String cAuditDate = sf.format(map.get("cAuditDate"));
@@ -233,6 +236,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iSum as 'amount',mo.cDefine28 as 'lineAttributeString1'," +
                         "mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3','' as 'attributeString1',mo.cDefine30 as 'lineAttributeString4'," +
                         "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10,"+
                         "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode " +
                         "left join PO_Podetails_extradefine ex on mo.ID = ex.ID"+
                         " where mo.POID = '"+map.get("moId")+"'";
@@ -259,6 +263,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iSum as 'amount',mo.cDefine28 as 'lineAttributeString1'," +
                         "mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3','' as 'attributeString1',mo.cDefine30 as 'lineAttributeString4'," +
                         "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10,"+
                         "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode " +
                         "left join PO_Podetails_extradefine ex on mo.ID = ex.ID"+
                         " where mo.POID = '"+map.get("moId")+"'";
@@ -284,6 +289,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iSum as 'amount',mo.cDefine28 as 'lineAttributeString1'," +
                         "mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3','' as 'attributeString1',mo.cDefine30 as 'lineAttributeString4'," +
                         "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10,"+
                         "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode " +
                         "left join PO_Podetails_extradefine ex on mo.ID = ex.ID "+
                         " where mo.POID = '"+map.get("moId")+"'";
@@ -315,7 +321,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
      */
     public static List<JSONObject> toRdrecordJson(List<Map<String, Object>> result) {
         List<JSONObject> pljf = new ArrayList<JSONObject>();// 表数据json集合
-        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         JSONObject jf = new JSONObject();
         for (int i = 0; i < result.size(); i++) {
             Map<String, Object> map = result.get(i);
@@ -330,11 +336,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
             }
             if(oConvertUtils.isNotEmpty(map.get("customerDemandDate"))){
                 String customerDemandDate = sf.format(map.get("customerDemandDate"));
-                jf.put("customerDemandDate",customerDemandDate+" 00:00:00");
+                jf.put("customerDemandDate",customerDemandDate);
             }
             if(oConvertUtils.isNotEmpty(map.get("headerAttributeDatetime1"))){
                 String headerAttributeDatetime1 = sf.format(map.get("headerAttributeDatetime1"));
-                jf.put("headerAttributeDatetime1",headerAttributeDatetime1+" 00:00:00");
+                jf.put("headerAttributeDatetime1",headerAttributeDatetime1);
 
             }
             //查询子表信息
@@ -364,8 +370,9 @@ public class JsonChangeUtils implements ApplicationContextAware{
     public static List<JSONObject> toListJson(List<Map<String, Object>> result) {
         List<JSONObject> pljf = new ArrayList<JSONObject>();// 表数据json集合
         Map<String, Object> mapCfree = new HashMap<>();//处理物料属性
-        int ii = 1;
-        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        Map<String, Object> mapbConfig = new HashMap<>();//处理物料是否存在属性
+        int ii = 0;
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         JSONObject jf = new JSONObject();
         for (int i = 0; i < result.size(); i++) {
             Map<String, Object> map = result.get(i);
@@ -396,31 +403,85 @@ public class JsonChangeUtils implements ApplicationContextAware{
                     }else if(key.equals("cFree10")&&oConvertUtils.isNotEmpty(map.get(key))){
                         mapCfree.put(key,map.get(key));
                     }
+                    //处理物料属性结构性
+                    if(key.equals("bConfigFree1")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree2")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree3")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree4")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree5")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree6")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree7")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree8")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree9")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree10")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }
                     jf.put(key, map.get(key));
                 }
             }
             if(oConvertUtils.isNotEmpty(map.get("customerDemandDate"))){
                 String customerDemandDate = sf.format(map.get("customerDemandDate"));
-                jf.put("customerDemandDate",customerDemandDate+" 00:00:00");
+                jf.put("customerDemandDate",customerDemandDate);
             }
 
             if(oConvertUtils.isNotEmpty(map.get("lineAttributeDatetime1"))){
                 String lineAttributeDatetime1 = sf.format(map.get("lineAttributeDatetime1"));
-                jf.put("lineAttributeDatetime1",lineAttributeDatetime1+" 00:00:00");
+                jf.put("lineAttributeDatetime1",lineAttributeDatetime1);
             }
 
             if(oConvertUtils.isNotEmpty(map.get("bomDate"))){
                 String bomDate = sf.format(map.get("bomDate"));
-                jf.put("bomDate",bomDate+" 00:00:00");
+                jf.put("bomDate",bomDate);
             }
 
             Set<String> keysCfree = mapCfree.keySet();
             for (String key : keysCfree) {
+                ii++;
                 jf.put("attributeCode"+ii, key);
                 jf.put("attributeValue"+ii, map.get(key));
-                ii++;
+                String code = key.substring(key.length()-1);
+                jf.put("attributeFlag"+ii, mapbConfig.get("bConfigFree"+code));
+            }
+            if(ii <4){
+                jf.put("attributeValue4", "");
+                jf.put("attributeFlag4", "false");
+            }
+            if(ii<3){
+                jf.put("attributeValue4", "");
+                jf.put("attributeValue3", "");
+                jf.put("attributeFlag4", "false");
+                jf.put("attributeFlag3", "false");
             }
-            ii = 1;
+            if(ii<2){
+                jf.put("attributeValue4", "");
+                jf.put("attributeValue3", "");
+                jf.put("attributeValue2", "");
+                jf.put("attributeFlag4", "false");
+                jf.put("attributeFlag3", "false");
+                jf.put("attributeFlag2", "false");
+            }
+            if(ii<1){
+                jf.put("attributeValue4", "");
+                jf.put("attributeValue3", "");
+                jf.put("attributeValue2", "");
+                jf.put("attributeValue1", "");
+                jf.put("attributeFlag4", "false");
+                jf.put("attributeFlag3", "false");
+                jf.put("attributeFlag2", "false");
+                jf.put("attributeFlag1", "false");
+
+            }
+
+            ii = 0;
             jf.remove("iMoney");
             jf.remove("cFree1");
             jf.remove("cFree2");
@@ -432,6 +493,16 @@ public class JsonChangeUtils implements ApplicationContextAware{
             jf.remove("cFree8");
             jf.remove("cFree9");
             jf.remove("cFree10");
+            jf.remove("bConfigFree1");
+            jf.remove("bConfigFree2");
+            jf.remove("bConfigFree3");
+            jf.remove("bConfigFree4");
+            jf.remove("bConfigFree5");
+            jf.remove("bConfigFree6");
+            jf.remove("bConfigFree7");
+            jf.remove("bConfigFree8");
+            jf.remove("bConfigFree9");
+            jf.remove("bConfigFree10");
             pljf.add(jf);
         }
         return pljf;
@@ -445,8 +516,9 @@ public class JsonChangeUtils implements ApplicationContextAware{
     public static List<JSONObject> toMOListJson(List<Map<String, Object>> result) {
         List<JSONObject> pljf = new ArrayList<JSONObject>();// 表数据json集合
         Map<String, Object> mapCfree = new HashMap<>();//处理物料属性
-        int ii = 1;
-        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        Map<String, Object> mapbConfig = new HashMap<>();//处理物料是否存在属性
+        int ii = 0;
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         JSONObject jf = new JSONObject();
         for (int i = 0; i < result.size(); i++) {
             Map<String, Object> map = result.get(i);
@@ -477,20 +549,42 @@ public class JsonChangeUtils implements ApplicationContextAware{
                     }else if(key.equals("cFree10")&&oConvertUtils.isNotEmpty(map.get(key))){
                         mapCfree.put(key,map.get(key));
                     }
+                    //处理物料属性结构性
+                    if(key.equals("bConfigFree1")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree2")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree3")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree4")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree5")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree6")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree7")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree8")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree9")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }else if(key.equals("bConfigFree10")&&oConvertUtils.isNotEmpty(map.get(key))){
+                        mapbConfig.put(key,map.get(key));
+                    }
                     jf.put(key, map.get(key));
                 }
             }
             if(oConvertUtils.isNotEmpty(map.get("customerDemandDate"))){
                 String customerDemandDate = sf.format(map.get("customerDemandDate"));
-                jf.put("customerDemandDate",customerDemandDate+" 00:00:00");
+                jf.put("customerDemandDate",customerDemandDate);
             }
             if(oConvertUtils.isNotEmpty(map.get("lineAttributeDatetime1"))){
                 String lineAttributeDatetime1 = sf.format(map.get("lineAttributeDatetime1"));
-                jf.put("lineAttributeDatetime1",lineAttributeDatetime1+" 00:00:00");
+                jf.put("lineAttributeDatetime1",lineAttributeDatetime1);
             }
             if(oConvertUtils.isNotEmpty(map.get("bomDate"))){
                 String bomDate = sf.format(map.get("bomDate"));
-                jf.put("bomDate",bomDate+" 00:00:00");
+                jf.put("bomDate",bomDate);
             }
             //查询委外用料子表数据
             if(map.get("pkorg").equals("one")){
@@ -500,8 +594,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
                         "mo.cFree5 as cFree5,mo.cFree6 as cFree6,mo.cFree7 as cFree7,mo.cFree8 as cFree8,mo.cFree9 as cFree9,mo.cFree10 as cFree10," +
                         "'' as poOutsourceId,''as poOutsourceNum,'' as 'customerUomId','' as customerUomCode,mo.iQuantity as customerPromiseQty, " +
-                        "mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'" +
-                        " from OM_MOMaterials mo where MODetailsID  = '"+map.get("MODetailsID")+"'";
+                        "mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10 "+
+                        " from OM_MOMaterials mo " +
+                        " left join Inventory inv on mo.cInvCode = inv.cInvCode " +
+                        "where MODetailsID  = '"+map.get("MODetailsID")+"'";
                 List<Map<String, Object>> list = senYuDataSourceOne.queryForList(sql1);
                 //子表转JSON
                 List<JSONObject> json = toListJson(list);
@@ -513,8 +610,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
                         "mo.cFree5 as cFree5,mo.cFree6 as cFree6,mo.cFree7 as cFree7,mo.cFree8 as cFree8,mo.cFree9 as cFree9,mo.cFree10 as cFree10," +
                         "'' as poOutsourceId,''as poOutsourceNum,'' as 'customerUomId','' as customerUomCode,mo.iQuantity as customerPromiseQty, " +
-                        "mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'" +
-                        " from OM_MOMaterials mo where MODetailsID  = '"+map.get("MODetailsID")+"'";
+                        "mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10 "+
+                        " from OM_MOMaterials mo " +
+                        " left join Inventory inv on mo.cInvCode = inv.cInvCode " +
+                        "where MODetailsID  = '"+map.get("MODetailsID")+"'";
                 List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql1);
                 //子表转JSON
                 List<JSONObject> json = toListJson(list);
@@ -525,8 +625,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
                         "mo.cFree5 as cFree5,mo.cFree6 as cFree6,mo.cFree7 as cFree7,mo.cFree8 as cFree8,mo.cFree9 as cFree9,mo.cFree10 as cFree10," +
                         "'' as poOutsourceId,''as poOutsourceNum,'' as 'customerUomId','' as customerUomCode,mo.iQuantity as customerPromiseQty, " +
-                        "mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'" +
-                        " from OM_MOMaterials mo where MODetailsID  = '"+map.get("MODetailsID")+"'";
+                        "mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'," +
+                        "inv.bConfigFree1 as bConfigFree1,inv.bConfigFree2 as bConfigFree2,inv.bConfigFree3 as bConfigFree3,inv.bConfigFree4 as bConfigFree4,inv.bConfigFree5 as bConfigFree5,inv.bConfigFree6 as bConfigFree6,inv.bConfigFree7 as bConfigFree7,inv.bConfigFree8 as bConfigFree8,inv.bConfigFree9 as bConfigFree9,inv.bConfigFree10 as bConfigFree10 "+
+                        " from OM_MOMaterials mo " +
+                        " left join Inventory inv on mo.cInvCode = inv.cInvCode " +
+                        "where MODetailsID  = '"+map.get("MODetailsID")+"'";
                 List<Map<String, Object>> list = senYuDataSourceThree.queryForList(sql1);
                 //子表转JSON
                 List<JSONObject> json = toListJson(list);
@@ -534,11 +637,47 @@ public class JsonChangeUtils implements ApplicationContextAware{
             }
             Set<String> keysCfree = mapCfree.keySet();
             for (String key : keysCfree) {
+                ii++;
                 jf.put("attributeCode"+ii, key);
                 jf.put("attributeValue"+ii, map.get(key));
-                ii++;
+                String code = key.substring(key.length()-1);
+                jf.put("attributeFlag"+ii, mapbConfig.get("bConfigFree"+code));
+            }
+            if(ii <4){
+                jf.put("attributeValue4", "");
+                jf.put("attributeFlag4", "false");
+            }
+            if(ii<3){
+                jf.put("attributeValue4", "");
+                jf.put("attributeValue3", "");
+                jf.put("attributeFlag4", "false");
+                jf.put("attributeFlag3", "false");
             }
-            ii = 1;
+            if(ii<2){
+                jf.put("attributeValue4", "");
+                jf.put("attributeValue3", "");
+                jf.put("attributeValue2", "");
+                jf.put("attributeFlag4", "false");
+                jf.put("attributeFlag3", "false");
+                jf.put("attributeFlag2", "false");
+            }
+            if(ii<1){
+                jf.put("attributeValue4", "");
+                jf.put("attributeValue3", "");
+                jf.put("attributeValue2", "");
+                jf.put("attributeValue1", "");
+                jf.put("attributeFlag4", "false");
+                jf.put("attributeFlag3", "false");
+                jf.put("attributeFlag2", "false");
+                jf.put("attributeFlag1", "false");
+
+            }
+//            Set<String> keysbConfig = mapbConfig.keySet();
+//            for (String key : keysbConfig) {
+//                jf.put("attributeFlag"+jj, map.get(key));
+//                jj++;
+//            }
+            ii = 0;
             jf.remove("cFree1");
             jf.remove("cFree2");
             jf.remove("cFree3");
@@ -549,6 +688,16 @@ public class JsonChangeUtils implements ApplicationContextAware{
             jf.remove("cFree8");
             jf.remove("cFree9");
             jf.remove("cFree10");
+            jf.remove("bConfigFree1");
+            jf.remove("bConfigFree2");
+            jf.remove("bConfigFree3");
+            jf.remove("bConfigFree4");
+            jf.remove("bConfigFree5");
+            jf.remove("bConfigFree6");
+            jf.remove("bConfigFree7");
+            jf.remove("bConfigFree8");
+            jf.remove("bConfigFree9");
+            jf.remove("bConfigFree10");
                 jf.remove("MODetailsID");
                 jf.remove("MOID");
                 jf.remove("pkorg");
@@ -566,4 +715,5 @@ public class JsonChangeUtils implements ApplicationContextAware{
         this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
         this.senYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
     }
+
 }