add:平板作业管理
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package org.nl.wms.pda.general_management.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.general_management.service.PdaTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 平板任务管理
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-09-19
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/pdaTask")
|
||||
@Slf4j
|
||||
public class PdaTaskController {
|
||||
|
||||
@Autowired
|
||||
private PdaTaskService pdaTaskService;
|
||||
|
||||
@PostMapping("/queryTask")
|
||||
@Log("查询任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaTaskService.queryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryHistoryTask")
|
||||
@Log("查询历史任务记录")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryHistoryTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaTaskService.queryHistoryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/againSendTask")
|
||||
@Log("重新下发任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> againSendTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaTaskService.againSendTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forceConfirmTask")
|
||||
@Log("强制完成任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> forceConfirmTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaTaskService.forceConfirmTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.wms.pda.general_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 平板任务管理 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-09-19
|
||||
*/
|
||||
public interface PdaTaskService {
|
||||
|
||||
/**
|
||||
* @param whereJson {
|
||||
* search: 载具号、起点、终点、任务号
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param whereJson {
|
||||
* search: 载具号、起点、终点、任务号
|
||||
* start_time: 开始时间
|
||||
* end_time: 结束时间
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryHistoryTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 重新下发任务
|
||||
* @param whereJson { }任务实体类
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse againSendTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 强制完成任务
|
||||
* @param whereJson { }任务实体类
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse forceConfirmTask(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.nl.wms.pda.general_management.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pda.general_management.service.PdaTaskService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBaseTaskMapper;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.TaskFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 平板任务管理 实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-09-19
|
||||
*/
|
||||
@Service
|
||||
public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
|
||||
/**
|
||||
* 任务服务mapper
|
||||
*/
|
||||
@Autowired
|
||||
private SchBaseTaskMapper schBaseTaskMapper;
|
||||
|
||||
/**
|
||||
* 任务工厂服务
|
||||
*/
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
@Override
|
||||
public PdaResponse queryTask(JSONObject whereJson) {
|
||||
return PdaResponse.requestParamOk(schBaseTaskMapper.queryPdaTask(whereJson));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse queryHistoryTask(JSONObject whereJson) {
|
||||
return PdaResponse.requestParamOk(schBaseTaskMapper.queryPdaHistoryTask(whereJson));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse againSendTask(JSONObject whereJson) {
|
||||
// 查询任务
|
||||
SchBaseTask taskDao = schBaseTaskMapper.selectById(whereJson.getString("task_id"));
|
||||
// 下发
|
||||
AbstractTask task = taskFactory.getTask(taskDao.getConfig_code());
|
||||
task.sendTaskOne(taskDao.getTask_id());
|
||||
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse forceConfirmTask(JSONObject whereJson) {
|
||||
// 查询任务
|
||||
SchBaseTask taskDao = schBaseTaskMapper.selectById(whereJson.getString("task_id"));
|
||||
// 完成
|
||||
AbstractTask task = taskFactory.getTask(taskDao.getConfig_code());
|
||||
task.forceFinish(taskDao.getTask_code());
|
||||
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,21 @@ public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
|
||||
/**
|
||||
* 手持查询任务
|
||||
* @param whereJson {
|
||||
* task_code: 任务号、载具号、点位号
|
||||
* search: 载具号、起点、终点、任务号
|
||||
* }
|
||||
*/
|
||||
List<JSONObject> queryPdaTask(@Param("param") JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 手持查询历史记录
|
||||
* @param whereJson {
|
||||
* search: 载具号、起点、终点、任务号
|
||||
* start_time: 开始时间
|
||||
* end_time: 结束时间
|
||||
* }
|
||||
*/
|
||||
List<JSONObject> queryPdaHistoryTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取载具任务
|
||||
* @param page
|
||||
@@ -53,4 +63,5 @@ public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
|
||||
* @return JSONObject
|
||||
*/
|
||||
IPage<JSONObject> getPointtoPoint(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -78,29 +78,50 @@
|
||||
|
||||
<select id="queryPdaTask" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
task_id,
|
||||
task_code,
|
||||
vehicle_code,
|
||||
point_code1,
|
||||
point_code2,
|
||||
(CASE task_status
|
||||
WHEN '0' THEN '生成'
|
||||
WHEN '1' THEN '申请'
|
||||
WHEN '2' THEN '创建完成'
|
||||
WHEN '3' THEN '下发'
|
||||
WHEN '4' THEN '执行中'
|
||||
END) AS task_status
|
||||
task.*,
|
||||
config.config_name
|
||||
FROM
|
||||
sch_base_task
|
||||
sch_base_task task
|
||||
INNER JOIN sch_base_taskconfig config ON task.config_code = config.config_code
|
||||
<where>
|
||||
is_delete = '0'
|
||||
task.is_delete = '0'
|
||||
AND task_status IN ('0','1','2','3','4')
|
||||
<if test="param.task_code != null and param.task_code != ''">
|
||||
<if test="param.search != null and param.search != ''">
|
||||
AND
|
||||
(task_code = #{param.task_code} or
|
||||
vehicle_code = #{param.task_code} or
|
||||
point_code1 = #{param.task_code} or
|
||||
point_code2 = #{param.task_code})
|
||||
(task.vehicle_code = #{param.search} or
|
||||
task.task_code = #{param.search} or
|
||||
task.point_code1 = #{param.search} or
|
||||
task.point_code2 = #{param.search})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryPdaHistoryTask" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
task.*,
|
||||
config.config_name
|
||||
FROM
|
||||
sch_base_task task
|
||||
INNER JOIN sch_base_taskconfig config ON task.config_code = config.config_code
|
||||
<where>
|
||||
task.is_delete = '0'
|
||||
AND task_status = '5'
|
||||
<if test="param.search != null and param.search != ''">
|
||||
AND
|
||||
(task.vehicle_code = #{param.search} or
|
||||
task.task_code = #{param.search} or
|
||||
task.point_code1 = #{param.search} or
|
||||
task.point_code2 = #{param.search})
|
||||
</if>
|
||||
|
||||
<if test="param.start_time != null and param.start_time != ''">
|
||||
AND
|
||||
task.create_time > #{param.start_time}
|
||||
</if>
|
||||
|
||||
<if test="param.end_time != null and param.end_time != ''">
|
||||
AND
|
||||
#{param.end_time} > task.create_time
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user