|
@@ -6,6 +6,8 @@ import com.google.gson.Gson;
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
|
+import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
|
|
|
+import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
|
|
|
import org.jeecg.modules.openApi.service.impl.SenYuDataSourceOneServiceImpl;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -25,6 +27,9 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
|
|
|
private static ISenYuDataSourceOne senYuDataSourceOne;
|
|
|
|
|
|
+ private static ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
|
+
|
|
|
+ private static ISenYuDataSourceThree iSenYuDataSourceThree;
|
|
|
|
|
|
|
|
|
|
|
@@ -54,7 +59,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
String publishDate = sf.format(map.get("publishDate"));
|
|
|
jf.put("publishDate",publishDate+" 00:00:00");
|
|
|
//查询子表信息
|
|
|
- if(map.get("accId").equals("903")){
|
|
|
+ if(map.get("pkorg").equals("one")){
|
|
|
// String sql = "select MODetailsID as MODetailsID,"+map.get("accId")+" as cAccId,"+map.get("MOID")+" as MOID,'' as cCode," +
|
|
|
// "'N0201001237' as customerItemCode,'门幅120 颜色 为深色' as cInvName,'lineStatus' as lineStatus," +
|
|
|
// "'' as attributeCode1,'' as attributeCode2,'' as attributeCode3,'' as attributeCode4,'' as attributeValue1,'' as attributeValue2," +
|
|
@@ -64,7 +69,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
// "'56' as lineAttributeString3,'78' as lineAttributeString4,cbMemo as lineAttributeString5 " +
|
|
|
// "from OM_MODetails where MOID = "+map.get("MOID");
|
|
|
//mo.cInvCode,inv.cInvName
|
|
|
- String sql = "select mo.iVouchRowNo as 'poLineNum',mo.MODetailsID as MODetailsID,mo.MODetailsID as 'moDetailId'," +
|
|
|
+ String sql = "select mo.iVouchRowNo as 'poLineNum',mo.MODetailsID as MODetailsID,mo.MODetailsID as 'moDetailId','"+map.get("pkorg")+"' as pkorg," +
|
|
|
"'' as receivingInventoryOrgCode,'"+map.get("headerAttributeString6")+"' as MOID,'"+map.get("accId")+"' as 'accId'," +
|
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName'," +
|
|
|
"'' as 'poLineStatus',mo.cFree1 as 'attributeValue1',mo.cFree2 as 'attributeValue2',mo.cFree3 as 'attributeValue3'," +
|
|
@@ -82,13 +87,55 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
//子表转JSON
|
|
|
List<JSONObject> json = toMOListJson(list);
|
|
|
jf.put("poLineList",json);
|
|
|
+
|
|
|
+ }else if(map.get("pkorg").equals("two")){
|
|
|
+ String sql = "select mo.iVouchRowNo as 'poLineNum',mo.MODetailsID as MODetailsID,mo.MODetailsID as 'moDetailId','"+map.get("pkorg")+"' as pkorg," +
|
|
|
+ "'' as receivingInventoryOrgCode,'"+map.get("headerAttributeString6")+"' as MOID,'"+map.get("accId")+"' as 'accId'," +
|
|
|
+ "'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName'," +
|
|
|
+ "'' as 'poLineStatus',mo.cFree1 as 'attributeValue1',mo.cFree2 as 'attributeValue2',mo.cFree3 as 'attributeValue3'," +
|
|
|
+ "mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2' as 'attributeCode2','cfree3' as 'attributeCode3'," +
|
|
|
+ "'cfree4' as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
|
+ "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
|
|
|
+ "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
|
|
|
+ "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'," +
|
|
|
+ "'' as externalLineNum,'' as itemAttrId,'"+map.get("headerAttributeString6")+"' as poId from OM_MODetails mo " +
|
|
|
+ "left join Inventory inv on mo.cInvCode = inv.cInvCode"+
|
|
|
+ " where mo.MOID = "+map.get("headerAttributeString6");
|
|
|
+ List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql);
|
|
|
+ //子表转JSON
|
|
|
+ List<JSONObject> json = toMOListJson(list);
|
|
|
+ jf.put("poLineList",json);
|
|
|
+
|
|
|
+ }else if(map.get("pkorg").equals("three")){
|
|
|
+ String sql = "select mo.iVouchRowNo as 'poLineNum',mo.MODetailsID as MODetailsID,mo.MODetailsID as 'moDetailId','"+map.get("pkorg")+"' as pkorg," +
|
|
|
+ "'' as receivingInventoryOrgCode,'"+map.get("headerAttributeString6")+"' as MOID,'"+map.get("accId")+"' as 'accId'," +
|
|
|
+ "'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName'," +
|
|
|
+ "'' as 'poLineStatus',mo.cFree1 as 'attributeValue1',mo.cFree2 as 'attributeValue2',mo.cFree3 as 'attributeValue3'," +
|
|
|
+ "mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2' as 'attributeCode2','cfree3' as 'attributeCode3'," +
|
|
|
+ "'cfree4' as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
|
+ "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
|
|
|
+ "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
|
|
|
+ "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'," +
|
|
|
+ "'' as externalLineNum,'' as itemAttrId,'"+map.get("headerAttributeString6")+"' as poId from OM_MODetails mo " +
|
|
|
+ "left join Inventory inv on mo.cInvCode = inv.cInvCode"+
|
|
|
+ " where mo.MOID = "+map.get("headerAttributeString6");
|
|
|
+ List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
|
|
|
+ //子表转JSON
|
|
|
+ List<JSONObject> json = toMOListJson(list);
|
|
|
+ jf.put("poLineList",json);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
jf.remove("MODetailsID");
|
|
|
jf.remove("MOID");
|
|
|
- //}
|
|
|
+ jf.remove("pkorg");
|
|
|
+ pljf.add(jf);
|
|
|
|
|
|
-
|
|
|
- pljf.add(jf);
|
|
|
- }
|
|
|
return pljf;
|
|
|
}
|
|
|
|
|
@@ -117,7 +164,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
String publishDate = sf.format(map.get("publishDate"));
|
|
|
jf.put("publishDate",publishDate+" 00:00:00");
|
|
|
//查询子表信息
|
|
|
- if(map.get("accId").equals("903")){
|
|
|
+ if(map.get("pkorg").equals("one")){
|
|
|
// String sql = "select '666' as cAccId,cPOID as cCode,cInvCode,'' as cInvName,'1' as lineStatus,'' as materialKeyAttribute," +
|
|
|
// " iQuantity as purchaseQuantity,cUnitID as cUnitID,'' as demandDate,iTaxPrice as iTaxPrice,iPerTaxRate as iPerTaxRate," +
|
|
|
// "iSum as lineTotalPrice,'' as smallPo,'' as packId,'' as distributionPoint,'' as dyeFactoryCode,cbMemo as cbMemo " +
|
|
@@ -133,13 +180,47 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
"'' as 'lineAttributeString2','' as 'lineAttributeString3','' as 'attributeString1','' as 'lineAttributeString4'," +
|
|
|
"mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
|
|
|
"'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode"+
|
|
|
- "where mo.POID = '"+map.get("headerAttributeString6")+"'";
|
|
|
+ " where mo.POID = '"+map.get("headerAttributeString6")+"'";
|
|
|
List<Map<String, Object>> list = senYuDataSourceOne.queryForList(sql);
|
|
|
//子表转JSON
|
|
|
List<JSONObject> json = toListJson(list);
|
|
|
jf.put("poLineList",json);
|
|
|
+ }else if(map.get("pkorg").equals("two")){
|
|
|
+ String sql ="select '"+map.get("accId")+"' as 'accId',mo.iVouchRowNo as 'poLineNum',ID as 'moDetailId','"+map.get("poNum")+"' as poNum," +
|
|
|
+ "mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName','' as 'poLineStatus'," +
|
|
|
+ "'' as receivingInventoryOrgCode,mo.cFree1 as 'attributeValue1',mo.cFree2 as 'attributeValue2'," +
|
|
|
+ "mo.cFree3 as 'attributeValue3',mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2' as 'attributeCode2'," +
|
|
|
+ "'cfree3' as 'attributeCode3','cfree4' as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
|
+ "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
|
|
|
+ "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount','' as 'lineAttributeString1'," +
|
|
|
+ "'' as 'lineAttributeString2','' as 'lineAttributeString3','' as 'attributeString1','' as 'lineAttributeString4'," +
|
|
|
+ "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
|
|
|
+ "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode"+
|
|
|
+ " where mo.POID = '"+map.get("headerAttributeString6")+"'";
|
|
|
+ List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql);
|
|
|
+ //子表转JSON
|
|
|
+ List<JSONObject> json = toListJson(list);
|
|
|
+ jf.put("poLineList",json);
|
|
|
+
|
|
|
+ }else if(map.get("pkorg").equals("three")){
|
|
|
+ String sql ="select '"+map.get("accId")+"' as 'accId',mo.iVouchRowNo as 'poLineNum',ID as 'moDetailId','"+map.get("poNum")+"' as poNum," +
|
|
|
+ "mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName','' as 'poLineStatus'," +
|
|
|
+ "'' as receivingInventoryOrgCode,mo.cFree1 as 'attributeValue1',mo.cFree2 as 'attributeValue2'," +
|
|
|
+ "mo.cFree3 as 'attributeValue3',mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2' as 'attributeCode2'," +
|
|
|
+ "'cfree3' as 'attributeCode3','cfree4' as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
|
+ "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
|
|
|
+ "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount','' as 'lineAttributeString1'," +
|
|
|
+ "'' as 'lineAttributeString2','' as 'lineAttributeString3','' as 'attributeString1','' as 'lineAttributeString4'," +
|
|
|
+ "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
|
|
|
+ "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode"+
|
|
|
+ " where mo.POID = '"+map.get("headerAttributeString6")+"'";
|
|
|
+ List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
|
|
|
+ //子表转JSON
|
|
|
+ List<JSONObject> json = toListJson(list);
|
|
|
+ jf.put("poLineList",json);
|
|
|
}
|
|
|
|
|
|
+ jf.remove("pkorg");
|
|
|
pljf.add(jf);
|
|
|
//}
|
|
|
return pljf;
|
|
@@ -236,7 +317,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
String customerPromiseDate = sf.format(map.get("customerPromiseDate"));
|
|
|
jf.put("customerPromiseDate",customerPromiseDate+" 00:00:00");
|
|
|
//查询委外用料子表数据
|
|
|
- if(map.get("accId").equals("903")){
|
|
|
+ if(map.get("pkorg").equals("one")){
|
|
|
// String sql = "select '' as poOutsourceNum,''as poNum,'903' as cAccId,"+map.get("MOID")+" as MOID,'YU-02' as customerItemCode,'' as itemAttrId," +
|
|
|
// "'' as attributeCode1,'' as attributeCode2,'' as attributeCode3,'' as attributeCode4,'' as attributeValue1,'' as attributeValue2," +
|
|
|
// "'' as attributeValue3,'' as attributeValue4," +
|
|
@@ -255,10 +336,38 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
//子表转JSON
|
|
|
List<JSONObject> json = toListJson(list);
|
|
|
jf.put("outSourceList",json);
|
|
|
+ }else if(map.get("pkorg").equals("two")){
|
|
|
+
|
|
|
+ String sql1 = "select '"+map.get("accId")+"' as accId,'"+map.get("MOID")+"' as poId,'"+map.get("poNum")+"' as poNum," +
|
|
|
+ "'N0201002142' as 'customerItemCode','' as 'itemAttrId','cfree1' as attributeCode1,'' as customerItemId," +
|
|
|
+ "'cfree2' as attributeCode2,'cfree3' as attributeCode3,'cfree4' as attributeCode4,'' as poOutsourceId," +
|
|
|
+ "''as poOutsourceNum,cFree1 as attributeValue1,cFree2 as attributeValue2,cFree3 as attributeValue3," +
|
|
|
+ "cFree4 as attributeValue4,'' as 'customerUomId','' as customerUomCode,0 as customerPromiseQty, " +
|
|
|
+ "cDefine25 as outsourceAttributeString1,cDefine24 as 'outsourceAttributeString2',cDefine27 as 'outsourceAttributeString3'" +
|
|
|
+ " from OM_MOMaterials where MODetailsID = '"+map.get("MODetailsID")+"'";
|
|
|
+ List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql1);
|
|
|
+ //子表转JSON
|
|
|
+ List<JSONObject> json = toListJson(list);
|
|
|
+ jf.put("outSourceList",json);
|
|
|
+ }else if(map.get("pkorg").equals("three")){
|
|
|
+
|
|
|
+ String sql1 = "select '"+map.get("accId")+"' as accId,'"+map.get("MOID")+"' as poId,'"+map.get("poNum")+"' as poNum," +
|
|
|
+ "'N0201002142' as 'customerItemCode','' as 'itemAttrId','cfree1' as attributeCode1,'' as customerItemId," +
|
|
|
+ "'cfree2' as attributeCode2,'cfree3' as attributeCode3,'cfree4' as attributeCode4,'' as poOutsourceId," +
|
|
|
+ "''as poOutsourceNum,cFree1 as attributeValue1,cFree2 as attributeValue2,cFree3 as attributeValue3," +
|
|
|
+ "cFree4 as attributeValue4,'' as 'customerUomId','' as customerUomCode,0 as customerPromiseQty, " +
|
|
|
+ "cDefine25 as outsourceAttributeString1,cDefine24 as 'outsourceAttributeString2',cDefine27 as 'outsourceAttributeString3'" +
|
|
|
+ " from OM_MOMaterials where MODetailsID = '"+map.get("MODetailsID")+"'";
|
|
|
+ List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql1);
|
|
|
+ //子表转JSON
|
|
|
+ List<JSONObject> json = toListJson(list);
|
|
|
+ jf.put("outSourceList",json);
|
|
|
}
|
|
|
- jf.remove("MODetailsID");
|
|
|
- jf.remove("MOID");
|
|
|
- pljf.add(jf);
|
|
|
+
|
|
|
+ jf.remove("MODetailsID");
|
|
|
+ jf.remove("MOID");
|
|
|
+ jf.remove("pkorg");
|
|
|
+ pljf.add(jf);
|
|
|
}
|
|
|
return pljf;
|
|
|
}
|
|
@@ -268,5 +377,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
|
|
|
|
|
this.senYuDataSourceOne = applicationContext.getBean(ISenYuDataSourceOne.class);
|
|
|
+ this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
|
|
|
+ this.iSenYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
|
|
|
}
|
|
|
}
|