|
@@ -30,7 +30,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
|
|
|
private static ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
private static ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
|
|
|
|
- private static ISenYuDataSourceThree iSenYuDataSourceThree;
|
|
|
|
|
|
+ private static ISenYuDataSourceThree senYuDataSourceThree;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 原始通用转JSON方法
|
|
* 原始通用转JSON方法
|
|
@@ -97,9 +97,9 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName',mo.dArriveDate as 'customerDemandDate', " +
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName',mo.dArriveDate as 'customerDemandDate', " +
|
|
"'' as 'poLineStatus',mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
|
|
"'' as 'poLineStatus',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,mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
"mo.cFree5 as cFree5,mo.cFree6 as cFree6,mo.cFree7 as cFree7,mo.cFree8 as cFree8,mo.cFree9 as cFree9,mo.cFree10 as cFree10,mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
- "mo.iMoney as 'iMoney'," +
|
|
|
|
|
|
+ "case when mo.iMoney is null then '0' else mo.iMoney end as iMoney," +
|
|
"mo.iTax as lineAttributeDecimal1,mo.dbCloseDate as lineAttributeDatetime1,mo.cDefine24 as lineAttributeString9," +
|
|
"mo.iTax as lineAttributeDecimal1,mo.dbCloseDate as lineAttributeDatetime1,mo.cDefine24 as lineAttributeString9," +
|
|
- "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iSum as 'amount',ex.cbdefine2 as lineAttributeString7,ex.cbdefine3 as lineAttributeString8," +
|
|
|
|
|
|
+ "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.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," +
|
|
"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," +
|
|
"cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
|
|
@@ -125,9 +125,9 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName',mo.dArriveDate as 'customerDemandDate', " +
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName',mo.dArriveDate as 'customerDemandDate', " +
|
|
"'' as 'poLineStatus',mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
|
|
"'' as 'poLineStatus',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,mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
"mo.cFree5 as cFree5,mo.cFree6 as cFree6,mo.cFree7 as cFree7,mo.cFree8 as cFree8,mo.cFree9 as cFree9,mo.cFree10 as cFree10,mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
- "mo.iMoney as 'iMoney'," +
|
|
|
|
|
|
+ "case when mo.iMoney is null then '0' else mo.iMoney end as iMoney," +
|
|
"mo.iTax as lineAttributeDecimal1,mo.dbCloseDate as lineAttributeDatetime1,mo.cDefine24 as lineAttributeString9," +
|
|
"mo.iTax as lineAttributeDecimal1,mo.dbCloseDate as lineAttributeDatetime1,mo.cDefine24 as lineAttributeString9," +
|
|
- "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iSum as 'amount',ex.cbdefine2 as lineAttributeString7,ex.cbdefine3 as lineAttributeString8," +
|
|
|
|
|
|
+ "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.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," +
|
|
"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," +
|
|
"cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
|
|
@@ -146,6 +146,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
jf.put("totalAmount",totalAmount);
|
|
jf.put("totalAmount",totalAmount);
|
|
jf.put("exTaxAmount",exTaxAmount);
|
|
jf.put("exTaxAmount",exTaxAmount);
|
|
}else if(map.get("pkorg").equals("three")){
|
|
}else if(map.get("pkorg").equals("three")){
|
|
|
|
+
|
|
BigDecimal totalAmount = BigDecimal.ZERO; //总金额
|
|
BigDecimal totalAmount = BigDecimal.ZERO; //总金额
|
|
BigDecimal exTaxAmount = BigDecimal.ZERO;//总无税金额
|
|
BigDecimal exTaxAmount = BigDecimal.ZERO;//总无税金额
|
|
String sql = "select mo.iVouchRowNo as 'poLineNum',mo.MODetailsID as MODetailsID,mo.MODetailsID as 'moDetailId','"+map.get("pkorg")+"' as pkorg," +
|
|
String sql = "select mo.iVouchRowNo as 'poLineNum',mo.MODetailsID as MODetailsID,mo.MODetailsID as 'moDetailId','"+map.get("pkorg")+"' as pkorg," +
|
|
@@ -153,9 +154,9 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName',mo.dArriveDate as 'customerDemandDate', " +
|
|
"'"+map.get("poNum")+"' as poNum,mo.cInvCode as 'customerItemCode',inv.cInvName as 'itemName',mo.dArriveDate as 'customerDemandDate', " +
|
|
"'' as 'poLineStatus',mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
|
|
"'' as 'poLineStatus',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,mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
"mo.cFree5 as cFree5,mo.cFree6 as cFree6,mo.cFree7 as cFree7,mo.cFree8 as cFree8,mo.cFree9 as cFree9,mo.cFree10 as cFree10,mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
|
|
- "mo.iMoney as 'iMoney'," +
|
|
|
|
|
|
+ "case when mo.iMoney is null then '0' else mo.iMoney end as iMoney," +
|
|
"mo.iTax as lineAttributeDecimal1,mo.dbCloseDate as lineAttributeDatetime1,mo.cDefine24 as lineAttributeString9," +
|
|
"mo.iTax as lineAttributeDecimal1,mo.dbCloseDate as lineAttributeDatetime1,mo.cDefine24 as lineAttributeString9," +
|
|
- "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iSum as 'amount',ex.cbdefine2 as lineAttributeString7,ex.cbdefine3 as lineAttributeString8," +
|
|
|
|
|
|
+ "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.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," +
|
|
"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," +
|
|
"cFree1 as 'color','' as 'customerNumber',mo.iUnitPrice as supplierExTaxPrice,'"+map.get("dVerifyDate")+"' as lineAttributeDatetime2," +
|
|
@@ -163,10 +164,11 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
"left join Inventory inv on mo.cInvCode = inv.cInvCode "+
|
|
"left join Inventory inv on mo.cInvCode = inv.cInvCode "+
|
|
"left join OM_MOdetails_extradefine ex on mo.MODetailsID = ex.MODetailsID "+
|
|
"left join OM_MOdetails_extradefine ex on mo.MODetailsID = ex.MODetailsID "+
|
|
" where mo.MOID = "+map.get("moId");
|
|
" where mo.MOID = "+map.get("moId");
|
|
- List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
|
|
|
|
|
|
+ List<Map<String, Object>> list = senYuDataSourceThree.queryForList(sql);
|
|
for(Map<String, Object> mapList:list){
|
|
for(Map<String, Object> mapList:list){
|
|
totalAmount = totalAmount.add(new BigDecimal(mapList.get("amount").toString()));
|
|
totalAmount = totalAmount.add(new BigDecimal(mapList.get("amount").toString()));
|
|
exTaxAmount = exTaxAmount.add(new BigDecimal(mapList.get("iMoney").toString()));
|
|
exTaxAmount = exTaxAmount.add(new BigDecimal(mapList.get("iMoney").toString()));
|
|
|
|
+
|
|
}
|
|
}
|
|
//子表转JSON
|
|
//子表转JSON
|
|
List<JSONObject> json = toMOListJson(list);
|
|
List<JSONObject> json = toMOListJson(list);
|
|
@@ -285,7 +287,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
"'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode " +
|
|
"'' 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 "+
|
|
"left join PO_Podetails_extradefine ex on mo.ID = ex.ID "+
|
|
" where mo.POID = '"+map.get("moId")+"'";
|
|
" where mo.POID = '"+map.get("moId")+"'";
|
|
- List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
|
|
|
|
|
|
+ List<Map<String, Object>> list = senYuDataSourceThree.queryForList(sql);
|
|
for(Map<String, Object> mapList:list){
|
|
for(Map<String, Object> mapList:list){
|
|
totalAmount = totalAmount.add(new BigDecimal(mapList.get("amount").toString()));
|
|
totalAmount = totalAmount.add(new BigDecimal(mapList.get("amount").toString()));
|
|
exTaxAmount = exTaxAmount.add(new BigDecimal(mapList.get("iMoney").toString()));
|
|
exTaxAmount = exTaxAmount.add(new BigDecimal(mapList.get("iMoney").toString()));
|
|
@@ -509,7 +511,6 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
List<JSONObject> json = toListJson(list);
|
|
List<JSONObject> json = toListJson(list);
|
|
jf.put("outSourceList",json);
|
|
jf.put("outSourceList",json);
|
|
}else if(map.get("pkorg").equals("three")){
|
|
}else if(map.get("pkorg").equals("three")){
|
|
-
|
|
|
|
String sql1 = "select MOMaterialsID as moMaterialsId,'"+map.get("accId")+"' as accId,'"+map.get("MOID")+"' as poId,'"+map.get("poNum")+"' as poNum," +
|
|
String sql1 = "select MOMaterialsID as moMaterialsId,'"+map.get("accId")+"' as accId,'"+map.get("MOID")+"' as poId,'"+map.get("poNum")+"' as poNum," +
|
|
"mo.cInvCode as 'customerItemCode','' as 'itemAttrId','' as customerItemId,mo.iUnitQuantity as 'bomUsage'," +
|
|
"mo.cInvCode as 'customerItemCode','' as 'itemAttrId','' as customerItemId,mo.iUnitQuantity as 'bomUsage'," +
|
|
"mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
|
|
"mo.cFree1 as cFree1,mo.cFree2 as cFree2,mo.cFree3 as cFree3,mo.cFree4 as cFree4," +
|
|
@@ -517,7 +518,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
"'' as poOutsourceId,''as poOutsourceNum,'' as 'customerUomId','' as customerUomCode,mo.iQuantity as customerPromiseQty, " +
|
|
"'' as poOutsourceId,''as poOutsourceNum,'' as 'customerUomId','' as customerUomCode,mo.iQuantity as customerPromiseQty, " +
|
|
"mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'" +
|
|
"mo.cDefine25 as outsourceAttributeString1,mo.cDefine24 as 'outsourceAttributeString2',mo.cDefine27 as 'outsourceAttributeString3'" +
|
|
" from OM_MOMaterials mo where MODetailsID = '"+map.get("MODetailsID")+"'";
|
|
" from OM_MOMaterials mo where MODetailsID = '"+map.get("MODetailsID")+"'";
|
|
- List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql1);
|
|
|
|
|
|
+ List<Map<String, Object>> list = senYuDataSourceThree.queryForList(sql1);
|
|
//子表转JSON
|
|
//子表转JSON
|
|
List<JSONObject> json = toListJson(list);
|
|
List<JSONObject> json = toListJson(list);
|
|
jf.put("outSourceList",json);
|
|
jf.put("outSourceList",json);
|
|
@@ -554,6 +555,6 @@ public class JsonChangeUtils implements ApplicationContextAware{
|
|
|
|
|
|
this.senYuDataSourceOne = applicationContext.getBean(ISenYuDataSourceOne.class);
|
|
this.senYuDataSourceOne = applicationContext.getBean(ISenYuDataSourceOne.class);
|
|
this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
|
|
this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
|
|
- this.iSenYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
|
|
|
|
|
|
+ this.senYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
|
|
}
|
|
}
|
|
}
|
|
}
|