代码更新

This commit is contained in:
2022-12-12 11:39:52 +08:00
parent b804c33d65
commit 44efdbc329
4 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
package org.nl.wms.pda.task.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.wms.pda.st.service.CoolInService;
import org.nl.wms.pda.task.service.PdaTaskService;
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;
/**
* @author liuxy
* @date 2022-05-25
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "任务管理")
@RequestMapping("/api/pda/task")
@Slf4j
public class PdaTaskController {
private final PdaTaskService pdaTaskService;
@PostMapping("/taskQuery")
@Log("任务查询")
@ApiOperation("任务查询")
public ResponseEntity<Object> taskQuery(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaTaskService.taskQuery(whereJson), HttpStatus.OK);
}
@PostMapping("/againLssued")
@Log("重新下发")
@ApiOperation("重新下发")
public ResponseEntity<Object> againLssued(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaTaskService.againLssued(whereJson), HttpStatus.OK);
}
@PostMapping("/confirm")
@Log("强制完成")
@ApiOperation("强制完成")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaTaskService.confirm(whereJson), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,34 @@
package org.nl.wms.pda.task.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.modules.wql.core.content.HttpContext;
/**
* @description 服务接口
* @author liuxy
* @date 2022-05-25
**/
public interface PdaTaskService {
/**
* 任务查询
* @param whereJson /
* @return JSONObject /
*/
JSONObject taskQuery(JSONObject whereJson);
/**
* 重新下发
* @param whereJson /
* @return JSONObject /
*/
JSONObject againLssued(JSONObject whereJson);
/**
* 强制完成
* @param whereJson /
* @return JSONObject /
*/
JSONObject confirm(JSONObject whereJson);
}

View File

@@ -0,0 +1,77 @@
package org.nl.wms.pda.task.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.pda.st.service.CoolInService;
import org.nl.wms.pda.task.service.PdaTaskService;
import org.nl.wms.sch.service.TaskService;
import org.nl.wms.sch.service.impl.TaskServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author liuxy
* @description 服务实现
* @date 2022-05-25
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class PdaTaskServiceImpl implements PdaTaskService {
@Override
public JSONObject taskQuery(JSONObject whereJson) {
String search = whereJson.getString("search");
JSONObject map = new JSONObject();
map.put("flag", "1");
if (ObjectUtil.isNotEmpty(search)) map.put("search", "%"+search+"%");
JSONArray resultJSONArray = WQL.getWO("PDA_TASK").addParamMap(map).process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray);
jo.put("message", "查询成功!");
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject againLssued(JSONObject whereJson) {
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject task_rows = whereJson.getJSONObject("task_rows");
JSONObject jsonTask = tab.query("task_code = '" + task_rows.getString("task_code") + "'").uniqueResult(0);
jsonTask.put("method_name", "immediateNotifyAcs");
SpringContextHolder.getBean(TaskService.class).operation(jsonTask);
JSONObject result = new JSONObject();
result.put("message", "下发成功");
return result;
}
@Override
public JSONObject confirm(JSONObject whereJson) {
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject task_rows = whereJson.getJSONObject("task_rows");
JSONObject jsonTask = tab.query("task_code = '" + task_rows.getString("task_code") + "'").uniqueResult(0);
jsonTask.put("method_name", "forceFinish");
SpringContextHolder.getBean(TaskService.class).operation(jsonTask);
JSONObject result = new JSONObject();
result.put("message", "下发成功");
return result;
}
}

View File

@@ -0,0 +1,100 @@
[交易说明]
交易名: 手持任务管理
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.search TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
task_code,
vehicle_code,
point_code1,
point_code2,
point_code3,
point_code4,
(
CASE task_status
WHEN '1' THEN '生成'
WHEN '2' THEN '确定起点'
WHEN '3' THEN '确定终点'
WHEN '4' THEN '起点和终点确定'
WHEN '5' THEN '下发'
WHEN '6' THEN '执行中'
END
) AS task_status,
(
CASE task_type
WHEN '010101' THEN '标准任务'
WHEN '010102' THEN '取满(生箔->冷却)'
WHEN '010103' THEN '取空(冷却->生箔)'
WHEN '010201' THEN '冷却->烘箱'
WHEN '010202' THEN '烘箱->暂存位'
WHEN '010203' THEN '暂存位->烘箱'
WHEN '010204' THEN '暂存位->冷却'
WHEN '010301' THEN '标准任务'
WHEN '010302' THEN '取满(冷却->分切)'
WHEN '010303' THEN '取空(分切->冷却)'
WHEN '010401' THEN '输送出'
WHEN '010402' THEN '输送入'
WHEN '010403' THEN '桁架标准任务'
WHEN '010404' THEN '分切>输送线'
WHEN '010405' THEN '输送线>分切'
END
) AS task_type,
car_no,
create_time
FROM
SCH_BASE_Task
WHERE
is_delete = '0'
AND task_status <> '7'
OPTION 输入.search <> ""
(vehicle_code like 输入.search or
point_code1 like 输入.search or
point_code2 like 输入.search or
point_code3 like 输入.search or
point_code4 like 输入.search or
task_code like 输入.search or
car_no like 输入.search)
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF