rev:修改任务下发接口实体生成。

rev:sch excel中缓存线位置表【SCH_CacheLine_Position】中增加taskid字段作为任务实时id
This commit is contained in:
2023-04-03 09:11:17 +08:00
parent 003f54e283
commit 8180dcaac5
5 changed files with 114 additions and 99 deletions

View File

@@ -132,7 +132,7 @@ public class CacheLineHandController{
log.info("海亮缓存线手持服务 [任务操作] 接口被请求, 请求参数-{}", param);
//任务类型和任务ID校验instruct_uuid为前端参数命名本来应为task_id
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("opt_type"))) {
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
throw new BizCoreException("ResultCode.VALIDATE_FAILED");
}
return new ResponseEntity<>(cacheLineHandService.instOperation(param), HttpStatus.OK);
}
@@ -143,8 +143,11 @@ public class CacheLineHandController{
public ResponseEntity<JSONArray> cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常-查询] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code"))) {
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
if(StringUtils.isEmpty(param.getString("wcsdevice_code"))) {
throw new BizCoreException("请选择缓存线并输入缓存线位置编号再查询");
}
if(StringUtils.isEmpty(param.getString("position_code"))) {
throw new BizCoreException("请输入缓存线位置编号再查询");
}
return new ResponseEntity<>(cacheLineHandService.cacheLineOutBoxExceptionQuery(param), HttpStatus.OK);
}
@@ -155,8 +158,11 @@ public class CacheLineHandController{
public ResponseEntity<Object> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-确认] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
if(StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException("请输入料箱码");
}
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code"))) {
throw new BizCoreException("请输入缓存线位置编号与缓存线编号");
}
return new ResponseEntity<>(cacheLineHandService.cacheLineOutBoxExceptionConfirm(param), HttpStatus.OK);
}

View File

@@ -24,6 +24,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.pda.dto.MaterialDto;
import org.nl.wms.pda.service.CacheLineHandService;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.SpeMachineryTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
@@ -200,10 +201,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
public CommonResult<String> instOperation(JSONObject param) {
String optType = param.getString("opt_type");
String instruct_uuid = param.getString("instruct_uuid");
SpeMachineryTask SpeMachineryTask = new SpeMachineryTask();
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
JSONObject taskObject = taskTab.query("task_id =" + param.getString("instruct_uuid")).uniqueResult(0);
//1-取消、2-完成、3-任务下发,根据操作类型执行相关操作
JSONObject taskObject = taskTab.query("task_id =" + instruct_uuid).uniqueResult(0);
if(null == taskObject) {
throw new BadRequestException("未找到该任务信息!");
}
//8-取消、7-完成、5-任务下发,根据操作类型执行相关操作
if(StatusEnum.TASK_CANNEL.getCode().equals(optType) || StatusEnum.TASK_FINISH.getCode().equals(optType)) {
return RestBusinessTemplate.execute(() -> updateTaskStatus(taskObject, optType));
}
@@ -258,7 +263,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
if(!CollectionUtils.isEmpty(cacheLineVehilesSub)) {
for(String vehileCode : cacheLineVehilesSub) {
ivtTab.insert(MapOf.of("create_time",DateUtil.now(),"vehmaterial_id", IdUtil.getStringId(), "vehicle_code", vehileCode, "vehicle_status", StatusEnum.CACHE_VEL_ERR.getCode(), "cacheline_code", cachelineCode, "err_type", StatusEnum.STATUS_TRUE.getCode()));
ivtTab.insert(MapOf.of("create_time", DateUtil.now(), "vehmaterial_id", IdUtil.getStringId(), "vehicle_code", vehileCode, "vehicle_status", StatusEnum.CACHE_VEL_ERR.getCode(), "cacheline_code", cachelineCode, "err_type", StatusEnum.STATUS_TRUE.getCode()));
}
}
}, cachelineCode, 3);
@@ -506,55 +511,39 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String wcsdevice_code = param.getString("wcsdevice_code");
//出入箱类型
String inOut_type = param.getString("inOut_type");
//任务表信息
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
//返回结果
JSONArray result = new JSONArray();
JSONObject params = new JSONObject();
params.put("flag", "10");
params.put("vehicle_code1", vehicle_code);
params.put("task_status", TaskStatusEnum.FINISHED.getCode());
// 入箱扫码异常
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
String where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code2"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
params.put("point_code2", wcsdevice_code);
}
// 出箱扫码异常
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
String where = "point_code1 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("task_code"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("wcsdevice_code", row.getString("point_code1"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
params.put("point_code1", wcsdevice_code);
}
JSONArray array = WQL.getWO("PDA_QUERY").addParamMap(params).process().getResultJSONArray(0);
for(int i = 0; i < array.size(); i++) {
JSONObject row = array.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("instruct_uuid"));
json.put("instructorder_no", row.getString("instructoperate_num"));
json.put("wcsdevice_code", row.getString("startpoint_code"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
result.add(json);
}
return result;
}
/**
* 扫码异常确认
* 出入类型 inOut_type 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
* 出入类型 inOut_type 1 入箱扫码扫码异常-空箱在对接位上对接位对应的类型位1 2 出箱扫码异常-满箱在准备位上需要传类型为2
* 缓存线编码 wcsdevice_code
* 缓存线位置编码 position_code
* 料箱码 vehicle_code
@@ -567,21 +556,17 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String inOut_type = param.getString("inOut_type");
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
//缓存线点位
String position_code = param.getString("position_code");
//载具编码
String vehicle_code = param.getString("vehicle_code");
// 封装给acs的数据
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
// 1 扫码异常-入箱扫码 2 出箱扫码
jsonObject.put("inOut_type", inOut_type);
jsonObject.put("type", inOut_type);
//缓存线编号
jsonObject.put("wcsdevice_code", wcsdevice_code);
//料箱码
jsonObject.put("vehicle_code", vehicle_code);
//缓存线点位编码
jsonObject.put("position_code", position_code);
jsonArray.add(jsonObject);
try {
//TOFIX 等确定api后换成下发的url
@@ -639,7 +624,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String wcsdevice_code = param.getString("wcsdevice_code");
String position_code = param.getString("position_code");
//根据缓存线编码和缓存线点位查找任务ID
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("position_code like '%" + position_code + "%'" + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("cacheLine_code = '" + wcsdevice_code + "' and position_code = '" + position_code + "'").uniqueResult(0);
//查不到点位信息
if(null == posiObj) {
throw new BadRequestException("未找到该缓存线的点位信息!");
@@ -667,6 +652,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
public CommonResult<Integer> cacheLineOutBoxExceptionConfirm(JSONObject param) {
String inOut_type = param.getString("inOut_type");
inOut_type = "1";
String cacheLine_code = param.getString("wcsdevice_code");
String position_code = param.getString("position_code");
String vehicle_code = param.getString("vehicle_code");
@@ -718,6 +704,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 出满箱扫码异常
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
//缓存线载具状态 1-空位、2-绿色空箱、3-黄色满箱、4-红色异常、5不显示
json.put("vehicle_status", StatusEnum.STATUS_TRUE.getCode());
json.put("material_id", "");
json.put("weight", "0");

View File

@@ -22,9 +22,14 @@
输入.start_point TYPEAS s_string
输入.end_point TYPEAS s_string
输入.start_date TYPEAS s_string
输入.vehicle_code TYPEAS s_string
输入.vehicle_code TYPEAS s_string
输入.vehicle_code1 TYPEAS s_string
输入.end_date TYPEAS s_string
输入.task_id TYPEAS s_string
输入.point_code1 TYPEAS s_string
输入.point_code2 TYPEAS s_string
输入.point_code3 TYPEAS s_string
输入.task_status TYPEAS s_string
@@ -88,7 +93,7 @@
IF 输入.flag = "3"
QUERY
SELECT
dict_id `value`,
value `value`,
label text
FROM
sys_dict
@@ -250,20 +255,32 @@
OPTION 输入.status <> ""
find_in_set(task.task_status,输入.status)
ENDOPTION
OPTION 输入.task_status <> ""
(task.task_status <> 输入.task_status)
ENDOPTION
OPTION 输入.inst_num <> ""
(task.task_code like CONCAT ('%', 输入.inst_num, '%'))
ENDOPTION
OPTION 输入.vehicle_code <> ""
(task.vehicle_code like CONCAT ('%', 输入.vehicle_code, '%'))
ENDOPTION
OPTION 输入.start_point <> ""
(task.point_code1 like CONCAT ('%', 输入.start_point, '%'))
ENDOPTION
OPTION 输入.task_id <> ""
(task.task_id = 输入.task_id )
OPTION 输入.vehicle_code1 <> ""
(task.vehicle_code = 输入.vehicle_code1)
ENDOPTION
OPTION 输入.end_point <> ""
(task.point_code2 like CONCAT ('%', 输入.end_point, '%'))
(point2.point_name like CONCAT ('%', 输入.end_point, '%'))
ENDOPTION
OPTION 输入.point_code1 <> ""
(task.point_code1 = 输入.point_code1)
ENDOPTION
OPTION 输入.point_code2 <> ""
(task.point_code2 = 输入.point_code2)
ENDOPTION
OPTION 输入.point_code3 <> ""
(task.point_code3 = 输入.point_code3)
ENDOPTION
OPTION 输入.task_id <> ""
(task.task_id = 输入.task_id)
ENDOPTION
OPTION 输入.start_date <> ""
task.create_time >= 输入.start_date

View File

@@ -14,6 +14,7 @@ import org.nl.modules.system.util.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.springframework.stereotype.Service;
@@ -51,46 +52,50 @@ public class SpeMachineryTask extends AbstractAcsTask {
}
}
@Override
public String createTask(JSONObject form) {
String start_point_code = form.getString("start_point_code");
String next_point_code = form.getString("next_point_code");
String return_point_code = form.getString("return_point_code");
String vehicle_code = form.getString("vehicle_code");
String type = form.getString("type");
if (StrUtil.isEmpty(start_point_code)) {
throw new BadRequestException("起点不能为空!");
}
if (StrUtil.isEmpty(next_point_code)) {
throw new BadRequestException("终点不能为空!");
}
String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = new JSONObject();
task.put("task_id", taskdtl_id);
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", type);
task.put("task_status", StatusEnum.TASK_CREATE.getCode());
task.put("task_name", AcsTaskEnum.getType(type,"TASK_").getDesc());
task.put("point_code1", start_point_code);
task.put("point_code2", next_point_code);
task.put("point_code3", return_point_code);
task.put("agv_system_type", AcsTaskEnum.AGV_SYSTEM_NB.getCode());
task.put("vehicle_code", vehicle_code);
task.put("handle_class", this.getClass().getName());
task.put("finished_type", "01");
task.put("is_delete", "0");
String currentUserId = SecurityUtils.getCurrentUserId();
task.put("create_id", currentUserId);
task.put("create_name", SecurityUtils.getCurrentNickName());
task.put("update_optid", currentUserId);
task.put("update_optname", SecurityUtils.getCurrentNickName());
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
return taskdtl_id;
}
@Override
public String createTask(JSONObject form) {
String task_name = form.getString("task_name");
String start_point_code = form.getString("point_code1");
String next_point_code = form.getString("point_code2");
String vehicle_code = form.getString("vehicle_code");
String vehicle_code2 = form.getString("vehicle_code2");
String material_id = form.getString("material_id");
String type = form.getString("type");
if(StrUtil.isEmpty(start_point_code)) {
throw new BadRequestException("起点不能为空!");
}
if(StrUtil.isEmpty(next_point_code)) {
throw new BadRequestException("终点不能为空!");
}
if(StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("载具不能为空!");
}
String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = new JSONObject();
task.put("task_id", taskdtl_id);
task.put("task_name", task_name);
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", type);
task.put("task_status", TaskStatusEnum.CREATED.getCode());
task.put("point_code1", start_point_code);
task.put("point_code2", next_point_code);
task.put("vehicle_code2", vehicle_code2);
task.put("vehicle_code", vehicle_code);
task.put("material_id", material_id);
task.put("handle_class", this.getClass().getName());
task.put("finished_type", "01");
task.put("is_delete", "0");
String currentUserId = SecurityUtils.getCurrentUserId();
task.put("create_id", currentUserId);
task.put("create_name", SecurityUtils.getCurrentNickName());
task.put("update_optid", currentUserId);
task.put("update_optname", SecurityUtils.getCurrentNickName());
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
return taskdtl_id;
}
@Override