feat: 任务类、手持点对点
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.pda.rest;
|
package org.nl.wms.pda.rest;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -12,10 +13,7 @@ import org.nl.wms.pda.util.PdaUtils;
|
|||||||
import org.nl.wms.pda.anno.PdaAnnotation;
|
import org.nl.wms.pda.anno.PdaAnnotation;
|
||||||
import org.nl.wms.pda.service.PdaService;
|
import org.nl.wms.pda.service.PdaService;
|
||||||
import org.nl.wms.sch.task.util.TaskUtils;
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 辽宁晟华手持控制层
|
* 辽宁晟华手持控制层
|
||||||
@@ -169,17 +167,28 @@ public class PdaController {
|
|||||||
throw new BadRequestException("点位不能为空!");
|
throw new BadRequestException("点位不能为空!");
|
||||||
}
|
}
|
||||||
String vehicle_type = param.getString("vehicle_type");
|
String vehicle_type = param.getString("vehicle_type");
|
||||||
if (StrUtil.isBlank(vehicle_type)) {
|
if (StrUtil.isBlank(vehicle_type) && "3".equals(param.getString("point_status"))) {
|
||||||
throw new BadRequestException("载具类型不能为空!");
|
throw new BadRequestException("载具类型不能为空!");
|
||||||
}
|
}
|
||||||
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
|
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
|
||||||
if ("0000".equals(vehicle_code)) {
|
if ("0000".equals(vehicle_code) && "3".equals(param.getString("point_status"))) {
|
||||||
throw new BadRequestException("载具编码不能为空!");
|
throw new BadRequestException("载具编码不能为空!");
|
||||||
}
|
}
|
||||||
|
if ("1".equals(param.getString("point_status"))) {
|
||||||
|
pdaService.vehicleUnbind(point_code);
|
||||||
|
} else {
|
||||||
|
pdaService.vehicleBind(point_code, vehicle_type, vehicle_code, param.getString("point_status"));
|
||||||
|
}
|
||||||
|
|
||||||
pdaService.vehicleBind(point_code, vehicle_type, vehicle_code);
|
|
||||||
return PdaUtils.buildSuccessResultJSON(null);
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/pointStatus")
|
||||||
|
@Log("获取点位状态下拉框")
|
||||||
|
@ApiOperation("获取点位状态下拉框")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject pointStatus() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.pointStatusList());
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/vehicleUnbind")
|
@PostMapping("/vehicleUnbind")
|
||||||
@Log("载具解绑")
|
@Log("载具解绑")
|
||||||
@@ -220,4 +229,55 @@ public class PdaController {
|
|||||||
pdaService.createTask(startPointCode, endPointCode, param.toJSONString());
|
pdaService.createTask(startPointCode, endPointCode, param.toJSONString());
|
||||||
return PdaUtils.buildSuccessResultJSON(null);
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getAllPointList")
|
||||||
|
@Log("查询所有点位信息")
|
||||||
|
@ApiOperation("查询所有点位信息")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject getAllPointList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getAllPointList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getRegionPointList")
|
||||||
|
@Log("查询区域点位信息")
|
||||||
|
@ApiOperation("查询区域点位信息")
|
||||||
|
@PdaAnnotation
|
||||||
|
@SaIgnore
|
||||||
|
public JSONObject getRegionPointList(@RequestBody JSONObject param) {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getRegionPointList(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/createP2PTask")
|
||||||
|
@Log("PDA点对点任务")
|
||||||
|
@ApiOperation("PDA点对点任务")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject createP2PTask(@RequestBody JSONObject param) {
|
||||||
|
String startPointCode = param.getString("start_point_code");
|
||||||
|
if (StrUtil.isBlank(startPointCode)) {
|
||||||
|
throw new BadRequestException("起点不能为空!");
|
||||||
|
}
|
||||||
|
String endPointCode = param.getString("end_point_code");
|
||||||
|
if (StrUtil.isBlank(endPointCode)) {
|
||||||
|
throw new BadRequestException("终点不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
pdaService.createP2PTask(startPointCode, endPointCode, param.toJSONString());
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getAllRegionList")
|
||||||
|
@Log("查询所有区域下拉框信息")
|
||||||
|
@ApiOperation("查询所有区域下拉框信息")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject getAllRegionList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getAllRegionList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getPointListByRegion")
|
||||||
|
@Log("查询指定区域下的点位信息")
|
||||||
|
@ApiOperation("查询指定区域下的点位信息")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject getPointListByRegion(@RequestBody JSONObject region_code) {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getPointListByRegion(region_code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.nl.wms.pda.service;
|
package org.nl.wms.pda.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
@@ -83,8 +82,9 @@ public interface PdaService {
|
|||||||
* @param point_code 点位编码
|
* @param point_code 点位编码
|
||||||
* @param vehicle_type 载具类型
|
* @param vehicle_type 载具类型
|
||||||
* @param vehicle_code 载具编码
|
* @param vehicle_code 载具编码
|
||||||
|
* @param point_status 点位状态
|
||||||
*/
|
*/
|
||||||
void vehicleBind(String point_code, String vehicle_type, String vehicle_code);
|
void vehicleBind(String point_code, String vehicle_type, String vehicle_code, String point_status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 载具解绑
|
* 载具解绑
|
||||||
@@ -107,4 +107,44 @@ public interface PdaService {
|
|||||||
* @param endPointCode 终点点位号
|
* @param endPointCode 终点点位号
|
||||||
*/
|
*/
|
||||||
void createTask(String startPointCode, String endPointCode, String requestParam);
|
void createTask(String startPointCode, String endPointCode, String requestParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态下拉框
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray pointStatusList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有点位数据
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray getAllPointList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建pda点对点任务
|
||||||
|
* @param startPointCode 起点点位号
|
||||||
|
* @param endPointCode 终点点位号
|
||||||
|
* @param toJSONString 参数
|
||||||
|
*/
|
||||||
|
void createP2PTask(String startPointCode, String endPointCode, String toJSONString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取区域下拉框
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray getAllRegionList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定区域下的点位信息
|
||||||
|
* @param region_code 区域编码
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray getPointListByRegion(JSONObject region_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据前端传来的region_code
|
||||||
|
* @param param region_code
|
||||||
|
* @return 库存信息
|
||||||
|
*/
|
||||||
|
JSONArray getRegionPointList(JSONObject param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,14 @@ import org.nl.wms.sch.task.call.empty.HLCallEmptyTask;
|
|||||||
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask;
|
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
||||||
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
|
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
|
||||||
|
import org.nl.wms.sch.task.p2p.PDATask;
|
||||||
import org.nl.wms.sch.task.p2p.RGCDTask;
|
import org.nl.wms.sch.task.p2p.RGCDTask;
|
||||||
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
||||||
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
|
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
|
||||||
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
|
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
|
||||||
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
|
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
|
||||||
import org.nl.wms.sch.task.util.TaskUtils;
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
|
import org.nl.wms.util.MapOf;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -60,6 +62,8 @@ public class PdaServiceImpl implements PdaService {
|
|||||||
|
|
||||||
private final RGCDTask recdTask;
|
private final RGCDTask recdTask;
|
||||||
|
|
||||||
|
private final PDATask pdaTask;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray region(String func) {
|
public JSONArray region(String func) {
|
||||||
switch (func) {
|
switch (func) {
|
||||||
@@ -438,16 +442,27 @@ public class PdaServiceImpl implements PdaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void vehicleBind(String point_code, String vehicle_type, String vehicle_code) {
|
public void vehicleBind(String point_code, String vehicle_type, String vehicle_code, String point_status) {
|
||||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject point_update = new JSONObject();
|
JSONObject point_update = new JSONObject();
|
||||||
if (ObjectUtil.isNotEmpty(vd)) {
|
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||||
point_update.put("point_status", PointStatus.HAS_GOODS.value());
|
if ("2".equals(point_status)) {
|
||||||
point_update.put("vd_id", vd.getString("vd_id"));
|
// 空载具
|
||||||
|
point_update.put("vd_id", "");
|
||||||
|
// 如果存在就载具删除
|
||||||
|
if (ObjectUtil.isEmpty(vd)) {
|
||||||
|
vd.put("is_delete", "1");
|
||||||
|
TaskUtils.addCurrentUpdateColum(vd);
|
||||||
|
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(vd);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
point_update.put("point_status", PointStatus.EMPTY_VEHICLE.value());
|
// 存在组盘信息才能设置有货
|
||||||
|
if (ObjectUtil.isNotEmpty(vd)) {
|
||||||
|
point_update.put("vd_id", vd.getString("vd_id"));
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("[" + vehicle_code + "] 组盘信息不存在!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
point_update.put("point_status", point_status);
|
||||||
point_update.put("vehicle_type", vehicle_type);
|
point_update.put("vehicle_type", vehicle_type);
|
||||||
point_update.put("vehicle_code", vehicle_code);
|
point_update.put("vehicle_code", vehicle_code);
|
||||||
TaskUtils.addCurrentUpdateColum(point_update);
|
TaskUtils.addCurrentUpdateColum(point_update);
|
||||||
@@ -511,4 +526,71 @@ public class PdaServiceImpl implements PdaService {
|
|||||||
|
|
||||||
recdTask.createTask(methodParam);
|
recdTask.createTask(methodParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray pointStatusList() {
|
||||||
|
JSONArray sysDictDetail = WQLObject.getWQLObject("sys_dict_detail").query("name = 'point_status'").getResultJSONArray(0);
|
||||||
|
return sysDictDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getAllPointList() {
|
||||||
|
return WQL.getWO("PDA").addParam("flag", "4").process().getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createP2PTask(String startPointCode, String endPointCode, String toJSONString) {
|
||||||
|
JSONObject point1 = WQLObject
|
||||||
|
.getWQLObject("sch_base_point")
|
||||||
|
.query("is_used = '1' AND point_code = '" + startPointCode + "'")
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(point1)) {
|
||||||
|
throw new BadRequestException("[" + startPointCode + "] 已删除或未启用!");
|
||||||
|
}
|
||||||
|
JSONObject point2 = WQLObject
|
||||||
|
.getWQLObject("sch_base_point")
|
||||||
|
.query("is_used = '1' AND point_code = '" + endPointCode + "'")
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(point2)) {
|
||||||
|
throw new BadRequestException("[" + endPointCode + "] 已删除或未启用!");
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskUtils.pointNameIsLocked(point1);
|
||||||
|
TaskUtils.pointNameIsLocked(point2);
|
||||||
|
|
||||||
|
JSONObject methodParam = new JSONObject();
|
||||||
|
methodParam.put("point1", point1);
|
||||||
|
methodParam.put("point2", point2);
|
||||||
|
methodParam.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
methodParam.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
methodParam.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
|
||||||
|
pdaTask.createTask(methodParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getAllRegionList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "1")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getPointListByRegion(JSONObject region_code) {
|
||||||
|
return WQLObject.getWQLObject("sch_base_point")
|
||||||
|
.query("region_code = '" + region_code.getString("region_code") + "'")
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getRegionPointList(JSONObject param) {
|
||||||
|
String regionCode = param.getString("region_code");
|
||||||
|
if (ObjectUtil.isEmpty(regionCode)) {
|
||||||
|
throw new BadRequestException("区域不能为空");
|
||||||
|
}
|
||||||
|
return WQL.getWO("PDA").addParamMap(MapOf.of("flag", "5", "region_code", regionCode))
|
||||||
|
.process().getResultJSONArray(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,3 +94,59 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
p.point_name,
|
||||||
|
sd1.label AS point_status,
|
||||||
|
sd2.label AS vehicle_type,
|
||||||
|
p.region_name,
|
||||||
|
p.vehicle_code,
|
||||||
|
mm.material_id,
|
||||||
|
mm.material_name
|
||||||
|
FROM
|
||||||
|
`sch_base_point` p
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT *,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY vehicle_code, vehicle_type ORDER BY create_time DESC) AS rn
|
||||||
|
FROM st_ivt_vehicle_detail
|
||||||
|
WHERE is_delete = '0' AND vehicle_code != '0000'
|
||||||
|
) vd
|
||||||
|
ON vd.vehicle_code = p.vehicle_code AND vd.vehicle_type = p.vehicle_type AND vd.rn = 1
|
||||||
|
LEFT JOIN md_me_materialbase mm ON mm.material_id = vd.material_id
|
||||||
|
LEFT JOIN sys_dict_detail sd1 ON sd1.`name` = 'point_status' AND sd1.`value` = p.point_status
|
||||||
|
LEFT JOIN sys_dict_detail sd2 ON sd2.`name` = 'vehicle_type' AND sd2.`value` = p.vehicle_type
|
||||||
|
WHERE p.is_used = '1' AND p.region_code IN ('KLHJ','YQHJ','YHHJ')
|
||||||
|
ORDER BY
|
||||||
|
p.region_code, p.point_type, p.point_code
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
IF 输入.flag = "5"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
p.point_name,
|
||||||
|
sd1.label AS point_status,
|
||||||
|
sd2.label AS vehicle_type,
|
||||||
|
p.region_name,
|
||||||
|
p.vehicle_code,
|
||||||
|
mm.material_id,
|
||||||
|
mm.material_name
|
||||||
|
FROM
|
||||||
|
`sch_base_point` p
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT *,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY vehicle_code, vehicle_type ORDER BY create_time DESC) AS rn
|
||||||
|
FROM st_ivt_vehicle_detail
|
||||||
|
WHERE is_delete = '0' AND vehicle_code != '0000'
|
||||||
|
) vd
|
||||||
|
ON vd.vehicle_code = p.vehicle_code AND vd.vehicle_type = p.vehicle_type AND vd.rn = 1
|
||||||
|
LEFT JOIN md_me_materialbase mm ON mm.material_id = vd.material_id
|
||||||
|
LEFT JOIN sys_dict_detail sd1 ON sd1.`name` = 'point_status' AND sd1.`value` = p.point_status
|
||||||
|
LEFT JOIN sys_dict_detail sd2 ON sd2.`name` = 'vehicle_type' AND sd2.`value` = p.vehicle_type
|
||||||
|
WHERE p.is_used = '1' AND region_code = 输入.region_code
|
||||||
|
ORDER BY
|
||||||
|
p.region_code, p.point_type, p.point_code
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ public enum TaskType {
|
|||||||
CALL_MATERIAL("叫料", "2"),
|
CALL_MATERIAL("叫料", "2"),
|
||||||
SEND_EMPTY("送空", "3"),
|
SEND_EMPTY("送空", "3"),
|
||||||
CALL_EMPTY("叫空", "4"),
|
CALL_EMPTY("叫空", "4"),
|
||||||
TO_PACKAGE("去包装", "5");
|
TO_PACKAGE("去包装", "5"),
|
||||||
|
PDA_TASK("PDA任务", "6");
|
||||||
|
|
||||||
private final String label;
|
private final String label;
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class HLCallEmptyTask extends AbstractAcsTask {
|
|||||||
JSONObject work_order = form.getJSONObject("workorder");
|
JSONObject work_order = form.getJSONObject("workorder");
|
||||||
int priority = 3;
|
int priority = 3;
|
||||||
if (ObjectUtil.isNotEmpty(work_order)) {
|
if (ObjectUtil.isNotEmpty(work_order)) {
|
||||||
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 8 : 3;
|
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 7 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject task = TaskUtils.buildTask(
|
JSONObject task = TaskUtils.buildTask(
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
package org.nl.wms.sch.task.p2p;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.sch.manage.*;
|
||||||
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description: 手持点对点任务类
|
||||||
|
* @Date: 2024/1/9
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component
|
||||||
|
public class PDATask extends AbstractAcsTask {
|
||||||
|
@Override
|
||||||
|
public void updateTaskStatus(JSONObject task, String status) {
|
||||||
|
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||||
|
task.put("task_status", TaskStatus.EXECUTING.value());
|
||||||
|
TaskUtils.addACSUpdateColum(task);
|
||||||
|
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||||
|
} else if (TaskStatus.FINISHED.value().equals(status)) {
|
||||||
|
this.finishTask(task, OperationType.AUTO);
|
||||||
|
} else if (TaskStatus.CANCELLED.value().equals(status)) {
|
||||||
|
this.cancelTask(task, OperationType.AUTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
JSONObject point1 = form.getJSONObject("point1");
|
||||||
|
JSONObject point2 = form.getJSONObject("point2");
|
||||||
|
|
||||||
|
JSONObject task = TaskUtils.buildTask(
|
||||||
|
"手持点对点任务",
|
||||||
|
TaskType.PDA_TASK.value(),
|
||||||
|
TaskStatus.START_AND_END.value(),
|
||||||
|
point1.getString("point_code"),
|
||||||
|
point2.getString("point_code"),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
"-",
|
||||||
|
"-",
|
||||||
|
8,
|
||||||
|
RGCDTask.class.getName(),
|
||||||
|
form.getString("create_mode"),
|
||||||
|
form.getString("request_param"),
|
||||||
|
ObjectUtil.isEmpty(form.getString("create_id")) ? "1" : form.getString("create_id"),
|
||||||
|
ObjectUtil.isEmpty(form.getString("create_name")) ? "-" : form.getString("create_name")
|
||||||
|
);
|
||||||
|
|
||||||
|
point1.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
point1.put("task_code", task.getString("task_code"));
|
||||||
|
TaskUtils.addFormUpdateColum(point1, form);
|
||||||
|
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
pointTable.update(point1);
|
||||||
|
|
||||||
|
point2.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
point2.put("task_code", task.getString("task_code"));
|
||||||
|
TaskUtils.addFormUpdateColum(point2, form);
|
||||||
|
pointTable.update(point2);
|
||||||
|
|
||||||
|
WQLObject.getWQLObject("sch_base_task").insert(task);
|
||||||
|
|
||||||
|
return task.getString("task_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(task)) {
|
||||||
|
throw new BadRequestException("未找到任务!");
|
||||||
|
}
|
||||||
|
this.finishTask(task, OperationType.MANUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(task)) {
|
||||||
|
throw new BadRequestException("未找到任务!");
|
||||||
|
}
|
||||||
|
this.cancelTask(task, OperationType.MANUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||||
|
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||||
|
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(task);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(task);
|
||||||
|
}
|
||||||
|
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||||
|
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
|
String point_code1 = task.getString("point_code1");
|
||||||
|
if (StrUtil.isNotBlank(point_code1)) {
|
||||||
|
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(point1)
|
||||||
|
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||||
|
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||||
|
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||||
|
point1.put("task_code", "");
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(point1);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(point1);
|
||||||
|
}
|
||||||
|
point_table.update(point1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String point_code2 = task.getString("point_code2");
|
||||||
|
if (StrUtil.isNotBlank(point_code2)) {
|
||||||
|
JSONObject point2 = new JSONObject();
|
||||||
|
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||||
|
point2.put("task_code", "");
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(point2);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(point2);
|
||||||
|
}
|
||||||
|
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||||
|
int current_task_status = task.getIntValue("task_status");
|
||||||
|
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||||
|
if (operation_type == OperationType.MANUAL
|
||||||
|
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
|
||||||
|
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
task.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(task);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(task);
|
||||||
|
}
|
||||||
|
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||||
|
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
|
String point_code1 = task.getString("point_code1");
|
||||||
|
if (StrUtil.isNotBlank(point_code1)) {
|
||||||
|
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||||
|
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||||
|
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||||
|
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||||
|
point1.put("task_code", "");
|
||||||
|
point1.put("vehicle_type", "");
|
||||||
|
point1.put("vehicle_code", "");
|
||||||
|
point1.put("vd_id", null);
|
||||||
|
point1.put("point_status", PointStatus.EMPTY.value());
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(point1);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(point1);
|
||||||
|
}
|
||||||
|
point_table.update(point1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String point_code2 = task.getString("point_code2");
|
||||||
|
if (StrUtil.isNotBlank(point_code2)) {
|
||||||
|
JSONObject point2 = new JSONObject();
|
||||||
|
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||||
|
point2.put("task_code", "");
|
||||||
|
point2.put("vehicle_type", task.getString("vehicle_type"));
|
||||||
|
point2.put("vehicle_code", task.getString("vehicle_code"));
|
||||||
|
point2.put("vd_id", task.getString("group_id"));
|
||||||
|
point2.put("point_status", PointStatus.HAS_GOODS.value());
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(point2);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(point2);
|
||||||
|
}
|
||||||
|
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ public class YZSendEmptyTask extends AbstractAcsTask {
|
|||||||
JSONObject work_order = form.getJSONObject("workorder");
|
JSONObject work_order = form.getJSONObject("workorder");
|
||||||
int priority = 3;
|
int priority = 3;
|
||||||
if (ObjectUtil.isNotEmpty(work_order)) {
|
if (ObjectUtil.isNotEmpty(work_order)) {
|
||||||
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 8 : 3;
|
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 7 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
String vehicleCode = TaskUtils.formatVehicleCode(point.getString("vehicle_code"));
|
String vehicleCode = TaskUtils.formatVehicleCode(point.getString("vehicle_code"));
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
输入.material_id TYPEAS f_string
|
输入.material_id TYPEAS f_string
|
||||||
输入.vd_id TYPEAS f_string
|
输入.vd_id TYPEAS f_string
|
||||||
输入.device_code TYPEAS s_string
|
输入.device_code TYPEAS s_string
|
||||||
|
输入.point_code TYPEAS s_string
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
--这边列出来的临时表就会在运行期动态创建
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
@@ -173,3 +174,16 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "9"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
wo.*
|
||||||
|
FROM
|
||||||
|
`sch_base_point` p
|
||||||
|
LEFT JOIN pdm_bi_device d ON p.device_code = d.device_code
|
||||||
|
LEFT JOIN pdm_bd_workorder wo ON d.device_id = wo.device_id AND wo.order_status = '3'
|
||||||
|
WHERE p.point_code = 输入.point_code
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
Reference in New Issue
Block a user