凭证相关--nc接口优化

This commit is contained in:
xiezhiwen 2019-07-18 11:43:55 +08:00
parent e8156f860d
commit 9176c8a76a
4 changed files with 95 additions and 53 deletions

View File

@ -5,6 +5,7 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -69,6 +70,7 @@ public class VoucherToNCforAssistContract implements Job{
//用于记录异常
File file1 = null;
PrintStream stream = null;
String ERROR_URL =null;
// xml类别
String type="contract";
// 批次号
@ -117,10 +119,8 @@ public class VoucherToNCforAssistContract implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// 异常记录路径
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
/**
* 定义全局变量
*/
@ -232,11 +232,18 @@ public class VoucherToNCforAssistContract implements Job{
} catch (Exception e2) {
e2.printStackTrace();
}
// 异常记录路径
file1=new File(ERROR_URL+"NC_ERROR-CONTRACT-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
e.printStackTrace();
}finally {
stream.flush();
stream.close();
e.printStackTrace();
}finally {
if(Sqlca!=null) {
try {
Sqlca.commit();
@ -269,6 +276,7 @@ public class VoucherToNCforAssistContract implements Job{
//用于记录异常
File file1 = null;
PrintStream stream = null;
String ERROR_URL =null;
// xml类别
String type="contract";
// 记录当前批次传输总量
@ -316,10 +324,8 @@ public class VoucherToNCforAssistContract implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// 异常记录路径
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
/**
* 定义全局变量
*/
@ -409,17 +415,17 @@ public class VoucherToNCforAssistContract implements Job{
}
}
}
Sqlca1.commit();
String URL=LOCALHOST_URL+"APleasing_Defdoc_"+year_month_day+".xml";
//String URL="D:\\voucherXml_NC\\APleasing_Defdoc_"+year_month_day+".xml";
file=new File(URL);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
InterActionToNC(Sqlca,URL,type,batch,count,batchList);
Sqlca.commit();
}
Sqlca1.commit();
String URL=LOCALHOST_URL+"APleasing_Defdoc_"+year_month_day+".xml";
//String URL="D:\\voucherXml_NC\\APleasing_Defdoc_"+year_month_day+".xml";
file=new File(URL);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
InterActionToNC(Sqlca,URL,type,batch,count,batchList);
Sqlca.commit();
}
} catch (Exception e) {
try {
Sqlca.rollback();
@ -432,12 +438,19 @@ public class VoucherToNCforAssistContract implements Job{
} catch (Exception e2) {
e2.printStackTrace();
}
// 异常记录路径
file1=new File(ERROR_URL+"NC_ERROR-CONTRACT-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
stream.flush();
stream.close();
e.printStackTrace();
returns="false";
}finally {
stream.flush();
stream.close();
if(Sqlca!=null) {
try {
Sqlca.commit();

View File

@ -5,6 +5,7 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -73,6 +74,8 @@ public class VoucherToNCforCustomer implements Job{
//用于记录异常
File file1 = null;
PrintStream stream = null;
// 错误信息存放路径
String ERROR_URL =null;
// 定义xml类型对象
String type="customer";
// 批次号
@ -131,10 +134,7 @@ public class VoucherToNCforCustomer implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// 定义文件对象
File file=null;
@ -302,11 +302,18 @@ public class VoucherToNCforCustomer implements Job{
} catch (Exception e2) {
e2.printStackTrace();
}
// 异常记录路径
file1=new File(ERROR_URL+"NC_ERROR-CUSTOMER-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
e.printStackTrace();
}finally {
stream.flush();
stream.close();
e.printStackTrace();
}finally {
if (Sqlca!=null) {
try {
Sqlca.commit();
@ -339,6 +346,7 @@ public class VoucherToNCforCustomer implements Job{
//用于记录异常
File file1 = null;
PrintStream stream = null;
String ERROR_URL = null;
// 定义xml类型对象
String type="customer";
// 批次号
@ -395,10 +403,7 @@ public class VoucherToNCforCustomer implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// 定义文件对象
File file=null;
// 定义Document对象
@ -566,12 +571,19 @@ public class VoucherToNCforCustomer implements Job{
} catch (Exception e2) {
e2.printStackTrace();
}
// 异常记录路径
file1=new File(ERROR_URL+"NC_ERROR-CUSTOMER-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
stream.flush();
stream.close();
e.printStackTrace();
returns="false";
}finally {
stream.flush();
stream.close();
if (Sqlca!=null) {
try {
Sqlca.commit();

View File

@ -5,6 +5,7 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -73,6 +74,7 @@ public class VoucherToNCforDistributor implements Job{
PrintStream stream = null;
// 批次号
String batch = "";
String ERROR_URL=null;
// xml类别
String type="distributor";
// 记录当前批次传输总量
@ -126,10 +128,7 @@ public class VoucherToNCforDistributor implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
File file = null; // 文件对象
XMLWriter writer = null; // 输出对象
@ -373,11 +372,18 @@ public class VoucherToNCforDistributor implements Job{
} catch (Exception e2) {
e2.printStackTrace();
}
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-DISTRIBUTOR-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
e.printStackTrace();
}finally {
stream.flush();
stream.close();
e.printStackTrace();
}finally {
if(Sqlca!=null) {
try {
Sqlca.commit();
@ -417,6 +423,7 @@ public class VoucherToNCforDistributor implements Job{
//用于记录异常
File file1 = null;
PrintStream stream = null;
String ERROR_URL=null;
// 批次号
String batch = "";
try {
@ -464,10 +471,7 @@ public class VoucherToNCforDistributor implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
File file = null; // 文件对象
XMLWriter writer = null; // 输出对象
@ -710,12 +714,19 @@ public class VoucherToNCforDistributor implements Job{
} catch (Exception e2) {
e2.printStackTrace();
}
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-DISTRIBUTOR-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
stream.flush();
stream.close();
e.printStackTrace();
returns="false";
}finally {
stream.flush();
stream.close();
if(Sqlca!=null) {
try {
Sqlca.commit();

View File

@ -6,6 +6,7 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
@ -97,6 +98,7 @@ public class VoucherToNCforVoucherPZ implements Job{
//用于记录异常
File file1 = null;
PrintStream stream = null;
String ERROR_URL = null;
// 记录表类别
String type="voucher";
// 批次号
@ -151,13 +153,10 @@ public class VoucherToNCforVoucherPZ implements Job{
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
// 错误信息存放路径
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
/**
* 定义全局变量
*/
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
stream=new PrintStream(file1);
// xml文件头
Document document=null;
// 生成的xml文件路径
@ -576,12 +575,19 @@ public class VoucherToNCforVoucherPZ implements Job{
} catch (IOException e1) {
e1.printStackTrace();
}*/
// Òì³£¼Ç¼·¾
file1=new File(ERROR_URL+"NC_ERROR-VOUCHER-"+year_month_day+".txt");
try {
stream=new PrintStream(file1);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
e.printStackTrace(stream);
stream.flush();
stream.close();
e.printStackTrace();
returns="false";
}finally {
stream.flush();
stream.close();
if(Sqlca!=null) {
try {
Sqlca.commit();