add:新增手持接口
This commit is contained in:
@@ -111,6 +111,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int to_last = 0;
|
||||
int last_to_last = 0;
|
||||
|
||||
int to_len = 0;
|
||||
int last_to_len = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = "";
|
||||
@@ -177,7 +180,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
to_max_no = this.itemProtocol.getTo_max_no();
|
||||
to_direction = this.itemProtocol.getTo_direction();
|
||||
to_last = this.itemProtocol.getTo_last();
|
||||
|
||||
to_len = this.itemProtocol.getTo_len();
|
||||
|
||||
if (mode != last_mode) {
|
||||
|
||||
@@ -251,6 +254,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
last_to_onset = to_onset;
|
||||
last_to_seq = to_seq;
|
||||
last_to_last = to_last;
|
||||
last_to_len = to_len;
|
||||
last_to_direction = to_direction;
|
||||
last_to_max_no = to_max_no;
|
||||
}
|
||||
@@ -359,8 +363,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
Map<String, Object> map7 = new HashMap<>();
|
||||
Map<String, Object> map8 = new HashMap<>();
|
||||
Map<String, Object> map9 = new HashMap<>();
|
||||
Map<String, Object> map10 = new HashMap<>();
|
||||
try {
|
||||
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9);
|
||||
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10);
|
||||
} catch (Exception e) {
|
||||
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
@@ -437,8 +442,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
Map<String, Object> map7 = new HashMap<>();
|
||||
Map<String, Object> map8 = new HashMap<>();
|
||||
Map<String, Object> map9 = new HashMap<>();
|
||||
Map<String, Object> map10 = new HashMap<>();
|
||||
try {
|
||||
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9);
|
||||
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10);
|
||||
} catch (Exception e) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
@@ -456,7 +462,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
}
|
||||
|
||||
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8,Map<String, Object> map9) {
|
||||
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8,Map<String, Object> map9,Map<String, Object> map10) {
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 1);
|
||||
@@ -492,6 +498,12 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
map9.put("value", interactionJsonDTO.getBarcode());
|
||||
list.add(map9);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLen())) {
|
||||
map10.put("code", "to_len");
|
||||
map10.put("value", interactionJsonDTO.getLen());
|
||||
list.add(map10);
|
||||
}
|
||||
}
|
||||
this.writing(list);
|
||||
}
|
||||
|
||||
@@ -26,4 +26,9 @@ public class InteractionJsonDTO {
|
||||
*子卷号
|
||||
*/
|
||||
private String barcode;
|
||||
|
||||
/**
|
||||
*子卷长度
|
||||
*/
|
||||
private String len;
|
||||
}
|
||||
|
||||
@@ -101,6 +101,11 @@ public class ItemProtocol {
|
||||
*/
|
||||
public static String item_to_barcode = "to_barcode";
|
||||
|
||||
/**
|
||||
*下发子卷长度
|
||||
*/
|
||||
public static String item_to_len = "to_len";
|
||||
|
||||
|
||||
private BoxPackageManipulatorDeviceDriver driver;
|
||||
|
||||
@@ -174,6 +179,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_last_one);
|
||||
}
|
||||
|
||||
public int getTo_len(){
|
||||
return this.getOpcIntegerValue(item_to_len);
|
||||
}
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
@@ -243,8 +252,8 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_to_direction, "子卷摆放方向", "DB2.D10"));
|
||||
list.add(new ItemDto(item_to_seq, "下发木箱工位顺序", "DB2.W12"));
|
||||
list.add(new ItemDto(item_to_last_one, "下发是否最后子卷", "DB2.W14"));
|
||||
list.add(new ItemDto(item_to_len, "下发子卷长度", "DB2.W16"));
|
||||
list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50"));
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
count = 0;
|
||||
}
|
||||
|
||||
if (mode != 3 || requireSucess) {
|
||||
if (mode != 3 && requireSucess) {
|
||||
message = "one_message7";
|
||||
|
||||
} else if (error != 0) {
|
||||
|
||||
@@ -332,7 +332,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
taskDtos = this.sortTask(taskDtos);
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
truss_type = taskDto.getTruss_type();
|
||||
// 9 行架任务
|
||||
//查询任务是行架任务
|
||||
if (!StrUtil.equals(taskDto.getTask_type(), "6")) {
|
||||
taskDto = null;
|
||||
continue;
|
||||
@@ -661,7 +661,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
String action = "";
|
||||
String walk_y = "";
|
||||
String mode = "";
|
||||
String status = "";
|
||||
String is_disable = "";
|
||||
|
||||
|
||||
@@ -704,6 +703,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
action = LangProcess.msg("two_action7");
|
||||
} else if (this.getAction() == 8) {
|
||||
action = LangProcess.msg("two_action8");
|
||||
} else if (this.getAction() == 9) {
|
||||
action = LangProcess.msg("two_action9");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 12:17
|
||||
*/
|
||||
@Data
|
||||
public class CreateHandTaskRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 取货点
|
||||
*/
|
||||
String start_device_code;
|
||||
|
||||
/**
|
||||
* 放货点
|
||||
*/
|
||||
String next_device_code;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
String task_type;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 12:19
|
||||
*/
|
||||
public class CreateHandTaskResponse extends BaseResponse {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.hand.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 16:54
|
||||
*/
|
||||
@Data
|
||||
public class HeadDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 起始设备编码
|
||||
*/
|
||||
private String start_device_code;
|
||||
|
||||
/**
|
||||
* 目标设备编码
|
||||
*/
|
||||
private String next_device_code;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String task_type;
|
||||
|
||||
/**
|
||||
* 关键字 可为载具号、指令号、agv车号
|
||||
*/
|
||||
private String keyword;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.hand.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 16:50
|
||||
*/
|
||||
@Data
|
||||
public class RegionDto implements Serializable {
|
||||
/**
|
||||
* 区域编号
|
||||
*/
|
||||
private String region_code;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.nl.hand.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.hand.dto.HeadDto;
|
||||
import org.nl.hand.dto.RegionDto;
|
||||
import org.nl.hand.service.HandService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 10:18
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持接口")
|
||||
@RequestMapping("api/hand")
|
||||
@Slf4j
|
||||
public class HandController {
|
||||
@Autowired
|
||||
private HandService handService;
|
||||
|
||||
@PostMapping("/queryArea")
|
||||
@Log("查询区域")
|
||||
@ApiOperation("查询区域")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryArea() {
|
||||
return new ResponseEntity<>(handService.queryArea(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPointByArea")
|
||||
@Log("根据区域编码查点位")
|
||||
@ApiOperation("根据区域编码查点位")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryPointByArea(@RequestBody RegionDto dto) {
|
||||
String region_code = dto.getRegion_code();
|
||||
return new ResponseEntity<>(handService.queryPointByArea(region_code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/callTask")
|
||||
@Log("手持创建任务")
|
||||
@ApiOperation("手持创建任务")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> callTask(@RequestBody HeadDto dto) {
|
||||
return new ResponseEntity<>(handService.callTask(dto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/insts")
|
||||
@Log("查询未完成指令")
|
||||
@ApiOperation("查询未完成指令")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryInst(@RequestBody HeadDto dto) {
|
||||
return new ResponseEntity<>(handService.queryInst(dto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package org.nl.hand.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.RsaUtils;
|
||||
import org.nl.common.utils.dto.CurrentUser;
|
||||
import org.nl.config.RsaProperties;
|
||||
import org.nl.system.service.role.ISysRoleService;
|
||||
import org.nl.system.service.secutiry.dto.AuthUserDto;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 16:00
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mobile/auth")
|
||||
public class MobileAuthorizationController {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@PostMapping(value = "/login")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
||||
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
|
||||
// 校验数据库
|
||||
// 根据用户名查询,在比对密码
|
||||
// 拿到多个已经抛出异常
|
||||
SysUser userInfo = userService.getOne(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getUsername, authUser.getUsername()));
|
||||
// 这里需要密码加密
|
||||
if (ObjectUtil.isEmpty(userInfo) || !userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) {
|
||||
throw new BadRequestException("账号或密码错误!");
|
||||
}
|
||||
// 获取权限列表 - 登录查找权限
|
||||
List<String> permissionList = roleService.getPermissionList((JSONObject) JSON.toJSON(userInfo));
|
||||
|
||||
// 登录输入,登出删除
|
||||
CurrentUser user = new CurrentUser();
|
||||
user.setId(userInfo.getUser_id());
|
||||
user.setUsername(userInfo.getUsername());
|
||||
user.setPresonName(userInfo.getPerson_name());
|
||||
user.setUser(userInfo);
|
||||
user.setPermissions(permissionList);
|
||||
|
||||
// SaLoginModel 配置登录相关参数
|
||||
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
||||
// 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
.setDevice("PE")
|
||||
// Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
.setExtra("loginInfo", user)
|
||||
);
|
||||
|
||||
// 返回 token 与 用户信息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("user", userInfo);
|
||||
JSONObject authInfo = new JSONObject(2) {{
|
||||
put("token", "Bearer " + StpUtil.getTokenValue());
|
||||
put("user", jsonObject);
|
||||
}};
|
||||
|
||||
return ResponseEntity.ok(authInfo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.hand.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.acs.ext.wms.data.CreateHandTaskResponse;
|
||||
import org.nl.hand.dto.HeadDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 10:19
|
||||
*/
|
||||
public interface HandService {
|
||||
|
||||
|
||||
Map<String, Object> queryPointByArea(String region_code);
|
||||
|
||||
/**
|
||||
* 手持创建任务
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> callTask(HeadDto dto);
|
||||
|
||||
Map<String, Object> queryArea();
|
||||
|
||||
Map<String, Object> queryInst(HeadDto dto);
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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 com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.data.CreateHandTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.CreateHandTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.JsonUtl;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.hand.dto.HeadDto;
|
||||
import org.nl.hand.service.HandService;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : TuQiang
|
||||
* @create 2024/4/2 10:20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class HandServiceImpl implements HandService {
|
||||
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@Autowired
|
||||
private TaskService taskserver;
|
||||
@Autowired
|
||||
private ISysDictService dictService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryPointByArea(String region_code) {
|
||||
JSONArray data = new JSONArray();
|
||||
if (StrUtil.isEmpty(region_code)) {
|
||||
throw new BadRequestException("区域编码不能为空!");
|
||||
}
|
||||
|
||||
//根据区域编码查询所有设备
|
||||
List<Device> list = deviceService.lambdaQuery()
|
||||
.eq(Device::getRegion, region_code)
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("未查到该区域的设备!");
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
Device device = list.get(i);
|
||||
String device_id = device.getDevice_id();
|
||||
String device_code = device.getDevice_code();
|
||||
String device_name = device.getDevice_name();
|
||||
BigDecimal seq_num = device.getSeq_num();
|
||||
jo.put("device_id", device_id);
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("device_name", device_name);
|
||||
jo.put("seq_num", seq_num);
|
||||
data.add(jo);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> callTask(HeadDto dto) {
|
||||
JSONArray errArr = new JSONArray();
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
String task_type = dto.getTask_type();
|
||||
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "起点不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "终点不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
if (StrUtil.isEmpty(task_type)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "任务类型不能为空");
|
||||
errArr.add(json);
|
||||
}
|
||||
|
||||
String start_device_code2 = "";
|
||||
String next_device_code2 = "";
|
||||
JSONObject jo = new JSONObject();
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
|
||||
String s = start_device_code.substring(9);
|
||||
if (StrUtil.equals("K", s)) {
|
||||
start_device_code2 = next_device_code.substring(0, 10) + "M";
|
||||
next_device_code2 = start_device_code.substring(0, 9) + "M";
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
}
|
||||
} else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
|
||||
start_device_code2 = next_device_code.substring(0, 9) + "K";
|
||||
next_device_code2 = start_device_code.substring(0, 9) + "K";
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
}
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_point_code", start_device_code);
|
||||
jo.put("next_point_code", next_device_code);
|
||||
jo.put("task_type", task_type);
|
||||
jo.put("agv_system_type", "2");
|
||||
jo.put("priority", "1");
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
taskserver.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
}
|
||||
JSONArray data = new JSONArray();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
} else {
|
||||
resultJson.put("message", "操作失败");
|
||||
resultJson.put("data", data);
|
||||
}
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryArea() {
|
||||
JSONArray data = new JSONArray();
|
||||
List<Dict> list = dictService.lambdaQuery()
|
||||
.eq(Dict::getCode, "region_type")
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("未查到该区域的设备!");
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
Dict dict = list.get(i);
|
||||
String region_id = dict.getDict_id();
|
||||
String region_code = dict.getCode();
|
||||
String region_name = dict.getName();
|
||||
jo.put("region_id", region_id);
|
||||
jo.put("region_code", region_code);
|
||||
jo.put("region_name", region_name);
|
||||
data.add(jo);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryInst(HeadDto dto) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user