add: lms初版

This commit is contained in:
2023-06-21 19:30:10 +08:00
parent 832d9579f2
commit 88ebea44a4
50 changed files with 2469 additions and 159 deletions

View File

@@ -1,10 +1,16 @@
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.yz.mapper.YZMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
/**
* @Author: lyd
* @Description: 单元测试
@@ -14,8 +20,16 @@ import org.springframework.boot.test.context.SpringBootTest;
public class ApplicationTest {
@Autowired
private ISysUserService userService;
@Autowired
private YZMapper 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);
}
}

View File

@@ -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);
}
}

View File

@@ -1,14 +1,17 @@
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.task_manage.task.tasks.mapper.TestMapper;
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.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -23,6 +26,9 @@ public class MapperTest {
@Autowired
private TestMapper testMapper;
@Autowired
private ISchBasePointService pointService;
/**
* 无参查询
* 返回类型: List<HashMap<String, Object>> 等同于JSONArray
@@ -157,4 +163,13 @@ public class MapperTest {
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);
}
}