更新充电任务
This commit is contained in:
@@ -32,4 +32,11 @@ public interface NDCAgvService {
|
|||||||
public byte[] sendAgvOneModeInst(int phase, int index,int result);
|
public byte[] sendAgvOneModeInst(int phase, int index,int result);
|
||||||
|
|
||||||
public byte[] sendAgvTwoModeInst(int phase, int index,int result);
|
public byte[] sendAgvTwoModeInst(int phase, int index,int result);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发充电任务
|
||||||
|
* @param carno
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean createChargingTaskToNDC(String carno);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
|
|||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
import org.nl.modules.system.service.ParamService;
|
import org.nl.modules.system.service.ParamService;
|
||||||
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
|||||||
};
|
};
|
||||||
log.info("下发删除AGV指令--{}", Bytes2HexString(b));
|
log.info("下发删除AGV指令--{}", Bytes2HexString(b));
|
||||||
|
|
||||||
// NDCSocketConnectionAutoRun.write(b);
|
OneNDCSocketConnectionAutoRun.write(b);
|
||||||
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b));
|
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,6 +298,50 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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{
|
||||||
|
OneNDCSocketConnectionAutoRun.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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,4 +196,13 @@ public class AMHandController {
|
|||||||
return new ResponseEntity<>(HandService.callTask(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(HandService.callTask(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/createChargingTask")
|
||||||
|
@Log("创建充电任务")
|
||||||
|
@ApiOperation("创建充电任务")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,4 +130,11 @@ public interface AMHandService {
|
|||||||
* @return json
|
* @return json
|
||||||
*/
|
*/
|
||||||
JSONObject queryPoint();
|
JSONObject queryPoint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建充电任务
|
||||||
|
* @param whereJson
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> createChargingTask(Map<String, String> whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.agv.server.AgvService;
|
||||||
import org.nl.acs.agv.server.MagicAgvService;
|
import org.nl.acs.agv.server.MagicAgvService;
|
||||||
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
|
import org.nl.acs.agv.server.impl.AgvServiceImpl;
|
||||||
import org.nl.acs.agv.server.impl.MagicAgvServiceImpl;
|
import org.nl.acs.agv.server.impl.MagicAgvServiceImpl;
|
||||||
|
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device.service.dto.DeviceDto;
|
import org.nl.acs.device.service.dto.DeviceDto;
|
||||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||||
@@ -157,6 +161,17 @@ public class AMHandServiceImpl implements AMHandService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> createChargingTask(Map<String, String> whereJson) {
|
||||||
|
String type = whereJson.get("type");
|
||||||
|
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
|
||||||
|
agvService.createChargingTaskToNDC(type);
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("code", "1");
|
||||||
|
jo.put("desc", "创建成功");
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryPointByArea(String areaCode) {
|
public Map<String, Object> queryPointByArea(String areaCode) {
|
||||||
JSONArray respArr = new JSONArray();
|
JSONArray respArr = new JSONArray();
|
||||||
@@ -581,7 +596,7 @@ public class AMHandServiceImpl implements AMHandService {
|
|||||||
}
|
}
|
||||||
String task_id = instwo.getString("task_id");
|
String task_id = instwo.getString("task_id");
|
||||||
Instruction instdto = (Instruction) instwo.toJavaObject(Instruction.class);
|
Instruction instdto = (Instruction) instwo.toJavaObject(Instruction.class);
|
||||||
MagicAgvService agvService = SpringContextHolder.getBean(MagicAgvServiceImpl.class);
|
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
|
||||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||||
|
|
||||||
/* 1 指令撤销
|
/* 1 指令撤销
|
||||||
@@ -595,7 +610,7 @@ public class AMHandServiceImpl implements AMHandService {
|
|||||||
if (StrUtil.isEmpty(instdto.getAgv_jobno())) {
|
if (StrUtil.isEmpty(instdto.getAgv_jobno())) {
|
||||||
instructionService.cancelNOSendAgv(inst_uuid);
|
instructionService.cancelNOSendAgv(inst_uuid);
|
||||||
} else {
|
} else {
|
||||||
agvService.deleteAgvInst(instdto.getInstruction_code());
|
instructionService.cancel(instdto.getInstruction_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -607,7 +622,7 @@ public class AMHandServiceImpl implements AMHandService {
|
|||||||
}
|
}
|
||||||
if (type.equals("2")) {
|
if (type.equals("2")) {
|
||||||
try {
|
try {
|
||||||
agvService.sendAgvInstToMagic(instdto);
|
agvService.sendAgvInstToNDC(instdto.getAgv_system_type(),instdto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
jo.put("code", "2");
|
jo.put("code", "2");
|
||||||
jo.put("desc", "下发agv失败");
|
jo.put("desc", "下发agv失败");
|
||||||
|
|||||||
@@ -238,12 +238,12 @@ public class InstructionDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 是否启用
|
* 是否启用
|
||||||
*/
|
*/
|
||||||
private String is_active;
|
private String is_active = "1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否删除
|
* 是否删除
|
||||||
*/
|
*/
|
||||||
private String is_delete;
|
private String is_delete = "0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建者
|
* 创建者
|
||||||
|
|||||||
Reference in New Issue
Block a user