手持系统
This commit is contained in:
@@ -14,6 +14,6 @@ public class Device extends DeviceManageDto {
|
||||
private DeviceDriverDefination deviceDriverDefination;
|
||||
|
||||
public String toString() {
|
||||
return "";
|
||||
return this.getDevice_code();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
package org.nl.pad.azd.rest;
|
||||
package org.nl.hand.alx.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -8,8 +8,9 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.annotation.rest.AnonymousPostMapping;
|
||||
import org.nl.hand.ajp.service.JPHandService;
|
||||
import org.nl.hand.alx.service.LXHandService;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.pad.azd.service.PadService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@@ -21,37 +22,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @date 2021-07-21
|
||||
* @author zhoujj
|
||||
* @date 2023-05-04
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "平板接口")
|
||||
@Api(tags = "手持接口")
|
||||
@RequestMapping("/api/hand")
|
||||
@Slf4j
|
||||
public class PadController {
|
||||
public class LXHandController {
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final UserService userService;
|
||||
private final PadService HandService;
|
||||
|
||||
@PostMapping("/area")
|
||||
@Log("查询区域")
|
||||
@ApiOperation("查询区域")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> query() {
|
||||
return new ResponseEntity<>(HandService.queryArea(null), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/point")
|
||||
@Log("根据区域查点位")
|
||||
@ApiOperation("根据区域查点位")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
//@RequestBody JSONObject json
|
||||
public ResponseEntity<Object> queryPointByArea(@RequestBody Map whereJson) {
|
||||
String dict_id = (String) whereJson.get("region");
|
||||
return new ResponseEntity<>(HandService.queryPointByArea(dict_id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
private final LXHandService HandService;
|
||||
@PostMapping("/tasks")
|
||||
@Log("查询任务")
|
||||
@ApiOperation("查询任务")
|
||||
@@ -61,6 +43,24 @@ public class PadController {
|
||||
return new ResponseEntity<>(HandService.queryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryArea")
|
||||
@Log("查询区域")
|
||||
@ApiOperation("查询区域")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> query() {
|
||||
return new ResponseEntity<>(HandService.queryArea(null), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPointByArea")
|
||||
@Log("查询设备编号及状态")
|
||||
@ApiOperation("查询设备编号及状态")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
//@RequestBody JSONObject json
|
||||
public ResponseEntity<Object> queryPoint(@RequestBody Map<String, String> whereJson) {
|
||||
String areaCode = (String) whereJson.get("areaCode");
|
||||
return new ResponseEntity<>(HandService.queryPointByArea(areaCode), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/insts")
|
||||
@Log("查询指令")
|
||||
@ApiOperation("查询指令")
|
||||
@@ -69,8 +69,16 @@ public class PadController {
|
||||
|
||||
return new ResponseEntity<>(HandService.queryInst(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/queryDevice")
|
||||
@Log("查询设备扩展属性")
|
||||
@ApiOperation("查询设备扩展属性")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
//@RequestBody JSONObject json
|
||||
public ResponseEntity<Object> queryDeviceAugmentabilityByCode(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.queryDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@AnonymousPostMapping("/task")
|
||||
@AnonymousPostMapping("/callTask")
|
||||
@Log("创建任务")
|
||||
@ApiOperation("创建任务")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
@@ -90,20 +98,10 @@ public class PadController {
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) {
|
||||
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) throws Exception {
|
||||
return new ResponseEntity<>(HandService.Taskoperation(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceStatus")
|
||||
@Log("修改设备状态")
|
||||
@ApiOperation("修改设备状态")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> updateDeviceStatus(@RequestBody Map<String, String> whereJson) {
|
||||
|
||||
return new ResponseEntity<>(HandService.updateDeviceStatus(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/handlogin")
|
||||
@PostMapping("/login")
|
||||
@Log("手持登陆验证")
|
||||
@ApiOperation("手持登陆验证")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
@@ -112,20 +110,4 @@ public class PadController {
|
||||
return new ResponseEntity<>(HandService.handleLogin(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/matrial")
|
||||
@Log("查询物料信息")
|
||||
@ApiOperation("查询物料信息")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryMaterial() {
|
||||
return new ResponseEntity<>(HandService.queryMaterial(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryRouteLine")
|
||||
@Log("查询路由路线信息")
|
||||
@ApiOperation("查询路由路线信息")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryRouteLine(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.queryRouteLine(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
|
||||
package org.nl.pad.azd.service;
|
||||
|
||||
package org.nl.hand.alx.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @author zhoujj
|
||||
* @description 服务接口
|
||||
* @date 2021-07-21
|
||||
* @date 2023-05-04
|
||||
**/
|
||||
public interface PadService {
|
||||
|
||||
public interface LXHandService {
|
||||
/**
|
||||
* 查询区域
|
||||
*
|
||||
@@ -20,13 +17,27 @@ public interface PadService {
|
||||
Map<String, Object> queryArea(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据区域查点位
|
||||
* 查询设备编号及状态
|
||||
*
|
||||
* @param dict_id 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryPointByArea(String dict_id);
|
||||
|
||||
/**
|
||||
* 查询设备扩展性
|
||||
*
|
||||
* @param deviceCode
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> queryDevice(Map deviceCode);
|
||||
|
||||
/**
|
||||
* 查询任务状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> queryTaskType();
|
||||
|
||||
/**
|
||||
* 查询指令
|
||||
*
|
||||
@@ -36,7 +47,7 @@ public interface PadService {
|
||||
Map<String, Object> queryInst(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 查询任务
|
||||
* 创建任务
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
@@ -51,13 +62,7 @@ public interface PadService {
|
||||
*/
|
||||
Map<String, Object> queryTask(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 指令操作
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> updateDeviceStatus(Map<String, String> jsonObject);
|
||||
|
||||
|
||||
/**
|
||||
* 手持登陆
|
||||
@@ -68,7 +73,7 @@ public interface PadService {
|
||||
Map<String, Object> handleLogin(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 手持登陆
|
||||
* 指令操作
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
@@ -76,25 +81,12 @@ public interface PadService {
|
||||
Map<String, Object> Instoperation(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 手持登陆
|
||||
* 任务操作
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> Taskoperation(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* 查询物料
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryMaterial();
|
||||
Map<String, Object> Taskoperation(Map<String, String> jsonObject) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 查询路由路线
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryRouteLine(Map<String, String> jsonObject);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.pad.azd.service.dto;
|
||||
package org.nl.hand.alx.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@Data
|
||||
public class PadDto implements Serializable {
|
||||
public class HandDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 库区标识
|
||||
@@ -0,0 +1,518 @@
|
||||
package org.nl.hand.alx.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.agv.server.impl.AgvServiceImpl;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
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.config.RsaProperties;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.hand.alx.service.LXHandService;
|
||||
import org.nl.hand.amb.service.MbHandService;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.RsaUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @description 服务实现
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class LXHandServicelmpl implements LXHandService{
|
||||
private final UserService userService;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
InstructionService instructionService = null;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryArea(Map whereJson) {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONArray resultJSONArray = WQL.getWO("QLX_QUERY001").addParam("flag", "1").process().getResultJSONArray(0);
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "查询成功");
|
||||
jo.put("result", resultJSONArray);
|
||||
|
||||
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);
|
||||
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);
|
||||
//无光电普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
resultArr.add(jo);
|
||||
}
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", resultArr);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevice(Map whereMap) {
|
||||
String deviceCode = whereMap.get("device_code").toString();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject acs_device = WQLObject.getWQLObject("ACS_DEVICE").query("device_code = '" + deviceCode + "'").pageResult();
|
||||
JSONObject acsDevice = (JSONObject) acs_device.getJSONArray("content").get(0);
|
||||
//判断设备类型是不是storage
|
||||
if (!"storage".equals(acsDevice.optString("device_type"))) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "该设备不是货架");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
JSONObject jsonObject = deviceService.queryStorageExtra(deviceCode);
|
||||
jo.put("device_id", acsDevice.optString("device_id"));
|
||||
jo.put("device_code", deviceCode);
|
||||
jo.put("device_name", acsDevice.optString("device_name"));
|
||||
jo.put("device_type", acsDevice.optString("device_type"));
|
||||
jo.put("maxY", jsonObject.optString("maxY"));
|
||||
jo.put("minY", jsonObject.optString("minY"));
|
||||
jo.put("maxZ", jsonObject.optString("maxZ"));
|
||||
jo.put("minZ", jsonObject.optString("minZ"));
|
||||
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", jo);
|
||||
return resultJson;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> queryTaskType() {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
JSONObject jo = WQLObject.getWQLObject("sys_dict_detail").query("name = 'task_type'").pageResult();
|
||||
JSONArray arr = new JSONArray();
|
||||
JSONArray content = jo.getJSONArray("content");
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject jsonObject = (JSONObject) content.get(i);
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("value", jsonObject.optString("value"));
|
||||
jsonObject1.put("label", jsonObject.optString("label"));
|
||||
arr.add(jsonObject1);
|
||||
}
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", arr);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryInst(Map<String, String> jsonObject) {
|
||||
//查询位完成的指令
|
||||
JSONObject resultJson = new JSONObject();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
String key = jsonObject.get("keyword");
|
||||
String start_point = jsonObject.get("start_devicecode");
|
||||
String next_point = jsonObject.get("next_devicecode");
|
||||
map.put("flag", "4");
|
||||
if (StrUtil.isNotEmpty(key)) {
|
||||
map.put("key", "%" + key + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(start_point)) {
|
||||
map.put("start_point", "%" + start_point + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(next_point)) {
|
||||
map.put("next_point", "%" + next_point + "%");
|
||||
}
|
||||
map.put("task_code", "%-%");
|
||||
JSONArray resultArr = WQL.getWO("QLX_QUERY001").addParamMap(map).addParamMap((HashMap) jsonObject).process().getResultJSONArray(0);
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", resultArr);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> createTask(Map<String, String> jsonObject) {
|
||||
String start_devicecode = jsonObject.get("start_device_codes");
|
||||
String next_devicecode = jsonObject.get("next_device_code");
|
||||
String material_type = jsonObject.get("material_type");
|
||||
String task_type = jsonObject.get("task_type");
|
||||
String priority = jsonObject.get("priority");
|
||||
String carrier = jsonObject.get("carrier");
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device startDevice = appService.findDeviceByCode(start_devicecode);
|
||||
Device nextDevice = appService.findDeviceByCode(next_devicecode);
|
||||
|
||||
if (StrUtil.isEmpty(start_devicecode)) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "起点不能为空");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_devicecode)) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "终点不能为空");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
//判断起点有货,终点为空
|
||||
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(Boolean.parseBoolean(startDevice.getIslock()) || Boolean.parseBoolean(nextDevice.getIslock())){
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "起点或终点设备已被锁定");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
if (StrUtil.isEmpty(priority)) {
|
||||
priority = "1";
|
||||
}
|
||||
|
||||
if (start_devicecode.equals(next_devicecode)) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "起点和终点不能是同一设备【" + next_devicecode + "】");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
TaskDto dto = new TaskDto();
|
||||
dto.setIs_active("1");
|
||||
dto.setIs_delete("0");
|
||||
dto.setMaterial(material_type);
|
||||
dto.setStart_point_code(start_devicecode);
|
||||
dto.setNext_point_code(next_devicecode);
|
||||
dto.setMaterial(material_type);
|
||||
dto.setTask_type(task_type);
|
||||
dto.setPriority(priority);
|
||||
dto.setVehicle_code(carrier);
|
||||
try {
|
||||
taskService.create(dto);
|
||||
// startDevice.setIslock("true");
|
||||
// nextDevice.setIslock("true");
|
||||
} catch (Exception e) {
|
||||
resultJson.put("code", "2");
|
||||
resultJson.put("desc", e.getMessage());
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "生成成功!");
|
||||
resultJson.put("result", "");
|
||||
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");
|
||||
if (StrUtil.isNotEmpty(key)) {
|
||||
map.put("key", "%" + key + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(start_point)) {
|
||||
map.put("start_point", "%" + start_point + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(next_point)) {
|
||||
map.put("next_point", "%" + next_point + "%");
|
||||
}
|
||||
|
||||
map.put("task_code", "%-%");
|
||||
|
||||
//查询有任务 但是没有指令的任务
|
||||
JSONArray result = WQL.getWO("QLX_QUERY001").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", result);
|
||||
return resultJson;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String user = jsonObject.get("username");
|
||||
String password = jsonObject.get("password");
|
||||
if (StrUtil.isEmpty("user")) {
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "用户不能为空");
|
||||
return resultJson;
|
||||
}
|
||||
if (StrUtil.isEmpty("password")) {
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "密码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
boolean is_match = false;
|
||||
Long account_id = 0L;
|
||||
try {
|
||||
String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
|
||||
UserDto userDto = userService.findByName(user);
|
||||
account_id = userDto.getId();
|
||||
is_match = passwordEncoder.matches(pwd, userDto.getPassword());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (is_match) {
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "登陆成功");
|
||||
} else {
|
||||
resultJson.put("code", "2");
|
||||
resultJson.put("desc", "登陆失败!");
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("user_name", user);
|
||||
jo.put("account_id", account_id);
|
||||
resultJson.put("result", jo);
|
||||
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) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "未找到该指令!");
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
if (StrUtil.equals(instwo.getString("instruction_status"), "2") ||
|
||||
StrUtil.equals(instwo.getString("instruction_status"), "3")) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "指令已完成或已取消,无法操作");
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
String task_id = instwo.optString("task_id");
|
||||
Instruction instdto = (Instruction) JSONObject.toBean(instwo, Instruction.class);
|
||||
AgvService agvService = SpringContextHolder.getBean(AgvServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
|
||||
/* 1 指令撤销
|
||||
2 重新下发
|
||||
3 强制完成*/
|
||||
if (type.equals("1")) {
|
||||
//调用agv删除任务的接口
|
||||
|
||||
try {
|
||||
//agvService.deleteAgvInst(instwo.getString("instruction_code"));
|
||||
if (StrUtil.isEmpty(instdto.getAgv_jobno())) {
|
||||
instructionService.cancelNOSendAgv(inst_uuid);
|
||||
} else {
|
||||
agvService.deleteAgvInstToNDC(instdto);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "下发agv失败");
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
if (type.equals("2")) {
|
||||
try {
|
||||
agvService.sendAgvInstToNDC(instdto);
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "下发agv失败");
|
||||
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) throws Exception {
|
||||
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);
|
||||
String task_code = taskjo.optString("task_code");
|
||||
String start_point_code = taskjo.optString("start_point_code");
|
||||
String next_point_code = taskjo.optString("next_point_code");
|
||||
String task_id = taskjo.optString("task_id");
|
||||
|
||||
if (StrUtil.isEmpty(task_uuid)) {
|
||||
throw new BadRequestException("id不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("操作类型不能为空!");
|
||||
}
|
||||
if (StrUtil.equals(taskjo.getString("task_status"), "2") ||
|
||||
StrUtil.equals(taskjo.getString("task_status"), "3")) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "任务已完成或已取消,无法操作");
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
//重新生成
|
||||
if (type.equals("1")) {
|
||||
//重新生产指令
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
instdto.setRemark(taskjo.optString("remark"));
|
||||
instdto.setMaterial(taskjo.optString("taskjo"));
|
||||
instdto.setTask_id(taskjo.optString("task_id"));
|
||||
instdto.setTask_code(taskjo.optString("task_code"));
|
||||
instdto.setVehicle_code(taskjo.optString("vehicle_code"));
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_point_code(taskjo.optString("start_point_code"));
|
||||
instdto.setNext_point_code(taskjo.optString("next_point_code"));
|
||||
instdto.setStart_device_code(taskjo.optString("start_device_code"));
|
||||
instdto.setNext_device_code(taskjo.optString("next_device_code"));
|
||||
instdto.setInstruction_status("0");
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject instcheckjson = instwo.query(" instruction_status <2 and next_point_code= '" + next_point_code + "'" + " and start_point_code = '" + start_point_code + "'" + " and task_id = '" + task_id + "'").uniqueResult(0);
|
||||
if (instcheckjson != null) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "操作失败");
|
||||
jo.put("result", task_code + ":该任务已存在待完成指令!");
|
||||
return jo;
|
||||
}
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", e.getMessage());
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
instdto.setExecute_device_code(taskjo.optString("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.toBean(taskjo, TaskDto.class);
|
||||
InstructionService instructionservice = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
InstructionDto instdto = instructionservice.findByTaskid(acsTask.getTask_id(), "instruction_status <2 ");
|
||||
if (instdto != null){
|
||||
jo.put("code", "0");
|
||||
jo.put("desc", "有指令未完成!");
|
||||
jo.put("result", new JSONObject());
|
||||
return jo;
|
||||
}
|
||||
taskService.finish(acsTask.getTask_id());
|
||||
Device startDevice = deviceAppService.findDeviceByCode(acsTask.getStart_device_code());
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(acsTask.getNext_device_code());
|
||||
startDevice.setIslock("false");
|
||||
nextDevice.setIslock("false");
|
||||
}
|
||||
|
||||
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "操作成功");
|
||||
jo.put("result", new JSONObject());
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -16,12 +16,10 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.key TYPEAS s_string
|
||||
输入.keyword TYPEAS s_string
|
||||
输入.start_devicecode TYPEAS s_string
|
||||
输入.next_devicecode TYPEAS s_string
|
||||
输入.start_point TYPEAS s_string
|
||||
输入.next_point TYPEAS s_string
|
||||
输入.detail_id TYPEAS s_string
|
||||
输入.start_point TYPEAS s_string
|
||||
输入.next_point TYPEAS s_string
|
||||
|
||||
输入.task_code TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -59,7 +57,7 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
@@ -68,32 +66,35 @@
|
||||
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.material AS material_type,
|
||||
sys2.label AS material_type_name,
|
||||
task.task_status AS task_status,
|
||||
sys.label AS task_status_name,
|
||||
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'
|
||||
INNER JOIN sys_dict_detail AS sys ON sys.VALUE = task.task_status
|
||||
AND sys.NAME = 'task_status'
|
||||
LEFT JOIN sys_dict_detail AS 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)
|
||||
task.task_code like 输入.key
|
||||
ENDOPTION
|
||||
OPTION 输入.start_point <> ""
|
||||
task.start_point_code = 输入.start_point
|
||||
task.start_point_code like 输入.start_point
|
||||
ENDOPTION
|
||||
OPTION 输入.next_point <> ""
|
||||
task.next_point_code = 输入.next_point
|
||||
task.next_point_code like 输入.next_point
|
||||
ENDOPTION
|
||||
OPTION 输入.task_code <> ""
|
||||
task.task_code like 输入.task_code
|
||||
ENDOPTION
|
||||
ORDER BY task.create_time
|
||||
ENDSELECT
|
||||
@@ -117,60 +118,70 @@
|
||||
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
|
||||
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.label AS inst_status_name,
|
||||
inst.execute_message AS inst_step,
|
||||
inst.vehicle_code AS carrier,
|
||||
inst.carno,
|
||||
inst.priority,
|
||||
inst.send_status,
|
||||
inst.create_time,
|
||||
inst.material AS material_type,
|
||||
dtl2.label AS material_type_name,
|
||||
dtl3.label AS send_status_name
|
||||
FROM
|
||||
acs_instruction inst
|
||||
INNER JOIN sys_dict_detail AS dtl ON dtl.
|
||||
VALUE
|
||||
= inst.instruction_status
|
||||
AND dtl.NAME = 'inst_status'
|
||||
LEFT JOIN sys_dict_detail dtl2 ON dtl2.
|
||||
VALUE
|
||||
= inst.material
|
||||
AND dtl2.NAME = 'material_type'
|
||||
LEFT JOIN sys_dict_detail dtl3 ON dtl3.
|
||||
VALUE
|
||||
= inst.send_status
|
||||
AND dtl3.NAME = 'send_status'
|
||||
WHERE
|
||||
inst.is_delete = '0'
|
||||
AND inst.instruction_status <> '2'
|
||||
OPTION 输入.key <> ""
|
||||
inst.instruction_code like 输入.key
|
||||
ENDOPTION
|
||||
OPTION 输入.start_point <> ""
|
||||
inst.start_point_code like 输入.start_point
|
||||
ENDOPTION
|
||||
OPTION 输入.next_point <> ""
|
||||
inst.next_point_code like 输入.next_point
|
||||
ENDOPTION
|
||||
OPTION 输入.task_code <> ""
|
||||
inst.task_code like 输入.task_code
|
||||
ENDOPTION
|
||||
ORDER BY
|
||||
inst.create_time DESC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
detl.label AS label,
|
||||
detl.
|
||||
VALUE
|
||||
AS value
|
||||
detl.VALUE AS value
|
||||
FROM
|
||||
sys_dict_detail detl
|
||||
WHERE
|
||||
detl.name = 'material_type'
|
||||
order by
|
||||
dict_sort
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -1,646 +0,0 @@
|
||||
|
||||
package org.nl.pad.azd.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.agv.server.impl.AgvServiceImpl;
|
||||
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.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
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.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||
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.config.RsaProperties;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.pad.azd.service.PadService;
|
||||
import org.nl.utils.RsaUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qxuan
|
||||
* @description 服务实现
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PadServiceImpl implements PadService {
|
||||
private final UserService userService;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryArea(Map whereJson) {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONArray resultJSONArray = WQL.getWO("QHAND_QUERY").addParam("flag", "1").process().getResultJSONArray(0);
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "查询成功");
|
||||
jo.put("result", resultJSONArray);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryPointByArea(String dict_id) {
|
||||
JSONArray resultArr = new JSONArray();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
if (StrUtil.isEmpty(dict_id)) {
|
||||
throw new BadRequestException("区域id不能为空!");
|
||||
}
|
||||
String value = "";
|
||||
String move = "";
|
||||
String status = "";
|
||||
String input_material = "0";
|
||||
String allow_update = "";
|
||||
String material = "";
|
||||
//再字典中查询出value
|
||||
//JSONObject valuejo = WQLObject.getWQLObject("sys_dict_detail").query("detail_id='" + dict_id + "'").uniqueResult(0);
|
||||
JSONObject valuejo = WQL.getWO("QHAND_QUERY").addParam("flag", "3").addParam("detail_id", dict_id).process().uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(valuejo)) {
|
||||
value = valuejo.optString("value");
|
||||
}
|
||||
//根据value值去查所有的设备
|
||||
JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + value + "' and device_type='conveyor'", "seq_num,device_name").getResultJSONArray(0);
|
||||
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);
|
||||
//无光电普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
//空盘站点
|
||||
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver;
|
||||
//检测站点
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
|
||||
//区域管制站点(机械手)
|
||||
StandardManipulatorInspectSiteDeviceDriver standardManipulatorInspectSiteDeviceDriver;
|
||||
//检测站点
|
||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
if (standardInspectSiteDevicedriver.getHasGoods() == 0) {
|
||||
status = "0";
|
||||
move = "无货";
|
||||
} else if (standardInspectSiteDevicedriver.getHasGoods() == 1) {
|
||||
status = "1";
|
||||
move = "有托盘";
|
||||
} else if (standardInspectSiteDevicedriver.getHasGoods() == 2) {
|
||||
status = "2";
|
||||
move = "有托盘有货";
|
||||
}
|
||||
material = standardInspectSiteDevicedriver.getMaterial();
|
||||
if (StrUtil.isNullOrUndefined(material)) {
|
||||
material = "";
|
||||
}
|
||||
jo.put("material_type", material);
|
||||
jo.put("status_name", move);
|
||||
jo.put("status", status);
|
||||
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", "0");
|
||||
jo.put("input_material", input_material);
|
||||
}
|
||||
//区域管制站点(机械手)
|
||||
else if (device.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
|
||||
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardManipulatorInspectSiteDeviceDriver.getHasGoods() == 0) {
|
||||
status = "0";
|
||||
move = "无货";
|
||||
} else if (standardManipulatorInspectSiteDeviceDriver.getHasGoods() == 1) {
|
||||
status = "1";
|
||||
move = "有托盘";
|
||||
} else if (standardManipulatorInspectSiteDeviceDriver.getHasGoods() == 2) {
|
||||
status = "2";
|
||||
move = "有托盘有货";
|
||||
}
|
||||
jo.put("material_type", material);
|
||||
jo.put("status_name", move);
|
||||
jo.put("status", status);
|
||||
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", "0");
|
||||
jo.put("input_material", input_material);
|
||||
|
||||
}
|
||||
//空盘站点
|
||||
else if (device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
|
||||
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
if (standardEmptyPalletSiteDeviceDriver.getHasGoods() == 0) {
|
||||
status = "0";
|
||||
move = "无货";
|
||||
} else if (standardEmptyPalletSiteDeviceDriver.getHasGoods() == 1) {
|
||||
status = "1";
|
||||
move = "有托盘";
|
||||
} else if (standardEmptyPalletSiteDeviceDriver.getHasGoods() == 2) {
|
||||
status = "2";
|
||||
move = "有托盘有货";
|
||||
}
|
||||
jo.put("material_type", material);
|
||||
jo.put("status_name", move);
|
||||
jo.put("status", status);
|
||||
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", "0");
|
||||
jo.put("input_material", input_material);
|
||||
|
||||
}
|
||||
//普通站点
|
||||
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
|
||||
status = "0";
|
||||
move = "无货";
|
||||
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) {
|
||||
status = "1";
|
||||
move = "有托盘";
|
||||
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) {
|
||||
status = "2";
|
||||
move = "有托盘有货";
|
||||
}
|
||||
material = standardOrdinarySiteDeviceDriver.getMaterial();
|
||||
if (StrUtil.isNullOrUndefined(material)) {
|
||||
material = "";
|
||||
}
|
||||
String input_materialflag = (String) device.getExtraValue().get("input_material");
|
||||
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
|
||||
input_material = "0";
|
||||
}
|
||||
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
|
||||
input_material = "1";
|
||||
}
|
||||
jo.put("material_type", material);
|
||||
jo.put("status_name", move);
|
||||
jo.put("status", status);
|
||||
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("input_material", input_material);
|
||||
}
|
||||
resultArr.add(jo);
|
||||
}
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "查询成功");
|
||||
resultJson.put("result", resultArr);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@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> createTask(Map<String, String> jsonObject) {
|
||||
String start_devicecode = jsonObject.get("start_devicecode");
|
||||
String next_devicecode = jsonObject.get("next_devicecode");
|
||||
String material_type = jsonObject.get("material_type");
|
||||
String carrier = jsonObject.get("carrier");
|
||||
String task_type = jsonObject.get("task_type");
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
if (StrUtil.isEmpty(start_devicecode)) {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_devicecode)) {
|
||||
throw new BadRequestException("终点点不能为空!");
|
||||
}
|
||||
|
||||
if (start_devicecode.equals(next_devicecode)) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("desc", "起点和终点不能是同一设备【" + next_devicecode + "】");
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
TaskDto dto = new TaskDto();
|
||||
|
||||
if (StrUtil.equals("2", task_type)) {
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_devicecode, next_devicecode, "normal");
|
||||
String compound_task_data = shortPathsList.get(0).getPath();
|
||||
dto.setCompound_task("1");
|
||||
dto.setCompound_task_data(compound_task_data);
|
||||
}
|
||||
dto.setIs_active("1");
|
||||
dto.setIs_delete("0");
|
||||
dto.setTask_type(task_type);
|
||||
dto.setMaterial(material_type);
|
||||
dto.setStart_point_code(start_devicecode);
|
||||
dto.setNext_point_code(next_devicecode);
|
||||
dto.setVehicle_code(carrier);
|
||||
try {
|
||||
taskService.create(dto);
|
||||
} catch (Exception e) {
|
||||
|
||||
resultJson.put("code", "2");
|
||||
resultJson.put("desc", e.getMessage());
|
||||
resultJson.put("result", "");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "生成成功!");
|
||||
resultJson.put("result", "");
|
||||
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> updateDeviceStatus(Map<String, String> jsonObject) {
|
||||
//修改任务的状态
|
||||
String device_code = jsonObject.get("device_code");
|
||||
String type = jsonObject.get("type");
|
||||
String status = jsonObject.get("status");
|
||||
String material_type = jsonObject.get("material_type");
|
||||
|
||||
//粉桶号
|
||||
String barrels_code = jsonObject.get("barrels_code");
|
||||
//配合批号
|
||||
String cooperate_code = jsonObject.get("cooperate_code");
|
||||
//粉钟名称
|
||||
String powder_name = jsonObject.get("powder_name");
|
||||
//粉桶状态
|
||||
String barrels_status = jsonObject.get("barrels_status");
|
||||
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device device = appService.findDeviceByCode(device_code);
|
||||
//无光电普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
//空盘站点
|
||||
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver;
|
||||
//检测站点
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
|
||||
//区域管制站点(机械手)
|
||||
StandardManipulatorInspectSiteDeviceDriver standardManipulatorInspectSiteDeviceDriver;
|
||||
//修改
|
||||
if (type.equals("1")) {
|
||||
//检测站点
|
||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (!StrUtil.isEmpty(material_type)) {
|
||||
standardInspectSiteDevicedriver.setMaterial(material_type);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barrels_code)) {
|
||||
device.setBarrels_code(barrels_code);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(cooperate_code)) {
|
||||
device.setCooperate_code(cooperate_code);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(powder_name)) {
|
||||
device.setPowder_name(powder_name);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barrels_status)) {
|
||||
device.setBarrels_status(barrels_status);
|
||||
}
|
||||
}
|
||||
//普通站点
|
||||
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setHasGoods(Integer.parseInt(status));
|
||||
device.setHas_goods(Integer.parseInt(status));
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("hasGoodStatus", status);
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
if (!StrUtil.isEmpty(material_type)) {
|
||||
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barrels_code)) {
|
||||
device.setBarrels_code(barrels_code);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(cooperate_code)) {
|
||||
device.setCooperate_code(cooperate_code);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(powder_name)) {
|
||||
device.setPowder_name(powder_name);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barrels_status)) {
|
||||
device.setBarrels_status(barrels_status);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//清空
|
||||
if (type.equals("2")) {
|
||||
|
||||
//检测站点
|
||||
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
standardInspectSiteDevicedriver.setMaterial("");
|
||||
device.setBarrels_code("");
|
||||
device.setCooperate_code("");
|
||||
device.setPowder_name("");
|
||||
device.setBarrels_status("");
|
||||
}
|
||||
//普通站点
|
||||
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setHasGoods(0);
|
||||
device.setHas_goods(0);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("hasGoodStatus", "0");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
standardOrdinarySiteDeviceDriver.setMaterial("");
|
||||
device.setBarrels_code("");
|
||||
device.setCooperate_code("");
|
||||
device.setPowder_name("");
|
||||
device.setBarrels_status("");
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "更新成功");
|
||||
resultJson.put("result", new JSONObject());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String user = jsonObject.get("user");
|
||||
String password = jsonObject.get("password");
|
||||
if (StrUtil.isEmpty("user")) {
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "用户不能为空");
|
||||
return resultJson;
|
||||
}
|
||||
if (StrUtil.isEmpty("password")) {
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "密码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
boolean is_match = false;
|
||||
Long account_id = 0L;
|
||||
try {
|
||||
String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
|
||||
UserDto userDto = userService.findByName(user);
|
||||
account_id = userDto.getId();
|
||||
is_match = passwordEncoder.matches(pwd, userDto.getPassword());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (is_match) {
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("desc", "登陆成功");
|
||||
} else {
|
||||
resultJson.put("code", "2");
|
||||
resultJson.put("desc", "登陆失败!");
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("user_name", user);
|
||||
jo.put("account_id", account_id);
|
||||
resultJson.put("result", jo);
|
||||
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);
|
||||
AgvService agvService = SpringContextHolder.getBean(AgvServiceImpl.class);
|
||||
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigServiceImpl.class);
|
||||
|
||||
String task_id = instwo.optString("task_id");
|
||||
/* 1 指令撤销
|
||||
2 重新下发
|
||||
3 强制完成*/
|
||||
if (type.equals("1")) {
|
||||
//调用agv删除任务的接口
|
||||
agvService = SpringContextHolder.getBean("agvServiceImpl");
|
||||
try {
|
||||
agvService.deleteAgvInst(instwo.getString("instruction_code"));
|
||||
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.toBean(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.sendAgvInstToMagic(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.optString("remark"));
|
||||
instdto.setMaterial(taskjo.optString("taskjo"));
|
||||
instdto.setTask_id(taskjo.optString("task_id"));
|
||||
instdto.setTask_code(taskjo.optString("task_code"));
|
||||
instdto.setVehicle_code(taskjo.optString("vehicle_code"));
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_point_code(taskjo.optString("start_point_code"));
|
||||
instdto.setNext_point_code(taskjo.optString("next_point_code"));
|
||||
instdto.setStart_device_code(taskjo.optString("start_device_code"));
|
||||
instdto.setNext_device_code(taskjo.optString("next_device_code"));
|
||||
instdto.setInstruction_status("0");
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
TaskDto acsTask = (TaskDto) JSONObject.toBean(taskjo, TaskDto.class);
|
||||
acsTask.setTask_status("1");
|
||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(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.optString("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.toBean(taskjo, TaskDto.class);
|
||||
taskService.finish(acsTask.getTask_id());
|
||||
}
|
||||
|
||||
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "操作成功");
|
||||
jo.put("result", new JSONObject());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryMaterial() {
|
||||
JSONArray resultArr = WQL.getWO("QHAND_QUERY").addParam("flag", "5").process().getResultJSONArray(0);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "查询成功");
|
||||
jo.put("result", resultArr);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryRouteLine(Map<String, String> jsonObject) {
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||
;
|
||||
String start_devicecode = jsonObject.get("start_devicecode");
|
||||
String next_devicecode = jsonObject.get("next_devicecode");
|
||||
String route_line = jsonObject.get("route_line");
|
||||
JSONObject jo = new JSONObject();
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_devicecode, next_devicecode, StrUtil.isEmpty(route_line) ? "normal" : route_line);
|
||||
if (ObjectUtil.isEmpty(shortPathsList)) {
|
||||
jo.put("code", "2");
|
||||
jo.put("desc", "路由不通");
|
||||
jo.put("result", "");
|
||||
return jo;
|
||||
}
|
||||
String path = shortPathsList.get(0).getPath();
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("path", path);
|
||||
jo.put("code", "1");
|
||||
jo.put("desc", "操作成功");
|
||||
jo.put("result", result);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -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:123456}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE5" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<appender name="FILEAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/反馈AGV请求/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
@@ -27,6 +27,6 @@
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.agv.server.impl.AgvServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE5"/>
|
||||
<appender-ref ref="FILEAgvServiceImpl"/>
|
||||
</logger>
|
||||
</included>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE3" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<appender name="FILEAutoCreateInst" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/自动创建指令/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.modules.quartz.task.AutoCreateInst" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
<appender-ref ref="FILEAutoCreateInst"/>
|
||||
</logger>
|
||||
</included>
|
||||
|
||||
@@ -80,27 +80,27 @@ https://juejin.cn/post/6844903775631572999
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
|
||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="springfox.documentation" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="jdbc.sqltiming" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="org.jinterop" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<!-- <logger name="jdbc.audit" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="jdbc.resultset" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="springfox.documentation" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="jdbc.resultsettable" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="jdbc.sqlonly" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="jdbc.sqltiming" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="org.jinterop" level="ERROR" additivity="false">-->
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
<!-- </logger>-->
|
||||
</springProfile>
|
||||
|
||||
<!--测试环境:打印控制台-->
|
||||
|
||||
Reference in New Issue
Block a user