项目完善
This commit is contained in:
0
acs/hd/logPath_IS_UNDEFINED/2022-10-21.0.log
Normal file
0
acs/hd/logPath_IS_UNDEFINED/2022-10-21.0.log
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
package org.nl.hand.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.hand.service.PadService;
|
||||
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;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "平板接口")
|
||||
@RequestMapping("/api/axg/hand")
|
||||
@Slf4j
|
||||
public class PadController {
|
||||
private final PadService HandService;
|
||||
|
||||
@PostMapping("/tasks")
|
||||
@Log("查询任务")
|
||||
@ApiOperation("查询任务")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryTask(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
return new ResponseEntity<>(HandService.queryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/insts")
|
||||
@Log("查询指令")
|
||||
@ApiOperation("查询指令")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryInst(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
return new ResponseEntity<>(HandService.queryInst(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/inst")
|
||||
@Log("指令操作")
|
||||
@ApiOperation("指令操作")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> Instoperation(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.Instoperation(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/taskoperation")
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.Taskoperation(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
package org.nl.hand.service;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @description 服务接口
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
public interface PadService {
|
||||
|
||||
/**
|
||||
* 查询指令
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryInst(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 查询任务
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryTask(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 指令操作
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> Instoperation(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 任务操作
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> Taskoperation(Map<String, String> jsonObject);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.nl.hand.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @description /
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@Data
|
||||
public class PadDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 库区标识
|
||||
*/
|
||||
private String sect_uuid;
|
||||
|
||||
/**
|
||||
* 库区编码
|
||||
*/
|
||||
private String sect_code;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
private String sect_name;
|
||||
|
||||
/**
|
||||
* 库区简称
|
||||
*/
|
||||
private String simple_name;
|
||||
|
||||
/**
|
||||
* 库区类型
|
||||
*/
|
||||
private String sect_type;
|
||||
|
||||
/**
|
||||
* 顺序号
|
||||
*/
|
||||
private BigDecimal order_seq;
|
||||
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
private String store_uuid;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.config.server.impl.AcsConfigServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.hand.service.PadService;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @description 服务实现
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PadServiceImpl implements PadService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryInst(Map<String, String> jsonObject) {
|
||||
//查询位完成的指令
|
||||
JSONObject resultJson = new JSONObject();
|
||||
JSONArray resultArr = WQL.getWO("QHAND_QUERY").addParam("flag", "4").addParamMap((HashMap) jsonObject).process().getResultJSONArray(0);
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", resultArr);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryTask(Map<String, String> jsonObject) {
|
||||
String key = jsonObject.get("keyword");
|
||||
String start_point = jsonObject.get("start_devicecode");
|
||||
String next_point = jsonObject.get("next_devicecode");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
map.put("key", key);
|
||||
map.put("start_point", start_point);
|
||||
map.put("next_point", next_point);
|
||||
//查询有任务 但是没有指令的任务
|
||||
JSONArray result = WQL.getWO("QHAND_QUERY").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", result);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> Instoperation(Map<String, String> jsonObject) {
|
||||
JSONObject jo = new JSONObject();
|
||||
String type = jsonObject.get("type");
|
||||
String inst_uuid = jsonObject.get("inst_uuid");
|
||||
JSONObject instwo = WQLObject.getWQLObject("acs_instruction").query("instruction_id='" + inst_uuid + "'").uniqueResult(0);
|
||||
if (instwo == null) {
|
||||
throw new BadRequestException("未找到该指令!");
|
||||
}
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigServiceImpl.class);
|
||||
|
||||
String task_id = instwo.getString("task_id");
|
||||
/* 1 指令撤销
|
||||
2 重新下发
|
||||
3 强制完成*/
|
||||
if (type.equals("1")) {
|
||||
//调用agv删除任务的接口
|
||||
agvService = SpringContextHolder.getBean("agvServiceImpl");
|
||||
try {
|
||||
agvService.deleteAgvInstToNDC(instwo.toJavaObject(Instruction.class));
|
||||
instructionService.cancel(inst_uuid);
|
||||
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", e.getMessage());
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
if (type.equals("2")) {
|
||||
Instruction instdto = (Instruction) JSONObject.toJavaObject(instwo, Instruction.class);
|
||||
AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
|
||||
try {
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")) {
|
||||
agvService.sendAgvInstToNDC(instdto);
|
||||
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "2")) {
|
||||
agvService.sendAgvInstToNDC(instdto);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", e.getMessage());
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
|
||||
}
|
||||
if (type.equals("3")) {
|
||||
//完成指令
|
||||
try {
|
||||
instructionService.finish(inst_uuid);
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", e.getMessage());
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "操作成功");
|
||||
jo.put("result", new JSONObject());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> Taskoperation(Map<String, String> jsonObject) {
|
||||
JSONObject jo = new JSONObject();
|
||||
String task_uuid = jsonObject.get("inst_uuid");
|
||||
String type = jsonObject.get("type");
|
||||
JSONObject taskjo = WQLObject.getWQLObject("acs_task").query("task_id='" + task_uuid + "'").uniqueResult(0);
|
||||
if (StrUtil.isEmpty(task_uuid)) {
|
||||
throw new BadRequestException("id不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("操作类型不能为空!");
|
||||
}
|
||||
//重新生成
|
||||
if (type.equals("1")) {
|
||||
//重新生产指令
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
instdto.setRemark(taskjo.getString("remark"));
|
||||
instdto.setMaterial(taskjo.getString("taskjo"));
|
||||
instdto.setTask_id(taskjo.getString("task_id"));
|
||||
instdto.setTask_code(taskjo.getString("task_code"));
|
||||
instdto.setVehicle_code(taskjo.getString("vehicle_code"));
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_point_code(taskjo.getString("start_point_code"));
|
||||
instdto.setNext_point_code(taskjo.getString("next_point_code"));
|
||||
instdto.setStart_device_code(taskjo.getString("start_device_code"));
|
||||
instdto.setNext_device_code(taskjo.getString("next_device_code"));
|
||||
instdto.setInstruction_status("0");
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
TaskDto acsTask = (TaskDto) JSONObject.toJavaObject(taskjo, TaskDto.class);
|
||||
acsTask.setTask_status("1");
|
||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(acsTask));
|
||||
taskwo.update(json);
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", e.getMessage());
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
|
||||
instdto.setExecute_device_code(taskjo.getString("start_point_code"));
|
||||
//下发指令给agv
|
||||
// AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
|
||||
// try {
|
||||
// agvserver.sendAgvInstToMagic(instdto);
|
||||
// } catch (Exception e) {
|
||||
// jo.put("code", "2");
|
||||
// jo.put("desc", e.getMessage());
|
||||
// jo.put("result", "");
|
||||
// return jo;
|
||||
// }
|
||||
|
||||
}
|
||||
//强制完成
|
||||
if (type.equals("2")) {
|
||||
//手工完成
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
TaskDto acsTask = (TaskDto) JSONObject.toJavaObject(taskjo, TaskDto.class);
|
||||
taskService.finish(acsTask.getTask_id());
|
||||
}
|
||||
|
||||
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "操作成功");
|
||||
jo.put("result", new JSONObject());
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
[交易说明]
|
||||
交易名: 手持接口查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.key TYPEAS s_string
|
||||
输入.keyword TYPEAS s_string
|
||||
输入.start_devicecode TYPEAS s_string
|
||||
输入.next_devicecode TYPEAS s_string
|
||||
输入.detail_id TYPEAS s_string
|
||||
输入.start_point TYPEAS s_string
|
||||
输入.next_point TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
dtl.detail_id as region_id,
|
||||
dtl.label as region_name,
|
||||
dtl.value as region_code
|
||||
FROM
|
||||
sys_dict sys
|
||||
LEFT JOIN sys_dict_detail dtl ON dtl.dict_id = sys.dict_id
|
||||
WHERE
|
||||
sys.NAME = "region_type"
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
task.task_id AS task_uuid,
|
||||
task.task_code AS task_no,
|
||||
task.start_point_code AS start_devicecode,
|
||||
task.next_point_code AS next_devicecode,
|
||||
task.task_type AS task_type,
|
||||
sys2.VALUE AS material_type_name,
|
||||
sys2.label AS material_type,
|
||||
sys.VALUE AS task_status_name,
|
||||
sys.label AS task_status,
|
||||
task.vehicle_code AS carrier,
|
||||
task.create_time,
|
||||
task.priority
|
||||
FROM
|
||||
acs_task task
|
||||
LEFT JOIN sys_dict_detail sys ON sys.label = task.task_status
|
||||
AND sys.NAME = 'task_status'
|
||||
LEFT JOIN sys_dict_detail sys2 ON sys2.VALUE = task.material
|
||||
AND sys2.NAME = 'material_type'
|
||||
where
|
||||
( task.task_status ='1' or task.task_status ='0' )
|
||||
and
|
||||
( task.task_id IN (select inst.task_id FROM acs_instruction inst where inst.is_delete<>1 and (instruction_status<>'1' and instruction_status <>'2' and instruction_status <>'0')) or task.task_id not in (select inst.task_id FROM acs_instruction inst where inst.is_delete<>1
|
||||
))
|
||||
OPTION 输入.key <> ""
|
||||
(task.task_code like 输入.key or task.task_status like 输入.key)
|
||||
ENDOPTION
|
||||
OPTION 输入.start_point <> ""
|
||||
task.start_point_code = 输入.start_point
|
||||
ENDOPTION
|
||||
OPTION 输入.next_point <> ""
|
||||
task.next_point_code = 输入.next_point
|
||||
ENDOPTION
|
||||
ORDER BY task.create_time
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_dict_detail detl
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.detail_id <> ""
|
||||
detl.detail_id = 输入.detail_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
inst.instruction_id AS inst_uuid,
|
||||
inst.task_code AS task_no,
|
||||
inst.instruction_code AS inst_no,
|
||||
inst.start_point_code AS start_devicecode,
|
||||
inst.next_point_code AS next_devicecode,
|
||||
inst.instruction_status AS inst_status,
|
||||
dtl.VALUE AS inst_status_name,
|
||||
inst.execute_message AS inst_step,
|
||||
inst.vehicle_code AS carrier,
|
||||
inst.carno,
|
||||
inst.priority,
|
||||
inst.create_time,
|
||||
inst.material AS material_type,
|
||||
dtl2.VALUE AS material_type_name
|
||||
FROM
|
||||
acs_instruction inst
|
||||
LEFT JOIN sys_dict_detail AS dtl ON dtl.label = inst.instruction_status
|
||||
AND dtl.NAME = 'task_status'
|
||||
LEFT JOIN sys_dict_detail AS dtl2 ON dtl2.label = inst.material
|
||||
AND dtl2.NAME = 'material_type'
|
||||
WHERE
|
||||
inst.is_delete = '0'
|
||||
AND (inst.instruction_status ='1'
|
||||
OR inst.instruction_status ='0')
|
||||
OPTION 输入.keyword <> ""
|
||||
(inst.instruction_code like 输入.keyword
|
||||
or
|
||||
inst.task_code like 输入.keyword
|
||||
or inst.execute_device_code like 输入.keyword)
|
||||
ENDOPTION
|
||||
OPTION 输入.start_devicecode <> ""
|
||||
inst.start_point_code = 输入.start_devicecode
|
||||
ENDOPTION
|
||||
OPTION 输入.next_devicecode <> ""
|
||||
inst.next_point_code = 输入.next_devicecode
|
||||
ENDOPTION
|
||||
ORDER BY inst.create_time desc
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
detl.label AS label,
|
||||
detl.
|
||||
VALUE
|
||||
AS value
|
||||
FROM
|
||||
sys_dict_detail detl
|
||||
WHERE
|
||||
detl.name = 'material_type'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Binary file not shown.
@@ -8,7 +8,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lnsh_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:xugong_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
|
||||
@@ -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
|
||||
.getWO("SEND_TASK")
|
||||
.addParam("flag", "3")
|
||||
.addParam("region_id", startRegionId)
|
||||
.addParam("material_type", materialType)
|
||||
.process()
|
||||
.uniqueResult(0)
|
||||
.getLongValue("col");
|
||||
|
||||
// 从第一排开始查询起点
|
||||
long currentCol = 1L;
|
||||
do {
|
||||
// 如果当前这排已经超过了总排数,说明没有找到叫料点位
|
||||
if (currentCol > colCount) {
|
||||
throw new BadRequestException("未找到合适的叫料点位");
|
||||
}
|
||||
|
||||
startPoint = WQL
|
||||
// 查询该区域存放此物料的排
|
||||
JSONArray colArray = WQL
|
||||
.getWO("SEND_TASK")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_id", startRegionId)
|
||||
.addParam("material_type", materialType)
|
||||
.addParam("col", String.valueOf(currentCol))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
|
||||
// 遍历该区域存放此物料的排寻找合适的点位
|
||||
for (Object o : colArray) {
|
||||
// 查找该排有货 或 已锁定的点位(出入库顺序降序)
|
||||
startPoint = WQL
|
||||
.getWO("SEND_TASK")
|
||||
.addParam("flag", "3")
|
||||
.addParam("region_id", startRegionId)
|
||||
.addParam("col", ((JSONObject) o).getString("col"))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
// 如果这排不存在合适点位 或 合适点位已被锁定,进入下一排查找
|
||||
currentCol++;
|
||||
} while (ObjectUtil.isEmpty(startPoint) || StrUtil.equals(startPoint.getString("lock_type"), "01"));
|
||||
|
||||
return sendTask.createTaskRelated(startPoint, nextPoint, param, CallTask.class, "01", "1");
|
||||
// 点位不为空 且 点位未锁定,则为合适的叫料点位
|
||||
if (ObjectUtil.isNotEmpty(startPoint) && StrUtil.equals(startPoint.getString("lock_type"), "00")) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 如果不合适重置为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
|
||||
// 如果起点是大吨位装配线下线区这根据物料类型给终点
|
||||
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", startPoint.getString("current_material_type"))
|
||||
.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);
|
||||
|
||||
@@ -64,6 +64,27 @@
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
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 输入.material_type <> ""
|
||||
material_type = 输入.material_type
|
||||
ENDOPTION
|
||||
ORDER BY
|
||||
col
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
@@ -72,13 +93,10 @@
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND ( point_status = '01' OR lock_type = '01' )
|
||||
AND (point_status = '01' OR lock_type IN ('01', '02'))
|
||||
OPTION 输入.region_id <> ""
|
||||
region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
OPTION 输入.material_type <> ""
|
||||
material_type = 输入.material_type
|
||||
ENDOPTION
|
||||
OPTION 输入.col <> ""
|
||||
col = 输入.col
|
||||
ENDOPTION
|
||||
@@ -87,26 +105,3 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.sch_point_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -48,6 +49,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reginoList"
|
||||
:key="item.id"
|
||||
:label="item.region_name"
|
||||
:value="item.region_id"
|
||||
/>
|
||||
@@ -66,6 +68,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.sch_point_status"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -83,6 +86,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.d_lock_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -100,6 +104,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_used"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -132,14 +137,14 @@
|
||||
width="600px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="150px">
|
||||
<el-form-item v-if="false" label="点位标识" prop="point_id" >
|
||||
<el-form-item v-if="false" label="点位标识" prop="point_id">
|
||||
<el-input v-model="form.point_id" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位编码" prop="point_code">
|
||||
<el-input v-model="form.point_code" style="width: 370px;" :disabled="this.form.point_type==='01'" />
|
||||
<el-input v-model="form.point_code" style="width: 370px;" :disabled="form.point_type==='01'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位名称" prop="point_name">
|
||||
<el-input v-model="form.point_name" style="width: 370px;" :disabled="this.form.point_type==='01'" />
|
||||
<el-input v-model="form.point_name" style="width: 370px;" :disabled="form.point_type==='01'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位状态" prop="point_status">
|
||||
<el-select
|
||||
@@ -151,6 +156,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.sch_point_status"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -166,6 +172,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.d_lock_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -181,6 +188,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.current_material_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -196,18 +204,20 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.material_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="列" prop="col">
|
||||
<el-form-item label="排号" prop="col">
|
||||
<el-input v-model="form.col" style="width: 370px;" type="number" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="点位类型" prop="point_type">
|
||||
<el-radio-group v-model="form.point_type">
|
||||
<el-radio
|
||||
v-for="item in dict.sch_point_type"
|
||||
:key="item.id"
|
||||
:label="item.value"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
@@ -221,6 +231,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reginoList"
|
||||
:key="item.id"
|
||||
:label="item.region_name"
|
||||
:value="item.region_id"
|
||||
/>
|
||||
@@ -234,6 +245,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reginoList"
|
||||
:key="item.id"
|
||||
:label="item.region_name"
|
||||
:value="item.region_id"
|
||||
/>
|
||||
@@ -247,6 +259,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reginoList"
|
||||
:key="item.id"
|
||||
:label="item.region_name"
|
||||
:value="item.region_id"
|
||||
/>
|
||||
@@ -281,7 +294,7 @@
|
||||
<el-table-column prop="lock_type_name" label="锁定类型" />
|
||||
<el-table-column prop="current_material_type_name" label="当前存放物料类型" width="120" />
|
||||
<el-table-column prop="material_type_name" label="限定物料类型" width="120" />
|
||||
<el-table-column prop="col" label="列" width="40" />
|
||||
<el-table-column prop="col" label="排号" width="60" />
|
||||
<el-table-column prop="region_name" label="所属区域" width="190" />
|
||||
<el-table-column prop="prev_region_name" label="叫料区域" width="190" />
|
||||
<el-table-column prop="next_region_name" label="送料区域" width="190" />
|
||||
@@ -386,7 +399,7 @@ export default {
|
||||
{ required: true, message: '当前存放物料类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
col: [
|
||||
{ required: true, message: '列不能为空', trigger: 'blur' }
|
||||
{ required: true, message: '排号不能为空', trigger: 'blur' }
|
||||
]
|
||||
// lock_type: [
|
||||
// { required: true, message: '锁定类型不能为空', trigger: 'blur' }
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务明细">
|
||||
<el-form-item v-if="false" label="任务明细">
|
||||
<el-select
|
||||
filterable
|
||||
v-model="query.taskdtl_type"
|
||||
@@ -143,7 +143,7 @@
|
||||
<el-table-column v-if="false" prop="task_type" label="任务类型" />
|
||||
<el-table-column prop="task_type_name" label="任务类型" />
|
||||
<el-table-column v-if="false" prop="taskdtl_type" label="任务明细" />
|
||||
<el-table-column prop="taskdtl_type_name" label="任务明细" />
|
||||
<el-table-column v-if="false" prop="taskdtl_type_name" label="任务明细" />
|
||||
<el-table-column v-if="false" prop="task_status" label="任务状态" />
|
||||
<el-table-column prop="task_status_name" label="任务状态" width="95px" :formatter="formatTaskStatusName" />
|
||||
<!--
|
||||
@@ -154,9 +154,9 @@
|
||||
<el-table-column prop="start_point_code" label="起点编码" width="85" />
|
||||
<el-table-column prop="start_point_name" label="起点名称" width="105" show-overflow-tooltip/>
|
||||
<el-table-column prop="next_area_name" label="下一区域" width="95" show-overflow-tooltip />
|
||||
<el-table-column prop="next_point_code" label="下一点编码" width="85" />
|
||||
<el-table-column prop="next_point_code" label="下一点编码" width="90" />
|
||||
<el-table-column prop="next_point_name" label="下一点名称" width="105" show-overflow-tooltip/>
|
||||
<el-table-column prop="material_code" label="物料编码" />
|
||||
<el-table-column v-if="false" prop="material_code" label="物料编码" />
|
||||
<el-table-column prop="remark" label="备注" width="120" show-overflow-tooltip />
|
||||
<el-table-column v-if="false" prop="update_by" label="修改者" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="135" />
|
||||
|
||||
Reference in New Issue
Block a user