凭证接口及凭证bug修复
This commit is contained in:
parent
e9a381311e
commit
832ae1ce8f
@ -31,12 +31,17 @@
|
||||
};
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
<script type="text/javascript">
|
||||
// 凭证NC接口生成xml文件
|
||||
/**
|
||||
* 凭证NC接口生成xml文件
|
||||
*/
|
||||
function NCInterface(){
|
||||
alert("´«Ê俪ʼ");
|
||||
//$.post('http://172.16.0.19/com.tenwa.voucher.serviceImp.VoucherSysJointNCServiceImpl/sendVoucherData' , function (text, status) { alert(text); });
|
||||
var mes = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.VoucherSysJointNCServiceImpl","sendVoucherData","");
|
||||
alert("传输成功");
|
||||
if("true"==mes){
|
||||
alert("传输成功");
|
||||
}else{
|
||||
alert("传输失败");
|
||||
}
|
||||
}
|
||||
|
||||
function synVoucherCode(){
|
||||
|
||||
@ -62,7 +62,7 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
|
||||
}
|
||||
param.clear();
|
||||
map.put("FLOWUNID", FlowUnid);
|
||||
|
||||
System.out.println();
|
||||
List<Map<String,String>> dataList=DataOperatorUtil.getDataBySql(Sqlca, sql, map);
|
||||
|
||||
CreateVoucherServiceImpl vs=new CreateVoucherServiceImpl();
|
||||
|
||||
@ -38,7 +38,7 @@ public class CleanLeaseMoneyAddOtherNoGps implements VoucherJavaParamService {
|
||||
// 判断GPS不参融, 减去GPS
|
||||
String GPS_FEE_FINA = param.get("GPS_FEE_FINA");
|
||||
System.out.println(GPS_FEE_FINA);
|
||||
if("finatype01".equals(GPS_FEE_FINA+"1111111111111111111111111111111111111")) {
|
||||
if("finatype01".equals(GPS_FEE_FINA)) {
|
||||
factmoney=new BigDecimal(EQUIP_AMT)
|
||||
.subtract(new BigDecimal(FIRST_PAYMENT))
|
||||
.add(new BigDecimal(PURCHASE_TAX))
|
||||
|
||||
@ -3,6 +3,6 @@ package com.tenwa.voucher.service;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
|
||||
public interface VoucherSysJointNCService {
|
||||
public void sendVoucherData(JBOTransaction tx)throws Exception;
|
||||
public String sendVoucherData(JBOTransaction tx)throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@ -42,15 +42,16 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
/**
|
||||
* 调用生成xml的方法
|
||||
*/
|
||||
public void sendVoucherData(JBOTransaction tx){
|
||||
getVoucherToXML(tx);
|
||||
public String sendVoucherData(JBOTransaction tx){
|
||||
String trueOrFalse = getVoucherToXML(tx);
|
||||
return trueOrFalse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 先获取V8视图中的凭证编号, 然后依次生成所需xml
|
||||
* @param tx
|
||||
*/
|
||||
public static void getVoucherToXML(JBOTransaction tx) {
|
||||
public static String getVoucherToXML(JBOTransaction tx) {
|
||||
try {
|
||||
Transaction Sqlca = null;
|
||||
Sqlca = Transaction.createTransaction(tx);
|
||||
@ -68,6 +69,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
e.printStackTrace();
|
||||
return "false";
|
||||
}finally {
|
||||
try {
|
||||
if(tx !=null){
|
||||
@ -76,6 +78,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace(); }
|
||||
}
|
||||
return "true";
|
||||
}
|
||||
/**
|
||||
* 获取数据库凭证信息表所有的待传F3凭证编号
|
||||
@ -85,7 +88,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
*/
|
||||
private static List<Map<String, String>> getDataList(JBOTransaction tx) throws Exception{
|
||||
// 查询所有待传输的数据
|
||||
String sql = "SELECT F3,F60,ID,MODULE_NAME,DEPT_NAME,F1,F15,V8_STATUS,F5,GENERATE_DATE FROM VI_VOUCHER_V8 WHERE V8_FLAG='0' OR V8_FLAG='-1'";
|
||||
String sql = "SELECT F3,F60,ID,MODULE_NAME,DEPT_NAME,F1,F15,V8_STATUS,F5,GENERATE_DATE FROM VI_VOUCHER_V8 WHERE V8_FLAG !='1'";
|
||||
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(tx, sql, null);// 将所有凭证号封装到list集合中
|
||||
return dataList;
|
||||
}
|
||||
@ -94,6 +97,10 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void DOM4JcreateToVoucher(Transaction Sqlca,List<Map<String, String>>list, Map<String, String> map) throws Exception {
|
||||
File file2 = new File("D:\\voucherXml_NC");
|
||||
if (!file2.exists()) {
|
||||
file2.mkdirs();
|
||||
}
|
||||
Document document=null;
|
||||
File file=null;
|
||||
XMLWriter writer=null;
|
||||
@ -154,7 +161,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
Element year = voucherHead.addElement("year");// 会计年度/非空
|
||||
year.setText((ACC_YEAR==null)?"":ACC_YEAR);
|
||||
Element pk_system = voucherHead.addElement("pk_system");// 来源系统/非空
|
||||
pk_system.setText((own.getAttribute("OWN_NAME").toString()==null)?"":own.getAttribute("OWN_NAME").toString());//----------------------------------------
|
||||
pk_system.setText((own.getAttribute("OWN_NAME")==null)? "":own.getAttribute("OWN_NAME").getString());//----------------------------------------
|
||||
Element voucherkind = voucherHead.addElement("voucherkind");// 凭证类型值/非空
|
||||
voucherkind.setText("0");
|
||||
Element pk_accountingbook = voucherHead.addElement("pk_accountingbook");// 核算核算账簿/非空
|
||||
@ -399,7 +406,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
pk_innercorp2.setText("");
|
||||
}
|
||||
}
|
||||
String URL="D:\\APleasing_VOUCHER_"+year_month_day+".xml";
|
||||
String URL="D:\\voucherXml_NC\\APleasing_VOUCHER_"+year_month_day+".xml";
|
||||
file=new File(URL);
|
||||
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
|
||||
writer.setEscapeText(false);// 字符是否转义,默认true
|
||||
@ -414,6 +421,10 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void DOM4JcreateToCustomer(Transaction Sqlca) throws Exception{
|
||||
File file2 = new File("D:\\voucherXml_NC");
|
||||
if(file2==null || "".equals(file2)) {
|
||||
file2.mkdirs();//创建父文件夹
|
||||
}
|
||||
// 定义全局对象
|
||||
File file=null;
|
||||
XMLWriter writer=null;
|
||||
@ -704,7 +715,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
SqlObject updSql=new SqlObject(updateSql);
|
||||
Sqlca.executeSQL(updSql);*/
|
||||
}
|
||||
String URL="D:\\APleasing_Customer_"+year_month_day+".xml";
|
||||
String URL="D:\\voucherXml_NC\\APleasing_Customer_"+year_month_day+".xml";
|
||||
file=new File(URL);
|
||||
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
|
||||
writer.setEscapeText(false);// 字符是否转义,默认true
|
||||
@ -718,6 +729,10 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void DOM4JcreateToSupplier(Transaction Sqlca) throws Exception{
|
||||
File file2 = new File("D:\\voucherXml_NC");
|
||||
if(file2==null || "".equals(file2)) {
|
||||
file2.mkdirs();//创建父文件夹
|
||||
}
|
||||
File file = null;
|
||||
XMLWriter writer = null;
|
||||
String DISTRIBUTOR_NAME = ""; // 经销商名称
|
||||
@ -904,7 +919,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
SqlObject updSql=new SqlObject(updateSql);
|
||||
Sqlca.executeSQL(updSql);*/
|
||||
}
|
||||
String f="D:\\APleasing_Supplier_"+year_month_day+".xml";
|
||||
String f="D:\\voucherXml_NC\\APleasing_Supplier_"+year_month_day+".xml";
|
||||
file=new File(f);
|
||||
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
|
||||
writer.setEscapeText(false);// 字符是否转义,默认true
|
||||
@ -918,6 +933,10 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
File file=null;
|
||||
XMLWriter writer=null;
|
||||
Date time = new Date(); // 获取当前时间对象, 并格式化
|
||||
File file2 = new File("D:\\voucherXml_NC");
|
||||
if(file2==null || "".equals(file2)) {
|
||||
file2.mkdirs();//创建父文件夹
|
||||
}
|
||||
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMddHHmmss");//
|
||||
String year_month_day = formatter1.format(time); // 年月日
|
||||
int a = list.size(); // 获取凭证编号的长度
|
||||
@ -971,7 +990,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
Element memo = billhead.addElement("memo");// 备注,最大长度为200,类型为:String
|
||||
memo.setText("");
|
||||
}
|
||||
String URL="D:\\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
|
||||
@ -982,12 +1001,15 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
||||
*/
|
||||
public static void InterActionToNC(Transaction Sqlca,String OutURL) {
|
||||
try {
|
||||
// 定义全局变量
|
||||
String updSql="";
|
||||
String sql="";
|
||||
String resultcode=""; //返回状态
|
||||
String bdocid=""; //数据ID
|
||||
SqlObject updSql;
|
||||
/**
|
||||
* 获取对方post连接
|
||||
*/
|
||||
@ -1013,7 +1035,7 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
/**
|
||||
* 获取回执信息
|
||||
*/
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
/*InputStream inputStream = connection.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(inputStream);
|
||||
BufferedReader bufreader = new BufferedReader(isr);
|
||||
String xmlString = "";
|
||||
@ -1025,9 +1047,9 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
input.close();
|
||||
System.out.println("----" + xmlString);
|
||||
|
||||
/**
|
||||
*//**
|
||||
* 将获取到的回执信息生成本地xml
|
||||
*/
|
||||
*//*
|
||||
Document resDoc = DocumentHelper.parseText(xmlString);
|
||||
TransformerFactory tFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = tFactory.newTransformer();
|
||||
@ -1037,13 +1059,15 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "YES");
|
||||
// 将回执信息输出到本地
|
||||
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String resFile = "D:\\"+fmt.format(new Date())+".xml";
|
||||
File file2 = new File("D:\\voucherXml_receipt");
|
||||
file2.mkdirs();//创建父文件夹
|
||||
String resFile = "D:\\voucherXml_receipt\\"+fmt.format(new Date())+".xml";
|
||||
StreamResult result = new StreamResult(new File(resFile));
|
||||
transformer.transform(source,result);
|
||||
|
||||
/**
|
||||
*//**
|
||||
* 解析xml, 根据回执信息更新状态
|
||||
*/
|
||||
*//*
|
||||
SAXReader sr = new SAXReader();
|
||||
Document doc = sr.read(resFile);
|
||||
Element root= doc.getRootElement();
|
||||
@ -1056,13 +1080,28 @@ public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
|
||||
}else if(resSuc.equals("Y")){
|
||||
System.out.println("导入成功");
|
||||
//接下来的代码,修改状态
|
||||
updSql="UPDATE ±íÃû set ×Ö¶Î='1'";
|
||||
sql="UPDATE 表名 set 字段 = '1' WHERE 状态字段 <> '1'";
|
||||
updSql = new SqlObject(sql);
|
||||
Sqlca.executeSQL(updSql);
|
||||
List<Element> list1 = root.elements();
|
||||
for (Element element : list1) {
|
||||
List<Element> list = element.elements();
|
||||
for (Element el : list) {
|
||||
resultcode = el.element("resultcode").getStringValue();
|
||||
if(!"1".equals(resultcode)) {
|
||||
bdocid = el.element("bdocid").getStringValue();
|
||||
sql=" UPDATE 表名 SET 字段='"+resultcode+"' WHERE 标签id='"+bdocid+"' ";
|
||||
updSql = new SqlObject(sql);
|
||||
Sqlca.executeSQL(updSql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
System.out.println("出现未知错误");
|
||||
}
|
||||
}else{
|
||||
System.out.println("未找到successful属性");
|
||||
}
|
||||
} */
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user