init project
This commit is contained in:
130
mes/hd/nladmin-system/src/test/java/day01/Test4.java
Normal file
130
mes/hd/nladmin-system/src/test/java/day01/Test4.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package day01;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.Test;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
public class Test4 extends day01.BaseTest {
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
/**R
|
||||
* 熟化区仓位数据初始化
|
||||
*/
|
||||
@Test
|
||||
public void test11() {
|
||||
//仓位基础表【st_base_struct】
|
||||
WQLObject structTab = WQLObject.getWQLObject("st_base_struct");
|
||||
//库区基础表【st_base_sect】
|
||||
WQLObject sectTab = WQLObject.getWQLObject("st_base_sect");
|
||||
JSONObject sectObj = sectTab.query("sect_code ='01'").uniqueResult(0);
|
||||
String sect_uuid = sectObj.getString("sect_uuid");
|
||||
structTab.delete("sect_uuid = '" + sect_uuid + "'");
|
||||
int order_seq = 1;
|
||||
//排
|
||||
for (int i = 1; i < 3; i++) {
|
||||
//列
|
||||
for (int j = 1; j < 9; j++) {
|
||||
for (int m = 1; m < 3; m++) {
|
||||
JSONObject structObj = new JSONObject();
|
||||
structObj.put("struct_uuid", IdUtil.simpleUUID());
|
||||
structObj.put("struct_code", sectObj.getString("sect_code") + "0" + i + "-0" + j + "-0" + m);
|
||||
structObj.put("struct_name", "0" + i + "排" + "0" + j + "列" + "0" + m + "层");
|
||||
structObj.put("struct_name", "0" + i + "排" + "0" + j + "列" + "0" + m + "层");
|
||||
structObj.put("row_num", i);
|
||||
structObj.put("col_num", j);
|
||||
structObj.put("layer_num", m);
|
||||
structObj.put("order_seq", order_seq++);
|
||||
structObj.put("store_uuid", sectObj.getString("store_uuid"));
|
||||
structObj.put("sect_uuid", sectObj.getString("sect_uuid"));
|
||||
structObj.put("create_by", "admin");
|
||||
structObj.put("create_by", "admin");
|
||||
structObj.put("update_by", "admin");
|
||||
structObj.put("create_time", DateUtil.now());
|
||||
structObj.put("update_time", DateUtil.now());
|
||||
structTab.insert(structObj);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("测试成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从上到下,从右到左
|
||||
* 恒温存储区仓位数据初始化
|
||||
*/
|
||||
@Test
|
||||
public void initStruct() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 从上到下,从右到左
|
||||
* 空卷轴存储区仓位数据初始化
|
||||
*/
|
||||
@Test
|
||||
public void initStruct2() {
|
||||
//仓位基础表【st_base_struct】
|
||||
WQLObject structTab = WQLObject.getWQLObject("st_base_struct");
|
||||
//库区基础表【st_base_sect】
|
||||
WQLObject sectTab = WQLObject.getWQLObject("st_base_sect");
|
||||
JSONObject sectObj = sectTab.query("sect_code ='04'").uniqueResult(0);
|
||||
|
||||
int order_seq = 1;
|
||||
//排
|
||||
for (int i = 1; i < 2; i++) {
|
||||
//列
|
||||
for (int j = 1; j < 6; j++) {
|
||||
for (int m = 1; m < 6; m++) {
|
||||
JSONObject structObj = new JSONObject();
|
||||
structObj.put("struct_uuid", IdUtil.simpleUUID());
|
||||
structObj.put("struct_code", sectObj.getString("sect_code") + "0" + i + "0" + j + "0" + m);
|
||||
structObj.put("struct_name", "0" + i + "排" + "0" + j + "列" + "0" + m + "层");
|
||||
structObj.put("struct_name", "0" + i + "排" + "0" + j + "列" + "0" + m + "层");
|
||||
structObj.put("order_seq", order_seq++);
|
||||
structObj.put("store_uuid", sectObj.getString("store_uuid"));
|
||||
structObj.put("sect_uuid", sectObj.getString("sect_uuid"));
|
||||
structObj.put("create_by", "admin");
|
||||
structObj.put("update_by", "admin");
|
||||
structObj.put("create_time", DateUtil.now());
|
||||
structObj.put("update_time", DateUtil.now());
|
||||
structTab.insert(structObj);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("测试成功!");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化入库分配规则
|
||||
*/
|
||||
@Test
|
||||
public void initInDisRule() {
|
||||
//仓位入库分配规则表【st_rule_inDisStruct】
|
||||
WQLObject disRuleTab = WQLObject.getWQLObject("st_rule_inDisStruct");
|
||||
disRuleTab.delete("1=1");
|
||||
|
||||
WQLObject structTab = WQLObject.getWQLObject("st_base_struct");
|
||||
JSONArray arr = structTab.query().getResultJSONArray(0);
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
json.put("disrule_uuid", IdUtil.simpleUUID());
|
||||
disRuleTab.insert(json);
|
||||
}
|
||||
System.out.println("插入完成");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
13
mes/hd/nladmin-system/src/test/java/day02/A.java
Normal file
13
mes/hd/nladmin-system/src/test/java/day02/A.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package day02;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class A {
|
||||
public static void main(String[] args) {
|
||||
String a = "PWT001";
|
||||
System.out.println(a.substring(5,6));
|
||||
}
|
||||
}
|
||||
13
mes/hd/nladmin-system/src/test/java/day02/InStore.java
Normal file
13
mes/hd/nladmin-system/src/test/java/day02/InStore.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package day02;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public abstract class InStore {
|
||||
public String create() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public JSONObject findStartPoint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
27
mes/hd/nladmin-system/src/test/java/org/nl/BaseTest.java
Normal file
27
mes/hd/nladmin-system/src/test/java/org/nl/BaseTest.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package day01;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.nl.wql.WQLCore;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class BaseTest {
|
||||
@Before
|
||||
public void init() {
|
||||
WQLCore.ROOT = "org.nl";
|
||||
try {
|
||||
WQLCore.init();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
System.out.println("测试结束-----------------");
|
||||
}
|
||||
}
|
||||
2
mes/hd/nladmin-system/src/test/java/org/nl/Student.java
Normal file
2
mes/hd/nladmin-system/src/test/java/org/nl/Student.java
Normal file
@@ -0,0 +1,2 @@
|
||||
package org.nl;public class Student {
|
||||
}
|
||||
10
mes/hd/nladmin-system/src/test/java/org/nl/Test3.java
Normal file
10
mes/hd/nladmin-system/src/test/java/org/nl/Test3.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package day01;
|
||||
|
||||
import org.nl.utils.StringUtils;
|
||||
|
||||
public class Test3 {
|
||||
public static void main(String[] args) {
|
||||
String localIp = StringUtils.getLocalIp();
|
||||
System.out.println(localIp);
|
||||
}
|
||||
}
|
||||
25
mes/hd/nladmin-system/src/test/java/test3/Test01.java
Normal file
25
mes/hd/nladmin-system/src/test/java/test3/Test01.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package test3;
|
||||
|
||||
import cn.hutool.core.date.ChineseDate;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import java.util.Date;
|
||||
|
||||
public class Test01 {
|
||||
public static void main(String[] args) {
|
||||
String dateStr = "2022/05/21";
|
||||
Date date = DateUtil.parse(dateStr, "yyyy/MM/dd");
|
||||
int dayOfWeek = DateUtil.dayOfWeek(date);
|
||||
System.out.println(dayOfWeek);
|
||||
|
||||
ChineseDate date2 = new ChineseDate(DateUtil.parseDate("2020-01-25"));
|
||||
date2.getFestivals();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
13
mes/hd/nladmin-system/src/test/java/test3/Test3.java
Normal file
13
mes/hd/nladmin-system/src/test/java/test3/Test3.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package test3;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public class Test3 {
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
String a = IdUtil.getSnowflake(1, 1).nextId()+"";
|
||||
System.out.println(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
212
mes/hd/nladmin-system/src/test/java/test3/Test4.java
Normal file
212
mes/hd/nladmin-system/src/test/java/test3/Test4.java
Normal file
@@ -0,0 +1,212 @@
|
||||
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 Test4 {
|
||||
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", "4D");
|
||||
ufinterface.setAttribute("filename", "");
|
||||
ufinterface.setAttribute("groupcode", "");
|
||||
ufinterface.setAttribute("isexchange", "Y");
|
||||
ufinterface.setAttribute("replace", "Y");
|
||||
ufinterface.setAttribute("roottag", "");
|
||||
ufinterface.setAttribute("sender", "pgmes");
|
||||
doc.appendChild(ufinterface);
|
||||
|
||||
//bill标签
|
||||
Element bill = doc.createElement("bill");
|
||||
bill.setAttribute("id", "");
|
||||
ufinterface.appendChild(bill);
|
||||
|
||||
//billhead标签
|
||||
Element billhead = doc.createElement("billhead");
|
||||
bill.appendChild(billhead);
|
||||
|
||||
Element billmaker = doc.createElement("billmaker");
|
||||
billmaker.setTextContent(jo.getString("billmaker"));
|
||||
billhead.appendChild(billmaker);
|
||||
|
||||
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 cbizid = doc.createElement("cbizid");
|
||||
cbizid.setTextContent(jo.getString("cbizid"));
|
||||
billhead.appendChild(cbizid);
|
||||
|
||||
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 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 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("0001A1100000000020DB");
|
||||
billhead.appendChild(ctrantypeid);
|
||||
|
||||
Element cwarehouseid = doc.createElement("cwarehouseid");
|
||||
cwarehouseid.setTextContent("1002A1100000000I3U0Y");
|
||||
billhead.appendChild(cwarehouseid);
|
||||
|
||||
Element dbilldate = doc.createElement("dbilldate");
|
||||
dbilldate.setTextContent(jo.getString("dbilldate"));
|
||||
billhead.appendChild(dbilldate);
|
||||
|
||||
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 vnote = doc.createElement("vnote");
|
||||
vnote.setTextContent(jo.getString("vnote"));
|
||||
billhead.appendChild(vnote);
|
||||
|
||||
Element vtrantypecode = doc.createElement("vtrantypecode");
|
||||
vtrantypecode.setTextContent("4D-01");
|
||||
billhead.appendChild(vtrantypecode);
|
||||
|
||||
//cgeneralbid标签
|
||||
Element cgeneralbid = doc.createElement("cgeneralbid");
|
||||
billhead.appendChild(cgeneralbid);
|
||||
|
||||
//item标签
|
||||
Element item = doc.createElement("item");
|
||||
cgeneralbid.appendChild(item);
|
||||
|
||||
Element bbarcodeclose = doc.createElement("bbarcodeclose");
|
||||
bbarcodeclose.setTextContent("N");
|
||||
item.appendChild(bbarcodeclose);
|
||||
|
||||
Element bonroadflag = doc.createElement("bonroadflag");
|
||||
bonroadflag.setTextContent("N");
|
||||
item.appendChild(bonroadflag);
|
||||
|
||||
Element castunitid = doc.createElement("castunitid");
|
||||
castunitid.setTextContent(jo.getString("castunitid"));
|
||||
item.appendChild(castunitid);
|
||||
|
||||
Element cbodytranstypecode = doc.createElement("cbodytranstypecode");
|
||||
cbodytranstypecode.setTextContent("4D-01");
|
||||
item.appendChild(cbodytranstypecode);
|
||||
|
||||
Element cbodywarehouseid = doc.createElement("cbodywarehouseid");
|
||||
cbodywarehouseid.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 crowno = doc.createElement("crowno");
|
||||
crowno.setTextContent(jo.getString("crowno"));
|
||||
item.appendChild(crowno);
|
||||
|
||||
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 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 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 vchangerate = doc.createElement("vchangerate");
|
||||
vchangerate.setTextContent(jo.getString("vchangerate"));
|
||||
item.appendChild(vchangerate);
|
||||
|
||||
Element vnotebody = doc.createElement("vnotebody");
|
||||
vnotebody.setTextContent(jo.getString("vnotebody"));
|
||||
item.appendChild(vnotebody);
|
||||
|
||||
System.out.println(XmlUtil.toStr(doc));
|
||||
}
|
||||
}
|
||||
211
mes/hd/nladmin-system/src/test/java/test3/Test5.java
Normal file
211
mes/hd/nladmin-system/src/test/java/test3/Test5.java
Normal file
@@ -0,0 +1,211 @@
|
||||
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 Test5 {
|
||||
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", "4I");
|
||||
ufinterface.setAttribute("filename", "");
|
||||
ufinterface.setAttribute("groupcode", "");
|
||||
ufinterface.setAttribute("isexchange", "Y");
|
||||
ufinterface.setAttribute("replace", "Y");
|
||||
ufinterface.setAttribute("roottag", "");
|
||||
ufinterface.setAttribute("sender", "pgmes");
|
||||
doc.appendChild(ufinterface);
|
||||
|
||||
//bill标签
|
||||
Element bill = doc.createElement("bill");
|
||||
bill.setAttribute("id", "");
|
||||
ufinterface.appendChild(bill);
|
||||
|
||||
//bill标签
|
||||
Element billhead = doc.createElement("billhead");
|
||||
bill.appendChild(billhead);
|
||||
|
||||
Element billmaker = doc.createElement("billmaker");
|
||||
billmaker.setTextContent(jo.getString("billmaker"));
|
||||
billhead.appendChild(billmaker);
|
||||
|
||||
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 cbizid = doc.createElement("cbizid");
|
||||
cbizid.setTextContent(jo.getString("cbizid"));
|
||||
billhead.appendChild(cbizid);
|
||||
|
||||
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 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 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("0001A1100000000020DB");
|
||||
billhead.appendChild(ctrantypeid);
|
||||
|
||||
Element cwarehouseid = doc.createElement("cwarehouseid");
|
||||
cwarehouseid.setTextContent("1002A1100000000I3U0Y");
|
||||
billhead.appendChild(cwarehouseid);
|
||||
|
||||
Element dbilldate = doc.createElement("dbilldate");
|
||||
dbilldate.setTextContent(jo.getString("dbilldate"));
|
||||
billhead.appendChild(dbilldate);
|
||||
|
||||
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 vnote = doc.createElement("vnote");
|
||||
vnote.setTextContent(jo.getString("vnote"));
|
||||
billhead.appendChild(vnote);
|
||||
|
||||
Element vtrantypecode = doc.createElement("vtrantypecode");
|
||||
vtrantypecode.setTextContent("4I-01");
|
||||
billhead.appendChild(vtrantypecode);
|
||||
|
||||
Element cgeneralbid = doc.createElement("cgeneralbid");
|
||||
billhead.appendChild(cgeneralbid);
|
||||
|
||||
//item标签
|
||||
Element item = doc.createElement("item");
|
||||
cgeneralbid.appendChild(item);
|
||||
|
||||
Element bbarcodeclose = doc.createElement("bbarcodeclose");
|
||||
bbarcodeclose.setTextContent("N");
|
||||
item.appendChild(bbarcodeclose);
|
||||
|
||||
Element bonroadflag = doc.createElement("bonroadflag");
|
||||
bonroadflag.setTextContent("N");
|
||||
item.appendChild(bonroadflag);
|
||||
|
||||
Element castunitid = doc.createElement("castunitid");
|
||||
castunitid.setTextContent(jo.getString("castunitid"));
|
||||
item.appendChild(castunitid);
|
||||
|
||||
Element cbodytranstypecode = doc.createElement("cbodytranstypecode");
|
||||
cbodytranstypecode.setTextContent("4D-01");
|
||||
item.appendChild(cbodytranstypecode);
|
||||
|
||||
Element cbodywarehouseid = doc.createElement("cbodywarehouseid");
|
||||
cbodywarehouseid.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 crowno = doc.createElement("crowno");
|
||||
crowno.setTextContent(jo.getString("crowno"));
|
||||
item.appendChild(crowno);
|
||||
|
||||
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 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 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 vchangerate = doc.createElement("vchangerate");
|
||||
vchangerate.setTextContent(jo.getString("vchangerate"));
|
||||
item.appendChild(vchangerate);
|
||||
|
||||
Element vnotebody = doc.createElement("vnotebody");
|
||||
vnotebody.setTextContent(jo.getString("vnotebody"));
|
||||
item.appendChild(vnotebody);
|
||||
|
||||
System.out.println(XmlUtil.toStr(doc));
|
||||
}
|
||||
}
|
||||
235
mes/hd/nladmin-system/src/test/java/test3/Test6.java
Normal file
235
mes/hd/nladmin-system/src/test/java/test3/Test6.java
Normal file
@@ -0,0 +1,235 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
10
mes/hd/nladmin-system/src/test/java/test4/DataDto.java
Normal file
10
mes/hd/nladmin-system/src/test/java/test4/DataDto.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package test4;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DataDto {
|
||||
|
||||
private String raw_material_name;
|
||||
|
||||
}
|
||||
49
mes/hd/nladmin-system/src/test/java/test4/ExcelTest.java
Normal file
49
mes/hd/nladmin-system/src/test/java/test4/ExcelTest.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package test4;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
|
||||
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.Test;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "下载测试")
|
||||
@RequestMapping("/api/test")
|
||||
@Slf4j
|
||||
public class ExcelTest {
|
||||
|
||||
@PostMapping("/orer")
|
||||
@Log("下载测试")
|
||||
@ApiOperation("下载测试")
|
||||
public void test01(HttpServletResponse response) throws IOException {
|
||||
String fileName = URLEncoder.encode("测试", "UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment; filename*=UTf-8''"+fileName+".xlsx");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
|
||||
// 获取模板path
|
||||
String template = "D:\\iderwork\\git_xr\\whxr_mes\\nladmin-system\\src\\test\\java\\xlxs\\模板.xlsx";
|
||||
// 创建模板工作簿
|
||||
ExcelWriterBuilder excelWriterBuilder = EasyExcel.write(outputStream, DataDto.class).withTemplate(template);
|
||||
// 获取第一个sheet
|
||||
ExcelWriterSheetBuilder sheet = excelWriterBuilder.sheet();
|
||||
// 获取数据
|
||||
DataDto dataDto = new DataDto();
|
||||
dataDto.setRaw_material_name("sssssss");
|
||||
// 填充
|
||||
sheet.doFill(dataDto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user