Browse Source

add:下发AGV充电接口

master
gengby 1 year ago
parent
commit
12eb4aa85b
  1. 7
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
  2. 45
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  3. 11
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  4. 7
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java
  5. 13
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

7
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java

@ -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);
} }

45
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java

@ -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;
@ -223,4 +224,48 @@ public class NDCAgvServiceImpl implements NDCAgvService {
return AGVDeviceStatus; return AGVDeviceStatus;
} }
@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;
}
} }

11
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java

@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/** /**
* @author ludj * @author ludj
* @date 2021-07-21 * @date 2021-07-21
@ -94,4 +96,13 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.putPlusPullAction(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<>(wmstoacsService.createChargingTask(whereJson), HttpStatus.OK);
}
} }

7
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java

@ -83,5 +83,12 @@ public interface WmsToAcsService {
*/ */
Map<String, Object> putPlusPullAction(String whereJson); Map<String, Object> putPlusPullAction(String whereJson);
/**
* 创建充电任务
* @param whereJson
* @return
*/
Map<String, Object> createChargingTask(Map<String, String> whereJson);
} }

13
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -9,6 +9,8 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.common.IDriverService; import org.nl.acs.common.IDriverService;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
@ -690,5 +692,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
} }
@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;
}
} }

Loading…
Cancel
Save