凭证相关, 凭证信息页面新增按钮
This commit is contained in:
parent
22abdbe1b2
commit
d2a2f34a67
@ -21,7 +21,10 @@
|
|||||||
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
|
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
|
||||||
String sButtons[][] = {
|
String sButtons[][] = {
|
||||||
{"true","","Button","导出凭证","导出凭证","createContractByTemplate()","","","","btn_icon_up",""},
|
{"true","","Button","导出凭证","导出凭证","createContractByTemplate()","","","","btn_icon_up",""},
|
||||||
{"true","","Button","NC接口","NC接口","NCInterface()","","","","btn_icon_up",""},
|
{"true","","Button","1.传输经销商信息入NC","1.传输经销商信息入NC","DistributorToNCInterface()","","","","btn_icon_up",""},
|
||||||
|
{"true","","Button","2.传输客户信息入NC","2.传输客户信息入NC","CustomerToNCInterface()","","","","btn_icon_up",""},
|
||||||
|
{"true","","Button","3.传输辅助合同信息入NC","3.传输辅助合同信息入NC","ContractToNCInterface()","","","","btn_icon_up",""},
|
||||||
|
{"true","","Button","4.传输凭证信息入NC","4.传输凭证信息入NC","VoucherToNCInterface()","","","","btn_icon_up",""},
|
||||||
//{"true","","Button","刷新辅助账编码","刷新辅助账编码","synVoucherCode()","","","","btn_icon_save",""},
|
//{"true","","Button","刷新辅助账编码","刷新辅助账编码","synVoucherCode()","","","","btn_icon_save",""},
|
||||||
//{"true","","Button","明细","明细","showContractInsurance()","","","","btn_icon_detail",""},
|
//{"true","","Button","明细","明细","showContractInsurance()","","","","btn_icon_detail",""},
|
||||||
//{"true","","Button","导入金蝶系统","导入金蝶系统","importFK()","","","","btn_icon_up",""},
|
//{"true","","Button","导入金蝶系统","导入金蝶系统","importFK()","","","","btn_icon_up",""},
|
||||||
@ -32,9 +35,42 @@
|
|||||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/**
|
/**
|
||||||
* 凭证NC接口生成xml文件
|
* 传输经销商信息入NC
|
||||||
*/
|
*/
|
||||||
function NCInterface(){
|
function DistributorToNCInterface(){
|
||||||
|
var res = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.VoucherToNCforDistributor","sendDistriturorData","");
|
||||||
|
if(res=="true"){
|
||||||
|
alert("传输成功 !");
|
||||||
|
}else{
|
||||||
|
alert("传输失败 !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 传输客户信息入NC
|
||||||
|
*/
|
||||||
|
function CustomerToNCInterface(){
|
||||||
|
var res = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.VoucherToNCforCustomer","sendCustomerData","");
|
||||||
|
if(res=="true"){
|
||||||
|
alert("传输成功 !");
|
||||||
|
}else{
|
||||||
|
alert("传输失败 !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 传输合同信息入NC
|
||||||
|
*/
|
||||||
|
function ContractToNCInterface(){
|
||||||
|
var res = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.VoucherToNCforAssistContract","sendContractData","");
|
||||||
|
if(res=="true"){
|
||||||
|
alert("传输成功 !");
|
||||||
|
}else{
|
||||||
|
alert("传输失败 !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 传输凭证信息入NC
|
||||||
|
*/
|
||||||
|
function VoucherToNCInterface(){
|
||||||
var res = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ","sendVoucherData","");
|
var res = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ","sendVoucherData","");
|
||||||
if(res=="true"){
|
if(res=="true"){
|
||||||
alert("传输成功 !");
|
alert("传输成功 !");
|
||||||
@ -42,6 +78,7 @@
|
|||||||
alert("传输失败 !");
|
alert("传输失败 !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function synVoucherCode(){
|
function synVoucherCode(){
|
||||||
var ids=getItemValue(0,'f3')+"";
|
var ids=getItemValue(0,'f3')+"";
|
||||||
|
|||||||
@ -117,8 +117,8 @@ contract_pk_org=06
|
|||||||
#用友连接配置-测试:http://172.16.0.88:9990/service/XChangeServlet?account=8&groupcode=06
|
#用友连接配置-测试:http://172.16.0.88:9990/service/XChangeServlet?account=8&groupcode=06
|
||||||
#用友连接配置-正式:http://sk.baicgroup.com.cn:80/service/XChangeServlet?account=8&groupcode=06
|
#用友连接配置-正式:http://sk.baicgroup.com.cn:80/service/XChangeServlet?account=8&groupcode=06
|
||||||
#IP地址及端口
|
#IP地址及端口
|
||||||
NC_URL=http://sk.baicgroup.com.cn/
|
#NC_URL=http://sk.baicgroup.com.cn/
|
||||||
|
NC_URL=http://172.16.0.88:9990/
|
||||||
#账套
|
#账套
|
||||||
account=8
|
account=8
|
||||||
#集团编码
|
#集团编码
|
||||||
|
|||||||
@ -220,6 +220,173 @@ public class VoucherToNCforAssistContract implements Job{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 凭证信息页面点击按钮传输合同信息入NC
|
||||||
|
*/
|
||||||
|
public String sendContractData(JBOTransaction tx) {
|
||||||
|
String returns="true";
|
||||||
|
Transaction Sqlca = null;
|
||||||
|
// 获取配置文件的输入流
|
||||||
|
FileInputStream in=null;
|
||||||
|
try {
|
||||||
|
Sqlca = Transaction.createTransaction(tx);
|
||||||
|
/**
|
||||||
|
* 读取配置文件信息
|
||||||
|
* */
|
||||||
|
// 创建Properties对象
|
||||||
|
// Properties properties = new Properties();
|
||||||
|
// 获取配置文件输入流
|
||||||
|
// in = new FileInputStream("/vouchers.properties");
|
||||||
|
// in = new FileInputStream("//data/config//vouchers.properties");
|
||||||
|
|
||||||
|
// 通过Properties对象读取配置文件
|
||||||
|
// properties.load(in);
|
||||||
|
// 获取配置文件数据
|
||||||
|
// 账套
|
||||||
|
String account = VouchersPropertiesUtil.get("contract_account");
|
||||||
|
// 单据类型
|
||||||
|
String billtype = VouchersPropertiesUtil.get("contract_billtype");
|
||||||
|
// 集团编码
|
||||||
|
String groupcode = VouchersPropertiesUtil.get("contract_groupcode");
|
||||||
|
// 系统参数
|
||||||
|
String isexchange = VouchersPropertiesUtil.get("contract_isexchange");
|
||||||
|
// 接收方
|
||||||
|
String receiver = VouchersPropertiesUtil.get("contract_receiver");
|
||||||
|
// 外系统编码
|
||||||
|
String sender = VouchersPropertiesUtil.get("contract_sender");
|
||||||
|
// 系统参数
|
||||||
|
String replace = VouchersPropertiesUtil.get("contract_replace");
|
||||||
|
// 所属组织
|
||||||
|
String pk_org = VouchersPropertiesUtil.get("contract_pk_org");
|
||||||
|
// 所属集团
|
||||||
|
String pk_group = VouchersPropertiesUtil.get("contract_pk_group");
|
||||||
|
// 传输xml文件存放路径
|
||||||
|
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义全局变量
|
||||||
|
*/
|
||||||
|
// 文件对象
|
||||||
|
File file=null;
|
||||||
|
// 输出对象
|
||||||
|
XMLWriter writer=null;
|
||||||
|
// xml传输id
|
||||||
|
String uuid="";
|
||||||
|
// 插入sql对象
|
||||||
|
String insertSql="";
|
||||||
|
// 合同编码对象
|
||||||
|
String contract_number="";
|
||||||
|
// xml类别
|
||||||
|
String type="contract";
|
||||||
|
// 文件名称
|
||||||
|
String year_month_day = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());// 年月日时分秒
|
||||||
|
// 明细表记录时间
|
||||||
|
String year_month_days = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());// 年月日时分秒
|
||||||
|
// 记录当前批次传输总量
|
||||||
|
int count=0;
|
||||||
|
// 记录历史批次号
|
||||||
|
List<String> batchList= new ArrayList<String>();
|
||||||
|
|
||||||
|
// 获取未传输及之前传输失败的数据
|
||||||
|
String sql="SELECT id,CONTRACT_NUMBER FROM LB_CONTRACT_INFO WHERE CONTRACT_NUMBER NOT IN(SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG = '1' AND XML_TYPE='"+type+"')";
|
||||||
|
List<Map<String, String>> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null);
|
||||||
|
if(rs!=null && rs.size()>0) {
|
||||||
|
// 批次号
|
||||||
|
String batch = "";
|
||||||
|
// 生成xml头
|
||||||
|
Document document = DocumentHelper.createDocument(); // 生成每个xml的头
|
||||||
|
Element root = document.addElement("ufinterface");
|
||||||
|
root.addAttribute("account",account);
|
||||||
|
root.addAttribute("billtype",billtype);
|
||||||
|
root.addAttribute("businessunitcode","");
|
||||||
|
root.addAttribute("filename","");
|
||||||
|
root.addAttribute("groupcode",groupcode);
|
||||||
|
root.addAttribute("isexchange",isexchange);
|
||||||
|
root.addAttribute("orgcode","");
|
||||||
|
root.addAttribute("receiver",receiver);
|
||||||
|
root.addAttribute("replace",replace);
|
||||||
|
root.addAttribute("roottag","");
|
||||||
|
root.addAttribute("sender",sender);
|
||||||
|
// 遍历结果集
|
||||||
|
for (Map<String, String> map : rs) {
|
||||||
|
contract_number=(map.get("CONTRACT_NUMBER")==null)?"":map.get("CONTRACT_NUMBER");
|
||||||
|
Element bill = root.addElement("bill");
|
||||||
|
//uuid=UUID.randomUUID().toString().replace("-", "");
|
||||||
|
uuid=map.get("id");
|
||||||
|
bill.addAttribute("id",uuid);
|
||||||
|
Element billhead = bill.addElement("billhead");
|
||||||
|
Element pk_defdoclist = billhead.addElement("pk_defdoclist");// 自定义档案列表主键,最大长度为20,类型为:String
|
||||||
|
pk_defdoclist.setText("ct01");
|
||||||
|
Element pk_defdoc = billhead.addElement("pk_defdoc");//
|
||||||
|
pk_defdoc.setText("");
|
||||||
|
Element pk_group1 = billhead.addElement("pk_group");// 所属集团,最大长度为20,类型为:String
|
||||||
|
pk_group1.setText(pk_group);
|
||||||
|
Element pk_org1 = billhead.addElement("pk_org");// 所属组织,最大长度为20,类型为:String
|
||||||
|
pk_org1.setText(pk_org);
|
||||||
|
Element code = billhead.addElement("code");// 档案编码,最大长度为40,类型为:String
|
||||||
|
code.setText(contract_number);
|
||||||
|
Element name = billhead.addElement("name");// 档案名称,最大长度为200,类型为:String
|
||||||
|
name.setText(contract_number);
|
||||||
|
Element shortname = billhead.addElement("shortname");// 简称,最大长度为200,类型为:String
|
||||||
|
shortname.setText("");
|
||||||
|
Element mnecode = billhead.addElement("mnecode");// 助记码,最大长度为50,类型为:String
|
||||||
|
mnecode.setText("");
|
||||||
|
Element pid = billhead.addElement("pid");// 上级档案,最大长度为20,类型为:String
|
||||||
|
pid.setText("");
|
||||||
|
Element memo = billhead.addElement("memo");// 备注,最大长度为200,类型为:String
|
||||||
|
memo.setText("");
|
||||||
|
|
||||||
|
// 根据id查询记录表是否已经记录过, 没有记录过使用当前批次号记录, 如果已经记录了, 则不操作
|
||||||
|
BizObject record=JBOFactory.createBizObjectQuery(NCXML_DETAIL_RECORDS.CLASS_NAME, "BILLID='"+uuid+"'").getSingleResult(false);
|
||||||
|
// 等于null说明新数据, 新增入记录表
|
||||||
|
if(record==null || "".equals(record)) {
|
||||||
|
if("".equals(batch)) {
|
||||||
|
batch = SerialNumberUtil.getVoucherPCNumber(Sqlca);
|
||||||
|
}
|
||||||
|
insertSql="INSERT INTO NCXML_DETAIL_RECORDS(BILLID,XML_TYPE,TABLE_NUM,FLAG,CREATE_TIME,BATCH) VALUES('"+uuid+"','"+type+"','"+contract_number+"','1','"+year_month_days+"','"+batch+"')";
|
||||||
|
Sqlca.executeSQL(insertSql);
|
||||||
|
logger.info("辅助合同记录语句: " + insertSql);
|
||||||
|
count++;
|
||||||
|
}else {
|
||||||
|
String updSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='1',ERR_DESCRIBE=null,CREATE_TIME='"+year_month_days+"' WHERE BILLID='"+uuid+"' AND XML_TYPE= '"+type+"'";
|
||||||
|
Sqlca.executeSQL(updSql);
|
||||||
|
logger.info("旧批次号记录: "+updSql);
|
||||||
|
String batch1= record.getAttribute("BATCH").getString();
|
||||||
|
if(batchList.indexOf(batch1) == -1) {
|
||||||
|
batchList.add(batch1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
logger.info("客户xml传输失败");
|
||||||
|
try {
|
||||||
|
Sqlca.rollback();
|
||||||
|
} catch (JBOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
returns="false";
|
||||||
|
}finally {
|
||||||
|
if(Sqlca!=null) {
|
||||||
|
try {
|
||||||
|
Sqlca.disConnect();
|
||||||
|
} catch (JBOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returns;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
||||||
|
|||||||
@ -267,8 +267,8 @@ public class VoucherToNCforCustomer implements Job{
|
|||||||
writer.close();
|
writer.close();
|
||||||
InterActionToNC(Sqlca,URL,type,batch,count,batchList);
|
InterActionToNC(Sqlca,URL,type,batch,count,batchList);
|
||||||
Sqlca.commit();
|
Sqlca.commit();
|
||||||
|
}
|
||||||
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforCustomer", "success", "成功",curUserId);
|
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforCustomer", "success", "成功",curUserId);
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforCustomer", "error", "失败",curUserId);
|
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforCustomer", "error", "失败",curUserId);
|
||||||
try {
|
try {
|
||||||
@ -289,6 +289,238 @@ public class VoucherToNCforCustomer implements Job{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 凭证信息页面点击按钮传输客户信息入NC
|
||||||
|
*/
|
||||||
|
public String sendCustomerData(JBOTransaction tx) {
|
||||||
|
String returns="true";
|
||||||
|
Transaction Sqlca = null;
|
||||||
|
// 获取配置文件的输入流
|
||||||
|
FileInputStream in =null;
|
||||||
|
try {
|
||||||
|
Sqlca = Transaction.createTransaction(tx);
|
||||||
|
/**
|
||||||
|
* 读取配置文件信息
|
||||||
|
*/
|
||||||
|
// 创建Properties对象
|
||||||
|
// Properties properties = new Properties();
|
||||||
|
// 获取配置文件输入流
|
||||||
|
// in = new FileInputStream("/vouchers.properties");
|
||||||
|
// in = new FileInputStream("//data/config//vouchers.properties");
|
||||||
|
|
||||||
|
// 通过Properties对象读取配置文件
|
||||||
|
// properties.load(in);
|
||||||
|
|
||||||
|
// 获取配置文件数据
|
||||||
|
// 账套
|
||||||
|
String account = VouchersPropertiesUtil.get("customer_account");
|
||||||
|
// 单据类型
|
||||||
|
String billtype = VouchersPropertiesUtil.get("customer_billtype");
|
||||||
|
// 集团编码
|
||||||
|
String groupcode = VouchersPropertiesUtil.get("customer_groupcode");
|
||||||
|
// 系统参数
|
||||||
|
String isexchange = VouchersPropertiesUtil.get("customer_isexchange");
|
||||||
|
// 接收方
|
||||||
|
String receiver = VouchersPropertiesUtil.get("customer_receiver");
|
||||||
|
// 外系统编码
|
||||||
|
String sender = VouchersPropertiesUtil.get("customer_sender");
|
||||||
|
// 系统参数
|
||||||
|
String replace = VouchersPropertiesUtil.get("customer_replace");
|
||||||
|
// 所属组织
|
||||||
|
String pk_org = VouchersPropertiesUtil.get("customer_pk_org");
|
||||||
|
// 所属集团
|
||||||
|
String pk_group = VouchersPropertiesUtil.get("customer_pk_group");
|
||||||
|
// 客户基本分类
|
||||||
|
String pk_custclass = VouchersPropertiesUtil.get("customer_pk_custclass");
|
||||||
|
// 国家地区
|
||||||
|
String pk_country = VouchersPropertiesUtil.get("customer_pk_country");
|
||||||
|
// 时区
|
||||||
|
String pk_timezone = VouchersPropertiesUtil.get("customer_pk_timezone");
|
||||||
|
// 数据格式
|
||||||
|
String pk_format = VouchersPropertiesUtil.get("customer_pk_format");
|
||||||
|
// 传输xml文件存放路径
|
||||||
|
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||||
|
|
||||||
|
// 定义文件对象
|
||||||
|
File file=null;
|
||||||
|
// 定义Document对象
|
||||||
|
Document document=null;
|
||||||
|
// 定义输出对象
|
||||||
|
XMLWriter writer=null;
|
||||||
|
// 定义xml类型对象
|
||||||
|
String type="customer";
|
||||||
|
// 定义新增语句对象
|
||||||
|
String insertSql="";
|
||||||
|
// 定义xml传输id对象
|
||||||
|
String uuid="";
|
||||||
|
// 定义客户编号对象
|
||||||
|
String customer_num="";
|
||||||
|
// 身份证号
|
||||||
|
String certid="";
|
||||||
|
// 定义客户名称对象
|
||||||
|
String customername="";
|
||||||
|
// 文件路径所需
|
||||||
|
String year_month_day = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||||
|
// 表数据记录日期
|
||||||
|
String year_month_days = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
|
|
||||||
|
// 查询为传输或之前传输失败的数据
|
||||||
|
String sql="SELECT max(cif.customerid) id,cif.customer_num,MAX(cif.customername)customername,MAX(cif.customertype)customertype,MAX(cif.customerid) customerid,MAX(cif.certid) as certid FROM CUSTOMER_INFO cif LEFT JOIN lb_union_lessee lul ON lul.customer_id=cif.customerid LEFT JOIN lb_contract_info lci ON lci.id=lul.contract_id WHERE lci.contract_status >='31' AND cif.customer_num NOT IN (SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG = '1' AND XML_TYPE = '"+type+"') GROUP BY CIF.CUSTOMER_NUM ";
|
||||||
|
List<Map<String, String>> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null);
|
||||||
|
if(rs != null && rs.size()>0) {
|
||||||
|
// 批次号
|
||||||
|
String batch = "";
|
||||||
|
// 记录历史批次号
|
||||||
|
List<String> batchList= new ArrayList<String>();
|
||||||
|
// 记录当前批次传输总量
|
||||||
|
int count=0;
|
||||||
|
// 生成xml头
|
||||||
|
document= DocumentHelper.createDocument();
|
||||||
|
Element root = document.addElement("ufinterface");
|
||||||
|
root.addAttribute("account", account);
|
||||||
|
root.addAttribute("billtype",billtype);
|
||||||
|
root.addAttribute("businessunitcode", "develop");
|
||||||
|
root.addAttribute("filename", "");
|
||||||
|
root.addAttribute("groupcode", groupcode);
|
||||||
|
root.addAttribute("isexchange", isexchange);
|
||||||
|
root.addAttribute("orgcode", "");
|
||||||
|
root.addAttribute("receiver", receiver);
|
||||||
|
root.addAttribute("replace", replace);
|
||||||
|
root.addAttribute("roottag", "");
|
||||||
|
root.addAttribute("sender", sender);
|
||||||
|
// 遍历要传输的结果集
|
||||||
|
for(int i=0;i<rs.size();i++) {
|
||||||
|
customer_num=rs.get(i).get("customer_num"); // 获取客户编号
|
||||||
|
customername=rs.get(i).get("customername"); // 获取客户名称
|
||||||
|
certid=rs.get(i).get("certid"); // 身份证号
|
||||||
|
|
||||||
|
Element bill = root.addElement("bill");
|
||||||
|
//uuid=UUID.randomUUID().toString().replace("-", "");
|
||||||
|
uuid=rs.get(i).get("id");
|
||||||
|
bill.addAttribute("id", uuid);
|
||||||
|
Element billhead = bill.addElement("billhead");
|
||||||
|
Element pk_group1 = billhead.addElement("pk_group"); // 所属集团,最大长度为20,类型为:String
|
||||||
|
pk_group1.setText(pk_group);
|
||||||
|
Element pk_org1 = billhead.addElement("pk_org"); // 所属组织,最大长度为20,类型为:String
|
||||||
|
pk_org1.setText(pk_org);
|
||||||
|
Element code = billhead.addElement("code"); // 客户编码,最大长度为40,类型为:String
|
||||||
|
code.setText((customer_num==null)?"":customer_num);
|
||||||
|
Element name = billhead.addElement("name"); // 客户名称,最大长度为200,类型为:String
|
||||||
|
name.setText((customername==null)?"":customername+"-"+certid);
|
||||||
|
Element shortname = billhead.addElement("shortname"); // 客户简称,最大长度为200,类型为:String
|
||||||
|
shortname.setText((customername==null)?"":customername);
|
||||||
|
Element mnecode = billhead.addElement("mnecode"); // 助记码,最大长度为50,类型为:String
|
||||||
|
mnecode.setText("");
|
||||||
|
Element pk_custclass1 = billhead.addElement("pk_custclass"); // 客户基本分类,最大长度为20,类型为:String
|
||||||
|
//pk_custclass.setText((customertype==null)?"":customertype);
|
||||||
|
pk_custclass1.setText(pk_custclass);
|
||||||
|
Element pk_areacl = billhead.addElement("pk_areacl"); // 地区分类,最大长度为20,类型为:String
|
||||||
|
pk_areacl.setText("");
|
||||||
|
Element issupplier = billhead.addElement("issupplier"); // 供应商,最大长度为1,类型为:UFBoolean
|
||||||
|
issupplier.setText("");
|
||||||
|
Element pk_supplier = billhead.addElement("pk_supplier"); // 对应供应商,最大长度为20,类型为:String
|
||||||
|
pk_supplier.setText("");
|
||||||
|
Element custprop1 = billhead.addElement("custprop"); // 客户类型,最大长度为0,类型为:Integer
|
||||||
|
custprop1.setText("外部单位");
|
||||||
|
Element pk_financeorg = billhead.addElement("pk_financeorg");// 对应财务组织,最大长度为20,类型为:String
|
||||||
|
pk_financeorg.setText("");
|
||||||
|
Element taxpayerid = billhead.addElement("taxpayerid"); // 纳税人登记号,最大长度为20,类型为:String
|
||||||
|
taxpayerid.setText("");
|
||||||
|
Element pk_customer_main = billhead.addElement("pk_customer_main");// 上级客户,最大长度为20,类型为:String
|
||||||
|
pk_customer_main.setText("");
|
||||||
|
Element trade = billhead.addElement("trade"); // 所属行业,最大长度为20,类型为:String
|
||||||
|
trade.setText("");
|
||||||
|
Element isfreecust = billhead.addElement("isfreecust"); // 散户,最大长度为1,类型为:UFBoolean
|
||||||
|
isfreecust.setText("");
|
||||||
|
Element registerfund = billhead.addElement("registerfund"); // 注册资金,最大长度为14,类型为:UFDouble
|
||||||
|
registerfund.setText("");
|
||||||
|
Element legalbody = billhead.addElement("legalbody"); // 法人,最大长度为20,类型为:String
|
||||||
|
legalbody.setText("");
|
||||||
|
Element ecotypesincevfive = billhead.addElement("ecotypesincevfive");// 经济类型,最大长度为20,类型为:String
|
||||||
|
ecotypesincevfive.setText("");
|
||||||
|
Element pk_custtaxes = billhead.addElement("pk_custtaxes"); // 客户税类,最大长度为20,类型为:String
|
||||||
|
pk_custtaxes.setText("");
|
||||||
|
Element corpaddress = billhead.addElement("corpaddress"); // 企业地址主键,最大长度为20,类型为:String
|
||||||
|
corpaddress.setText("");
|
||||||
|
Element url = billhead.addElement("url"); // Web网址,最大长度为60,类型为:String
|
||||||
|
url.setText("");
|
||||||
|
Element tel1 = billhead.addElement("tel1"); // 电话1,最大长度为50,类型为:String
|
||||||
|
tel1.setText("");
|
||||||
|
Element tel2 = billhead.addElement("tel2"); // 电话2,最大长度为50,类型为:String
|
||||||
|
tel2.setText("");
|
||||||
|
Element tel3 = billhead.addElement("tel3"); // 电话3,最大长度为50,类型为:String
|
||||||
|
tel3.setText("");
|
||||||
|
Element fax1 = billhead.addElement("fax1"); // 传真1,最大长度为50,类型为:String
|
||||||
|
fax1.setText("");
|
||||||
|
Element fax2 = billhead.addElement("fax2"); // 传真2,最大长度为50,类型为:String
|
||||||
|
fax2.setText("");
|
||||||
|
Element email = billhead.addElement("email"); // e-mail地址,最大长度为50,类型为:String
|
||||||
|
email.setText("");
|
||||||
|
Element pk_country1 = billhead.addElement("pk_country"); // 国家/地区,最大长度为20,类型为:String
|
||||||
|
pk_country1.setText(pk_country);
|
||||||
|
Element pk_timezone1 = billhead.addElement("pk_timezone"); // 时区,最大长度为20,类型为:String
|
||||||
|
pk_timezone1.setText(pk_timezone);
|
||||||
|
Element pk_format1 = billhead.addElement("pk_format"); // 数据格式,最大长度为20,类型为:String
|
||||||
|
pk_format1.setText(pk_format);
|
||||||
|
Element memo = billhead.addElement("memo");
|
||||||
|
memo.setText("");
|
||||||
|
Element frozenflag = billhead.addElement("frozenflag"); // 冻结标志,最大长度为1,类型为:UFBoolean
|
||||||
|
frozenflag.setText("");
|
||||||
|
Element enablestate = billhead.addElement("enablestate"); // 启用状态,最大长度为0,类型为:Integer
|
||||||
|
enablestate.setText("");
|
||||||
|
// 根据id查询记录表是否已经记录过, 没有记录过使用当前批次号记录, 如果已经记录了, 则不操作
|
||||||
|
BizObject record=JBOFactory.createBizObjectQuery(NCXML_DETAIL_RECORDS.CLASS_NAME, "BILLID='"+uuid+"'").getSingleResult(false);
|
||||||
|
// 等于null说明新数据, 新增入记录表
|
||||||
|
if(record==null || "".equals(record)) {
|
||||||
|
if("".equals(batch)) {
|
||||||
|
batch = SerialNumberUtil.getVoucherPCNumber(Sqlca);
|
||||||
|
}
|
||||||
|
// 将客户xml信息写入状态表中
|
||||||
|
insertSql="INSERT INTO NCXML_DETAIL_RECORDS(BILLID,XML_TYPE,TABLE_NUM,FLAG,CREATE_TIME,BATCH) VALUES('"+uuid+"','"+type+"','"+customer_num+"','1','"+year_month_days+"','"+batch+"')";
|
||||||
|
Sqlca.executeSQL(insertSql);
|
||||||
|
logger.info("客户记录语句: "+insertSql);
|
||||||
|
count++;
|
||||||
|
}else {
|
||||||
|
String updSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='1',ERR_DESCRIBE=null,CREATE_TIME='"+year_month_days+"' WHERE BILLID='"+uuid+"' AND XML_TYPE= '"+type+"'";
|
||||||
|
Sqlca.executeSQL(updSql);
|
||||||
|
logger.info("旧批次号记录: "+updSql);
|
||||||
|
String batch1= record.getAttribute("BATCH").getString();
|
||||||
|
if(batchList.indexOf(batch1) == -1) {
|
||||||
|
batchList.add(batch1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String URL=LOCALHOST_URL+"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
|
||||||
|
writer.write(document);
|
||||||
|
writer.close();
|
||||||
|
InterActionToNC(Sqlca,URL,type,batch,count,batchList);
|
||||||
|
Sqlca.commit();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
logger.debug("客户xml传输失败");
|
||||||
|
Sqlca.rollback();
|
||||||
|
} catch (JBOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
returns="false";
|
||||||
|
}finally {
|
||||||
|
if (Sqlca!=null) {
|
||||||
|
try {
|
||||||
|
Sqlca.disConnect();
|
||||||
|
} catch (JBOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returns;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -343,8 +343,8 @@ public class VoucherToNCforDistributor implements Job{
|
|||||||
writer.close();
|
writer.close();
|
||||||
InterActionToNC(Sqlca,f,type,batch,count,batchList);
|
InterActionToNC(Sqlca,f,type,batch,count,batchList);
|
||||||
Sqlca.commit();
|
Sqlca.commit();
|
||||||
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforDistributor", "success", "成功",curUserId);
|
|
||||||
}
|
}
|
||||||
|
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforDistributor", "success", "成功",curUserId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforDistributor", "error", "失败",curUserId);
|
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforDistributor", "error", "失败",curUserId);
|
||||||
try {
|
try {
|
||||||
@ -365,6 +365,312 @@ public class VoucherToNCforDistributor implements Job{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 凭证信息页面, 传输经销商信息入NC
|
||||||
|
*/
|
||||||
|
public String sendDistriturorData(JBOTransaction tx) {
|
||||||
|
String returns="true";
|
||||||
|
Transaction Sqlca = null;
|
||||||
|
// 获取配置文件的输入流
|
||||||
|
FileInputStream in=null;
|
||||||
|
try {
|
||||||
|
Sqlca = Transaction.createTransaction(tx);
|
||||||
|
/**
|
||||||
|
* 读取配置文件信息
|
||||||
|
* */
|
||||||
|
// 创建Properties对象
|
||||||
|
// Properties properties = new Properties();
|
||||||
|
// 获取配置文件输入流
|
||||||
|
// in = new FileInputStream("/vouchers.properties");
|
||||||
|
// in = new FileInputStream("//data/config//vouchers.properties");
|
||||||
|
// 通过Properties对象读取配置文件
|
||||||
|
// properties.load(in);
|
||||||
|
|
||||||
|
// 获取配置文件数据
|
||||||
|
// 账套
|
||||||
|
String account = VouchersPropertiesUtil.get("distributor_account");
|
||||||
|
// 单据类型
|
||||||
|
String billtype = VouchersPropertiesUtil.get("distributor_billtype");
|
||||||
|
// 集团编码
|
||||||
|
String groupcode = VouchersPropertiesUtil.get("distributor_groupcode");
|
||||||
|
// 系统参数
|
||||||
|
String isexchange = VouchersPropertiesUtil.get("distributor_isexchange");
|
||||||
|
// 接收方
|
||||||
|
String receiver = VouchersPropertiesUtil.get("distributor_receiver");
|
||||||
|
// 外系统编码
|
||||||
|
String sender = VouchersPropertiesUtil.get("distributor_sender");
|
||||||
|
// 系统参数
|
||||||
|
String replace = VouchersPropertiesUtil.get("distributor_replace");
|
||||||
|
// 所属组织
|
||||||
|
String pk_org = VouchersPropertiesUtil.get("distributor_pk_org");
|
||||||
|
// 所属集团
|
||||||
|
String pk_group = VouchersPropertiesUtil.get("distributor_pk_group");
|
||||||
|
// 供应商基本分类
|
||||||
|
String pk_supplierclass = VouchersPropertiesUtil.get("distributor_pk_supplierclass");
|
||||||
|
// 国家地区
|
||||||
|
String pk_country = VouchersPropertiesUtil.get("distributor_pk_country");
|
||||||
|
// 时区
|
||||||
|
String pk_timezone = VouchersPropertiesUtil.get("distributor_pk_timezone");
|
||||||
|
// 账数据格式
|
||||||
|
String pk_format = VouchersPropertiesUtil.get("distributor_pk_format");
|
||||||
|
// 传输xml文件存放路径
|
||||||
|
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||||
|
|
||||||
|
|
||||||
|
File file = null; // 文件对象
|
||||||
|
XMLWriter writer = null; // 输出对象
|
||||||
|
String type="distributor"; // xml类别
|
||||||
|
String DISTRIBUTOR_NAME = ""; // 经销商名称
|
||||||
|
String DISTRIBUTOR_CODING = ""; // 经销商id
|
||||||
|
String DISTRIBUTOR_ADDRESS=""; // 地区编码
|
||||||
|
String REGISTERED_ADDR=""; // 注册地址
|
||||||
|
String POSTCODE=""; // 邮编
|
||||||
|
String FACT_ADDR=""; // 企业地址
|
||||||
|
String region=""; // 地区
|
||||||
|
String PROVINCES=""; // 省份
|
||||||
|
String BUSINESS_SCOPE=""; // 经营范围
|
||||||
|
String SUBSIDIARY_COMPANY=""; // 母公司
|
||||||
|
String TYPE=""; // 供应商基本分类
|
||||||
|
String BUSINESS_LICENSE_NO=""; // 组织机构代码
|
||||||
|
String DISTRIBUTOR_STATUS=""; // 启用状态
|
||||||
|
String FAX_NUMBER=""; // 传真
|
||||||
|
String E_MAIL=""; // email
|
||||||
|
String REGISTERED_ASSET=""; // 注册资金
|
||||||
|
String DISTRIBUTORER=""; // 法人
|
||||||
|
String URL=""; // 网址
|
||||||
|
String insertSql=""; // 新增语句
|
||||||
|
String uuid=""; // uuid
|
||||||
|
String MBAFC_EARLYDISBURSEMENT_TYPE="";// 资金类型/支付类型
|
||||||
|
// 记录历史批次号
|
||||||
|
List<String> batchList= new ArrayList<String>();
|
||||||
|
// 记录当前批次传输总量
|
||||||
|
int count=0;
|
||||||
|
|
||||||
|
// 获取特定日期
|
||||||
|
String year_month_day = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||||
|
String year_month_days = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
|
// 获取未传输及以前传输失败的数据
|
||||||
|
String sql="SELECT id,DISTRIBUTOR_NAME,DISTRIBUTOR_CODING,DISTRIBUTOR_ADDRESS,FACT_ADDR,PROVINCES,POSTCODE,REGISTERED_ADDR,BUSINESS_SCOPE,SUBSIDIARY_COMPANY,TYPE,BUSINESS_LICENSE_NO,DISTRIBUTOR_STATUS,E_MAIL,FAX_NUMBER,REGISTERED_ASSET,DISTRIBUTORER,MBAFC_EARLYDISBURSEMENT_TYPE,URL FROM DISTRIBUTOR_INFO WHERE (DISTRIBUTOR_CODING NOT IN(SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG ='1' AND XML_TYPE='"+type+"') and DISTRIBUTOR_CODING not in(SELECT cust_id FROM customer_list)) and DISTRIBUTOR_STATUS='distributor_status04' ";
|
||||||
|
List<Map<String, String>> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null);
|
||||||
|
if(rs !=null && rs.size()>0) {
|
||||||
|
// 批次号
|
||||||
|
String batch = "";
|
||||||
|
// 设置xml标签头
|
||||||
|
Document document = DocumentHelper.createDocument();
|
||||||
|
Element root = document.addElement("ufinterface");
|
||||||
|
root.addAttribute("account",account);
|
||||||
|
root.addAttribute("billtype",billtype);
|
||||||
|
root.addAttribute("filename", "");
|
||||||
|
root.addAttribute("groupcode", groupcode);
|
||||||
|
root.addAttribute("isexchange",isexchange);
|
||||||
|
root.addAttribute("receiver", receiver);
|
||||||
|
root.addAttribute("replace", replace);
|
||||||
|
root.addAttribute("roottag", "");
|
||||||
|
root.addAttribute("sender",sender);
|
||||||
|
|
||||||
|
// 遍历要传输的结果集
|
||||||
|
for(int i=0; i<rs.size();i++) {
|
||||||
|
DISTRIBUTOR_NAME = rs.get(i).get("DISTRIBUTOR_NAME"); // 获取经销商名称
|
||||||
|
DISTRIBUTOR_CODING = rs.get(i).get("DISTRIBUTOR_CODING"); // 获取经销商id
|
||||||
|
DISTRIBUTOR_ADDRESS = rs.get(i).get("DISTRIBUTOR_ADDRESS"); // 获取地区编码
|
||||||
|
FACT_ADDR=rs.get(i).get("FACT_ADDR"); // 获取企业地址
|
||||||
|
PROVINCES=rs.get(i).get("PROVINCES"); // 获取省份
|
||||||
|
POSTCODE=rs.get(i).get("POSTCODE"); // 获取邮编
|
||||||
|
REGISTERED_ADDR=rs.get(i).get("REGISTERED_ADDR"); // 获取注册地址
|
||||||
|
BUSINESS_SCOPE=rs.get(i).get("BUSINESS_SCOPE"); // 获取经营范围
|
||||||
|
SUBSIDIARY_COMPANY=rs.get(i).get("SUBSIDIARY_COMPANY"); // 获取母公司
|
||||||
|
BUSINESS_LICENSE_NO=rs.get(i).get("BUSINESS_LICENSE_NO"); // 获取组织机构代码
|
||||||
|
DISTRIBUTOR_STATUS=rs.get(i).get("DISTRIBUTOR_STATUS"); // 获取启用状态
|
||||||
|
TYPE=rs.get(i).get("TYPE"); // 获取供应商基本分类
|
||||||
|
E_MAIL=rs.get(i).get("E_MAIL"); // 获取邮箱
|
||||||
|
REGISTERED_ASSET=rs.get(i).get("REGISTERED_ASSET"); // 获取注册资金
|
||||||
|
FAX_NUMBER=rs.get(i).get("FAX_NUMBER"); // 获取传真
|
||||||
|
DISTRIBUTORER=rs.get(i).get("DISTRIBUTORER"); // 获取法人
|
||||||
|
MBAFC_EARLYDISBURSEMENT_TYPE=rs.get(i).get("MBAFC_EARLYDISBURSEMENT_TYPE"); // 获取资金类型/支付类型
|
||||||
|
URL=rs.get(i).get("URL"); // 获取网址
|
||||||
|
region = NameManager.getItemName("AreaCode",DISTRIBUTOR_ADDRESS); // 获取地区
|
||||||
|
|
||||||
|
Element bill = root.addElement("bill");
|
||||||
|
//uuid=UUID.randomUUID().toString().replace("-", "");
|
||||||
|
uuid=rs.get(i).get("id");
|
||||||
|
bill.addAttribute("id",uuid);
|
||||||
|
Element billhead = bill.addElement("billhead");
|
||||||
|
Element pk_group1 = billhead.addElement("pk_group"); // 所属集团,最大长度为20,类型为:String
|
||||||
|
pk_group1.setText(pk_group);
|
||||||
|
Element pk_org1 = billhead.addElement("pk_org"); // 所属组织,最大长度为20,类型为:String
|
||||||
|
pk_org1.setText(pk_org);
|
||||||
|
Element code = billhead.addElement("code"); // 供应商编号,最大长度为40,类型为:String
|
||||||
|
code.setText((DISTRIBUTOR_CODING==null)?"":DISTRIBUTOR_CODING);
|
||||||
|
Element name = billhead.addElement("name"); // 供应商名称,最大长度为200,类型为:String
|
||||||
|
name.setText((DISTRIBUTOR_NAME==null)?"":DISTRIBUTOR_NAME);
|
||||||
|
Element shortname = billhead.addElement("shortname"); // 供应商简称,最大长度为200,类型为:String
|
||||||
|
// shortname.setText((DISTRIBUTOR_NAME==null)?"":DISTRIBUTOR_NAME);
|
||||||
|
shortname.setText("");
|
||||||
|
Element ename = billhead.addElement("ename"); // 外文名称,最大长度为60,类型为:String
|
||||||
|
ename.setText("");
|
||||||
|
Element mnecode = billhead.addElement("mnecode"); // 助记码,最大长度为50,类型为:String
|
||||||
|
mnecode.setText("");
|
||||||
|
Element trade = billhead.addElement("trade"); // 所属行业,最大长度为20,类型为:String
|
||||||
|
trade.setText((BUSINESS_SCOPE==null)?"":BUSINESS_SCOPE);
|
||||||
|
Element pk_supplier_main = billhead.addElement("pk_supplier_main"); // 上级供应商,最大长度为20,类型为:String
|
||||||
|
// pk_supplier_main.setText((SUBSIDIARY_COMPANY==null)?"":SUBSIDIARY_COMPANY);
|
||||||
|
pk_supplier_main.setText("");
|
||||||
|
Element supprop1 = billhead.addElement("supprop"); // 供应商类型,最大长度为1,类型为:Integer
|
||||||
|
supprop1.setText("外部单位");
|
||||||
|
Element pk_areacl = billhead.addElement("pk_areacl"); // 地区分类,最大长度为20,类型为:String
|
||||||
|
pk_areacl.setText("");
|
||||||
|
Element pk_supplierclass1 = billhead.addElement("pk_supplierclass"); // 供应商基本分类,最大长度为20,类型为:String
|
||||||
|
//pk_supplierclass.setText((TYPE==null)?"":TYPE);
|
||||||
|
pk_supplierclass1.setText(pk_supplierclass);
|
||||||
|
Element iscustomer = billhead.addElement("iscustomer"); // 客户,最大长度为1,类型为:UFBoolean
|
||||||
|
iscustomer.setText("");
|
||||||
|
Element corcustomer = billhead.addElement("corcustomer"); // 对应客户,最大长度为20,类型为:String
|
||||||
|
corcustomer.setText("");
|
||||||
|
Element isfreecust = billhead.addElement("isfreecust"); // 散户,最大长度为1,类型为:UFBoolean
|
||||||
|
isfreecust.setText("");
|
||||||
|
Element isoutcheck = billhead.addElement("isoutcheck"); // 外部检测机构,最大长度为1,类型为:UFBoolean
|
||||||
|
isoutcheck.setText("");
|
||||||
|
Element pk_financeorg = billhead.addElement("pk_financeorg"); // 对应财务组织,最大长度为20,类型为:String
|
||||||
|
pk_financeorg.setText("");
|
||||||
|
Element taxpayerid = billhead.addElement("taxpayerid"); // 纳税人登记号,最大长度为20,类型为:String
|
||||||
|
taxpayerid.setText("");
|
||||||
|
Element registerfund = billhead.addElement("registerfund"); // 注册资金,最大长度为14,类型为:UFDouble
|
||||||
|
registerfund.setText((REGISTERED_ASSET==null)?"":REGISTERED_ASSET);
|
||||||
|
Element legalbody = billhead.addElement("legalbody"); // 法人,最大长度为20,类型为:String
|
||||||
|
legalbody.setText((DISTRIBUTORER==null)?"":DISTRIBUTORER);
|
||||||
|
Element ecotypesincevfive = billhead.addElement("ecotypesincevfive");// 经济类型,最大长度为20,类型为:String
|
||||||
|
ecotypesincevfive.setText((MBAFC_EARLYDISBURSEMENT_TYPE==null)?"":MBAFC_EARLYDISBURSEMENT_TYPE);
|
||||||
|
Element pk_suptaxes = billhead.addElement("pk_suptaxes"); // 供应商税类,最大长度为20,类型为:String
|
||||||
|
pk_suptaxes.setText("");
|
||||||
|
Element zipcode = billhead.addElement("zipcode");
|
||||||
|
zipcode.setText("");
|
||||||
|
Element url = billhead.addElement("url"); // Web网址,最大长度为60,类型为:String
|
||||||
|
url.setText((URL==null)?"":URL);
|
||||||
|
Element memo = billhead.addElement("memo");
|
||||||
|
memo.setText("");
|
||||||
|
Element suplinkman = billhead.addElement("suplinkman"); // 企业地址明细
|
||||||
|
Element item1 = suplinkman.addElement("item"); // 编码,最大长度为64,类型为:String
|
||||||
|
Element linkmanvo = item1.addElement("linkmanvo");
|
||||||
|
Element code2 = linkmanvo.addElement("code"); // 编码,最大长度为64,类型为:String
|
||||||
|
code2.setText("");
|
||||||
|
Element name2 = linkmanvo.addElement("name"); // 名称,最大长度为64,类型为:String
|
||||||
|
name2.setText("");
|
||||||
|
Element sex = linkmanvo.addElement("sex"); // 性别,最大长度为64,类型为:Integer
|
||||||
|
sex.setText("");
|
||||||
|
Element vjob2 = linkmanvo.addElement("vjob"); // 职位,最大长度为64,类型为:String
|
||||||
|
vjob2.setText("");
|
||||||
|
Element birthday2 = linkmanvo.addElement("birthday"); // 出生日期,最大长度为64,类型为:UFDate
|
||||||
|
birthday2.setText("");
|
||||||
|
Element phone2 = linkmanvo.addElement("phone"); // 电话,最大长度为64,类型为:String
|
||||||
|
phone2.setText("");
|
||||||
|
Element cell2 = linkmanvo.addElement("cell"); // 手机,最大长度为64,类型为:String
|
||||||
|
cell2.setText("");
|
||||||
|
Element fax = linkmanvo.addElement("fax"); // 传真,最大长度为64,类型为:String
|
||||||
|
fax.setText("");
|
||||||
|
Element email = linkmanvo.addElement("email"); // email,最大长度为64,类型为:String
|
||||||
|
email.setText("");
|
||||||
|
Element webaddress = linkmanvo.addElement("webaddress");// Web网址,最大长度为64,类型为:String
|
||||||
|
webaddress.setText((URL==null)?"":URL);
|
||||||
|
Element address = linkmanvo.addElement("address"); // 住址,最大长度为64,类型为:String
|
||||||
|
address.setText("");
|
||||||
|
Element postcode = linkmanvo.addElement("postcode"); // 邮编,最大长度为64,类型为:String
|
||||||
|
postcode.setText((POSTCODE==null)?"":POSTCODE);
|
||||||
|
Element memo2 = linkmanvo.addElement("memo"); // 其它,最大长度为64,类型为:String
|
||||||
|
memo2.setText("");
|
||||||
|
Element pk_linkman = item1.addElement("pk_linkman"); // 联系人,最大长度为20,类型为:String
|
||||||
|
pk_linkman.setText("");
|
||||||
|
Element isdefault = item1.addElement("isdefault"); // 是否默认,最大长度为1,类型为:UFBoolean
|
||||||
|
isdefault.setText("");
|
||||||
|
Element tel1 = billhead.addElement("tel1"); // 电话1,最大长度为50,类型为:String
|
||||||
|
tel1.setText("");
|
||||||
|
Element tel2 = billhead.addElement("tel2"); // 电话2,最大长度为50,类型为:String
|
||||||
|
tel2.setText("");
|
||||||
|
Element tel3 = billhead.addElement("tel3"); // 电话3,最大长度为50,类型为:String
|
||||||
|
tel3.setText("");
|
||||||
|
Element fax1 = billhead.addElement("fax1"); // 传真1,最大长度为50,类型为:String
|
||||||
|
fax1.setText((FAX_NUMBER==null)?"":FAX_NUMBER);
|
||||||
|
Element fax2 = billhead.addElement("fax2"); // 传真2,最大长度为50,类型为:String
|
||||||
|
fax2.setText("");
|
||||||
|
Element email2 = billhead.addElement("email"); // e-mail地址,最大长度为50,类型为:String
|
||||||
|
email2.setText((E_MAIL==null)?"":E_MAIL);
|
||||||
|
Element pk_country1 = billhead.addElement("pk_country"); // 国家/地区,最大长度为20,类型为:String
|
||||||
|
pk_country1.setText(pk_country);
|
||||||
|
Element pk_timezone1 = billhead.addElement("pk_timezone"); // 时区,最大长度为20,类型为:String
|
||||||
|
pk_timezone1.setText(pk_timezone);
|
||||||
|
Element pk_format1 = billhead.addElement("pk_format"); // 数据格式,最大长度为20,类型为:String
|
||||||
|
pk_format1.setText(pk_format);
|
||||||
|
Element enablestate = billhead.addElement("enablestate"); // 启用状态,最大长度为0,类型为:Integer
|
||||||
|
// enablestate.setText((DISTRIBUTOR_STATUS==null)?"":DISTRIBUTOR_STATUS);
|
||||||
|
enablestate.setText("2");
|
||||||
|
/*Element aaa = billhead.addElement("企业地址");
|
||||||
|
Element code3 = aaa.addElement("code"); // 编码,最大长度为64,类型为:String
|
||||||
|
code3.setText("");
|
||||||
|
Element country = aaa.addElement("country"); // 国家,最大长度为64,类型为:String
|
||||||
|
country.setText("CN");
|
||||||
|
Element detailinfo = aaa.addElement("detailinfo"); // 详细地址,最大长度为64,类型为:String
|
||||||
|
detailinfo.setText("");
|
||||||
|
Element postcode3 = aaa.addElement("postcode"); // 邮编,最大长度为64,类型为:String
|
||||||
|
postcode3.setText("");
|
||||||
|
Element province = aaa.addElement("province"); // 省份,最大长度为64,类型为:String
|
||||||
|
province.setText("");
|
||||||
|
Element status = aaa.addElement("status"); // status,最大长度为64,类型为:Integer
|
||||||
|
status.setText("0");
|
||||||
|
Element vsection = aaa.addElement("vsection"); // 区县,最大长度为64,类型为:String
|
||||||
|
vsection.setText("");
|
||||||
|
Element corpaddress = billhead.addElement("corpaddress"); // 企业地址主键,最大长度为20,类型为:String
|
||||||
|
corpaddress.setText((FACT_ADDR==null)?"":FACT_ADDR);*/
|
||||||
|
|
||||||
|
// 根据id查询记录表是否已经记录过, 没有记录过使用当前批次号记录, 如果已经记录了, 则不操作
|
||||||
|
BizObject record=JBOFactory.createBizObjectQuery(NCXML_DETAIL_RECORDS.CLASS_NAME, "BILLID='"+uuid+"'").getSingleResult(false);
|
||||||
|
// 等于null说明新数据, 新增入记录表
|
||||||
|
if(record==null || "".equals(record)) {
|
||||||
|
if("".equals(batch)) {
|
||||||
|
batch = SerialNumberUtil.getVoucherPCNumber(Sqlca);
|
||||||
|
}
|
||||||
|
insertSql="INSERT INTO NCXML_DETAIL_RECORDS(BILLID,XML_TYPE,TABLE_NUM,FLAG,CREATE_TIME,BATCH) VALUES('"+uuid+"','"+type+"','"+DISTRIBUTOR_CODING+"','1','"+year_month_days+"','"+batch+"')";
|
||||||
|
Sqlca.executeSQL(insertSql);
|
||||||
|
logger.info("经销商记录语句: "+ insertSql);
|
||||||
|
count++;
|
||||||
|
}else {
|
||||||
|
String updSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='1',ERR_DESCRIBE=null,CREATE_TIME='"+year_month_days+"' WHERE BILLID='"+uuid+"' AND XML_TYPE= '"+type+"'";
|
||||||
|
Sqlca.executeSQL(updSql);
|
||||||
|
logger.info("旧批次号记录: "+updSql);
|
||||||
|
String batch1= record.getAttribute("BATCH").getString();
|
||||||
|
if(batchList.indexOf(batch1) == -1) {
|
||||||
|
batchList.add(batch1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//String f="D:\\voucherXml_NC\\APleasing_Supplier_"+year_month_day+".xml";
|
||||||
|
String f=LOCALHOST_URL+"APleasing_Supplier_"+year_month_day+".xml";
|
||||||
|
file=new File(f);
|
||||||
|
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
|
||||||
|
writer.setEscapeText(false);// 字符是否转义,默认true
|
||||||
|
writer.write(document);
|
||||||
|
writer.close();
|
||||||
|
InterActionToNC(Sqlca,f,type,batch,count,batchList);
|
||||||
|
Sqlca.commit();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
logger.debug("经销商xml传输失败");
|
||||||
|
Sqlca.rollback();
|
||||||
|
} catch (JBOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
returns="false";
|
||||||
|
}finally {
|
||||||
|
if(Sqlca!=null) {
|
||||||
|
try {
|
||||||
|
Sqlca.disConnect();
|
||||||
|
} catch (JBOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returns;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
||||||
|
|||||||
@ -530,12 +530,13 @@ public class VoucherToNCforVoucherPZ implements Job{
|
|||||||
Sqlca.commit();
|
Sqlca.commit();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
logger.info("ƾ֤xml´«Êäʧ°Ü");
|
||||||
try {
|
try {
|
||||||
Sqlca.rollback();
|
Sqlca.rollback();
|
||||||
} catch (JBOException e1) {
|
} catch (JBOException e1) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
e.printStackTrace();
|
||||||
returns="false";
|
returns="false";
|
||||||
}finally {
|
}finally {
|
||||||
if(Sqlca!=null) {
|
if(Sqlca!=null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user