项目完善
This commit is contained in:
@@ -203,4 +203,72 @@ public class PadController {
|
||||
|
||||
return new ResponseEntity<>(padService.send(startPointCode), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该区域已锁定或未锁定的排号
|
||||
*
|
||||
* @param param String region_id 区域id
|
||||
* String type 类型 0-未锁定 1-已锁定
|
||||
* @return 该区域已锁定或未锁定的排号
|
||||
*/
|
||||
@PostMapping("/row")
|
||||
@Log("查询该区域已锁定或未锁定的排号")
|
||||
@ApiOperation("查询该区域已锁定或未锁定的排号")
|
||||
public ResponseEntity<JSONObject> row(@RequestBody JSONObject param) {
|
||||
// 参数校验
|
||||
String regionId = param.getString("region_id");
|
||||
if (StrUtil.isEmpty(regionId)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "区域不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
String type = param.getString("type");
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "类型不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(padService.row(regionId, type), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定排或解锁排
|
||||
*
|
||||
* @param param String region_id 区域id
|
||||
* String col 排号
|
||||
* String type 操作类型 0-锁定 1-解锁
|
||||
* @return 提示
|
||||
*/
|
||||
@PostMapping("/lockrow")
|
||||
@Log("锁定排或解锁排")
|
||||
@ApiOperation("锁定排或解锁排")
|
||||
public ResponseEntity<JSONObject> lockRow(@RequestBody JSONObject param) {
|
||||
// 参数校验
|
||||
String regionId = param.getString("region_id");
|
||||
if (StrUtil.isEmpty(regionId)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "区域不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
String col = param.getString("col");
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "排号不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
String type = param.getString("type");
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "操作类型不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(padService.lockRow(regionId, col, type), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,4 +71,23 @@ public interface PadService {
|
||||
* @return 提示
|
||||
*/
|
||||
JSONObject send(String startPointCode);
|
||||
|
||||
/**
|
||||
* 查询该区域已锁定或未锁定的排号
|
||||
*
|
||||
* @param regionId 区域id
|
||||
* @param type 类型 0-未锁定 1-已锁定
|
||||
* @return 该区域已锁定或未锁定的排号
|
||||
*/
|
||||
JSONObject row(String regionId, String type);
|
||||
|
||||
/**
|
||||
* 锁定排或解锁排
|
||||
*
|
||||
* @param regionId 区域id
|
||||
* @param col 排号
|
||||
* @param type 操作类型 0-锁定 1-解锁
|
||||
* @return 提示
|
||||
*/
|
||||
JSONObject lockRow(String regionId, String col, String type);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,14 @@ public class PadServiceImpl implements PadService {
|
||||
|
||||
private final SendTask sendTask;
|
||||
|
||||
/**
|
||||
* 手持登陆
|
||||
*
|
||||
* @param user 用户名
|
||||
* @param password 密码
|
||||
* @param request 本次请求
|
||||
* @return 登陆成功将携带用户id和token返回
|
||||
*/
|
||||
@Override
|
||||
public JSONObject login(String user, String password, HttpServletRequest request) {
|
||||
// 返回值
|
||||
@@ -97,10 +105,9 @@ public class PadServiceImpl implements PadService {
|
||||
Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
String token = tokenProvider.createToken(authentication);
|
||||
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
|
||||
|
||||
// 保存在线信息
|
||||
onlineUserService.save(jwtUserDto, token, request);
|
||||
onlineUserService.save((JwtUserDto) authentication.getPrincipal(), token, request);
|
||||
|
||||
// 返回
|
||||
resultJSON.put("code", "1");
|
||||
@@ -113,6 +120,11 @@ public class PadServiceImpl implements PadService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有区域信息
|
||||
*
|
||||
* @return 所有区域信息
|
||||
*/
|
||||
@Override
|
||||
public JSONObject region() {
|
||||
// 返回值
|
||||
@@ -127,6 +139,12 @@ public class PadServiceImpl implements PadService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区域查询点位
|
||||
*
|
||||
* @param regionId 区域id
|
||||
* @return 该区域下的所有点位
|
||||
*/
|
||||
@Override
|
||||
public JSONObject point(String regionId) {
|
||||
// 返回值
|
||||
@@ -144,7 +162,7 @@ public class PadServiceImpl implements PadService {
|
||||
for (Object o : result) {
|
||||
JSONObject point = (JSONObject) o;
|
||||
|
||||
// 如果点位已锁定,则为有任务,status为2,status_name为有任务
|
||||
// 如果锁定类型为 01,则为有任务,status为2,status_name为有任务
|
||||
if (StrUtil.equals(point.getString("lock_type"), "01")) {
|
||||
point.put("status", "2");
|
||||
point.put("status_name", "有任务");
|
||||
@@ -158,6 +176,11 @@ public class PadServiceImpl implements PadService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料
|
||||
*
|
||||
* @return 所有物料
|
||||
*/
|
||||
@Override
|
||||
public JSONObject material() {
|
||||
// 返回值
|
||||
@@ -172,6 +195,14 @@ public class PadServiceImpl implements PadService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 点位状态绑定
|
||||
*
|
||||
* @param type 操作类型
|
||||
* @param pointCode 点位编码
|
||||
* @param materialType 物料类型
|
||||
* @return 提示
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public JSONObject bindPoint(String type, String pointCode, String materialType) {
|
||||
@@ -192,7 +223,7 @@ public class PadServiceImpl implements PadService {
|
||||
// 判断是否已被锁定
|
||||
if (StrUtil.equals(point.getString("lock_type"), "01")) {
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "该点位已被锁定");
|
||||
resultJSON.put("desc", "该点位存在任务");
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
@@ -233,6 +264,13 @@ public class PadServiceImpl implements PadService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 叫料(确定终点)
|
||||
*
|
||||
* @param nextPointCode 终点编码
|
||||
* @param materialType 物料类型
|
||||
* @return 提示
|
||||
*/
|
||||
@Override
|
||||
public JSONObject call(String nextPointCode, String materialType) {
|
||||
// 返回值
|
||||
@@ -256,6 +294,12 @@ public class PadServiceImpl implements PadService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 送料(确定起点)
|
||||
*
|
||||
* @param startPointCode 起点编码
|
||||
* @return 提示
|
||||
*/
|
||||
@Override
|
||||
public JSONObject send(String startPointCode) {
|
||||
// 返回值
|
||||
@@ -277,4 +321,95 @@ public class PadServiceImpl implements PadService {
|
||||
resultJSON.put("desc", "已创建任务");
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该区域已锁定或未锁定的排号
|
||||
*
|
||||
* @param regionId 区域id
|
||||
* @param type 类型 0-未锁定 1-已锁定
|
||||
* @return 该区域已锁定或未锁定的排号
|
||||
*/
|
||||
@Override
|
||||
public JSONObject row(String regionId, String type) {
|
||||
// 返回值
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
|
||||
// 根据操作类型做不同的操作
|
||||
JSONArray result = new JSONArray();
|
||||
switch (type) {
|
||||
case "0":
|
||||
// 未锁定
|
||||
result = WQL
|
||||
.getWO("PAD")
|
||||
.addParam("flag", "4")
|
||||
.addParam("region_id", regionId)
|
||||
.addParam("lock_type", "00")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
break;
|
||||
case "1":
|
||||
// 已锁定
|
||||
result = WQL
|
||||
.getWO("PAD")
|
||||
.addParam("flag", "4")
|
||||
.addParam("region_id", regionId)
|
||||
.addParam("lock_type", "02")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
}
|
||||
|
||||
// 返回
|
||||
resultJSON.put("code", "1");
|
||||
resultJSON.put("desc", "查询成功");
|
||||
resultJSON.put("result", result);
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定排或解锁排
|
||||
*
|
||||
* @param regionId 区域id
|
||||
* @param col 排号
|
||||
* @param type 操作类型 0-锁定 1-解锁
|
||||
* @return 提示
|
||||
*/
|
||||
@Override
|
||||
public JSONObject lockRow(String regionId, String col, String type) {
|
||||
// 返回值
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
|
||||
// 先查询该排有没有被任务锁的点位
|
||||
JSONObject lockPoint = WQL
|
||||
.getWO("PAD")
|
||||
.addParam("flag", "5")
|
||||
.addParam("region_id", regionId)
|
||||
.addParam("col", col)
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(lockPoint)) {
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "该排有点位存在任务");
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
// 根据操作类型做不同操作
|
||||
JSONObject rowStatus = new JSONObject();
|
||||
switch (type) {
|
||||
case "0":
|
||||
// 锁定
|
||||
rowStatus.put("lock_type", "02");
|
||||
break;
|
||||
case "1":
|
||||
// 解锁
|
||||
rowStatus.put("lock_type", "00");
|
||||
}
|
||||
WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.update(rowStatus, "is_delete = '0' AND is_used = '1' AND region_id = '" + regionId + "' AND col = " + col);
|
||||
|
||||
// 返回
|
||||
resultJSON.put("code", "1");
|
||||
resultJSON.put("desc", "操作成功");
|
||||
return resultJSON;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.region_id TYPEAS s_string
|
||||
输入.lock_type TYPEAS s_string
|
||||
输入.col TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -93,3 +95,44 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
col
|
||||
FROM
|
||||
sch_base_point
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
OPTION 输入.region_id <> ""
|
||||
region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
OPTION 输入.lock_type <> ""
|
||||
lock_type = 输入.lock_type
|
||||
ENDOPTION
|
||||
ORDER BY
|
||||
col
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_point
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND lock_type = '01'
|
||||
OPTION 输入.region_id <> ""
|
||||
region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
OPTION 输入.col <> ""
|
||||
col = 输入.col
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -90,11 +90,11 @@ public class PointServiceImpl implements PointService {
|
||||
}
|
||||
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 material_type = '" + dto.getMaterial_type() + "'")
|
||||
.query("is_delete = '0' AND seq = " + dto.getSeq() + " AND region_id = " + dto.getRegion_id() + "'")
|
||||
.getResultJSONArray(0)
|
||||
.size();
|
||||
if (count > 0) {
|
||||
throw new BadRequestException("该区域存放该物料的点位中存在相同的出入库顺序");
|
||||
throw new BadRequestException("该区域存在相同的出入库顺序");
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(dto.getPoint_status(), "00") && !StrUtil.equals(dto.getCurrent_material_type(), "14")) {
|
||||
@@ -107,7 +107,16 @@ public class PointServiceImpl implements PointService {
|
||||
throw new BadRequestException("出入库顺序号不能小于0");
|
||||
}
|
||||
if (dto.getCol() < 0L) {
|
||||
throw new BadRequestException("列不能小于0");
|
||||
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("当前存放物料与限定物料不一致");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -142,11 +151,11 @@ public class PointServiceImpl implements PointService {
|
||||
}
|
||||
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 material_type = '" + dto.getMaterial_type() + "' AND point_id <> " + pointId)
|
||||
.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("该区域存放该物料的其他点位中存在相同的出入库顺序");
|
||||
throw new BadRequestException("该区域的其他点位中存在相同的出入库顺序");
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(dto.getPoint_status(), "00") && !StrUtil.equals(dto.getCurrent_material_type(), "14")) {
|
||||
|
||||
@@ -2,11 +2,14 @@ package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -23,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Slf4j
|
||||
public class CallTask extends AbstractAcsTask {
|
||||
|
||||
private final SendTask sendTask;
|
||||
private final SendTask sendTask = new SendTask();
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
@@ -34,7 +37,7 @@ public class CallTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskJSON, String status) {
|
||||
sendTask.updateTaskStatus(taskJSON, status);
|
||||
new SendTask().updateTaskStatus(taskJSON, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,6 +57,7 @@ public class CallTask extends AbstractAcsTask {
|
||||
* String material_type 物料类型
|
||||
* @return 任务id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String createTask(JSONObject param) {
|
||||
String nextPointCode = param.getString("next_point_code");
|
||||
@@ -86,7 +90,7 @@ public class CallTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
// 判断点位有没有被锁定
|
||||
if (StrUtil.equals(nextPoint.getString("lock_type"), "01")) {
|
||||
if (!StrUtil.equals(nextPoint.getString("lock_type"), "00")) {
|
||||
throw new BadRequestException("该点位已被锁定");
|
||||
}
|
||||
|
||||
@@ -96,45 +100,59 @@ public class CallTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
// 起点
|
||||
JSONObject startPoint;
|
||||
JSONObject startPoint = null;
|
||||
|
||||
// 查询该区域存放此物料一共有几排
|
||||
long colCount = WQL
|
||||
// 查询该区域存放此物料的排
|
||||
JSONArray colArray = WQL
|
||||
.getWO("SEND_TASK")
|
||||
.addParam("flag", "3")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_id", startRegionId)
|
||||
.addParam("material_type", materialType)
|
||||
.process()
|
||||
.uniqueResult(0)
|
||||
.getLongValue("col");
|
||||
|
||||
// 从第一排开始查询起点
|
||||
long currentCol = 1L;
|
||||
do {
|
||||
// 如果当前这排已经超过了总排数,说明没有找到叫料点位
|
||||
if (currentCol > colCount) {
|
||||
throw new BadRequestException("未找到合适的叫料点位");
|
||||
}
|
||||
.getResultJSONArray(0);
|
||||
|
||||
// 遍历该区域存放此物料的排寻找合适的点位
|
||||
for (Object o : colArray) {
|
||||
// 查找该排有货 或 已锁定的点位(出入库顺序降序)
|
||||
startPoint = WQL
|
||||
.getWO("SEND_TASK")
|
||||
.addParam("flag", "2")
|
||||
.addParam("flag", "3")
|
||||
.addParam("region_id", startRegionId)
|
||||
.addParam("material_type", materialType)
|
||||
.addParam("col", String.valueOf(currentCol))
|
||||
.addParam("col", ((JSONObject) o).getString("col"))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
// 如果这排不存在合适点位 或 合适点位已被锁定,进入下一排查找
|
||||
currentCol++;
|
||||
} while (ObjectUtil.isEmpty(startPoint) || StrUtil.equals(startPoint.getString("lock_type"), "01"));
|
||||
// 点位不为空 且 点位未锁定,则为合适的叫料点位
|
||||
if (ObjectUtil.isNotEmpty(startPoint) && StrUtil.equals(startPoint.getString("lock_type"), "00")) {
|
||||
break;
|
||||
}
|
||||
|
||||
return sendTask.createTaskRelated(startPoint, nextPoint, param, CallTask.class, "01", "1");
|
||||
// 如果不合适重置为null
|
||||
startPoint = null;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(startPoint)) {
|
||||
throw new BadRequestException("未找到合适的叫料点位");
|
||||
}
|
||||
|
||||
assert startPoint != null;
|
||||
return sendTask.createTaskRelated(
|
||||
startPoint,
|
||||
nextPoint,
|
||||
param,
|
||||
CallTask.class,
|
||||
"01",
|
||||
CodeUtil.getNewCode("CALL_BILL_CODE"),
|
||||
"1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @param task_id 任务标识
|
||||
*/
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
|
||||
sendTask.forceFinish(task_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -164,6 +164,7 @@ public class SendTask extends AbstractAcsTask {
|
||||
* @param param String start_point_code 点位编码
|
||||
* @return 任务id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String createTask(JSONObject param) {
|
||||
String startPointCode = param.getString("start_point_code");
|
||||
@@ -184,7 +185,7 @@ public class SendTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
// 判断点位有没有被锁定
|
||||
if (StrUtil.equals(startPoint.getString("lock_type"), "01")) {
|
||||
if (!StrUtil.equals(startPoint.getString("lock_type"), "00")) {
|
||||
throw new BadRequestException("该点位已被锁定");
|
||||
}
|
||||
|
||||
@@ -193,25 +194,59 @@ public class SendTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("该点位是空位");
|
||||
}
|
||||
|
||||
|
||||
// 查询入库点位
|
||||
JSONObject nextPoint = WQL
|
||||
.getWO("SEND_TASK")
|
||||
.addParam("flag", "1")
|
||||
.addParam("region_id", nextRegionId)
|
||||
.addParam("material_type", startPoint.getString("current_material_type"))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
// 如果起点是大吨位装配线下线区这根据物料类型给终点
|
||||
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);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextPoint)) {
|
||||
throw new BadRequestException("未找到合适的送料点位");
|
||||
}
|
||||
|
||||
return createTaskRelated(startPoint, nextPoint, param, SendTask.class, "02", "2");
|
||||
return createTaskRelated(
|
||||
startPoint,
|
||||
nextPoint,
|
||||
param,
|
||||
SendTask.class,
|
||||
"02",
|
||||
CodeUtil.getNewCode("SEND_BILL_CODE"),
|
||||
"2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
// 根据id查code
|
||||
String taskCode = WQLObject
|
||||
.getWQLObject("sch_base_task")
|
||||
.query("task_id = " + task_id)
|
||||
.uniqueResult(0)
|
||||
.getString("task_code");
|
||||
|
||||
// 调用更新任务状态逻辑
|
||||
JSONObject taskJSON = new JSONObject();
|
||||
taskJSON.put("task_code", taskCode);
|
||||
updateTaskStatus(taskJSON, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -226,17 +261,19 @@ public class SendTask extends AbstractAcsTask {
|
||||
|
||||
/**
|
||||
* 创建任务相关(创建任务、创建单据、锁定点位)
|
||||
* CallTask 和 SendTask 可用
|
||||
*
|
||||
* @param startPoint 起点
|
||||
* @param nextPoint 终点
|
||||
* @param requestParam 请求参数
|
||||
* @param handler 处理类
|
||||
* @param taskType 任务类型 字典表 name = 'SCH_TASK_TYPE'
|
||||
* @param billCode 单据编码
|
||||
* @param ioType 单据类型 字典表 name = 'io_type'
|
||||
* @return 任务id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTaskRelated(JSONObject startPoint, JSONObject nextPoint, JSONObject requestParam, Class<? extends AbstractAcsTask> handler, String taskType, String ioType) {
|
||||
public String createTaskRelated(JSONObject startPoint, JSONObject nextPoint, JSONObject requestParam, Class<? extends AbstractAcsTask> handler, String taskType, String billCode, String ioType) {
|
||||
String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String startRegionId = startPoint.getString("region_id");
|
||||
String startPointCode = startPoint.getString("point_code");
|
||||
@@ -252,7 +289,7 @@ public class SendTask extends AbstractAcsTask {
|
||||
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.put("task_type", taskType);
|
||||
task.put("acs_task_type", "1");
|
||||
task.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
task.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
task.put("start_point_code", startPointCode);
|
||||
task.put("start_area", startRegionId);
|
||||
task.put("request_param", requestParam.toJSONString());
|
||||
@@ -272,7 +309,7 @@ public class SendTask extends AbstractAcsTask {
|
||||
// 创建搬运单
|
||||
JSONObject bill = new JSONObject();
|
||||
bill.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
bill.put("bill_code", CodeUtil.getNewCode("SEND_BILL_CODE"));
|
||||
bill.put("bill_code", billCode);
|
||||
bill.put("io_type", ioType);
|
||||
bill.put("bill_status", "30");
|
||||
bill.put("start_point_code", startPointCode);
|
||||
|
||||
@@ -65,25 +65,21 @@
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
SELECT DISTINCT
|
||||
col
|
||||
FROM
|
||||
sch_base_point
|
||||
`sch_base_point`
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND ( point_status = '01' OR lock_type = '01' )
|
||||
OPTION 输入.region_id <> ""
|
||||
region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
OPTION 输入.material_type <> ""
|
||||
material_type = 输入.material_type
|
||||
ENDOPTION
|
||||
OPTION 输入.col <> ""
|
||||
col = 输入.col
|
||||
ENDOPTION
|
||||
ORDER BY
|
||||
seq DESC
|
||||
col
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -91,22 +87,21 @@
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
point.region_id,
|
||||
region.region_name,
|
||||
point.material_type,
|
||||
COUNT( DISTINCT point.col ) AS col
|
||||
*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN sch_base_region region ON point.region_id = region.region_id
|
||||
sch_base_point
|
||||
WHERE
|
||||
point.is_delete = '0'
|
||||
AND point.is_used = '1'
|
||||
OPTION 输入.region_id <> ""
|
||||
point.region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
OPTION 输入.material_type <> ""
|
||||
point.material_type = 输入.material_type
|
||||
ENDOPTION
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND (point_status = '01' OR lock_type IN ('01', '02'))
|
||||
OPTION 输入.region_id <> ""
|
||||
region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
OPTION 输入.col <> ""
|
||||
col = 输入.col
|
||||
ENDOPTION
|
||||
ORDER BY
|
||||
seq DESC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -68,8 +68,6 @@
|
||||
LEFT JOIN sch_base_point point2 ON point2.point_code = ios.end_point_code
|
||||
WHERE
|
||||
ios.is_delete = '0'
|
||||
AND ios.io_type = '0'
|
||||
|
||||
OPTION 输入.bill_code <> ""
|
||||
ios.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
|
||||
Reference in New Issue
Block a user