wms前后端提交

This commit is contained in:
18188916393
2022-06-29 10:19:40 +08:00
parent 3602eaeb64
commit 35ecc9fd22
945 changed files with 82519 additions and 0 deletions

View 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("测试结束-----------------");
}
}

View File

@@ -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 {
}

View 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 申请WMSWMS直接返回任务
* 2.2 申请WMS直接返回false或true,然后WMS通过定时器下发给ACS
*/
public class TaskCreate {
}

View File

@@ -0,0 +1,266 @@
package org.nl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.swing.internal.plaf.synth.resources.synth_sv;
import org.junit.Test;
import org.nl.wql.core.bean.WQLObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
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);
}
}
@Test
public void test3() {
String stor_id = "1518109007364100096";
String is_used = "1";
String is_delete = "0";
String create_id = "1";
String create_time = "2022-04-24 14:12:26";
int flag = 0;
String sect_id = "1518109805401739264";//满托货架库区
for (int k = 1; k < 8; k++) {
for (int i = 1; i < 3; i++) {
if (k == 1) {
flag = 10 + 1;
sect_id = "1518109502010953728";
}
if (k == 2) {
flag = 10 + 1;
sect_id = "1518109502010953728";
}
if (k == 3) {
flag = 6 + 1;
sect_id = "1518109805401739264";
}
if (k == 4) {
flag = 6 + 1;
sect_id = "1518109805401739264";
}
if (k == 5) {
flag = 20 + 1;
sect_id = "1518109805401739264";
}
if (k == 6) {
flag = 26 + 1;
sect_id = "1518121250239680512";
}
if (k == 7) {
flag = 11 + 1;
sect_id = "1518121250239684212";
}
if (k == 7 && i == 2) {
continue;
}
for (int j = 1; j < flag; j++) {
String struct_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String row_seq = String.valueOf(k);//排
String col = String.valueOf(j);//列
String layer = String.valueOf(i);//层
String struct_code = "L" + row_seq + "-" + col + "-" + layer;
String struct_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);
jo.put("sect_id", sect_id);
jo.put("stor_id", stor_id);
jo.put("row_seq", row_seq);
jo.put("col", col);
jo.put("layer", layer);
jo.put("is_used", is_used);
jo.put("is_delete", is_delete);
jo.put("create_id", create_id);
jo.put("create_name", "管理员");
jo.put("create_time", create_time);
WQLObject.getWQLObject("st_ivt_structattr").insert(jo);
}
}
}
}
@Test
public void syncStruct() {
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("1=1").getResultJSONArray(0);
WQLObject wo = WQLObject.getWQLObject("st_rule_iodisstruct");
String now = DateUtil.now();
for (int i = 0; i < structArray.size(); i++) {
JSONObject structObject = structArray.getJSONObject(i);
JSONObject iodObject = new JSONObject();
iodObject.put("disrule_uuid", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
iodObject.put("disrule_type", "00");
iodObject.put("struct_uuid", structObject.getString("struct_id"));
iodObject.put("struct_code", structObject.getString("struct_code"));
iodObject.put("struct_name", structObject.getString("struct_name"));
iodObject.put("sect_uuid", structObject.getString("sect_id"));
iodObject.put("store_uuid", structObject.getString("stor_id"));
iodObject.put("row_num", structObject.getString("row_seq"));
iodObject.put("col_num", structObject.getString("col"));
iodObject.put("layer_num", structObject.getString("layer"));
iodObject.put("height", 10);
iodObject.put("out_seq_no", i*10);
iodObject.put("in_seq_no", i*10);
iodObject.put("load_series", 1);
iodObject.put("create_id", 1);
iodObject.put("create_name", "管理员");
iodObject.put("create_time", now);
iodObject.put("update_optid", 1);
iodObject.put("update_optname", "管理员");
iodObject.put("update_time", now);
wo.insert(iodObject);
}
}
@Test
public void syncStruct1() {
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0' and struct_code like 'YZJ1%'").getResultJSONArray(0);
WQLObject wo = WQLObject.getWQLObject("ST_IVT_StructRelaMaterial");
String now = DateUtil.now();
for (int i = 0; i < structArray.size(); i++) {
String material_id = "";
for (int j = 0; j < 4; j++) {
if (j == 0) {
material_id = "1515940603542769664";
}
if (j == 1) {
material_id = "1515940976307343360";
}
if (j == 2) {
material_id = "1515947921256878080";
}
if (j == 3) {
material_id = "1516309702840029184";
}
JSONObject jsonObject = structArray.getJSONObject(i);
JSONObject map = new JSONObject();
map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
map.put("struct_id", jsonObject.getString("struct_id"));
map.put("material_id", material_id);
map.put("create_id", 1);
map.put("create_name", "管理员");
map.put("create_time", now);
map.put("update_optid", 1);
map.put("update_optname", "管理员");
map.put("update_time", now);
wo.insert(map);
}
}
}
@Test
public void syncStruct2() {
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0' and struct_code like 'YZJ%'").getResultJSONArray(0);
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelavehicletype");
String now = DateUtil.now();
for (int i = 0; i < structArray.size(); i++) {
for (int j = 1; j <= 3; j++) {
JSONObject jsonObject = structArray.getJSONObject(i);
JSONObject map = new JSONObject();
map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
map.put("struct_id", jsonObject.getString("struct_id"));
map.put("vehicle_type", "0" + j);
map.put("create_id", 1);
map.put("create_name", "管理员");
map.put("create_time", now);
map.put("update_optid", 1);
map.put("update_optname", "管理员");
map.put("update_time", now);
wo.insert(map);
}
}
}
@Test
public void compare() {
try {
/* Date instorage_time_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2028-09-23 23:00:45");
Date now_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(DateUtil.now());
if (instorage_time_parse.){
System.out.println();
}*/
Date instorage_time_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2022-05-13 21:00:45");
System.out.println("----------------------------------------");
Date now_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(DateUtil.now());
Date now = new Date();
System.out.println(instorage_time_parse);
System.out.println(DateUtil.now());
System.out.println(now_parse);
long min = (now.getTime() - instorage_time_parse.getTime()) / (1000 * 60);
System.out.println(min);
min = (now_parse.getTime() - instorage_time_parse.getTime()) / (1000 * 60);
System.out.println(min);
System.out.println("----------------------------------------");
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void syncStruct4() {
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0'").getResultJSONArray(0);
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelavehicletype");
String now = DateUtil.now();
for (int i = 0; i < structArray.size(); i++) {
for (int j = 1; j <= 3; j++) {
JSONObject jsonObject = structArray.getJSONObject(i);
JSONObject map = new JSONObject();
map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
map.put("struct_id", jsonObject.getString("struct_id"));
map.put("vehicle_type", "0" + j);
map.put("create_id", 1);
map.put("create_name", "管理员");
map.put("create_time", now);
map.put("update_optid", 1);
map.put("update_optname", "管理员");
map.put("update_time", now);
wo.insert(map);
}
}
}
}

View 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);*/
}
}