236 lines
8.5 KiB
Java
236 lines
8.5 KiB
Java
package test3;
|
|
|
|
import cn.hutool.core.util.XmlUtil;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.Element;
|
|
|
|
public class Test6 {
|
|
public static void main(String[] args) {
|
|
JSONObject jo = new JSONObject();
|
|
Document doc = XmlUtil.createXml();
|
|
doc.setXmlStandalone(true);
|
|
|
|
// ufinterface标签
|
|
Element ufinterface = doc.createElement("ufinterface");
|
|
ufinterface.setAttribute("account", "");
|
|
ufinterface.setAttribute("billtype", "46");
|
|
ufinterface.setAttribute("filename", "");
|
|
ufinterface.setAttribute("groupcode", "");
|
|
ufinterface.setAttribute("isexchange", "Y");
|
|
ufinterface.setAttribute("replace", "Y");
|
|
ufinterface.setAttribute("roottag", "");
|
|
ufinterface.setAttribute("sender", "pgmes");
|
|
|
|
Element bill = doc.createElement("bill");
|
|
bill.setAttribute("id", "");
|
|
ufinterface.appendChild(bill);
|
|
|
|
Element billhead = doc.createElement("billhead");
|
|
bill.appendChild(billhead);
|
|
|
|
Element billmaker = doc.createElement("billmaker");
|
|
billmaker.setTextContent(jo.getString("billmaker"));
|
|
billhead.appendChild(billmaker);
|
|
|
|
Element cbizid = doc.createElement("cbizid");
|
|
cbizid.setTextContent(jo.getString("cbizid"));
|
|
billhead.appendChild(cbizid);
|
|
|
|
Element cdptid = doc.createElement("cdptid");
|
|
cdptid.setTextContent(jo.getString("cdptid"));
|
|
billhead.appendChild(cdptid);
|
|
|
|
Element cdptvid = doc.createElement("cdptvid");
|
|
cdptvid.setTextContent(jo.getString("cdptvid"));
|
|
billhead.appendChild(cdptvid);
|
|
|
|
Element corpoid = doc.createElement("corpoid");
|
|
corpoid.setTextContent("0001A11000000001MYHK");
|
|
billhead.appendChild(corpoid);
|
|
|
|
Element corpvid = doc.createElement("corpvid");
|
|
corpvid.setTextContent("0001A11000000001MYHJ");
|
|
billhead.appendChild(corpvid);
|
|
|
|
Element cprocalbodyoid = doc.createElement("cprocalbodyoid");
|
|
cprocalbodyoid.setTextContent("0001A11000000001MYHK");
|
|
billhead.appendChild(cprocalbodyoid);
|
|
|
|
Element cprocalbodyvid = doc.createElement("cprocalbodyvid");
|
|
cprocalbodyvid.setTextContent("0001A11000000001MYHJ");
|
|
billhead.appendChild(cprocalbodyvid);
|
|
|
|
Element cprowarehouseid = doc.createElement("cprowarehouseid");
|
|
cprowarehouseid.setTextContent("1002A1100000000I3U48");
|
|
billhead.appendChild(cprowarehouseid);
|
|
|
|
Element creationtime = doc.createElement("creationtime");
|
|
creationtime.setTextContent(jo.getString("creationtime"));
|
|
billhead.appendChild(creationtime);
|
|
|
|
Element creator = doc.createElement("creator");
|
|
creator.setTextContent(jo.getString("creator"));
|
|
billhead.appendChild(creator);
|
|
|
|
Element ctrantypeid = doc.createElement("ctrantypeid");
|
|
ctrantypeid.setTextContent("0001A1100000000020CP");
|
|
billhead.appendChild(ctrantypeid);
|
|
|
|
Element cwarehouseid = doc.createElement("cwarehouseid");
|
|
cwarehouseid.setTextContent("1002A1100000000I3U48");
|
|
billhead.appendChild(cwarehouseid);
|
|
|
|
Element dbilldate = doc.createElement("dbilldate");
|
|
dbilldate.setTextContent(jo.getString("dbilldate"));
|
|
billhead.appendChild(dbilldate);
|
|
|
|
Element dmakedate = doc.createElement("dmakedate");
|
|
dmakedate.setTextContent(jo.getString("dmakedate"));
|
|
billhead.appendChild(dmakedate);
|
|
|
|
Element dr = doc.createElement("dr");
|
|
dr.setTextContent("0");
|
|
billhead.appendChild(dr);
|
|
|
|
Element fbillflag = doc.createElement("fbillflag");
|
|
fbillflag.setTextContent("2");
|
|
billhead.appendChild(fbillflag);
|
|
|
|
Element pk_group = doc.createElement("pk_group");
|
|
pk_group.setTextContent("0001A110000000000FJ5");
|
|
billhead.appendChild(pk_group);
|
|
|
|
Element pk_org = doc.createElement("pk_org");
|
|
pk_org.setTextContent("0001A11000000001MYHK");
|
|
billhead.appendChild(pk_org);
|
|
|
|
Element pk_org_v = doc.createElement("pk_org_v");
|
|
pk_org_v.setTextContent("0001A11000000001MYHJ");
|
|
billhead.appendChild(pk_org_v);
|
|
|
|
Element vnote = doc.createElement("vnote");
|
|
vnote.setTextContent("诺力测试");
|
|
billhead.appendChild(vnote);
|
|
|
|
Element vtrantypecode = doc.createElement("vtrantypecode");
|
|
vtrantypecode.setTextContent("46-01");
|
|
billhead.appendChild(vtrantypecode);
|
|
|
|
Element cgeneralbid = doc.createElement("cgeneralbid");
|
|
billhead.appendChild(cgeneralbid);
|
|
|
|
//针对物料明细循环插入item
|
|
Element item = doc.createElement("item");
|
|
cgeneralbid.appendChild(item);
|
|
|
|
Element breworkflag = doc.createElement("breworkflag");
|
|
breworkflag.setTextContent("N");
|
|
item.appendChild(breworkflag);
|
|
|
|
Element bbarcodeclose = doc.createElement("bbarcodeclose");
|
|
bbarcodeclose.setTextContent("N");
|
|
item.appendChild(bbarcodeclose);
|
|
|
|
Element bonroadflag = doc.createElement("bonroadflag");
|
|
bonroadflag.setTextContent(jo.getString("bonroadflag"));
|
|
item.appendChild(bonroadflag);
|
|
|
|
Element castunitid = doc.createElement("castunitid");
|
|
castunitid.setTextContent(jo.getString("castunitid"));
|
|
item.appendChild(castunitid);
|
|
|
|
Element cbodytranstypecode = doc.createElement("cbodytranstypecode");
|
|
cbodytranstypecode.setTextContent("46-01");
|
|
item.appendChild(cbodytranstypecode);
|
|
|
|
Element cbodywarehouseid = doc.createElement("cbodywarehouseid");
|
|
cbodytranstypecode.setTextContent(jo.getString("cbodywarehouseid"));
|
|
item.appendChild(cbodywarehouseid);
|
|
|
|
Element cmaterialoid = doc.createElement("cmaterialoid");
|
|
cmaterialoid.setTextContent(jo.getString("cmaterialoid"));
|
|
item.appendChild(cmaterialoid);
|
|
|
|
Element cmaterialvid = doc.createElement("cmaterialvid");
|
|
cmaterialvid.setTextContent(jo.getString("cmaterialvid"));
|
|
item.appendChild(cmaterialvid);
|
|
|
|
item.appendChild(corpoid);
|
|
|
|
item.appendChild(corpvid);
|
|
|
|
Element cproductid = doc.createElement("cproductid");
|
|
cproductid.setTextContent(jo.getString("cproductid"));
|
|
item.appendChild(cproductid);
|
|
|
|
Element crowno = doc.createElement("crowno");
|
|
crowno.setTextContent(jo.getString("crowno"));
|
|
item.appendChild(crowno);
|
|
|
|
Element cunitid = doc.createElement("cunitid");
|
|
cunitid.setTextContent("0001Z0100000000000XI");
|
|
item.appendChild(cunitid);
|
|
|
|
Element dbizdate = doc.createElement("dbizdate");
|
|
dbizdate.setTextContent(jo.getString("dbizdate"));
|
|
item.appendChild(dbizdate);
|
|
|
|
item.appendChild(dr);
|
|
|
|
Element flargess = doc.createElement("flargess");
|
|
flargess.setTextContent("N");
|
|
item.appendChild(flargess);
|
|
|
|
Element fproductclass = doc.createElement("fproductclass");
|
|
fproductclass.setTextContent("1");
|
|
item.appendChild(fproductclass);
|
|
|
|
Element nassistnum = doc.createElement("nassistnum");
|
|
nassistnum.setTextContent("0");
|
|
item.appendChild(nassistnum);
|
|
|
|
Element nnum = doc.createElement("nnum");
|
|
nnum.setTextContent("0");
|
|
item.appendChild(nnum);
|
|
|
|
Element nshouldassistnum = doc.createElement("nshouldassistnum");
|
|
nshouldassistnum.setTextContent(jo.getString("nshouldassistnum"));
|
|
item.appendChild(nshouldassistnum);
|
|
|
|
Element nshouldnum = doc.createElement("nshouldnum");
|
|
nshouldnum.setTextContent(jo.getString("nshouldnum"));
|
|
item.appendChild(nshouldnum);
|
|
|
|
item.appendChild(pk_group);
|
|
|
|
item.appendChild(pk_org);
|
|
|
|
item.appendChild(pk_org_v);
|
|
|
|
Element vbatchcode = doc.createElement("vbatchcode");
|
|
vbatchcode.setTextContent(jo.getString("vbatchcode"));
|
|
item.appendChild(vbatchcode);
|
|
|
|
Element pk_batchcode = doc.createElement("pk_batchcode");
|
|
pk_batchcode.setTextContent(jo.getString("pk_batchcode"));
|
|
item.appendChild(pk_batchcode);
|
|
|
|
Element vbdef7 = doc.createElement("vbdef7");
|
|
vbdef7.setTextContent("1002Z0100000000001K1");
|
|
item.appendChild(vbdef7);
|
|
|
|
Element vchangerate = doc.createElement("vchangerate");
|
|
vchangerate.setTextContent(".0329/1.000");
|
|
item.appendChild(vchangerate);
|
|
|
|
Element vnotebody = doc.createElement("vnotebody");
|
|
vnotebody.setTextContent("诺力测试");
|
|
item.appendChild(vnotebody);
|
|
|
|
doc.appendChild(ufinterface);
|
|
|
|
System.out.println(XmlUtil.toStr(doc));
|
|
}
|
|
}
|