This commit is contained in:
张江玮
2023-02-22 17:30:28 +08:00
parent 9b95d60d87
commit 1451500dbf
43 changed files with 2086 additions and 253 deletions

View File

@@ -103,13 +103,23 @@ public class PadController {
/**
* 查询物料
*
* @return 所有物料
* @param param String device_id 点位标识
* @return 点位可以选择的物料
*/
@PostMapping("/matrial")
@Log("查询物料")
@ApiOperation("查询物料")
public ResponseEntity<JSONObject> material() {
return new ResponseEntity<>(padService.material(), HttpStatus.OK);
public ResponseEntity<JSONObject> material(@RequestBody JSONObject param) {
// 参数校验
String point_id = param.getString("device_id");
if (StrUtil.isEmpty(point_id)) {
JSONObject resultJSON = new JSONObject();
resultJSON.put("code", "0");
resultJSON.put("desc", "点位不能为空");
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
}
return new ResponseEntity<>(padService.material(point_id), HttpStatus.OK);
}
/**

View File

@@ -41,9 +41,10 @@ public interface PadService {
/**
* 查询物料
*
* @return 所有物料
* @param point_id 点位标识
* @return 点位可以选择的物料
*/
JSONObject material();
JSONObject material(String point_id);
/**
* 点位状态绑定

View File

@@ -179,15 +179,22 @@ public class PadServiceImpl implements PadService {
/**
* 查询物料
*
* @return 所有物料
* @param point_id 点位标识
* @return 点位可以选择的物料
*/
@Override
public JSONObject material() {
public JSONObject material(String point_id) {
// 返回值
JSONObject resultJSON = new JSONObject();
// 查询物料
resultJSON.put("result", WQL.getWO("PAD").addParam("flag", "3").process().getResultJSONArray(0));
resultJSON.put("result",
WQL
.getWO("PAD")
.addParam("flag", "3")
.addParam("point_id", point_id)
.process()
.getResultJSONArray(0));
// 返回
resultJSON.put("code", "1");

View File

@@ -15,6 +15,7 @@
#################################################
输入.flag TYPEAS s_string
输入.region_id TYPEAS s_string
输入.point_id TYPEAS s_string
输入.lock_type TYPEAS s_string
输入.col TYPEAS s_string
@@ -86,12 +87,15 @@
IF 输入.flag = "3"
QUERY
SELECT
`value`,
label
dd.label,
dd.`value`
FROM
sys_dict_detail
sch_base_point point
LEFT JOIN sch_base_point_material pm ON point.point_id = pm.point_id
LEFT JOIN sys_dict_detail dd ON pm.material = dd.`value`
AND dd.`name` = 'material_type'
WHERE
`name` = 'current_material_type'
point.point_id = 输入.point_id
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -43,7 +43,7 @@ public class PointController {
@Log("新增点位")
@ApiOperation("新增点位")
//@PreAuthorize("@el.check('point:add')")
public ResponseEntity<Object> create(@Validated @RequestBody PointDto dto) {
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject dto) {
pointService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@@ -52,7 +52,7 @@ public class PointController {
@Log("修改点位")
@ApiOperation("修改点位")
//@PreAuthorize("@el.check('point:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody PointDto dto) {
public ResponseEntity<Object> updatePoint(@Validated @RequestBody JSONObject dto) {
pointService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

View File

@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.wms.sch.service.dto.PointDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
@@ -22,21 +21,21 @@ public interface PointService {
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
Map<String,Object> queryAll(Map<String, Object> whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<PointDto>
*/
List<PointDto> queryAll(Map whereJson);
JSONArray queryAll(Map whereJson);
/**
* 根据ID查询
* @param point_id ID
* @return Point
*/
PointDto findById(Long point_id);
JSONObject findById(Long point_id);
/**
* 根据编码查询
@@ -50,13 +49,13 @@ public interface PointService {
* 创建
* @param dto /
*/
void create(PointDto dto);
void create(JSONObject dto);
/**
* 编辑
* @param dto /
*/
void update(PointDto dto);
void update(JSONObject dto);
/**
* 多选删除

View File

@@ -131,11 +131,6 @@ public class PointDto implements Serializable {
*/
private String material_code;
/**
* 物料类型
*/
private String material_type;
/**
* 上一区域id
*/

View File

@@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mchange.lang.DoubleUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.exception.BadRequestException;
@@ -25,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author ldjun
@@ -36,8 +36,8 @@ import java.util.Map;
@Slf4j
public class PointServiceImpl implements PointService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
HashMap map = new HashMap();
public Map<String, Object> queryAll(Map<String, Object> whereJson, Pageable page) {
HashMap<String, Object> map = new HashMap<>();
map.put("flag", "1");
map.put("region_id", whereJson.get("region_id"));
map.put("ids", whereJson.get("ids"));
@@ -46,27 +46,34 @@ public class PointServiceImpl implements PointService {
map.put("is_used", whereJson.get("is_used"));
map.put("point_type", whereJson.get("point_type"));
map.put("name", whereJson.get("name"));
JSONObject json = WQL.getWO("QSCH_BASE_POINT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
return json;
}
JSONObject result = WQL.getWO("QSCH_BASE_POINT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
@Override
public List<PointDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
JSONArray arr = wo.query().getResultJSONArray(0);
List<PointDto> list = arr.toJavaList(PointDto.class);
return list;
}
@Override
public PointDto findById(Long point_id) {
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
JSONObject json = wo.query("point_id =" + point_id + "").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(PointDto.class);
JSONArray content = result.getJSONArray("content");
WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
for (Object o : content) {
JSONObject point = (JSONObject) o;
List<String> material_type = pm_table
.query("point_id = " + point.getString("point_id"))
.getResultJSONArray(0)
.stream()
.map(pm -> ((JSONObject) pm).getString("material"))
.collect(Collectors.toList());
point.put("material_type", material_type);
}
final PointDto obj = json.toJavaObject(PointDto.class);
return obj;
return result;
}
@Override
public JSONArray queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
return wo.query().getResultJSONArray(0);
}
@Override
public JSONObject findById(Long point_id) {
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
return wo.query("point_id =" + point_id + "").uniqueResult(0);
}
@@ -82,103 +89,134 @@ public class PointServiceImpl implements PointService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(PointDto dto) {
public void create(JSONObject dto) {
// 参数校验
PointDto byCode = this.findByCode(dto.getPoint_code());
PointDto byCode = this.findByCode(dto.getString("point_code"));
if (ObjectUtil.isNotEmpty(byCode)) {
throw new BadRequestException("存在相同的点位编码");
}
if (!StrUtil.equals(dto.getMaterial_type(), "14")) {
int count = WQLObject.getWQLObject("sch_base_point")
.query("is_delete = '0' AND seq = " + dto.getSeq() + " AND region_id = " + dto.getRegion_id() + "'")
.getResultJSONArray(0)
.size();
if (count > 0) {
throw new BadRequestException("该区域存在相同的出入库顺序");
}
int count = WQLObject.getWQLObject("sch_base_point")
.query("is_delete = '0' AND seq = " + dto.getLong("seq") + " AND region_id = '" + dto.getString("region_id") + "'")
.getResultJSONArray(0)
.size();
if (count > 0) {
throw new BadRequestException("该区域存在相同的出入库顺序");
}
if (StrUtil.equals(dto.getPoint_status(), "00") && !StrUtil.equals(dto.getCurrent_material_type(), "14")) {
String current_material_type = dto.getString("current_material_type");
if (StrUtil.equals(dto.getString("point_status"), "00") && StrUtil.isNotBlank(current_material_type)) {
throw new BadRequestException("当前为空位但是存放物料类型不为空");
}
if (StrUtil.equals(dto.getPoint_status(), "01") && StrUtil.equals(dto.getCurrent_material_type(), "14")) {
if (StrUtil.equals(dto.getString("point_status"), "01") && StrUtil.isBlank(current_material_type)) {
throw new BadRequestException("当前为有货但是存放物料类型为空");
}
if (dto.getSeq() < 0L) {
if (dto.getLongValue("seq") < 0L) {
throw new BadRequestException("出入库顺序号不能小于0");
}
if (dto.getCol() < 0L) {
if (dto.getLongValue("col") < 0L) {
throw new BadRequestException("排号不能小于0");
}
JSONObject colPoint = WQLObject.getWQLObject("sch_base_point").query("region_id = '" + dto.getRegion_id() + "' AND col = " + dto.getCol()).uniqueResult(0);
if (ObjectUtil.isNotEmpty(colPoint) && !StrUtil.equals(colPoint.getString("material_type"), dto.getMaterial_type())) {
throw new BadRequestException("当前排不能限定这种物料");
}
if (!StrUtil.equals(dto.getCurrent_material_type(), "14")
&& !StrUtil.equals(dto.getMaterial_type(), "14")
&& !StrUtil.equals(dto.getMaterial_type(), dto.getCurrent_material_type())) {
throw new BadRequestException("当前存放物料与限定物料不一致");
List<String> material_types = dto.getJSONArray("material_type").stream().map(Object::toString).collect(Collectors.toList());
if (StrUtil.isNotBlank(current_material_type) && !material_types.contains(current_material_type)) {
throw new BadRequestException("该点位不能存放这种物料");
}
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
dto.setPoint_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
long point_id = IdUtil.createSnowflake(1L, 1L).nextId();
JSONObject pm = new JSONObject();
pm.put("point_id", point_id);
for (String material_type : material_types) {
pm.put("pm_id", IdUtil.getSnowflake(1L, 1L).nextId());
pm.put("material", material_type);
pm_table.insert(pm);
}
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
JSONObject point = new JSONObject();
point.put("point_id", point_id);
point.put("point_code", dto.getString("point_code"));
point.put("point_name", dto.getString("point_name"));
point.put("point_status", dto.getString("point_status"));
point.put("lock_type", dto.getString("lock_type"));
point.put("current_material_type", dto.getString("current_material_type"));
point.put("col", dto.getString("col"));
point.put("region_id", dto.getString("region_id"));
point.put("prev_region_id", dto.getString("prev_region_id"));
point.put("next_region_id", dto.getString("next_region_id"));
point.put("seq", dto.getString("seq"));
point.put("remark", dto.getString("remark"));
point.put("create_id", SecurityUtils.getCurrentUserId());
point.put("create_name", SecurityUtils.getNickName());
point.put("create_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_point").insert(point);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PointDto dto) {
Long pointId = dto.getPoint_id();
PointDto entity = this.findById(pointId);
public void update(JSONObject dto) {
Long point_id = dto.getLong("point_id");
JSONObject entity = this.findById(point_id);
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
// 参数校验
PointDto byCode = this.findByCode(dto.getPoint_code());
if (!byCode.getPoint_id().equals(pointId)) {
PointDto byCode = this.findByCode(dto.getString("point_code"));
if (!byCode.getPoint_id().equals(point_id)) {
throw new BadRequestException("该点位编码已被其他点位占用");
}
if (!StrUtil.equals(dto.getMaterial_type(), "14")) {
int count = WQLObject.getWQLObject("sch_base_point")
.query("is_delete = '0' AND seq = " + dto.getSeq() + " AND region_id = " + dto.getRegion_id() + " AND point_id <> " + pointId)
.getResultJSONArray(0)
.size();
if (count > 0) {
throw new BadRequestException("该区域的其他点位中存在相同的出入库顺序");
}
int count = WQLObject.getWQLObject("sch_base_point")
.query("is_delete = '0' AND seq = " + dto.getString("seq") + " AND region_id = " + dto.getLongValue("region_id") + " AND point_id <> " + point_id)
.getResultJSONArray(0)
.size();
if (count > 0) {
throw new BadRequestException("该区域的其他点位中存在相同的出入库顺序");
}
if (StrUtil.equals(dto.getPoint_status(), "00") && !StrUtil.equals(dto.getCurrent_material_type(), "14")) {
String current_material_type = dto.getString("current_material_type");
if (StrUtil.equals(dto.getString("point_status"), "00") && StrUtil.isNotBlank(current_material_type)) {
throw new BadRequestException("当前为空位但是存放物料类型不为空");
}
if (StrUtil.equals(dto.getPoint_status(), "01") && StrUtil.equals(dto.getCurrent_material_type(), "14")) {
if (StrUtil.equals(dto.getString("point_status"), "01") && StrUtil.isBlank(current_material_type)) {
throw new BadRequestException("当前为有货但是存放物料类型为空");
}
if (!StrUtil.equals(dto.getMaterial_type(), "14") && StrUtil.equals(dto.getCurrent_material_type(), dto.getMaterial_type())) {
throw new BadRequestException("当前存放物料类型与限定物料类型不一致");
if (dto.getLongValue("seq") < 0L) {
throw new BadRequestException("出入库顺序号不能小于0");
}
if (dto.getLongValue("col") < 0L) {
throw new BadRequestException("排号不能小于0");
}
List<String> material_types = dto.getJSONArray("material_type").stream().map(Object::toString).collect(Collectors.toList());
if (StrUtil.isNotBlank(current_material_type) && !material_types.contains(current_material_type)) {
throw new BadRequestException("该点位不能存放这种物料");
}
WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
pm_table.delete("point_id = " + point_id);
JSONObject pm = new JSONObject();
pm.put("point_id", point_id);
for (String material_type : material_types) {
pm.put("pm_id", IdUtil.getSnowflake(1L, 1L).nextId());
pm.put("material", material_type);
pm_table.insert(pm);
}
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
JSONObject point = new JSONObject();
point.put("point_code", dto.getString("point_code"));
point.put("point_name", dto.getString("point_name"));
point.put("point_status", dto.getString("point_status"));
point.put("lock_type", dto.getString("lock_type"));
point.put("current_material_type", dto.getString("current_material_type"));
point.put("col", dto.getString("col"));
point.put("region_id", dto.getString("region_id"));
point.put("prev_region_id", dto.getString("prev_region_id"));
point.put("next_region_id", dto.getString("next_region_id"));
point.put("seq", dto.getString("seq"));
point.put("remark", dto.getString("remark"));
point.put("update_optid", SecurityUtils.getCurrentUserId());
point.put("update_optname", SecurityUtils.getNickName());
point.put("update_time", DateUtil.now());
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
WQLObject
.getWQLObject("sch_base_point")
.update(point, "point_id = " + point_id);
}

View File

@@ -82,10 +82,8 @@
point.next_region_id,
prev_region.region_name AS prev_region_name,
next_region.region_name AS next_region_name,
d5.label AS material_type_name,
point.seq,
d6.label AS current_material_type_name,
point.material_type,
point.current_material_type,
point.col
FROM
@@ -96,7 +94,6 @@
LEFT JOIN sys_dict_detail d4 ON point.point_status = d4.value and d4.name='sch_point_status'
LEFT JOIN SCH_BASE_Region prev_region ON point.prev_region_id = prev_region.region_id
LEFT JOIN SCH_BASE_Region next_region ON point.next_region_id = next_region.region_id
LEFT JOIN sys_dict_detail d5 ON point.material_type = d5.`value` AND d5.`name` = 'material_type'
LEFT JOIN sys_dict_detail d6 ON point.current_material_type = d6.`value` AND d6.`name` = 'current_material_type'
WHERE
point.is_delete = '0'

View File

@@ -8,12 +8,16 @@ import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
* 徐工叫料任务类
*
@@ -25,8 +29,6 @@ import org.springframework.transaction.annotation.Transactional;
@Slf4j
public class CallTask extends AbstractAcsTask {
private final SendTask sendTask = new SendTask();
/**
* 更新任务状态
*
@@ -36,7 +38,7 @@ public class CallTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
@Override
public void updateTaskStatus(JSONObject taskJSON, String status) {
sendTask.updateTaskStatus(taskJSON, status);
SpringContextHolder.getBean(SendTask.class).updateTaskStatus(taskJSON, status);
}
@Override
@@ -60,12 +62,7 @@ public class CallTask extends AbstractAcsTask {
@Override
public String createTask(JSONObject param) {
String nextPointCode = param.getString("next_point_code");
String materialType = param.getString("material_type");
// 判断呼叫的物料类型
if (StrUtil.equals(materialType, "14")) {
throw new BadRequestException("不能呼叫空物料");
}
String materialType = param.getString("call_material_type");
// 判断点位是否存在
JSONObject nextPoint = WQLObject
@@ -83,8 +80,14 @@ public class CallTask extends AbstractAcsTask {
}
// 判断叫的物料是否为点位的限定物料
String nextPointMaterialType = nextPoint.getString("material_type");
if (!StrUtil.equals(nextPointMaterialType, "14") && !StrUtil.equals(nextPointMaterialType, materialType)) {
List<String> materialTypes = WQLObject
.getWQLObject("sch_base_point_material")
.query("point_id = " + nextPoint.getLong("point_id"))
.getResultJSONArray(0)
.stream()
.map(o -> ((JSONObject) o).getString("material"))
.collect(Collectors.toList());
if (!materialTypes.contains(materialType)) {
throw new BadRequestException("该点位不能呼叫这种物料");
}
@@ -98,10 +101,7 @@ public class CallTask extends AbstractAcsTask {
throw new BadRequestException("该点位不是空位");
}
// 起点
JSONObject startPoint = null;
// 查询该区域存放此物料的排
// 查询叫料区域存放此物料的排
JSONArray colArray = WQL
.getWO("SEND_TASK")
.addParam("flag", "2")
@@ -111,9 +111,10 @@ public class CallTask extends AbstractAcsTask {
.getResultJSONArray(0);
// 遍历该区域存放此物料的排寻找合适的点位
JSONObject startPoint = null;
for (Object o : colArray) {
// 查找该排有货 或 已锁定的点位(出入库顺序降序)
startPoint = WQL
JSONObject tempPoint = WQL
.getWO("SEND_TASK")
.addParam("flag", "3")
.addParam("region_id", startRegionId)
@@ -122,19 +123,17 @@ public class CallTask extends AbstractAcsTask {
.uniqueResult(0);
// 点位不为空 且 点位未锁定,则为合适的叫料点位
if (ObjectUtil.isNotEmpty(startPoint) && StrUtil.equals(startPoint.getString("lock_type"), "00")) {
if (ObjectUtil.isNotEmpty(tempPoint) && StrUtil.equals(tempPoint.getString("lock_type"), "00")) {
startPoint = tempPoint;
break;
}
// 如果不合适重置为null
startPoint = null;
}
if (ObjectUtil.isEmpty(startPoint)) {
throw new BadRequestException("未找到合适的叫料点位");
}
assert startPoint != null;
return sendTask.createTaskRelated(
return SpringContextHolder.getBean(SendTask.class).createTaskRelated(
startPoint,
nextPoint,
param,
@@ -151,7 +150,7 @@ public class CallTask extends AbstractAcsTask {
*/
@Override
public void forceFinish(String task_id) {
sendTask.forceFinish(task_id);
SpringContextHolder.getBean(SendTask.class).forceFinish(task_id);
}
@Override

View File

@@ -194,32 +194,16 @@ public class SendTask extends AbstractAcsTask {
throw new BadRequestException("该点位是空位");
}
// 如果起点是大吨位装配线下线区这根据物料类型给终点
// 查送料点位(出入库顺序升序)
JSONObject nextPoint;
String startRegionId = startPoint.getString("region_id");
String currentMaterialType = startPoint.getString("current_material_type");
if (StrUtil.equals(startRegionId, "1578917189698850816") || StrUtil.equals(startRegionId, "1578917627470942208")) {
String nextPointCode = null;
if (StrUtil.equals(currentMaterialType, "08")) {
nextPointCode = "TZSXDCP1";
}
if (StrUtil.equals(currentMaterialType, "09")) {
nextPointCode = "TZSXDCP2";
}
nextPoint = WQLObject
.getWQLObject("sch_base_point")
.query("is_delete = '0' AND is_used = '1' AND point_code = '" + nextPointCode + "'")
.uniqueResult(0);
} else {
// 查送料点位(出入库顺序升序)
nextPoint = WQL
.getWO("SEND_TASK")
.addParam("flag", "1")
.addParam("region_id", nextRegionId)
.addParam("material_type", currentMaterialType)
.process()
.uniqueResult(0);
}
nextPoint = WQL
.getWO("SEND_TASK")
.addParam("flag", "1")
.addParam("region_id", nextRegionId)
.addParam("material_type", currentMaterialType)
.process()
.uniqueResult(0);
if (ObjectUtil.isEmpty(nextPoint)) {
throw new BadRequestException("未找到合适的送料点位");
}

View File

@@ -45,17 +45,18 @@
SELECT
*
FROM
sch_base_point
sch_base_point point
LEFT JOIN sch_base_point_material pm ON point.point_id = pm.point_id
WHERE
point_status = '00'
AND lock_type = '00'
AND is_delete = '0'
AND is_used = '1'
point.point_status = '00'
AND point.lock_type = '00'
AND point.is_delete = '0'
AND point.is_used = '1'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
point.region_id = 输入.region_id
ENDOPTION
OPTION 输入.material_type <> ""
material_type = 输入.material_type
pm.material = 输入.material_type
ENDOPTION
ORDER BY
seq ASC
@@ -66,17 +67,18 @@
IF 输入.flag = "2"
QUERY
SELECT DISTINCT
col
point.col
FROM
`sch_base_point`
`sch_base_point` point
LEFT JOIN sch_base_point_material pm ON point.point_id = pm.point_id
WHERE
is_delete = '0'
AND is_used = '1'
point.is_delete = '0'
AND point.is_used = '1'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
point.region_id = 输入.region_id
ENDOPTION
OPTION 输入.material_type <> ""
material_type = 输入.material_type
pm.material = 输入.material_type
ENDOPTION
ORDER BY
col

View File

@@ -3,13 +3,16 @@ package org.nl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nl.utils.SecurityUtils;
import org.nl.wms.sch.service.dto.PointDto;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@@ -17,40 +20,48 @@ public class PointTest {
@Test
public void test01() {
for (int i = 0; i < 21; i++) {
int nameSeq = i + 1;
PointDto point = new PointDto();
point.setMaterial_type("10");
if (nameSeq < 10) {
point.setPoint_code("XCPM0" + nameSeq);
} else {
point.setPoint_code("XCPM" + nameSeq);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
// JSONObject point = new JSONObject();
// point.put("region_id", "1628275194667864064");
// point.put("point_type", "00");
// point.put("point_status", "00");
// point.put("lock_type", "00");
// point.put("is_used", "1");
// point.put("is_delete", "0");
// String now = DateUtil.now();
// point.put("create_id", 1);
// point.put("create_name", "管理员");
// point.put("create_time", now);
// point.put("update_optid", 1);
// point.put("update_optname", "管理员");
// point.put("update_time", now);
// point.put("current_material_type", "14");
//
// int seq = 0;
// for (int i = 1; i < 6; i++) {
// for (int j = 1; j < 6; j++) {
// point.put("point_id", IdUtil.createSnowflake(1L, 1L).nextId());
// point.put("point_code", "HC" + i + "-0" + j + "-01");
// point.put("point_name", "缓存周转区" + i + "排" + j + "列");
// point.put("seq", ++seq);
// point.put("col", i);
// point.put("seq_num", ((i - 1) * 10) + j);
// point_table.insert(point);
// }
// }
JSONArray points = point_table
.query("region_id = 1628275194667864064")
.getResultJSONArray(0);
WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
JSONObject pm = new JSONObject();
String[] materials = new String[]{"08", "09", "10", "11", "12", "13"};
for (Object o : points) {
pm.put("point_id", ((JSONObject) o).getLongValue("point_id"));
for (String material : materials) {
pm.put("pm_id", IdUtil.getSnowflake(1L, 1L).nextId());
pm.put("material", material);
pm_table.insert(pm);
}
point.setPoint_name("小吨位成品满框" + nameSeq + "号位");
//---------------------------------------------------------------------------------------------------------
point.setRegion_id(1578915492142387200L);
//---------------------------------------------------------------------------------------------------------
point.setSeq((long) i);
point.setPoint_status("00");
point.setPoint_type("00");
point.setLock_type("00");
Long currentUserId = 1L;
String nickName = "管理员";
String now = DateUtil.now();
point.setPoint_id(IdUtil.getSnowflake(1, 1).nextId());
point.setCreate_id(currentUserId);
point.setCreate_name(nickName);
point.setUpdate_optid(currentUserId);
point.setUpdate_optname(nickName);
point.setUpdate_time(now);
point.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(point));
wo.insert(json);
}
}
}