充电初版&页面供更改组盘类型
This commit is contained in:
@@ -40,4 +40,6 @@ public interface NDCAgvService {
|
||||
* @return
|
||||
*/
|
||||
public boolean createChargingTaskToNDC(String carno);
|
||||
|
||||
public void charge(String carno);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
@@ -23,6 +25,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@@ -34,6 +37,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final ISysParamService paramService;
|
||||
private final AcsToWmsService acsToWmsService;
|
||||
private final ISysDictService dictService;
|
||||
|
||||
private final DeviceExecuteLogService logServer;
|
||||
|
||||
@@ -150,7 +154,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) 0X00, (byte) 0X6D,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) indexhigh, (byte) indexlow,
|
||||
(byte) 0X01, (byte) 0X19,
|
||||
(byte) 0X01, (byte) 0X12,
|
||||
(byte) phasehigh, (byte) phaselow,
|
||||
(byte) nextPointHigh,(byte) nextPointLow
|
||||
};
|
||||
@@ -190,6 +194,58 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
|
||||
return b;
|
||||
}
|
||||
@Override
|
||||
public void charge(String carno) {
|
||||
//检查数据字典station为0的参数
|
||||
//分配车辆
|
||||
List<Dict> dictList= dictService.getDictByName("station");
|
||||
int satation=0;
|
||||
for(Dict dict : dictList){
|
||||
if ("0".equals(dict.getValue())){
|
||||
satation = Integer.parseInt(dict.getPara1());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(satation!=0){
|
||||
String instcode =CodeUtil.getNewCode("INSTRUCT_NO");
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
|
||||
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
|
||||
byte satationhigh = (byte) IntToHexHigh(satation);
|
||||
byte satationlow = (byte) IntToHexLow(satation);
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
str += "carno:" + (Integer.parseInt(carno));
|
||||
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
|
||||
str += "/satation:" + (satation);
|
||||
str1 += "/satation:" + hexToString(satationhigh & 0xFF) + hexToString(satationlow & 0xFF);
|
||||
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X0E,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X0A,
|
||||
(byte) 0X64, (byte) 0X80,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) satationhigh, (byte) satationlow,
|
||||
(byte) carhigh, (byte) carlow
|
||||
};
|
||||
log.info("下发AGV充电任务--{}", str1);
|
||||
|
||||
try{
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
} catch (Exception e){
|
||||
log.error("下发充电任务失败{}{}",e,e.getMessage());
|
||||
}
|
||||
}else{
|
||||
log.error("目前暂无可使用充电桩充电桩,暂不分配{}充电任务",carno);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createChargingTaskToNDC(String carno) {
|
||||
|
||||
@@ -14,6 +14,8 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.lucene.LuceneExecuteLogService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
@@ -58,6 +60,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
AutoRunService autoRunService;
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
ISysDictService dictService;
|
||||
|
||||
|
||||
public OneNDCSocketConnectionAutoRun() {
|
||||
@@ -126,6 +130,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
int agvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
//充电桩站点号
|
||||
int station=arr[25];
|
||||
Instruction link_inst = null;
|
||||
Instruction inst = null;
|
||||
List<Instruction> insts = null;
|
||||
@@ -189,6 +195,42 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
|
||||
//充电任务下发成功上报
|
||||
}else if (phase == 0x64){
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station);
|
||||
List<Dict> dictList= dictService.getDictByName("station");
|
||||
for(Dict dict : dictList){
|
||||
if (Integer.parseInt(dict.getPara1())==station){
|
||||
dict.setValue("1");
|
||||
dict.setPara2(String.valueOf(agvaddr));
|
||||
dictService.updateDetail(dict);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//充电成功
|
||||
}else if (phase == 0x65){
|
||||
log.info("AGV车号{}反馈充电成功,释放充电桩{}",agvaddr,station);
|
||||
List<Dict> dictList= dictService.getDictByName("station");
|
||||
for(Dict dict : dictList){
|
||||
if (Integer.parseInt(dict.getPara1())==station){
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dictService.updateDetail(dict);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//充电取消上报
|
||||
}else if (phase == 0x66){
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station);
|
||||
List<Dict> dictList= dictService.getDictByName("station");
|
||||
for(Dict dict : dictList){
|
||||
if (Integer.parseInt(dict.getPara1())==station){
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dictService.updateDetail(dict);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
|
||||
@@ -76,6 +76,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int last_status = 0;
|
||||
int last_error = 0;
|
||||
String transportOrder = "";
|
||||
boolean isCharge = false;
|
||||
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
@@ -322,6 +323,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (phase == 0x73) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
if (electric_qty < 40 && !isCharge) {
|
||||
log.info("当前车辆{}电量为{}低于40,开始充电!", this.device_code, electric_qty);
|
||||
NDCAgvService.charge(this.device_code);
|
||||
isCharge =true;
|
||||
}
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
@@ -334,15 +340,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
private byte[] getData(byte[] data, int index, Instruction inst, TaskDto task) {
|
||||
if (!"2".equals(task.getTask_type())) {
|
||||
String resp = acsToWmsService.requestTaskAgain(task.getNext_point_code(),task.getExt_task_id(),inst.getVehicle_code());
|
||||
String resp = acsToWmsService.requestTaskAgain(task.getNext_point_code(), task.getExt_task_id(), inst.getVehicle_code());
|
||||
JSONObject respjson = JSONObject.parseObject(resp);
|
||||
String next_device_code = respjson.getString("next_point_code");
|
||||
task.setNext_point_code(next_device_code);
|
||||
int start_address = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int next_address = deviceService.queryAddressBydeviceCode(next_device_code);
|
||||
taskService.update(task);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, 0, 0);
|
||||
log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(), phase);
|
||||
task.setNext_point_code(next_device_code);
|
||||
int start_address = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int next_address = deviceService.queryAddressBydeviceCode(next_device_code);
|
||||
taskService.update(task);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, 0, 0);
|
||||
log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(), phase);
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -211,6 +211,9 @@
|
||||
<el-form-item v-if="form.point_status !== '1'" label="载具编码" prop="vehicle_code">
|
||||
<el-input v-model="form.vehicle_code" clearable style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.point_status !== '1'" label="载具类型" prop="vehicle_type">
|
||||
<el-input v-model="form.vehicle_type" clearable style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="可放载具类型" prop="can_vehicle_types">
|
||||
<el-select v-model="form.can_vehicle_types" multiple placeholder="请选择" clearable style="width: 370px;">
|
||||
<el-option
|
||||
|
||||
Reference in New Issue
Block a user