add 平板新需求新增站点管理、任务限制
This commit is contained in:
@@ -100,6 +100,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
|
||||
int move;
|
||||
|
||||
//站点物料来源
|
||||
String source_device = "";
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
hasGoods = this.getDevice().getHas_goods();
|
||||
|
||||
@@ -195,6 +195,7 @@ public interface InstructionService {
|
||||
* @return Instruction
|
||||
*/
|
||||
Instruction findByInstCodeFromCache(String inst_code);
|
||||
|
||||
/**
|
||||
* 根据设备id查询
|
||||
*
|
||||
|
||||
@@ -461,7 +461,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
log.info("指令号:" + dto.getInstruction_code() + "下发agv失败!");
|
||||
logServer.log(dto.getTask_code(),"create","","","指令号:" + dto.getInstruction_code() + "下发agv失败!","","",dto.getVehicle_code());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -671,11 +670,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
JSONObject jo1 = new JSONObject();
|
||||
jo1.put("device_code", instnextdevice);
|
||||
if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
// if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
jo1.put("hasGoodStatus", "1");
|
||||
} else {
|
||||
jo1.put("hasGoodStatus", "2");
|
||||
}
|
||||
// } else {
|
||||
// jo1.put("hasGoodStatus", "2");
|
||||
// }
|
||||
jo1.put("put_goods_time", DateUtil.now());
|
||||
jo1.put("material_type", startdevice.getMaterial_type());
|
||||
jo1.put("quantity", startdevice.getQuantity());
|
||||
@@ -683,6 +682,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
jo1.put("batch", startdevice.getBatch());
|
||||
jo1.put("vehicle_code", entity.getVehicle_code());
|
||||
jo1.put("islock", "false");
|
||||
jo1.put("source_device", entity.getStart_device_code());
|
||||
|
||||
deviceService.changeDeviceStatus(jo1);
|
||||
// 如果是无光电的设备 指令完成变更起点、终点状态
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -695,6 +696,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
jo.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
||||
@@ -1037,7 +1039,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Instruction findByInstCodeFromCache(String inst_code) {
|
||||
for (int i = 0; i < this.instructions.size(); i++) {
|
||||
@@ -1057,7 +1058,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
return null; }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByIdFromCache(String id) {
|
||||
|
||||
@@ -30,6 +30,7 @@ public interface TaskService {
|
||||
* 数据同步
|
||||
*/
|
||||
void reload();
|
||||
|
||||
/**
|
||||
* 在缓存中查询所有任务列表
|
||||
*
|
||||
@@ -99,8 +100,12 @@ public interface TaskService {
|
||||
*/
|
||||
TaskDto findByCode(String code);
|
||||
|
||||
|
||||
List<TaskDto> findByDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
* 检测任务号是否重复
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -302,6 +302,17 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> findByDeviceCode(String device_code) {
|
||||
return Optional
|
||||
.ofNullable(this.tasks)
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.filter(taskDto -> taskDto.getStart_device_code().equals(device_code) || taskDto.getNext_device_code().equals(device_code))
|
||||
.filter(taskDto -> taskDto.getTask_code().startsWith("-"))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkSameTaskByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.annotation.rest.AnonymousPostMapping;
|
||||
import org.nl.hand.ajp.service.JPHandService;
|
||||
@@ -61,6 +62,14 @@ public class LXHandController {
|
||||
return new ResponseEntity<>(HandService.queryPointByArea(areaCode), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/bindpoint")
|
||||
@Log("点位绑定")
|
||||
@ApiOperation("点位绑定")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> bindPoint(@RequestBody JSONObject reqParam) {
|
||||
return new ResponseEntity<>(HandService.bindPoint(reqParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/insts")
|
||||
@Log("查询指令")
|
||||
@ApiOperation("查询指令")
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.nl.hand.alx.service;
|
||||
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -23,6 +26,8 @@ public interface LXHandService {
|
||||
*/
|
||||
Map<String, Object> queryPointByArea(String dict_id);
|
||||
|
||||
Map<String, Object> bindPoint(JSONObject reqParam);
|
||||
|
||||
/**
|
||||
* 查询设备扩展性
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.hand.alx.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -42,8 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
@@ -58,7 +58,6 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
InstructionService instructionService = null;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -71,31 +70,52 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryPointByArea(String dict_id) {
|
||||
JSONArray resultArr = new JSONArray();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
|
||||
//根据value值去查所有的设备
|
||||
JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + dict_id + "' and device_type='conveyor' and is_config='true' ", "seq_num,device_name").getResultJSONArray(0);
|
||||
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
WQLObject wo_runPoint = WQLObject.getWQLObject("acs_device_runpoint");
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
|
||||
|
||||
for (int i = 0; i < acs_deviceja.size(); i++) {
|
||||
JSONObject devicejo = acs_deviceja.getJSONObject(i);
|
||||
String device_code = devicejo.optString("device_code");
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device device = appService.findDeviceByCode(device_code);
|
||||
//点位状态status对应status_name 0空 1有货 2有任务
|
||||
String status = "0";
|
||||
String status_name = "无货";
|
||||
String input_material = "0";
|
||||
String allow_update = "0";
|
||||
JSONObject jo = new JSONObject();
|
||||
//无光电普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
JSONObject deviceRunPoint = wo_runPoint.query("device_code = '" + devicejo.optString("device_code") + "'").uniqueResult(0);
|
||||
Integer hasgoods = deviceRunPoint.optInt("hasgoods");
|
||||
if (hasgoods == 1) {
|
||||
status = "1";
|
||||
status_name = "有货";
|
||||
}
|
||||
allow_update = "1";
|
||||
input_material = "1";
|
||||
jo.put("device_id", devicejo.optString("device_id"));
|
||||
jo.put("device_code", devicejo.optString("device_code"));
|
||||
jo.put("device_name", devicejo.optString("device_name"));
|
||||
jo.put("allow_update", "1");
|
||||
jo.put("allow_update", allow_update);
|
||||
jo.put("status", status);
|
||||
jo.put("status_name", status_name);
|
||||
jo.put("input_material", input_material);
|
||||
jo.put("source_device", standardOrdinarySiteDeviceDriver.getSource_device());
|
||||
}
|
||||
|
||||
|
||||
resultArr.add(jo);
|
||||
}
|
||||
resultJson.put("code", "1");
|
||||
@@ -104,6 +124,33 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> bindPoint(JSONObject reqParam) {
|
||||
WQLObject wo_runPoint = WQLObject.getWQLObject("acs_device_runpoint");
|
||||
String device_code = reqParam.getString("device_code");
|
||||
String status = reqParam.getString("status");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(status)) {
|
||||
throw new BadRequestException("点位状态不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("hasgoods", status);
|
||||
wo_runPoint.update(map, "device_code = '" + device_code + "'");
|
||||
if (device != null && device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setHasGoods(Integer.valueOf(status));
|
||||
device.setHas_goods(Integer.valueOf(status));
|
||||
}
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "成功");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevice(Map whereMap) {
|
||||
String deviceCode = whereMap.get("device_code").toString();
|
||||
@@ -133,6 +180,7 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
resultJson.put("result", jo);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryTaskType() {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
@@ -207,18 +255,42 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
}
|
||||
|
||||
//判断起点有货,终点为空
|
||||
// if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) {
|
||||
// resultJson.put("code", "0");
|
||||
// resultJson.put("desc", "起点必须有货");
|
||||
// resultJson.put("result", "");
|
||||
// return resultJson;
|
||||
// }
|
||||
// if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) {
|
||||
// resultJson.put("code", "0");
|
||||
// resultJson.put("desc", "终点必须为空");
|
||||
// resultJson.put("result", "");
|
||||
// return resultJson;
|
||||
// }
|
||||
if (ObjectUtil.isEmpty(startDevice.getHas_goods()) || startDevice.getHas_goods() == 0) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "起点必须有货");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
if (StrUtil.equals(String.valueOf(startDevice.getExtraValue().get("source_device")), "true")) {
|
||||
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (StrUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getSource_device()) &&
|
||||
!StrUtil.equals(standardOrdinarySiteDeviceDriver.getSource_device(), next_devicecode)) {
|
||||
throw new BadRequestException("起点物料来源与终点不一致,不能生成任务!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ObjectUtil.isEmpty(nextDevice.getHas_goods()) && nextDevice.getHas_goods() == 1) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "终点必须为空");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
//判断是否有起点的任务
|
||||
List<TaskDto> start_taskDtos = taskService.findByDeviceCode(start_devicecode);
|
||||
//判断是否有终点的任务
|
||||
List<TaskDto> next_taskDtos = taskService.findByDeviceCode(next_devicecode);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(start_taskDtos) || ObjectUtil.isNotEmpty(next_taskDtos)) {
|
||||
throw new BadRequestException("已存在该点位的任务,不能生成任务!");
|
||||
}
|
||||
|
||||
|
||||
// if(Boolean.parseBoolean(startDevice.getIslock()) || Boolean.parseBoolean(nextDevice.getIslock())){
|
||||
// resultJson.put("code", "0");
|
||||
// resultJson.put("desc", "起点或终点设备已被锁定");
|
||||
@@ -236,7 +308,6 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
TaskDto dto = new TaskDto();
|
||||
dto.setIs_active("1");
|
||||
dto.setIs_delete("0");
|
||||
@@ -295,7 +366,6 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
|
||||
@@ -514,5 +584,4 @@ public class LXHandServicelmpl implements LXHandService{
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -109,8 +109,11 @@ public class QueryXZAgvTaskStatus {
|
||||
}
|
||||
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
// inst.setInstruction_status("1");
|
||||
// instructionService.update(inst);
|
||||
//任务失败时取消指令和任务
|
||||
instructionService.cancel(inst.getInstruction_id());
|
||||
taskService.cancel(inst.getTask_id());
|
||||
}
|
||||
}
|
||||
// else if ("STOPPED".equals(state)){
|
||||
|
||||
@@ -8,12 +8,12 @@ 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:lxjm_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:lxjm_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:lxjm_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:lxjm_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
# password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:password}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
@@ -43,7 +43,7 @@ rsa:
|
||||
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
|
||||
logging:
|
||||
file:
|
||||
path: C:\logs\nlacs\
|
||||
path: /Users/onepiece/myFile/logs
|
||||
|
||||
acsTowms:
|
||||
token: Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJiZTVmOGZiZDcyMWU0NGFiODRlOGI4NTE4ODE5OWM0ZiIsImF1dGgiOiJ1c2VyOmxpc3QsbW9uaXRvcjpsaXN0Iiwic3ViIjoiYWNzIn0.JGga-TcIHTt76KT_m_7bt-fxdBUdwdRfRjXzwLyPLVLLPoOSXbVPbf2q6vcV-fh33r2wyrBEleWYVPOEvjrZMw
|
||||
|
||||
@@ -74,6 +74,13 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料来源">
|
||||
<el-switch v-model="form.source_device" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||
@@ -165,6 +172,7 @@ export default {
|
||||
manual_create_task: true,
|
||||
auto_create_task: true,
|
||||
is_pickup: true,
|
||||
source_device: true,
|
||||
is_release: true,
|
||||
station_manager: true,
|
||||
auto_clean_task: true,
|
||||
|
||||
Reference in New Issue
Block a user