更新平板充电任务
This commit is contained in:
@@ -182,4 +182,12 @@ public interface AgvService {
|
|||||||
|
|
||||||
|
|
||||||
String queryDeviceStation();
|
String queryDeviceStation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发充电任务
|
||||||
|
* @param carno
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean createChargingTaskToNDC(String carno);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import org.nl.acs.opc.DeviceType;
|
|||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
import org.nl.logger.BusinessLogger;
|
import org.nl.logger.BusinessLogger;
|
||||||
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
|
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
|
||||||
import org.nl.utils.SpringContextHolder;
|
import org.nl.utils.SpringContextHolder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -1974,6 +1975,52 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createChargingTaskToNDC(String carno) {
|
||||||
|
|
||||||
|
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
|
||||||
|
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
|
||||||
|
|
||||||
|
String instcode = CodeUtil.getNewCode("INSTRUCT_NO");
|
||||||
|
byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||||
|
byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||||
|
|
||||||
|
String str = "十进制下发:";
|
||||||
|
String str1 = "十六进制下发:";
|
||||||
|
str += "carno:" + (Integer.parseInt(carno));
|
||||||
|
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
|
||||||
|
|
||||||
|
str += "/instcode:" + (instcode);
|
||||||
|
str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF);
|
||||||
|
|
||||||
|
System.out.println(str);
|
||||||
|
System.out.println(str1);
|
||||||
|
|
||||||
|
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||||
|
(byte) 0X00, (byte) 0X08,
|
||||||
|
(byte) 0X00, (byte) 0X0C,
|
||||||
|
(byte) 0X00, (byte) 0X01,
|
||||||
|
(byte) 0X00, (byte) 0X71,
|
||||||
|
(byte) 0X00, (byte) 0X08,
|
||||||
|
(byte) 0X64, (byte) 0X80,
|
||||||
|
(byte) 0X00, (byte) 0X01,
|
||||||
|
(byte) instcodehigh, (byte) instcodelow,
|
||||||
|
(byte) carhigh, (byte) carlow
|
||||||
|
};
|
||||||
|
log.info("下发AGV充电任务--{}", str1);
|
||||||
|
|
||||||
|
try{
|
||||||
|
NDCSocketConnectionAutoRun.write(b);
|
||||||
|
} catch (Exception e){
|
||||||
|
e.getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
System.out.println("下发agv充电任务数据:" + Bytes2HexString(b));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String hexToString(int i) {
|
String hexToString(int i) {
|
||||||
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
|
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
package org.nl.hand.andxy.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.annotation.Log;
|
||||||
|
import org.nl.annotation.rest.AnonymousPostMapping;
|
||||||
|
import org.nl.hand.andxy.service.NdxyHandService;
|
||||||
|
import org.nl.modules.system.service.UserService;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author qxuan
|
||||||
|
* @date 2021-07-21
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "纽迪希亚手持接口")
|
||||||
|
@RequestMapping("/api/andxy1/hand")
|
||||||
|
@Slf4j
|
||||||
|
public class Ndxy1HandController {
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
private final UserService userService;
|
||||||
|
private final NdxyHandService HandService;
|
||||||
|
|
||||||
|
@AnonymousPostMapping("/createChargingTask")
|
||||||
|
@Log("创建任务")
|
||||||
|
@ApiOperation("创建任务")
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -153,4 +153,11 @@ public class NdxyHandController {
|
|||||||
return new ResponseEntity<>(HandService.createTask2(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(HandService.createTask2(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AnonymousPostMapping("/createChargingTask")
|
||||||
|
@Log("创建任务")
|
||||||
|
@ApiOperation("创建任务")
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,4 +112,7 @@ public interface NdxyHandService {
|
|||||||
Map<String, Object> queryMaterial();
|
Map<String, Object> queryMaterial();
|
||||||
|
|
||||||
Map<String, Object> createTask2(Map<String, String> whereJson);
|
Map<String, Object> createTask2(Map<String, String> whereJson);
|
||||||
|
|
||||||
|
Map<String, Object> createChargingTask(Map<String, String> whereJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
|
|||||||
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;
|
private final AgvService agvService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryArea(Map whereJson) {
|
public Map<String, Object> queryArea(Map whereJson) {
|
||||||
@@ -805,6 +804,18 @@ public class NdxyHandServiceImpl implements NdxyHandService {
|
|||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> createChargingTask(Map<String, String> whereJson) {
|
||||||
|
String type = whereJson.get("type");
|
||||||
|
AgvService agvService = SpringContextHolder.getBean(AgvServiceImpl.class);
|
||||||
|
agvService.createChargingTaskToNDC(type);
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("code", "1");
|
||||||
|
jo.put("desc", "创建成功");
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> createTask2(Map<String, String> whereJson) {
|
public Map<String, Object> createTask2(Map<String, String> whereJson) {
|
||||||
String type = whereJson.get("type");
|
String type = whereJson.get("type");
|
||||||
|
|||||||
@@ -2462,6 +2462,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
}
|
}
|
||||||
} else if (phase == 0x64) {
|
} else if (phase == 0x64) {
|
||||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
|
} else if (phase == 0x65) {
|
||||||
|
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
|
} else if (phase == 0x66) {
|
||||||
|
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
|
} else if (phase == 0x67) {
|
||||||
|
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
}
|
}
|
||||||
//上报异常
|
//上报异常
|
||||||
else if (phase == 0x67) {
|
else if (phase == 0x67) {
|
||||||
|
|||||||
Reference in New Issue
Block a user