Ver Fonte

订单接口调整

zengtx há 3 anos atrás
pai
commit
2ba81042cf

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

@@ -112,7 +112,7 @@ public class MOMainController implements ApplicationContextAware {
                             " on mo.cPersonCode = hr1.cPsn_Num " +
                             " left join foreigncurrency curr " +
                             " on mo.cexch_name = curr.cexch_name " +
-                            " where  mo.iVerifyStateNew = 2 and (mo.dVerifyTime>'"+lasttimeSf+"' or mo.dChangeVerifyTime >'"+lasttimeSf+"')  order by mo.dCreateTime desc";
+                            " where  mo.iVerifyStateNew = 2 and (mo.dVerifyTime>'"+lasttimeSf+"' or mo.dChangeVerifyTime >'"+lasttimeSf+"') and cDefine16 is null  order by mo.dCreateTime desc";
 
                     List<Map<String, Object>> list = senYuDataSourceOne.queryForList(sql);
                     for(Map<String, Object> map:list){
@@ -137,7 +137,7 @@ public class MOMainController implements ApplicationContextAware {
                             " on mo.cPersonCode = hr1.cPsn_Num " +
                             " left join foreigncurrency curr " +
                             " on mo.cexch_name = curr.cexch_name " +
-                            " where  mo.iVerifyStateNew = 2 and (mo.dVerifyTime>'"+lasttimeSf+"' or mo.dChangeVerifyTime >'"+lasttimeSf+"')  order by mo.dCreateTime desc";
+                            " where  mo.iVerifyStateNew = 2 and (mo.dVerifyTime>'"+lasttimeSf+"' or mo.dChangeVerifyTime >'"+lasttimeSf+"') and cDefine16 is null  order by mo.dCreateTime desc";
 
                     List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql);
                     for(Map<String, Object> map:list){
@@ -162,7 +162,7 @@ public class MOMainController implements ApplicationContextAware {
                             " on mo.cPersonCode = hr1.cPsn_Num " +
                             " left join foreigncurrency curr " +
                             " on mo.cexch_name = curr.cexch_name " +
-                            " where  mo.iVerifyStateNew = 2 and (mo.dVerifyTime>'"+lasttimeSf+"' or mo.dChangeVerifyTime >'"+lasttimeSf+"')  order by mo.dCreateTime desc";
+                            " where  mo.iVerifyStateNew = 2 and (mo.dVerifyTime>'"+lasttimeSf+"' or mo.dChangeVerifyTime >'"+lasttimeSf+"') and cDefine16 is null  order by mo.dCreateTime desc";
 
                     List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
                     for(Map<String, Object> map:list){
@@ -215,20 +215,19 @@ public class MOMainController implements ApplicationContextAware {
                             //获取返回消息
                             String message = jo.getString("message");
                             //获取moId
-                            String moId = jo.getString("moId");
+                            String moId = map.get("moId").toString();
                             //账套号
-                            String accId = jo.getString("accId");
+                            String accId = map.get("accId").toString();//jo.getString("accId");
                             //订单类型
-                            String type = jo.getString("type");
+                            String type = map.get("poType").toString();
                             //单据号
-                            String poNum = jo.getString("poNum");
-
+                            String poNum = map.get("poNum").toString();
                             //单据日期
-                            String date = jo.getString("date");
+                            String date = map.get("customerDemandDate").toString();
                             //账套666
                             if (accId.equals(yi)) {
                                 if(type.equals("SUBCONTRACTOR_PO")) {
-                                    if (code.equals("E")) {
+                                    if (!code.equals("S")) {
                                         //失败  新增失败汇总表
                                         SyFailDocument syFailDocument = new SyFailDocument();
                                         syFailDocument.setId(oConvertUtils.id());
@@ -239,11 +238,16 @@ public class MOMainController implements ApplicationContextAware {
                                         syFailDocument.setAccid(accId);
                                         syFailDocument.setReason(message);
                                         iSyFailDocumentService.save(syFailDocument);
+                                    }else{
+
+                                        String sql1 = "update OM_MOMain set cDefine16 = ? where MOID = ?";
+                                        senYuDataSourceOne.updateMOMain(sql1,1, moId);
+
                                     }
                                 }
                             }else if (accId.equals(er)) {
                                 if(type.equals("SUBCONTRACTOR_PO")) {
-                                    if (code.equals("E")) {
+                                    if (!code.equals("S")) {
                                         //失败  新增失败汇总表
                                         SyFailDocument syFailDocument = new SyFailDocument();
                                         syFailDocument.setId(oConvertUtils.id());
@@ -254,11 +258,16 @@ public class MOMainController implements ApplicationContextAware {
                                         syFailDocument.setAccid(accId);
                                         syFailDocument.setReason(message);
                                         iSyFailDocumentService.save(syFailDocument);
+                                    }else{
+
+                                        String sql1 = "update OM_MOMain set cDefine16 = ? where MOID = ?";
+                                        senYuDataSourceTwo.updateMOMain(sql1, 1, moId);
+
                                     }
                                 }
                             }else if (accId.equals(san)) {
                                 if(type.equals("SUBCONTRACTOR_PO")) {
-                                    if (code.equals("E")) {
+                                    if (!code.equals("S")) {
                                         //失败  新增失败汇总表
                                         SyFailDocument syFailDocument = new SyFailDocument();
                                         syFailDocument.setId(oConvertUtils.id());
@@ -269,14 +278,17 @@ public class MOMainController implements ApplicationContextAware {
                                         syFailDocument.setAccid(accId);
                                         syFailDocument.setReason(message);
                                         iSyFailDocumentService.save(syFailDocument);
+                                    }else{
+
+                                        String sql1 = "update OM_MOMain set cDefine16 = ? where MOID = ?";
+                                        iSenYuDataSourceThree.updateMOMain(sql1, 1, moId);
+
                                     }
                                 }
                             }
 
-
                         }
 
-
                 //回写委外订单接口最后时间
                 Date datetome = sf.parse(beginTime);
                 dxpDataPlanService.updateLastTime(datetome, "senYu_moMain");

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

@@ -106,7 +106,7 @@ public class POPomainController implements ApplicationContextAware {
                             "on mo.cPersonCode = hr1.cPsn_Num " +
                             "left join foreigncurrency curr " +
                             "on mo.cexch_name = curr.cexch_name " +
-                            "where (cAuditTime>'"+lasttimeSf+"' or cChangAuditTime >'"+lasttimeSf+"') and mo.iverifystateex = 2 order by mo.cAuditTime desc";
+                            "where (cAuditTime>'"+lasttimeSf+"' or cChangAuditTime >'"+lasttimeSf+"') and mo.iverifystateex = 2 and cDefine16 is null order by mo.cAuditTime desc";
                     List<Map<String, Object>> list = senYuDataSourceOne.queryForList(sql);
                     for(Map<String, Object> map:list){
                         sumlist.add(map);
@@ -131,7 +131,7 @@ public class POPomainController implements ApplicationContextAware {
                             "on mo.cPersonCode = hr1.cPsn_Num " +
                             "left join foreigncurrency curr " +
                             "on mo.cexch_name = curr.cexch_name " +
-                            "where (cAuditTime>'"+lasttimeSf+"' or cChangAuditTime >'"+lasttimeSf+"') and mo.iverifystateex = 2 order by mo.cAuditTime desc";
+                            "where (cAuditTime>'"+lasttimeSf+"' or cChangAuditTime >'"+lasttimeSf+"') and mo.iverifystateex = 2 and cDefine16 is null order by mo.cAuditTime desc";
                     List<Map<String, Object>> list = senYuDataSourceTwo.queryForList(sql);
                     for(Map<String, Object> map:list){
                         sumlist.add(map);
@@ -155,7 +155,7 @@ public class POPomainController implements ApplicationContextAware {
                             "on mo.cPersonCode = hr1.cPsn_Num " +
                             "left join foreigncurrency curr " +
                             "on mo.cexch_name = curr.cexch_name " +
-                            "where (cAuditTime>'"+lasttimeSf+"' or cChangAuditTime >'"+lasttimeSf+"') and mo.iverifystateex = 2 order by mo.cAuditTime desc";
+                            "where (cAuditTime>'"+lasttimeSf+"' or cChangAuditTime >'"+lasttimeSf+"') and mo.iverifystateex = 2 and cDefine16 is null order by mo.cAuditTime desc";
                     List<Map<String, Object>> list = iSenYuDataSourceThree.queryForList(sql);
                     for(Map<String, Object> map:list){
                         sumlist.add(map);
@@ -208,25 +208,24 @@ public class POPomainController implements ApplicationContextAware {
                         }
                         //回写U8物料信息表是否同步成功字段
                             JSONObject jo = jsonArray;
-                             System.out.println("JSON数据:"+jo);
                             //获取是否成功
                             String code = jo.getString("code");
                             //获取返回消息
                             String message = jo.getString("message");
                             //获取moId
-                            String moId = jo.getString("moId");
+                            String moId = map.get("moId").toString();
                             //账套号
-                            String accId = jo.getString("accId");
+                            String accId = map.get("accId").toString();//jo.getString("accId");
                             //订单类型
-                            String type = jo.getString("type");
+                            String type = map.get("poType").toString();
                             //单据号
-                            String poNum = jo.getString("poNum");
+                            String poNum = map.get("poNum").toString();
                             //单据日期
-                            String date = jo.getString("date");
+                            String date = map.get("customerDemandDate").toString();
                             //账套1
                             if (accId.equals(yi)) {
-                                if(type.equals("STANDARD_PO")){
-                                    if (code.equals("E")) {
+                                    //失败单据
+                                    if (!code.equals("S")) {
                                        //失败  新增失败汇总表
                                         SyFailDocument syFailDocument = new SyFailDocument();
                                         syFailDocument.setId(oConvertUtils.id());
@@ -237,11 +236,15 @@ public class POPomainController implements ApplicationContextAware {
                                         syFailDocument.setAccid(accId);
                                         syFailDocument.setReason(message);
                                         iSyFailDocumentService.save(syFailDocument);
+                                    }else{
+                                        //成功单据
+                                        String sql = "update PO_Pomain set cDefine16 = ? where POID = ?";
+                                        senYuDataSourceOne.updatePOMain(sql, 1, moId);
                                     }
-                                }
+
                             }else if(accId.equals(er)){
                                 if(type.equals("STANDARD_PO")) {
-                                    if (code.equals("E")) {
+                                    if (!code.equals("S")) {
                                         //失败  新增失败汇总表
                                         SyFailDocument syFailDocument = new SyFailDocument();
                                         syFailDocument.setId(oConvertUtils.id());
@@ -252,11 +255,15 @@ public class POPomainController implements ApplicationContextAware {
                                         syFailDocument.setAccid(accId);
                                         syFailDocument.setReason(message);
                                         iSyFailDocumentService.save(syFailDocument);
+                                    }else{
+                                        //成功单据
+                                        String sql = "update PO_Pomain set cDefine16 = ? where POID = ?";
+                                        senYuDataSourceTwo.updatePOMain(sql, 1, moId);
                                     }
                                 }
                             }else if(accId.equals(san)) {
                                 if(type.equals("STANDARD_PO")) {
-                                    if (code.equals("E")) {
+                                    if (!code.equals("S")) {
                                         //失败  新增失败汇总表
                                         SyFailDocument syFailDocument = new SyFailDocument();
                                         syFailDocument.setId(oConvertUtils.id());
@@ -267,6 +274,10 @@ public class POPomainController implements ApplicationContextAware {
                                         syFailDocument.setAccid(accId);
                                         syFailDocument.setReason(message);
                                         iSyFailDocumentService.save(syFailDocument);
+                                    }else{
+                                        //成功单据
+                                        String sql = "update PO_Pomain set cDefine16 = ? where POID = ?";
+                                        iSenYuDataSourceThree.updatePOMain(sql, 1, moId);
                                     }
                                 }
                             }

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

@@ -13,4 +13,13 @@ public interface ISenYuDataSourceOne {
 
     public boolean update(String sql);//执行更新或删除语句
 
+    //修改采购订单是否同步成功!
+    public boolean updateMOMain(String sql,float cDefine16,String moId);
+
+    //修改委外订单是否同步成功!
+    public boolean updatePOMain(String sql,float cDefine16,String moId);
+
+    //修改材料出库单是否同步成功!
+    public boolean updateRdrecord(String sql,float cDefine16,String id);
+
 }

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

@@ -14,5 +14,12 @@ public interface ISenYuDataSourceThree {
 
     public boolean update(String sql);//执行更新或删除语句
 
+    //修改采购订单是否同步成功!
+    public boolean updateMOMain(String sql,float cDefine16,String moId);
 
+    //修改委外订单是否同步成功!
+    public boolean updatePOMain(String sql,float cDefine16,String moId);
+
+    //修改材料出库单是否同步成功!
+    public boolean updateRdrecord(String sql,float cDefine16,String id);
 }

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

@@ -14,5 +14,12 @@ public interface ISenYuDataSourceTwo {
 
     public boolean update(String sql);//执行更新或删除语句
 
+    //修改采购订单是否同步成功!
+    public boolean updateMOMain(String sql,float cDefine16,String moId);
 
+    //修改委外订单是否同步成功!
+    public boolean updatePOMain(String sql,float cDefine16,String moId);
+
+    //修改材料出库单是否同步成功!
+    public boolean updateRdrecord(String sql,float cDefine16,String id);
 }

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

@@ -36,5 +36,74 @@ public class SenYuDataSourceOneServiceImpl implements ISenYuDataSourceOne {
         return flag;
     }
 
+    /**
+     * 修改委外订单是否同步成功
+     * @param sql
+     * @param cDefine16
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updateMOMain(String sql, float cDefine16, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+
+    /**
+     * 修改采购订单是否同步成功
+     * @param sql
+     * @param cDefine16
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updatePOMain(String sql, float cDefine16, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 修改材料出库单是否同步成功!
+     * @param sql
+     * @param cDefine16
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean updateRdrecord(String sql, float cDefine16, String id) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, id);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
 
 }

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

@@ -33,5 +33,75 @@ public class SenYuDataSourceThreeServiceImpl implements ISenYuDataSourceThree {
         return flag;
     }
 
+    /**
+     * 修改委外订单是否同步成功
+     * @param sql
+     * @param cDefine16
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updateMOMain(String sql, float cDefine16, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+
+    /**
+     * 修改采购订单是否同步成功
+     * @param sql
+     * @param cDefine16
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updatePOMain(String sql, float cDefine16, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 修改材料出库单是否同步成功!
+     * @param sql
+     * @param cDefine16
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean updateRdrecord(String sql, float cDefine16, String id) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, id);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
 
 }

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

@@ -32,5 +32,74 @@ public class SenYuDataSourceTwoServiceImpl implements ISenYuDataSourceTwo {
         return flag;
     }
 
+    /**
+     * 修改委外订单是否同步成功
+     * @param sql
+     * @param cDefine16
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updateMOMain(String sql, float cDefine16, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+
+    /**
+     * 修改采购订单是否同步成功
+     * @param sql
+     * @param cDefine16
+     * @param moId
+     * @return
+     */
+    @Override
+    public boolean updatePOMain(String sql, float cDefine16, String moId) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, moId);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 修改材料出库单是否同步成功!
+     * @param sql
+     * @param cDefine16
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean updateRdrecord(String sql, float cDefine16, String id) {
+        // 定义返回结果
+        boolean flag = false;
+        try {
+            int i = jdbcTemplate.update(sql, cDefine16, id);
+            if (i > 0) {
+                flag = true;
+            }
+
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return flag;
+    }
 
 }