init project
This commit is contained in:
28
acs/hd/nladmin-system/src/test/java/org/nl/BaseTest.java
Normal file
28
acs/hd/nladmin-system/src/test/java/org/nl/BaseTest.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.nl;
|
||||
|
||||
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.defalutDBName = "eladmin";
|
||||
WQLCore.ROOT = "org.nl";
|
||||
try {
|
||||
WQLCore.init();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
System.out.println("测试结束-----------------");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl;
|
||||
|
||||
/**
|
||||
* 模拟从1001--1002的AGV搬运指令。比如从入库口---库内等
|
||||
* 0、生成指令之前需要判断光电状态,最大指令数等条件
|
||||
* 1、定时器查询任务,判断任务状态比如status=0这种。
|
||||
* 2、根据起点找路由next,A-->B
|
||||
* 3、更新任务状态,下发给PLC、AGV
|
||||
* 4、指令完成,
|
||||
* 4.1 PLC型号类型:比如A task和B的task点位任务号相同,相当于指令结束
|
||||
* 4.2 AGV类型:定时器查接口数据
|
||||
*/
|
||||
public class InstructCreate {
|
||||
|
||||
}
|
||||
14
acs/hd/nladmin-system/src/test/java/org/nl/TaskCreate.java
Normal file
14
acs/hd/nladmin-system/src/test/java/org/nl/TaskCreate.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.nl;
|
||||
|
||||
/**
|
||||
* 模拟从1001-1002的AGV搬运任务生成,如从入库口到库内
|
||||
* 任务触发,比如mode变为2
|
||||
* 1、申请任务,需要判断路由是否存在。
|
||||
* 1.1、电器按钮:mode=2,3,4代表任务类型:申请空盘,申请入库等
|
||||
* 1.2、光电信号:move:0,1 有货,无货等
|
||||
* 2、相关接口
|
||||
* 2.1 申请WMS,WMS直接返回任务
|
||||
* 2.2 申请WMS,直接返回false或true,然后WMS通过定时器下发给ACS
|
||||
*/
|
||||
public class TaskCreate {
|
||||
}
|
||||
29
acs/hd/nladmin-system/src/test/java/org/nl/Test.java
Normal file
29
acs/hd/nladmin-system/src/test/java/org/nl/Test.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package org.nl;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Process printProcess;
|
||||
String printName ="HP LaserJet Pro MFP M225-M226 PCL 6";
|
||||
|
||||
try
|
||||
{
|
||||
printProcess = Runtime
|
||||
.getRuntime()
|
||||
.exec(new String[] {
|
||||
"E:\\条码标签设计软件和打印程序\\BarcodePrint\\BarcodePrint.exe",
|
||||
"PrinterName=" + printName,
|
||||
"LabelName=Label.ct", "Text1="+ "111","Text2="+"222","Text3="+"333","Text4="+"444"});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("aaa");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
168
acs/hd/nladmin-system/src/test/java/org/nl/Test3.java
Normal file
168
acs/hd/nladmin-system/src/test/java/org/nl/Test3.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package org.nl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.Test;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class Test3 extends BaseTest {
|
||||
@org.junit.Test
|
||||
public void test() {
|
||||
|
||||
JSONArray array = WQLObject.getWQLObject("acs_route_line").query("device_code='A11'").getResultJSONArray(0);
|
||||
WQLObject tab= WQLObject.getWQLObject("acs_route_line");
|
||||
for(int i=1;i<5;i++){
|
||||
JSONObject json = array.getJSONObject(0);
|
||||
|
||||
json.put("next_device_code","B2"+i);
|
||||
|
||||
json.put("line_uuid", IdUtil.simpleUUID());
|
||||
json.put("device_code","D22");
|
||||
tab.insert(json);
|
||||
json.put("line_uuid", IdUtil.simpleUUID());
|
||||
json.put("device_code","E22");
|
||||
tab.insert(json);
|
||||
json.put("line_uuid", IdUtil.simpleUUID());
|
||||
json.put("device_code","F22");
|
||||
tab.insert(json);
|
||||
json.put("line_uuid", IdUtil.simpleUUID());
|
||||
json.put("device_code","G22");
|
||||
tab.insert(json);
|
||||
json.put("line_uuid", IdUtil.simpleUUID());
|
||||
json.put("device_code","H22");
|
||||
tab.insert(json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
DeviceService deviceService;
|
||||
|
||||
@Test
|
||||
public void test3() {
|
||||
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
String device_code = "HLJ";
|
||||
String device_name = "混料机";
|
||||
String device_type = "station";
|
||||
if (i < 10) {
|
||||
device_code = "HLJ0";
|
||||
}
|
||||
device_code = device_code + String.valueOf(i);
|
||||
device_name = device_name + String.valueOf(i);
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setDevice_name(device_name);
|
||||
dto.setDevice_type(device_type);
|
||||
dto.setSeq_num(BigDecimal.valueOf(1));
|
||||
|
||||
deviceService.create(dto);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test4() {
|
||||
|
||||
int flag = 0;
|
||||
for (int k = 1; k < 8; k++) {
|
||||
for (int i = 1; i < 3; i++) {
|
||||
if (k == 1) {
|
||||
flag = 10 + 1;
|
||||
}
|
||||
if (k == 2) {
|
||||
flag = 10 + 1;
|
||||
}
|
||||
if (k == 3) {
|
||||
flag = 6 + 1;
|
||||
}
|
||||
if (k == 4) {
|
||||
flag = 6 + 1;
|
||||
}
|
||||
if (k == 5) {
|
||||
flag = 20 + 1;
|
||||
}
|
||||
if (k == 6) {
|
||||
flag = 26 + 1;
|
||||
}
|
||||
if (k == 7) {
|
||||
flag = 11 + 1;
|
||||
}
|
||||
if (k == 7 && i == 2) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 1; j < flag; j++) {
|
||||
String row_seq = String.valueOf(k);//排
|
||||
String col = String.valueOf(j);//列
|
||||
String layer = String.valueOf(i);//层
|
||||
String device_code = "L" + row_seq + "-" + col + "-" + layer;
|
||||
String device_name = row_seq + "排" + col + "列" + layer + "层";
|
||||
// String simple_name = struct_name;
|
||||
// JSONObject jo = new JSONObject();
|
||||
// jo.put("struct_id", struct_id);
|
||||
// jo.put("struct_code", struct_code);
|
||||
// jo.put("struct_name", struct_name);
|
||||
// jo.put("simple_name", simple_name);
|
||||
// WQLObject.getWQLObject("st_ivt_structattr").insert(jo);
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setSeq_num(BigDecimal.valueOf(1));
|
||||
dto.setDevice_name(device_name);
|
||||
dto.setDevice_type("station");
|
||||
deviceService.create(dto);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//初始化入窑缓存货架
|
||||
@Test
|
||||
public void syncStruct4() {
|
||||
for (int i = 1; i < 4; i++) {
|
||||
for (int j = 1; j < 7; j++) {
|
||||
for (int k = 1; k < 3; k++) {
|
||||
String device_code = "L" + i + "-" + j + "-" + k;
|
||||
String device_name = i + "排" + j + "列" + k + "层";
|
||||
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setSeq_num(BigDecimal.valueOf(1));
|
||||
dto.setDevice_name(device_name);
|
||||
dto.setDevice_type("station");
|
||||
deviceService.create(dto);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//初始化成品货架
|
||||
@Test
|
||||
public void syncStruct5() {
|
||||
for (int i = 4; i < 5; i++) {
|
||||
for (int j = 1; j < 19; j++) {
|
||||
for (int k = 1; k < 3; k++) {
|
||||
String device_code = "L" + i + "-" + j + "-" + k;
|
||||
String device_name = i + "排" + j + "列" + k + "层";
|
||||
|
||||
DeviceDto dto = new DeviceDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setSeq_num(BigDecimal.valueOf(1));
|
||||
dto.setDevice_name(device_name);
|
||||
dto.setDevice_type("station");
|
||||
deviceService.create(dto);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
59
acs/hd/nladmin-system/src/test/java/org/nl/mongodb/Test.java
Normal file
59
acs/hd/nladmin-system/src/test/java/org/nl/mongodb/Test.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package org.nl.mongodb;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public class Test {
|
||||
|
||||
|
||||
public Page test2(Integer currentPage, Integer pageSize, Long loanApplyId) {
|
||||
/* //创建查询对象
|
||||
Query query = new Query();
|
||||
//设置起始数
|
||||
query.skip((currentPage - 1) * pageSize);
|
||||
//设置查询条数
|
||||
query.limit(pageSize);
|
||||
Criteria criteria = new Criteria();
|
||||
criteria.where("loanApplyId").is(loanApplyId);
|
||||
//查询当前页数据集合
|
||||
List<ApplyLog> ApplyLogList = mongoTemplate.find(query, ApplyLog.class);
|
||||
//查询总记录数
|
||||
int count = (int) mongoTemplate.count(query, ApplyLog.class);
|
||||
//创建分页实体对象
|
||||
Page<ApplyLog> page = new Page<>();
|
||||
//添加每页的集合、数据总条数、总页数
|
||||
page.setRecords(ApplyLogList);
|
||||
page.setSize(count);
|
||||
page.setTotal(count % pageSize == 0 ? 1 : count / pageSize + 1);
|
||||
return page;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
/* int pageNo = 1;
|
||||
int pageSize = 10;
|
||||
|
||||
// limit限定查询2条
|
||||
Query query = Query.query(Criteria.where("user").is("一灰灰blog").and("a").is("b").and("")).with(Sort.by("age")).limit(2);
|
||||
//Query query = Query.query(Criteria.where("user").is("一灰灰blog")).with(Sort.by("age")).limit(2);
|
||||
// Pageable pageable = PageRequest.of(page,size);
|
||||
List<Map> result = mongoTemplate.find(query, Map.class, "logdb");
|
||||
System.out.println("query: " + query + " | limitPageQuery " + result);
|
||||
|
||||
|
||||
// skip()方法来跳过指定数量的数据
|
||||
query = Query.query(Criteria.where("user").is("一灰灰blog")).with(Sort.by("age")).skip(2);
|
||||
result = mongoTemplate.find(query, Map.class, "logdb");
|
||||
System.out.println("query: " + query + " | skipPageQuery " + result);
|
||||
|
||||
|
||||
|
||||
Query query = new Query(new Criteria());
|
||||
query.with(Sort.by(Sort.Direction.DESC, "time"));
|
||||
mongoUtil.start(2, 2, query);
|
||||
List<Teacher> teachers = mongoTemplate.find(query, Teacher.class);
|
||||
long count = mongoTemplate.count(query, Teacher.class);
|
||||
PageHelper pageHelper = mongoUtil.pageHelper(count, teachers);*/
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user