|
@@ -397,6 +397,19 @@ public class HanaOrderComponent {
|
|
return j;
|
|
return j;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**HANA已复核线下月底手动过账的交货单仍需自提同步*/
|
|
|
|
+ public void hanaSelfReviewedDeliverOrderSync() throws Exception{
|
|
|
|
+ Connection con = this.getHanaConnection();
|
|
|
|
+ PreparedStatement pstmt = con.prepareStatement("SELECT MANDT,VBELN,DTIME from ERP.ZSDT_POST_IN_ADV");
|
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
|
+ ResultSet rs = pstmt.executeQuery();
|
|
|
|
+ Long endTime = System.currentTimeMillis();
|
|
|
|
+ log.info("DeliverOrder查询用时:" + (endTime - startTime)+"毫秒");
|
|
|
|
+ this.createSelfReviewedDeliverOrderTxt(rs);
|
|
|
|
+ this.runLoadSelfReviewedDeliverOrder();
|
|
|
|
+ this.closeConnection(con, pstmt);
|
|
|
|
+ }
|
|
|
|
+
|
|
public void hanaDeliverOrderSync() throws Exception {
|
|
public void hanaDeliverOrderSync() throws Exception {
|
|
Connection con = this.getHanaConnection();
|
|
Connection con = this.getHanaConnection();
|
|
PreparedStatement pstmt = con.prepareStatement("SELECT\n" +
|
|
PreparedStatement pstmt = con.prepareStatement("SELECT\n" +
|
|
@@ -545,6 +558,92 @@ public class HanaOrderComponent {
|
|
this.closeConnection(con, pstmt);
|
|
this.closeConnection(con, pstmt);
|
|
|
|
|
|
}*/
|
|
}*/
|
|
|
|
+ private int createSelfReviewedDeliverOrderTxt(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()+"selfDeliverOrder/"));
|
|
|
|
+ log.info("selfDeliverOrder数据缓存路径:" + Global.getTemdataPath()+"selfDeliverOrder/");
|
|
|
|
+ if(!file.exists()){
|
|
|
|
+ file.mkdir();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ file = new File(Global.getTemdataPath()+"selfDeliverOrder/"+j+".txt");
|
|
|
|
+ if(!file.exists()){
|
|
|
|
+ file.createNewFile();
|
|
|
|
+ }else {
|
|
|
|
+ //取得这个目录下的所有子文件对象
|
|
|
|
+ File[] files = new File(Global.getTemdataPath()+"selfDeliverOrder/").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("MANDT")
|
|
|
|
+ +"$$"+result.getString("VBELN")
|
|
|
|
+ +"$$"+result.getString("DTIME")
|
|
|
|
+ + "\r\n");
|
|
|
|
+
|
|
|
|
+ fw.flush();
|
|
|
|
+ i++;
|
|
|
|
+ if (i%50000==0){
|
|
|
|
+ j++;
|
|
|
|
+ //创建IO需求的条件,并声明输出路径
|
|
|
|
+ file = new File(Global.getTemdataPath()+"selfDeliverOrder/"+j+".txt");
|
|
|
|
+ if(!file.exists()){
|
|
|
|
+ file.createNewFile();
|
|
|
|
+ }else {
|
|
|
|
+ file.delete();
|
|
|
|
+ file.createNewFile();
|
|
|
|
+ }
|
|
|
|
+ fw = new FileWriter(file);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Long endTime = System.currentTimeMillis();
|
|
|
|
+ log.info("生成selfDeliverOrder-TXT用时:" + (endTime - startTime) + "毫秒");
|
|
|
|
+
|
|
|
|
+ conn = getMysqlConnection();
|
|
|
|
+ //生产表
|
|
|
|
+ String sql = "TRUNCATE TABLE meta_hana_self_deliver_order";
|
|
|
|
+ pstm = conn.prepareStatement(sql);
|
|
|
|
+ pstm.execute();
|
|
|
|
+ }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 createDeliverOrderTxt(ResultSet result) throws Exception {
|
|
private int createDeliverOrderTxt(ResultSet result) throws Exception {
|
|
File file = null;
|
|
File file = null;
|
|
@@ -809,6 +908,18 @@ public class HanaOrderComponent {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ public void runLoadSelfReviewedDeliverOrder()throws Exception{
|
|
|
|
+ //生产表
|
|
|
|
+ String testSql = "LOAD DATA LOCAL INFILE 'testIO.txt' into table meta_hana_self_deliver_order fields terminated by '$$' lines terminated by '\\n'";
|
|
|
|
+ try {
|
|
|
|
+ long beginTime=System.currentTimeMillis();
|
|
|
|
+ int rows=this.bulkLoadFromInputStream(testSql, mergeGetStream(new File((Global.getTemdataPath()+"selfDeliverOrder/"))));
|
|
|
|
+ long endTime=System.currentTimeMillis();
|
|
|
|
+ log.info("importing selfDeliverOrder := "+rows+" rows data into mysql and cost "+(endTime-beginTime)+" ms!");
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
public void runLoadDeliverOrder() throws Exception{
|
|
public void runLoadDeliverOrder() throws Exception{
|
|
//测试表
|
|
//测试表
|