add 平板新需求新增站点管理、任务限制

This commit is contained in:
2023-12-15 14:18:29 +08:00
parent 646722751b
commit a783eee4d7
14 changed files with 190 additions and 74 deletions

View File

@@ -167,12 +167,12 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error); this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error);
} }
if ( move != 0 && task > 0) { if (move != 0 && task > 0) {
//inst_message //inst_message
inst = instructionService.findByCodeFromCache(String.valueOf(task)); inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst != null) { if (inst != null) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
if(mode == 2){ if (mode == 2) {
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
finish_instruction(); finish_instruction();
} }

View File

@@ -100,6 +100,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
int move; int move;
//站点物料来源
String source_device = "";
@Override @Override
public void execute() { public void execute() {
hasGoods = this.getDevice().getHas_goods(); hasGoods = this.getDevice().getHas_goods();

View File

@@ -195,6 +195,7 @@ public interface InstructionService {
* @return Instruction * @return Instruction
*/ */
Instruction findByInstCodeFromCache(String inst_code); Instruction findByInstCodeFromCache(String inst_code);
/** /**
* 根据设备id查询 * 根据设备id查询
* *

View File

@@ -67,7 +67,7 @@ public class InstructionDto implements Serializable {
/** /**
* 完成类型 * 完成类型
*/ */
private String finish_type ="0"; private String finish_type = "0";
/** /**
* 优先级 * 优先级

View File

@@ -461,7 +461,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} catch (Exception e) { } catch (Exception e) {
dto.setSend_status("2"); dto.setSend_status("2");
log.info("指令号:" + dto.getInstruction_code() + "下发agv失败"); log.info("指令号:" + dto.getInstruction_code() + "下发agv失败");
logServer.log(dto.getTask_code(),"create","","","指令号:" + dto.getInstruction_code() + "下发agv失败","","",dto.getVehicle_code());
e.printStackTrace(); e.printStackTrace();
} }
@@ -671,18 +670,20 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
JSONObject jo1 = new JSONObject(); JSONObject jo1 = new JSONObject();
jo1.put("device_code", instnextdevice); jo1.put("device_code", instnextdevice);
if (StrUtil.equals(entity.getMaterial(), "1")) { // if (StrUtil.equals(entity.getMaterial(), "1")) {
jo1.put("hasGoodStatus", "1"); jo1.put("hasGoodStatus", "1");
} else { // } else {
jo1.put("hasGoodStatus", "2"); // jo1.put("hasGoodStatus", "2");
} // }
jo1.put("put_goods_time",DateUtil.now()); jo1.put("put_goods_time", DateUtil.now());
jo1.put("material_type", startdevice.getMaterial_type()); jo1.put("material_type", startdevice.getMaterial_type());
jo1.put("quantity", startdevice.getQuantity()); jo1.put("quantity", startdevice.getQuantity());
jo1.put("remark", startdevice.getRemark()); jo1.put("remark", startdevice.getRemark());
jo1.put("batch", startdevice.getBatch()); jo1.put("batch", startdevice.getBatch());
jo1.put("vehicle_code", entity.getVehicle_code()); jo1.put("vehicle_code", entity.getVehicle_code());
jo1.put("islock", "false"); jo1.put("islock", "false");
jo1.put("source_device", entity.getStart_device_code());
deviceService.changeDeviceStatus(jo1); deviceService.changeDeviceStatus(jo1);
// 如果是无光电的设备 指令完成变更起点、终点状态 // 如果是无光电的设备 指令完成变更起点、终点状态
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
@@ -695,6 +696,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
jo.put("islock", "false"); jo.put("islock", "false");
deviceService.changeDeviceStatus(jo); deviceService.changeDeviceStatus(jo);
JSONObject json = JSONObject.fromObject(entity); JSONObject json = JSONObject.fromObject(entity);
wo.update(json); wo.update(json);
JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0); JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
@@ -878,7 +880,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
// != 0 为agv任务 1=magic 2=NDC 3=XZ // != 0 为agv任务 1=magic 2=NDC 3=XZ
if (!StrUtil.equals(type, "0")) { if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1") if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")
&& !StrUtil.equals(entity.getSend_status(),"2")) { && !StrUtil.equals(entity.getSend_status(), "2")) {
agvService.deleteAgvInst(entity.getInstruction_code()); agvService.deleteAgvInst(entity.getInstruction_code());
flag = true; flag = true;
@@ -890,7 +892,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
flag = true; flag = true;
} }
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3") } else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")
&& !StrUtil.equals(entity.getSend_status(),"2")) { && !StrUtil.equals(entity.getSend_status(), "2")) {
agvService.deleteXZAgvInst(entity.getInstruction_code()); agvService.deleteXZAgvInst(entity.getInstruction_code());
flag = true; flag = true;
} else { } else {
@@ -1037,7 +1039,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
@Override @Override
public Instruction findByInstCodeFromCache(String inst_code) { public Instruction findByInstCodeFromCache(String inst_code) {
for (int i = 0; i < this.instructions.size(); i++) { for (int i = 0; i < this.instructions.size(); i++) {
@@ -1057,7 +1058,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
return inst; return inst;
} }
} }
return null; } return null;
}
@Override @Override
public Instruction findByIdFromCache(String id) { public Instruction findByIdFromCache(String id) {
@@ -1232,14 +1234,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
@Override @Override
public void getFinish(String id){ public void getFinish(String id) {
Instruction inst = this.findById(id); Instruction inst = this.findById(id);
JSONObject feedjo = new JSONObject(); JSONObject feedjo = new JSONObject();
feedjo.put("status","1"); feedjo.put("status", "1");
feedjo.put("device_code",inst.getStart_device_code()); feedjo.put("device_code", inst.getStart_device_code());
feedjo.put("vehicle_code",inst.getVehicle_code()); feedjo.put("vehicle_code", inst.getVehicle_code());
feedjo.put("task_code",inst.getTask_code()); feedjo.put("task_code", inst.getTask_code());
JSONArray feedja = JSONArray.fromObject(feedjo); JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja); acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("1"); inst.setFinish_type("1");
@@ -1247,14 +1249,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
@Override @Override
public void putFinish(String id){ public void putFinish(String id) {
Instruction inst = this.findById(id); Instruction inst = this.findById(id);
JSONObject feedjo = new JSONObject(); JSONObject feedjo = new JSONObject();
feedjo.put("status","2"); feedjo.put("status", "2");
feedjo.put("device_code",inst.getNext_device_code()); feedjo.put("device_code", inst.getNext_device_code());
feedjo.put("vehicle_code",inst.getVehicle_code()); feedjo.put("vehicle_code", inst.getVehicle_code());
feedjo.put("task_code",inst.getTask_code()); feedjo.put("task_code", inst.getTask_code());
JSONArray feedja = JSONArray.fromObject(feedjo); JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja); acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("2"); inst.setFinish_type("2");

View File

@@ -30,6 +30,7 @@ public interface TaskService {
* 数据同步 * 数据同步
*/ */
void reload(); void reload();
/** /**
* 在缓存中查询所有任务列表 * 在缓存中查询所有任务列表
* *
@@ -99,8 +100,12 @@ public interface TaskService {
*/ */
TaskDto findByCode(String code); TaskDto findByCode(String code);
List<TaskDto> findByDeviceCode(String device_code);
/** /**
* 检测任务号是否重复 * 检测任务号是否重复
*
* @param code * @param code
* @return * @return
*/ */

View File

@@ -302,12 +302,23 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return obj; 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 @Override
public Boolean checkSameTaskByCode(String code) { public Boolean checkSameTaskByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("acs_task"); WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0); JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
final TaskDto obj = (TaskDto) JSONObject.toBean(json, TaskDto.class); final TaskDto obj = (TaskDto) JSONObject.toBean(json, TaskDto.class);
if(ObjectUtil.isEmpty(obj)){ if (ObjectUtil.isEmpty(obj)) {
return false; return false;
} }
return true; return true;
@@ -620,7 +631,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
} }
if (ObjectUtil.isNotEmpty(this.findByStartCode(start_device_code)) if (ObjectUtil.isNotEmpty(this.findByStartCode(start_device_code))
|| ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) { || ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) {
throw new WDKException("已存在该起点或终点的任务!"); throw new WDKException("已存在该起点或终点的任务!");
} }
if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) { if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) {
@@ -1022,7 +1033,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto instdto = instructionservice.findByTaskid(entity.getTask_id(), "instruction_status <2 "); InstructionDto instdto = instructionservice.findByTaskid(entity.getTask_id(), "instruction_status <2 ");
if(!ObjectUtil.isEmpty(instdto)){ if (!ObjectUtil.isEmpty(instdto)) {
instructionService.cancel(instdto.getInstruction_id()); instructionService.cancel(instdto.getInstruction_id());
} }
@@ -1150,7 +1161,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto instdto = instructionservice.findByTaskid(entity.getTask_id(), "instruction_status <2 "); InstructionDto instdto = instructionservice.findByTaskid(entity.getTask_id(), "instruction_status <2 ");
if(!ObjectUtil.isEmpty(instdto)){ if (!ObjectUtil.isEmpty(instdto)) {
instructionService.cancel(instdto.getInstruction_id()); instructionService.cancel(instdto.getInstruction_id());
} }

View File

@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.nl.annotation.Log; import org.nl.annotation.Log;
import org.nl.annotation.rest.AnonymousPostMapping; import org.nl.annotation.rest.AnonymousPostMapping;
import org.nl.hand.ajp.service.JPHandService; import org.nl.hand.ajp.service.JPHandService;
@@ -61,6 +62,14 @@ public class LXHandController {
return new ResponseEntity<>(HandService.queryPointByArea(areaCode), HttpStatus.OK); 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") @PostMapping("/insts")
@Log("查询指令") @Log("查询指令")
@ApiOperation("查询指令") @ApiOperation("查询指令")

View File

@@ -1,5 +1,8 @@
package org.nl.hand.alx.service; package org.nl.hand.alx.service;
import net.sf.json.JSONObject;
import java.util.Map; import java.util.Map;
/** /**
@@ -23,6 +26,8 @@ public interface LXHandService {
*/ */
Map<String, Object> queryPointByArea(String dict_id); Map<String, Object> queryPointByArea(String dict_id);
Map<String, Object> bindPoint(JSONObject reqParam);
/** /**
* 查询设备扩展性 * 查询设备扩展性
* *

View File

@@ -1,6 +1,7 @@
package org.nl.hand.alx.service.impl; package org.nl.hand.alx.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; 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.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.*;
import java.util.Map;
/** /**
* @author qxuan * @author qxuan
@@ -53,12 +53,11 @@ import java.util.Map;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class LXHandServicelmpl implements LXHandService{ public class LXHandServicelmpl implements LXHandService {
private final UserService userService; private final UserService userService;
private final PasswordEncoder passwordEncoder; private final PasswordEncoder passwordEncoder;
private final DeviceService deviceService; private final DeviceService deviceService;
private final DeviceAppService deviceAppService; private final DeviceAppService deviceAppService;
InstructionService instructionService = null;
@Override @Override
@@ -71,31 +70,52 @@ public class LXHandServicelmpl implements LXHandService{
return jo; return jo;
} }
@Override @Override
public Map<String, Object> queryPointByArea(String dict_id) { public Map<String, Object> queryPointByArea(String dict_id) {
JSONArray resultArr = new JSONArray(); JSONArray resultArr = new JSONArray();
JSONObject resultJson = new JSONObject(); JSONObject resultJson = new JSONObject();
JSONObject jo = new JSONObject();
//根据value值去查所有的设备 //根据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); 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++) { for (int i = 0; i < acs_deviceja.size(); i++) {
JSONObject devicejo = acs_deviceja.getJSONObject(i); JSONObject devicejo = acs_deviceja.getJSONObject(i);
String device_code = devicejo.optString("device_code"); String device_code = devicejo.optString("device_code");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code); 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) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); 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_id", devicejo.optString("device_id"));
jo.put("device_code", devicejo.optString("device_code")); jo.put("device_code", devicejo.optString("device_code"));
jo.put("device_name", devicejo.optString("device_name")); 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); resultArr.add(jo);
} }
resultJson.put("code", "1"); resultJson.put("code", "1");
@@ -104,6 +124,33 @@ public class LXHandServicelmpl implements LXHandService{
return resultJson; 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 @Override
public Map<String, Object> queryDevice(Map whereMap) { public Map<String, Object> queryDevice(Map whereMap) {
String deviceCode = whereMap.get("device_code").toString(); String deviceCode = whereMap.get("device_code").toString();
@@ -133,6 +180,7 @@ public class LXHandServicelmpl implements LXHandService{
resultJson.put("result", jo); resultJson.put("result", jo);
return resultJson; return resultJson;
} }
@Override @Override
public Map<String, Object> queryTaskType() { public Map<String, Object> queryTaskType() {
JSONObject resultJson = new JSONObject(); 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) { if (ObjectUtil.isEmpty(startDevice.getHas_goods()) || startDevice.getHas_goods() == 0) {
// resultJson.put("code", "0"); resultJson.put("code", "0");
// resultJson.put("desc", "起点必须有货"); resultJson.put("desc", "起点必须有货");
// resultJson.put("result", ""); resultJson.put("result", "");
// return resultJson; return resultJson;
// } }
// if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) {
// resultJson.put("code", "0"); StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
// resultJson.put("desc", "终点必须为空"); if (StrUtil.equals(String.valueOf(startDevice.getExtraValue().get("source_device")), "true")) {
// resultJson.put("result", ""); if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// return resultJson; 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())){ // if(Boolean.parseBoolean(startDevice.getIslock()) || Boolean.parseBoolean(nextDevice.getIslock())){
// resultJson.put("code", "0"); // resultJson.put("code", "0");
// resultJson.put("desc", "起点或终点设备已被锁定"); // resultJson.put("desc", "起点或终点设备已被锁定");
@@ -236,7 +308,6 @@ public class LXHandServicelmpl implements LXHandService{
return resultJson; return resultJson;
} }
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
TaskDto dto = new TaskDto(); TaskDto dto = new TaskDto();
dto.setIs_active("1"); dto.setIs_active("1");
dto.setIs_delete("0"); dto.setIs_delete("0");
@@ -295,7 +366,6 @@ public class LXHandServicelmpl implements LXHandService{
} }
@SneakyThrows @SneakyThrows
@Override @Override
public Map<String, Object> handleLogin(Map<String, String> jsonObject) { public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
@@ -493,7 +563,7 @@ public class LXHandServicelmpl implements LXHandService{
TaskDto acsTask = (TaskDto) JSONObject.toBean(taskjo, TaskDto.class); TaskDto acsTask = (TaskDto) JSONObject.toBean(taskjo, TaskDto.class);
InstructionService instructionservice = SpringContextHolder.getBean(InstructionServiceImpl.class); InstructionService instructionservice = SpringContextHolder.getBean(InstructionServiceImpl.class);
InstructionDto instdto = instructionservice.findByTaskid(acsTask.getTask_id(), "instruction_status <2 "); InstructionDto instdto = instructionservice.findByTaskid(acsTask.getTask_id(), "instruction_status <2 ");
if (instdto != null){ if (instdto != null) {
jo.put("code", "0"); jo.put("code", "0");
jo.put("desc", "有指令未完成!"); jo.put("desc", "有指令未完成!");
jo.put("result", new JSONObject()); jo.put("result", new JSONObject());
@@ -514,5 +584,4 @@ public class LXHandServicelmpl implements LXHandService{
} }
} }

View File

@@ -50,30 +50,30 @@ public class QueryXZAgvTaskStatus {
continue; continue;
//子任务状态 待以后处理 //子任务状态 待以后处理
JSONArray blocks = JSONArray.fromObject(one.get("blocks")); JSONArray blocks = JSONArray.fromObject(one.get("blocks"));
for(int j=0;j<blocks.size();j++){ for (int j = 0; j < blocks.size(); j++) {
JSONObject blocksjo = (JSONObject) blocks.get(j); JSONObject blocksjo = (JSONObject) blocks.get(j);
String blockId = blocksjo.getString("blockId"); String blockId = blocksjo.getString("blockId");
String device_code = blocksjo.getString("location"); String device_code = blocksjo.getString("location");
String state = blocksjo.getString("state"); String state = blocksjo.getString("state");
//取货 //取货
if(StrUtil.equals(String.valueOf(j+1),"1") && StrUtil.equals(state,"FINISHED") && StrUtil.equals(inst.getFinish_type(),"0")){ if (StrUtil.equals(String.valueOf(j + 1), "1") && StrUtil.equals(state, "FINISHED") && StrUtil.equals(inst.getFinish_type(), "0")) {
JSONObject feedjo = new JSONObject(); JSONObject feedjo = new JSONObject();
feedjo.put("status","1"); feedjo.put("status", "1");
feedjo.put("device_code",device_code); feedjo.put("device_code", device_code);
feedjo.put("vehicle_code",inst.getVehicle_code()); feedjo.put("vehicle_code", inst.getVehicle_code());
feedjo.put("task_code",inst.getTask_code()); feedjo.put("task_code", inst.getTask_code());
JSONArray feedja = JSONArray.fromObject(feedjo); JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja); acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("1"); inst.setFinish_type("1");
instructionService.update(inst); instructionService.update(inst);
} }
//放货 //放货
if(StrUtil.equals(String.valueOf(j+1),"2") && StrUtil.equals(state,"FINISHED") && StrUtil.equals(inst.getFinish_type(),"1")){ if (StrUtil.equals(String.valueOf(j + 1), "2") && StrUtil.equals(state, "FINISHED") && StrUtil.equals(inst.getFinish_type(), "1")) {
JSONObject feedjo = new JSONObject(); JSONObject feedjo = new JSONObject();
feedjo.put("status","2"); feedjo.put("status", "2");
feedjo.put("device_code",device_code); feedjo.put("device_code", device_code);
feedjo.put("task_code",inst.getTask_code()); feedjo.put("task_code", inst.getTask_code());
feedjo.put("vehicle_code",inst.getVehicle_code()); feedjo.put("vehicle_code", inst.getVehicle_code());
JSONArray feedja = JSONArray.fromObject(feedjo); JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja); acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("2"); inst.setFinish_type("2");
@@ -97,7 +97,7 @@ public class QueryXZAgvTaskStatus {
// 等待=WAITING // 等待=WAITING
//执行中 //执行中
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
if (inst != null) { if (inst != null) {
inst.setInstruction_status("1"); inst.setInstruction_status("1");
instructionService.update(inst); instructionService.update(inst);
@@ -109,8 +109,11 @@ public class QueryXZAgvTaskStatus {
} }
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) { } else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
if (inst != null) { if (inst != null) {
inst.setInstruction_status("1"); // inst.setInstruction_status("1");
instructionService.update(inst); // instructionService.update(inst);
//任务失败时取消指令和任务
instructionService.cancel(inst.getInstruction_id());
taskService.cancel(inst.getTask_id());
} }
} }
// else if ("STOPPED".equals(state)){ // else if ("STOPPED".equals(state)){

View File

@@ -8,12 +8,12 @@ spring:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy 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: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:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lxjm_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root} username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd} # password: ${DB_PWD:P@ssw0rd}
# password: ${DB_PWD:123456} # password: ${DB_PWD:123456}
password: ${DB_PWD:Root.123456} password: ${DB_PWD:password}
# 初始连接数 # 初始连接数
initial-size: 5 initial-size: 5
# 最小连接数 # 最小连接数

View File

@@ -2,7 +2,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: dev active: prod
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:
@@ -43,7 +43,7 @@ rsa:
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
logging: logging:
file: file:
path: C:\logs\nlacs\ path: /Users/onepiece/myFile/logs
acsTowms: acsTowms:
token: Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJiZTVmOGZiZDcyMWU0NGFiODRlOGI4NTE4ODE5OWM0ZiIsImF1dGgiOiJ1c2VyOmxpc3QsbW9uaXRvcjpsaXN0Iiwic3ViIjoiYWNzIn0.JGga-TcIHTt76KT_m_7bt-fxdBUdwdRfRjXzwLyPLVLLPoOSXbVPbf2q6vcV-fh33r2wyrBEleWYVPOEvjrZMw token: Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJiZTVmOGZiZDcyMWU0NGFiODRlOGI4NTE4ODE5OWM0ZiIsImF1dGgiOiJ1c2VyOmxpc3QsbW9uaXRvcjpsaXN0Iiwic3ViIjoiYWNzIn0.JGga-TcIHTt76KT_m_7bt-fxdBUdwdRfRjXzwLyPLVLLPoOSXbVPbf2q6vcV-fh33r2wyrBEleWYVPOEvjrZMw

View File

@@ -74,6 +74,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </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-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="关联三色灯" prop="device_code" label-width="100px"> <el-form-item label="关联三色灯" prop="device_code" label-width="100px">
@@ -165,6 +172,7 @@ export default {
manual_create_task: true, manual_create_task: true,
auto_create_task: true, auto_create_task: true,
is_pickup: true, is_pickup: true,
source_device: true,
is_release: true, is_release: true,
station_manager: true, station_manager: true,
auto_clean_task: true, auto_clean_task: true,