ソースを参照

委外订单,采购订单接口调整

zengtx 3 年 前
コミット
a89bdc1239

+ 82 - 26
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/controller/MOMainController.java

@@ -14,6 +14,8 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
 import org.jeecg.modules.openApi.service.IDxpDataPlanService;
 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.system.util.InterfaceConnUtils;
 import org.jeecg.modules.system.util.JsonChangeUtils;
 import org.springframework.beans.BeansException;
@@ -44,6 +46,10 @@ public class MOMainController implements ApplicationContextAware {
     private static IDxpDataPlanService dxpDataPlanService;
     //数据源one
     private static ISenYuDataSourceOne senYuDataSourceOne;
+    //数据源one
+    private static ISenYuDataSourceTwo senYuDataSourceTwo;
+    //数据源one
+    private static ISenYuDataSourceThree iSenYuDataSourceThree;
 
 
     @PostMapping(value = "/QueryMoMain")
@@ -76,7 +82,7 @@ public class MOMainController implements ApplicationContextAware {
                 String pkorgValue[] = pkorgStr.split(":");
                 String ac = pkorgValue[1];
                 if (pkorgValue[0].equals("one")) {
-                    String sql = "select mo.MOID as 'headerAttributeString6',mo.MOID as 'moId','903' as accId,mo.cState as 'poStatus'," +
+                    String sql = "select mo.MOID as 'headerAttributeString6',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
                             "mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
                             "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'salerId'," +
                             "hr1.cPsn_Name as 'salerCode',mo.cVenPerson as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
@@ -85,13 +91,13 @@ public class MOMainController implements ApplicationContextAware {
                             "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',hr.cPsn_Num as 'buyerId',mo.dCreateTime  as 'publishDate',0 as 'tenantId'," +
                             "0 as 'totalAmount','' as 'headerAttributeString1', mo.cCode as 'headerAttributeString2','' as 'headerAttributeString3'," +
                             "'' as 'headerAttributeString4'  from OM_MOMain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
-                            "left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
-                            "on mo.cMaker = hr.cPsn_Name " +
-                            "left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr1 " +
-                            "on mo.cPersonCode = hr1.cPsn_Num " +
-                            "left join foreigncurrency curr " +
-                            "on mo.cexch_name = curr.cexch_name " +
-                            "where ( mo.iVerifyStateNew = 2 or mo.cState = 2) and cAuditTime>'"+lasttimeSf+"'  order by mo.dCreateTime desc";
+                            " left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
+                            " on mo.cMaker = hr.cPsn_Name " +
+                            " left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr1 " +
+                            " on mo.cPersonCode = hr1.cPsn_Num " +
+                            " left join foreigncurrency curr " +
+                            " on mo.cexch_name = curr.cexch_name " +
+                            " where ( mo.iVerifyStateNew = 2 or mo.cState = 2) and cAuditTime>'"+lasttimeSf+"'  order by mo.dCreateTime desc";
 
 //            String sql1 = "select top 2 '903' as accId,MOID as MOID,cPersonCode as buyerCode,cexch_name as currencyCode,cVenPerson as customerContacts,'联系人电话' as customerContactsPhone,'123' as customerNumber,cVenAccount as headerAttributeString1," +
 //                    "'合同号' as headerAttributeString2,'0097' as headerAttributeString3,'' as headerAttributeString4,'3' as headerTaxRate,cCode as poNum,'01' as poType,'0085' as supplierNumber " +
@@ -102,7 +108,49 @@ public class MOMainController implements ApplicationContextAware {
                         sumlist.add(map);
                     }
                 }else if(pkorgValue[0].equals("two")){
+                    String sql = "select mo.MOID as 'headerAttributeString6',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
+                            "mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'salerId'," +
+                            "hr1.cPsn_Name as 'salerCode',mo.cVenPerson as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
+                            "'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
+                            "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark'," +
+                            "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',hr.cPsn_Num as 'buyerId',mo.dCreateTime  as 'publishDate',0 as 'tenantId'," +
+                            "0 as 'totalAmount','' as 'headerAttributeString1', mo.cCode as 'headerAttributeString2','' as 'headerAttributeString3'," +
+                            "'' as 'headerAttributeString4'  from OM_MOMain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
+                            " left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
+                            " on mo.cMaker = hr.cPsn_Name " +
+                            " left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr1 " +
+                            " on mo.cPersonCode = hr1.cPsn_Num " +
+                            " left join foreigncurrency curr " +
+                            " on mo.cexch_name = curr.cexch_name " +
+                            " where ( mo.iVerifyStateNew = 2 or mo.cState = 2) and cAuditTime>'"+lasttimeSf+"'  order by mo.dCreateTime desc";
 
+                    List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql);
+                    for(Map<String, Object> map:list){
+                        sumlist.add(map);
+                    }
+                }else if(pkorgValue[0].equals("three")){
+                    String sql = "select mo.MOID as 'headerAttributeString6',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
+                            "mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'salerId'," +
+                            "hr1.cPsn_Name as 'salerCode',mo.cVenPerson as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
+                            "'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
+                            "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark'," +
+                            "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',hr.cPsn_Num as 'buyerId',mo.dCreateTime  as 'publishDate',0 as 'tenantId'," +
+                            "0 as 'totalAmount','' as 'headerAttributeString1', mo.cCode as 'headerAttributeString2','' as 'headerAttributeString3'," +
+                            "'' as 'headerAttributeString4'  from OM_MOMain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
+                            " left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
+                            " on mo.cMaker = hr.cPsn_Name " +
+                            " left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr1 " +
+                            " on mo.cPersonCode = hr1.cPsn_Num " +
+                            " left join foreigncurrency curr " +
+                            " on mo.cexch_name = curr.cexch_name " +
+                            " where ( mo.iVerifyStateNew = 2 or mo.cState = 2) and cAuditTime>'"+lasttimeSf+"'  order by mo.dCreateTime desc";
+
+                    List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
+                    for(Map<String, Object> map:list){
+                        sumlist.add(map);
+                    }
                 }
             }
             if(sumlist.size()==0){
@@ -142,9 +190,6 @@ public class MOMainController implements ApplicationContextAware {
                             if (pkorgValue[0].equals("three")) {
                                 san = pkorgValue[1];
                             }
-                            if (pkorgValue[0].equals("four")) {
-                                si = pkorgValue[1];
-                            }
                         }
                         //回写U8物料信息表是否同步成功字段
                         Iterator<Object> it = jsonArray.iterator();
@@ -154,28 +199,37 @@ public class MOMainController implements ApplicationContextAware {
                             String code = jo.getString("code");
                             //获取返回消息
                             String message = jo.getString("message");
-                            //获取businessCode
-                            String businessCode = jo.getString("businessCode");
-                            String busSplit[] = businessCode.split("#");
+                            //获取moId
+                            String moId = jo.getString("moId");
+                            //账套号
+                            String accId = jo.getString("accId");
                             //账套666
-                            if (busSplit[1].equals(yi)) {
+                            if (accId.equals(yi)) {
+                                if (code.equals("S")) {
+                                    String sql1 = "update HY_MOMain set cDefine10 = ? where cCode = ?";
+                                    senYuDataSourceOne.updateMOMain(sql1, "true," + message, moId);
+                                } else {
+                                    String sql1 = "update HY_MOMain set cDefine10 = ? where cCode = ?";
+                                    senYuDataSourceOne.updateMOMain(sql1, "false," + message, moId);
+                                }
+                            }else if (accId.equals(er)) {
                                 if (code.equals("S")) {
-                                    //普通采购回写
-                                    String sql = "update PO_Pomain set cDefine12 = ? where cPOID = ?";
-                                    senYuDataSourceOne.updateMOMain(sql, "true," + message, busSplit[0]);
-                                    //订单委外
                                     String sql1 = "update HY_MOMain set cDefine10 = ? where cCode = ?";
-                                    senYuDataSourceOne.updateMOMain(sql1, "true," + message, busSplit[0]);
+                                    senYuDataSourceOne.updateMOMain(sql1, "true," + message, moId);
                                 } else {
-                                    //普通采购回写
-                                    String sql = "update PO_Pomain set cDefine12 = ? where cPOID = ?";
-                                    senYuDataSourceOne.updateMOMain(sql, "false," + message, busSplit[0]);
-                                    //订单委外
                                     String sql1 = "update HY_MOMain set cDefine10 = ? where cCode = ?";
-                                    senYuDataSourceOne.updateMOMain(sql1, "false," + message, busSplit[0]);
+                                    senYuDataSourceOne.updateMOMain(sql1, "false," + message, moId);
+                                }
+                            }else if (accId.equals(san)) {
+                                if (code.equals("S")) {
+                                    String sql1 = "update HY_MOMain set cDefine10 = ? where cCode = ?";
+                                    senYuDataSourceOne.updateMOMain(sql1, "true," + message, moId);
+                                } else {
+                                    String sql1 = "update HY_MOMain set cDefine10 = ? where cCode = ?";
+                                    senYuDataSourceOne.updateMOMain(sql1, "false," + message, moId);
                                 }
                             }
-                            //账套012
+
 
                         }
                     }
@@ -197,5 +251,7 @@ public class MOMainController implements ApplicationContextAware {
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.dxpDataPlanService = applicationContext.getBean(IDxpDataPlanService.class);
         this.senYuDataSourceOne = applicationContext.getBean(ISenYuDataSourceOne.class);
+        this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
+        this.iSenYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
     }
 }

+ 69 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/controller/POPomainController.java

@@ -12,6 +12,8 @@ import lombok.extern.log4j.Log4j2;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
 import org.jeecg.modules.openApi.service.IDxpDataPlanService;
 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.system.util.InterfaceConnUtils;
 import org.jeecg.modules.system.util.JsonChangeUtils;
 import org.springframework.beans.BeansException;
@@ -36,6 +38,10 @@ public class POPomainController implements ApplicationContextAware {
     private static IDxpDataPlanService dxpDataPlanService;
     //数据源one
     private static ISenYuDataSourceOne senYuDataSourceOne;
+    //数据源one
+    private static ISenYuDataSourceTwo senYuDataSourceTwo;
+    //数据源one
+    private static ISenYuDataSourceThree iSenYuDataSourceThree;
 
 
     @PostMapping(value = "/QueryPoMain")
@@ -69,7 +75,7 @@ public class POPomainController implements ApplicationContextAware {
                 if (pkorgValue[0].equals("one")) {
                     //ven.cVenName,mo.cVenCode
                     //cAuditTime>'"+lasttimeSf+"' and mo.iverifystateex = 2
-                    String sql = "select mo.POID as 'headerAttributeString6','"+ac+"' as accId,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
+                    String sql = "select mo.POID as 'headerAttributeString6','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
                             "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName'," +
                             "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cVenPerson as 'customerContacts'," +
                             "mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTotalAmount'," +
@@ -90,7 +96,46 @@ public class POPomainController implements ApplicationContextAware {
                     }
 
                 }else if(pkorgValue[0].equals("two")){
+                    String sql = "select mo.POID as 'headerAttributeString6','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
+                            "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cVenPerson as 'customerContacts'," +
+                            "mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTotalAmount'," +
+                            "'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
+                            "mo.dPODate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
+                            "hr.cPsn_Num as 'buyerId',mo.cMaker as 'buyerCode',mo.cPersonCode as salerId,hr1.cPsn_Name as salerCode," +
+                            " mo.cmaketime  as 'publishDate'  from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
+                            "left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
+                            "on mo.cMaker = hr.cPsn_Name " +
+                            "left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr1 " +
+                            "on mo.cPersonCode = hr1.cPsn_Num " +
+                            "left join foreigncurrency curr " +
+                            "on mo.cexch_name = curr.cexch_name " +
+                            "where cAuditTime>'"+lasttimeSf+"' and mo.iverifystateex = 2 order by mo.cAuditTime desc";
+                    List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql);
+                    for(Map<String, Object> map:list){
+                        sumlist.add(map);
+                    }
 
+                }else if(pkorgValue[0].equals("three")){
+                    String sql = "select mo.POID as 'headerAttributeString6','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
+                            "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cVenPerson as 'customerContacts'," +
+                            "mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTotalAmount'," +
+                            "'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
+                            "mo.dPODate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
+                            "hr.cPsn_Num as 'buyerId',mo.cMaker as 'buyerCode',mo.cPersonCode as salerId,hr1.cPsn_Name as salerCode," +
+                            " mo.cmaketime  as 'publishDate'  from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
+                            "left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
+                            "on mo.cMaker = hr.cPsn_Name " +
+                            "left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr1 " +
+                            "on mo.cPersonCode = hr1.cPsn_Num " +
+                            "left join foreigncurrency curr " +
+                            "on mo.cexch_name = curr.cexch_name " +
+                            "where cAuditTime>'"+lasttimeSf+"' and mo.iverifystateex = 2 order by mo.cAuditTime desc";
+                    List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
+                    for(Map<String, Object> map:list){
+                        sumlist.add(map);
+                    }
 
                 }
             }
@@ -134,9 +179,6 @@ public class POPomainController implements ApplicationContextAware {
                             if (pkorgValue[0].equals("three")) {
                                 san = pkorgValue[1];
                             }
-                            if (pkorgValue[0].equals("four")) {
-                                si = pkorgValue[1];
-                            }
                         }
                         //回写U8物料信息表是否同步成功字段
                         Iterator<Object> it = jsonArray.iterator();
@@ -150,7 +192,7 @@ public class POPomainController implements ApplicationContextAware {
                             String moId = jo.getString("moId");
                             //账套号
                             String accId = jo.getString("accId");
-                            //账套666
+                            //账套1
                             if (accId.equals(yi)) {
                                 if (code.equals("S")) {
                                     //普通采购回写
@@ -161,9 +203,27 @@ public class POPomainController implements ApplicationContextAware {
                                     String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
                                     senYuDataSourceOne.updatePOMain(sql, "false," + message, moId);
                                 }
+                            }else if(accId.equals(er)){
+                                if (code.equals("S")) {
+                                    //普通采购回写
+                                    String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
+                                    senYuDataSourceTwo.updatePOMain(sql, "true," + message, moId);
+                                } else {
+                                    //普通采购回写
+                                    String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
+                                    senYuDataSourceTwo.updatePOMain(sql, "false," + message, moId);
+                                }
+                            }else if(accId.equals(san)) {
+                                if (code.equals("S")) {
+                                    //普通采购回写
+                                    String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
+                                    iSenYuDataSourceThree.updatePOMain(sql, "true," + message, moId);
+                                } else {
+                                    //普通采购回写
+                                    String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
+                                    iSenYuDataSourceThree.updatePOMain(sql, "false," + message, moId);
+                                }
                             }
-                            //账套012
-
                         }
                     }
                 }
@@ -183,5 +243,7 @@ public class POPomainController implements ApplicationContextAware {
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.dxpDataPlanService = applicationContext.getBean(IDxpDataPlanService.class);
         this.senYuDataSourceOne = applicationContext.getBean(ISenYuDataSourceOne.class);
+        this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
+        this.iSenYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
     }
 }

+ 25 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/ISenYuDataSourceThree.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.openApi.service;
+
+import java.util.List;
+import java.util.Map;
+
+
+/***
+ * 数据源3
+ *
+ */
+public interface ISenYuDataSourceThree {
+
+    public List<Map<String, Object>> queryForList(String sql);//查询
+
+    public boolean update(String sql);//执行更新或删除语句
+
+    //修改采购订单是否同步成功!
+    public boolean updateMOMain(String sql,String cDefine10,String moId);
+
+    //修改委外订单是否同步成功!
+    public boolean updatePOMain(String sql,String cDefine10,String moId);
+
+    //修改材料出库单是否同步成功!
+    public boolean updateRdrecord(String sql,String cDefine10,String id);
+}

+ 25 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/ISenYuDataSourceTwo.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.openApi.service;
+
+import java.util.List;
+import java.util.Map;
+
+
+/***
+ * 数据源2
+ *
+ */
+public interface ISenYuDataSourceTwo {
+
+    public List<Map<String, Object>> queryForList(String sql);//查询
+
+    public boolean update(String sql);//执行更新或删除语句
+
+    //修改采购订单是否同步成功!
+    public boolean updateMOMain(String sql,String cDefine10,String moId);
+
+    //修改委外订单是否同步成功!
+    public boolean updatePOMain(String sql,String cDefine10,String moId);
+
+    //修改材料出库单是否同步成功!
+    public boolean updateRdrecord(String sql,String cDefine10,String id);
+}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/SenYuDataSourceOneServiceImpl.java

@@ -11,7 +11,7 @@ import java.util.List;
 import java.util.Map;
 
 @Service
-@DS("multi-three")
+@DS("multi-one")
 public class SenYuDataSourceOneServiceImpl implements ISenYuDataSourceOne {
 
     @Autowired

+ 106 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/SenYuDataSourceThreeServiceImpl.java

@@ -0,0 +1,106 @@
+package org.jeecg.modules.openApi.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+
+@Service
+@DS("multi-three")
+public class SenYuDataSourceThreeServiceImpl implements ISenYuDataSourceThree {
+
+
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
+
+    @Override
+    public List<Map<String, Object>> queryForList(String sql) {
+        return jdbcTemplate.queryForList(sql);
+    }
+
+    @Override
+    public boolean update(String sql) {
+        boolean flag = false;
+        int i=jdbcTemplate.update(sql);
+        if (i > 0) {
+            flag = true;
+        }
+        return flag;
+    }
+
+    /**
+     * 修改委外订单是否同步成功
+     * @param sql
+     * @param cDefine10
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updateMOMain(String sql, String cDefine10, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine10, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+
+    /**
+     * 修改采购订单是否同步成功
+     * @param sql
+     * @param cDefine10
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updatePOMain(String sql, String cDefine10, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine10, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 修改材料出库单是否同步成功!
+     * @param sql
+     * @param cDefine10
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean updateRdrecord(String sql, String cDefine10, String id) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine10, id);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+}

+ 105 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/SenYuDataSourceTwoServiceImpl.java

@@ -0,0 +1,105 @@
+package org.jeecg.modules.openApi.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+@DS("multi-two")
+public class SenYuDataSourceTwoServiceImpl implements ISenYuDataSourceTwo {
+
+
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
+
+    @Override
+    public List<Map<String, Object>> queryForList(String sql) {
+        return jdbcTemplate.queryForList(sql);
+    }
+
+    @Override
+    public boolean update(String sql) {
+        boolean flag = false;
+        int i=jdbcTemplate.update(sql);
+        if (i > 0) {
+            flag = true;
+        }
+        return flag;
+    }
+
+    /**
+     * 修改委外订单是否同步成功
+     * @param sql
+     * @param cDefine10
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updateMOMain(String sql, String cDefine10, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine10, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+
+    /**
+     * 修改采购订单是否同步成功
+     * @param sql
+     * @param cDefine10
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updatePOMain(String sql, String cDefine10, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine10, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 修改材料出库单是否同步成功!
+     * @param sql
+     * @param cDefine10
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean updateRdrecord(String sql, String cDefine10, String id) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine10, id);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+}

+ 123 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/JsonChangeUtils.java

@@ -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);
     }
 }