init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package org.nl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 单元测试
|
||||
* @Date: 2023/5/15
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class ApplicationTest {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private PointMapper yzMapper;
|
||||
@Test
|
||||
void contextLoads() {
|
||||
System.out.println(userService.list());
|
||||
}
|
||||
@Test
|
||||
void yzMapperTest() {
|
||||
// List<SchBasePoint> pointForYZSL = yzMapper.findPointForYZSL(new JSONObject(
|
||||
// MapOf.of("regionCode", "HCSSX", "pointType", "1")));
|
||||
// System.out.println(pointForYZSL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.enums;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskDirectionEnum;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/5/25
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class GetEnumOnSqlTest {
|
||||
@Test
|
||||
public void TaskDirectionEnum() {
|
||||
TaskDirectionEnum[] values = TaskDirectionEnum.values();
|
||||
for (TaskDirectionEnum value : values) {
|
||||
System.out.println(value.getValue() + ", " + value.getLabel());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GroupBindMaterialStatusEnum() {
|
||||
GroupBindMaterialStatusEnum[] values = GroupBindMaterialStatusEnum.values();
|
||||
for (GroupBindMaterialStatusEnum value : values) {
|
||||
System.out.println(value.getValue() + ", " + value.getLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package org.nl.point;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.region.service.ISchBaseRegionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 创建点位
|
||||
* @Date: 2023/6/15
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class PointCreate {
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseRegionService regionService;
|
||||
@Test
|
||||
void test01() {
|
||||
// 创建YJ01-08
|
||||
List<SchBasePoint> pointList = new ArrayList<>();
|
||||
for (int i = 3; i <= 8; i++) {
|
||||
String pointName = "压机0";
|
||||
String pointCode = "YJ0";
|
||||
pointName = pointName + i;
|
||||
pointCode = pointCode + i;
|
||||
SchBasePoint point = new SchBasePoint();
|
||||
point.setPoint_code(pointCode);
|
||||
point.setPoint_name(pointName);
|
||||
point.setRegion_code("YZ");
|
||||
point.setRegion_name("压制区域");
|
||||
point.setPoint_type("1");
|
||||
point.setParent_point_code(pointCode);
|
||||
point.setIs_has_workder(true);
|
||||
point.setIs_auto(true);
|
||||
pointList.add(point);
|
||||
}
|
||||
pointService.saveBatch(pointList);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test02() { // 压机接料位
|
||||
// 创建YJ01JLW01
|
||||
List<SchBasePoint> pointList = new ArrayList<>();
|
||||
for (int i = 3; i <= 8; i++) {
|
||||
String pointName = "压机0";
|
||||
String pointCode = "YJ0";
|
||||
pointName = pointName + i;
|
||||
pointCode = pointCode + i;
|
||||
for (int j = 1; j <= 2; j++) {
|
||||
String jlw = "JLW0";
|
||||
String jlw2 = "接料位0";
|
||||
jlw = jlw + j;
|
||||
jlw2 = jlw2 + j;
|
||||
SchBasePoint point = new SchBasePoint();
|
||||
point.setPoint_code(pointCode + jlw);
|
||||
point.setPoint_name(pointName + jlw2);
|
||||
point.setRegion_code("YZ");
|
||||
point.setRegion_name("压制区域");
|
||||
point.setPoint_type("2");
|
||||
point.setParent_point_code(pointCode);
|
||||
point.setIs_has_workder(false);
|
||||
point.setIs_auto(true);
|
||||
pointList.add(point);
|
||||
}
|
||||
}
|
||||
pointService.saveBatch(pointList);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test03() { // 料盅睏料线区域
|
||||
// 创建LZKL01 - 32
|
||||
List<SchBasePoint> pointList = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {// 3台
|
||||
String pointName = "睏料位";
|
||||
String pointCode = "KLW";
|
||||
if (i < 10) {
|
||||
pointName = pointName + "0" + i;
|
||||
pointCode = pointCode + "0" + i;
|
||||
} else {
|
||||
pointName = pointName + i;
|
||||
pointCode = pointCode + i;
|
||||
}
|
||||
SchBasePoint point = new SchBasePoint();
|
||||
point.setPoint_code(pointCode);
|
||||
point.setPoint_name(pointName);
|
||||
point.setRegion_code("LZKLX");
|
||||
point.setRegion_name("料盅睏料线区域");
|
||||
point.setParent_point_code(pointCode);
|
||||
point.setIs_has_workder(false);
|
||||
point.setIs_auto(true);
|
||||
pointList.add(point);
|
||||
}
|
||||
pointService.saveBatch(pointList);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void test04() { // 缓存库位区域
|
||||
List<SchBasePoint> pointList = new ArrayList<>();
|
||||
int count = 1;
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
for (int j = 1; j <= 29; j++) {
|
||||
for (int k = 1; k <= 3; k++) {
|
||||
String code = "HCHJ";
|
||||
String name = "缓存货架";
|
||||
if (count < 10) {
|
||||
code = code + "00" + count;
|
||||
name = name + "00" + count;
|
||||
} else if (count >= 10 && count < 100) {
|
||||
code = code + "0" + count;
|
||||
name = name + "0" + count;
|
||||
} else {
|
||||
code = code + count;
|
||||
name = name + count;
|
||||
}
|
||||
SchBasePoint point = new SchBasePoint();
|
||||
point.setPoint_code(code);
|
||||
point.setPoint_name(name);
|
||||
point.setRegion_code("GTPHC");
|
||||
point.setRegion_name("钢托盘缓存区域");
|
||||
point.setPoint_status("1");
|
||||
point.setCan_vehicle_type("2");
|
||||
point.setVehicle_max_qty(1);
|
||||
point.setBlock_num(1);
|
||||
point.setRow_num(i);
|
||||
point.setCol_num(j);
|
||||
point.setLayer_num(k);
|
||||
point.setIn_order_seq(count);
|
||||
point.setOut_order_seq(count);
|
||||
point.setIn_empty_seq(count);
|
||||
point.setOut_empty_seq(count);
|
||||
point.setParent_point_code(code);
|
||||
point.setCreate_id("1");
|
||||
point.setCreate_name("管理员");
|
||||
point.setCreate_time(DateUtil.now());
|
||||
point.setIs_has_workder(false);
|
||||
point.setIs_auto(true);
|
||||
point.setIs_used(true);
|
||||
pointList.add(point);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
pointService.saveBatch(pointList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package org.nl.task;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.util.test.mapper.TestMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 单元测试
|
||||
* @Date: 2023/5/19
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class MapperTest {
|
||||
@Autowired
|
||||
private TestMapper testMapper;
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: List<HashMap<String, Object>> 等同于JSONArray
|
||||
* 定义resultMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper() {
|
||||
List<HashMap<String, Object>> all = testMapper.getAll();
|
||||
System.out.println(all);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: JSONObject
|
||||
* 定义resultMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper2() {
|
||||
JSONObject all2 = testMapper.getAll2();
|
||||
System.out.println(all2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: List<JSONObject> 等同JSONArray
|
||||
* 定义resultMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper3() {
|
||||
List<JSONObject> all3 = testMapper.getAll3();
|
||||
System.out.println(all3);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: JSONArray
|
||||
* 每条记录类型: JSONObject
|
||||
* 定义resultMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper4() {
|
||||
JSONArray all4 = testMapper.getAll4();
|
||||
System.out.println(all4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: JSONArray
|
||||
* 每条记录类型: HashMap
|
||||
* 定义resultMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper5() {
|
||||
JSONArray all5 = testMapper.getAll5();
|
||||
System.out.println(all5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: HashMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper6() {
|
||||
HashMap<String, Object> all6 = testMapper.getAll6();
|
||||
System.out.println("结果集:" + all6);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: JSONObject
|
||||
*/
|
||||
@Test
|
||||
void testMapper7() {
|
||||
JSONObject all7 = testMapper.getAll7();
|
||||
System.out.println("结果集:" + all7);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: JSONArray
|
||||
* 每条记录类型: JSONObject
|
||||
*/
|
||||
@Test
|
||||
void testMapper8() {
|
||||
JSONArray all8 = testMapper.getAll8();
|
||||
System.out.println("结果集:" + all8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参查询
|
||||
* 返回类型: JSONArray
|
||||
* 每条记录类型: HashMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper9() {
|
||||
JSONArray all9 = testMapper.getAll9();
|
||||
System.out.println("结果集:" + all9);
|
||||
}
|
||||
|
||||
/**
|
||||
* 含参查询
|
||||
* 返回类型: JSONObject
|
||||
* 传参类型: HashMap
|
||||
*/
|
||||
@Test
|
||||
void testMapper10() {
|
||||
JSONObject all10 = testMapper.getAll10(MapOf.of("pointCode", "HNJ01"));
|
||||
System.out.println("结果集:" + all10);
|
||||
}
|
||||
|
||||
/**
|
||||
* 含参查询
|
||||
* 返回类型: JSONObject
|
||||
* 传参类型: JSONObject
|
||||
*/
|
||||
@Test
|
||||
void testMapper11() {
|
||||
//
|
||||
JSONObject json=new JSONObject();
|
||||
// json.put("pointCode","HNJ01");
|
||||
JSONArray all11 = testMapper.getAll11(json);
|
||||
System.out.println("结果集:" + all11);
|
||||
}
|
||||
|
||||
/**
|
||||
* mybatis - for的写法 - 使用于IN查询
|
||||
*/
|
||||
@Test
|
||||
void testMapper12() {
|
||||
List<String> list = Arrays.asList("HNJ01", "KLHJ02");
|
||||
// List<String> list = new ArrayList<>();
|
||||
JSONArray all12 = testMapper.getAll12(list);
|
||||
System.out.println("结果集:" + all12);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMapper13() {
|
||||
SchBasePoint bcphj01 = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, "BCPHJ01"));
|
||||
String s = JSON.toJSONString(bcphj01);
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
jsonObject.put("point_name", "测试");
|
||||
testMapper.updateByObject(jsonObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user