|
@@ -114,6 +114,7 @@ public class HanaOrderComponent {
|
|
|
" T.PSTYV,\n"+
|
|
" T.PSTYV,\n"+
|
|
|
" T.UEPOS, \n"+
|
|
" T.UEPOS, \n"+
|
|
|
" T.MAABC, \n"+
|
|
" T.MAABC, \n"+
|
|
|
|
|
+ " T.ZCODE8, \n"+
|
|
|
"\t replace(replace(T.BSTKD_E,CHAR(10),''),CHAR(13),'') BSTKD_E \n" +
|
|
"\t replace(replace(T.BSTKD_E,CHAR(10),''),CHAR(13),'') BSTKD_E \n" +
|
|
|
"FROM (\n" +
|
|
"FROM (\n" +
|
|
|
"\n" +
|
|
"\n" +
|
|
@@ -171,6 +172,7 @@ public class HanaOrderComponent {
|
|
|
" A.PSTYV,"+
|
|
" A.PSTYV,"+
|
|
|
" A.UEPOS,"+
|
|
" A.UEPOS,"+
|
|
|
" A.MAABC,"+
|
|
" A.MAABC,"+
|
|
|
|
|
+ " A.ZCODE8,"+
|
|
|
" A.BSTKD_E "+
|
|
" A.BSTKD_E "+
|
|
|
"FROM \"_SYS_BIC\".\"com.sd/CAL_SALES\"" +
|
|
"FROM \"_SYS_BIC\".\"com.sd/CAL_SALES\"" +
|
|
|
"('PLACEHOLDER' = ('$$IP_ENDDATE$$',\n" +
|
|
"('PLACEHOLDER' = ('$$IP_ENDDATE$$',\n" +
|
|
@@ -181,7 +183,7 @@ public class HanaOrderComponent {
|
|
|
"\t LEFT JOIN ERP.ZHANAMATDOWN D ON D.MATNR = A.MATNR \n" +
|
|
"\t LEFT JOIN ERP.ZHANAMATDOWN D ON D.MATNR = A.MATNR \n" +
|
|
|
"\t LEFT JOIN ERP.T001L E ON E.WERKS = A.WERKS AND E.LGORT = A.LGORT \n" +
|
|
"\t LEFT JOIN ERP.T001L E ON E.WERKS = A.WERKS AND E.LGORT = A.LGORT \n" +
|
|
|
"\t LEFT JOIN \"_SYS_BIC\".\"com.md/CAL_MAT_HIERARCHY_S\" CAL ON B.MATNR=CAL.MATNR AND A.VTWEG=CAL.VTWEG \n" +
|
|
"\t LEFT JOIN \"_SYS_BIC\".\"com.md/CAL_MAT_HIERARCHY_S\" CAL ON B.MATNR=CAL.MATNR AND A.VTWEG=CAL.VTWEG \n" +
|
|
|
- "\t WHERE A.VKORG != '4000' AND A.VTWEG IN ('D9','Y9','D8') AND A.SPART != '16' AND A.AUART NOT IN ('31','32','33','35','36','39','29') " +
|
|
|
|
|
|
|
+ "\t WHERE A.VKORG != '4000' AND A.VTWEG IN ('D9','Y9','D8') AND A.SPART != '16' AND A.AUART NOT IN ('31','32','33','35','36','39','29','11') " +
|
|
|
"and ((A.ZCMGST !='信用通过' and A.ABGRU='') or (A.ZCMGST ='信用通过' and A.ABGRU=''))\n" +
|
|
"and ((A.ZCMGST !='信用通过' and A.ABGRU='') or (A.ZCMGST ='信用通过' and A.ABGRU=''))\n" +
|
|
|
" order by A.VBELN,A.POSNR " +
|
|
" order by A.VBELN,A.POSNR " +
|
|
|
" ) T");
|
|
" ) T");
|
|
@@ -197,6 +199,28 @@ public class HanaOrderComponent {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @description: C类产品订单标记
|
|
|
|
|
+ * @param: []
|
|
|
|
|
+ * @return: void
|
|
|
|
|
+ * @author: njs
|
|
|
|
|
+ * @date: 2025/5/7 13:24
|
|
|
|
|
+ */
|
|
|
|
|
+ public void hanaErpOrderSyncByC() throws Exception {
|
|
|
|
|
+ Connection con = this.getHanaConnection();
|
|
|
|
|
+ PreparedStatement pstmt = con.prepareStatement("SELECT MAABC,SPRAS,TMABC,MANDT FROM ERP.TMABCT");
|
|
|
|
|
+
|
|
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
|
|
+ ResultSet rs = pstmt.executeQuery();
|
|
|
|
|
+ Long endTime = System.currentTimeMillis();
|
|
|
|
|
+ log.info("TMABCT查询用时:" + (endTime - startTime)+"毫秒");
|
|
|
|
|
+ this.createTmabcTxt(rs);
|
|
|
|
|
+ this.runLoadTmabcTxt();
|
|
|
|
|
+ this.closeConnection(con, pstmt);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @description: 交货单电子签收数据同步
|
|
* @description: 交货单电子签收数据同步
|
|
|
* @param: []
|
|
* @param: []
|
|
@@ -221,6 +245,7 @@ public class HanaOrderComponent {
|
|
|
"\t ZVBELN_YCHH,\n" +
|
|
"\t ZVBELN_YCHH,\n" +
|
|
|
"\t ZSTATUS_HH,\n" +
|
|
"\t ZSTATUS_HH,\n" +
|
|
|
"\t CONTRACTID, \n" +
|
|
"\t CONTRACTID, \n" +
|
|
|
|
|
+ "\t BIZNO, \n" +
|
|
|
"\t MANDT \n" +
|
|
"\t MANDT \n" +
|
|
|
" FROM ERP.ZSDT056 where ERDAT_SO between ADD_MONTHS(CURRENT_DATE, -3) AND CURRENT_DATE");
|
|
" FROM ERP.ZSDT056 where ERDAT_SO between ADD_MONTHS(CURRENT_DATE, -3) AND CURRENT_DATE");
|
|
|
|
|
|
|
@@ -376,6 +401,7 @@ public class HanaOrderComponent {
|
|
|
+"$$"+ result.getString("ZVBELN_YCHH")
|
|
+"$$"+ result.getString("ZVBELN_YCHH")
|
|
|
+"$$"+ result.getString("ZSTATUS_HH")
|
|
+"$$"+ result.getString("ZSTATUS_HH")
|
|
|
+"$$"+ result.getString("CONTRACTID")
|
|
+"$$"+ result.getString("CONTRACTID")
|
|
|
|
|
+ +"$$"+ result.getString("BIZNO")
|
|
|
+"$$"+ result.getString("MANDT")
|
|
+"$$"+ result.getString("MANDT")
|
|
|
+ "\r\n");
|
|
+ "\r\n");
|
|
|
|
|
|
|
@@ -423,6 +449,93 @@ public class HanaOrderComponent {
|
|
|
return j;
|
|
return j;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //C类
|
|
|
|
|
+ private int createTmabcTxt(ResultSet result) throws Exception {
|
|
|
|
|
+ File file = null;
|
|
|
|
|
+ FileWriter fw = null;
|
|
|
|
|
+ Connection conn = null;
|
|
|
|
|
+ PreparedStatement pstm =null;
|
|
|
|
|
+ int j =0;
|
|
|
|
|
+ try {
|
|
|
|
|
+ long i =0;
|
|
|
|
|
+
|
|
|
|
|
+ //创建IO需求的条件,并声明输出路径
|
|
|
|
|
+ file = new File((Global.getTemdataPath()+"erpOrderByC/"));
|
|
|
|
|
+ log.info("erpOrderByC数据缓存路径:" + Global.getTemdataPath()+"erpOrderByC/");
|
|
|
|
|
+ if(!file.exists()){
|
|
|
|
|
+ file.mkdir();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ file = new File(Global.getTemdataPath()+"erpOrderByC/"+j+".txt");
|
|
|
|
|
+ if(!file.exists()){
|
|
|
|
|
+ file.createNewFile();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ //取得这个目录下的所有子文件对象
|
|
|
|
|
+ File[] files = new File(Global.getTemdataPath()+"erpOrderByC/").listFiles();
|
|
|
|
|
+ //遍历该目录下的文件对象
|
|
|
|
|
+
|
|
|
|
|
+ for (File f: files){
|
|
|
|
|
+ f.delete();
|
|
|
|
|
+ }
|
|
|
|
|
+ file.delete();
|
|
|
|
|
+ file.createNewFile();
|
|
|
|
|
+ }
|
|
|
|
|
+ fw = new FileWriter(file);
|
|
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
|
|
+ while (result.next()){
|
|
|
|
|
+
|
|
|
|
|
+ fw.write(
|
|
|
|
|
+ result.getString("MAABC")
|
|
|
|
|
+ +"$$"+ result.getString("SPRAS")
|
|
|
|
|
+ +"$$"+ result.getString("TMABC")
|
|
|
|
|
+ +"$$"+ result.getString("MANDT")
|
|
|
|
|
+ + "\r\n");
|
|
|
|
|
+
|
|
|
|
|
+ fw.flush();
|
|
|
|
|
+ i++;
|
|
|
|
|
+ if (i%50000==0){
|
|
|
|
|
+ j++;
|
|
|
|
|
+ //创建IO需求的条件,并声明输出路径
|
|
|
|
|
+ file = new File(Global.getTemdataPath()+"erpOrderByC/"+j+".txt");
|
|
|
|
|
+ if(!file.exists()){
|
|
|
|
|
+ file.createNewFile();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ file.delete();
|
|
|
|
|
+ file.createNewFile();
|
|
|
|
|
+ }
|
|
|
|
|
+ fw = new FileWriter(file);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ Long endTime = System.currentTimeMillis();
|
|
|
|
|
+ log.info("生成erpOrderByC-TXT用时:" + (endTime - startTime) + "毫秒");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }finally {
|
|
|
|
|
+ fw.close();
|
|
|
|
|
+ if(pstm!=null){
|
|
|
|
|
+ try {
|
|
|
|
|
+ pstm.close();
|
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(conn!=null){
|
|
|
|
|
+ try {
|
|
|
|
|
+ conn.close();
|
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return j;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//订单
|
|
//订单
|
|
|
private int createSalesOrderTxt(ResultSet result) throws Exception {
|
|
private int createSalesOrderTxt(ResultSet result) throws Exception {
|
|
|
File file = null;
|
|
File file = null;
|
|
@@ -515,6 +628,7 @@ public class HanaOrderComponent {
|
|
|
+"$$"+ result.getString("PSTYV")
|
|
+"$$"+ result.getString("PSTYV")
|
|
|
+"$$"+ result.getString("UEPOS")
|
|
+"$$"+ result.getString("UEPOS")
|
|
|
+"$$"+ result.getString("MAABC")
|
|
+"$$"+ result.getString("MAABC")
|
|
|
|
|
+ +"$$"+ result.getString("ZCODE8")
|
|
|
+"$$"+ result.getString("BSTKD_E")
|
|
+"$$"+ result.getString("BSTKD_E")
|
|
|
+ "\r\n");
|
|
+ "\r\n");
|
|
|
|
|
|
|
@@ -1165,6 +1279,49 @@ public class HanaOrderComponent {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //订单C类标识
|
|
|
|
|
+ private void runLoadTmabcTxt()throws Exception{
|
|
|
|
|
+ //生产表
|
|
|
|
|
+ Connection conn = null;
|
|
|
|
|
+ PreparedStatement pstm =null;
|
|
|
|
|
+ try{
|
|
|
|
|
+ conn = getMysqlConnection();
|
|
|
|
|
+ String sql = "TRUNCATE TABLE meta_hana_order_maabc";
|
|
|
|
|
+ pstm = conn.prepareStatement(sql);
|
|
|
|
|
+ pstm.execute();
|
|
|
|
|
+ String testSql = "LOAD DATA LOCAL INFILE 'testIO.txt' into table meta_hana_order_maabc fields terminated by '$$' lines terminated by '\\n'";
|
|
|
|
|
+ long beginTime=System.currentTimeMillis();
|
|
|
|
|
+ int rows=this.bulkLoadFromInputStream(testSql, mergeGetStream(new File((Global.getTemdataPath()+"erpOrderByC/"))));
|
|
|
|
|
+ long endTime=System.currentTimeMillis();
|
|
|
|
|
+ log.info("importing erpOrderByC := "+rows+" rows data into mysql and cost "+(endTime-beginTime)+" ms!");
|
|
|
|
|
+
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ String name ="meta_hana_order_maabc订单C类标识表同步异常";
|
|
|
|
|
+ userOrderAuthorService.sendMailHanaWarning(name);
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }finally {
|
|
|
|
|
+ if(pstm!=null){
|
|
|
|
|
+ try {
|
|
|
|
|
+ pstm.close();
|
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(conn!=null){
|
|
|
|
|
+ try {
|
|
|
|
|
+ conn.close();
|
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//电子单签收状态
|
|
//电子单签收状态
|
|
|
public void runLoadDeliverSignature () throws Exception{
|
|
public void runLoadDeliverSignature () throws Exception{
|
|
|
//生产表
|
|
//生产表
|