add: 添加自动门功能,手动推送物料功能
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
@@ -131,7 +133,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
//充电桩站点号
|
||||
int station=arr[25];
|
||||
int station = arr[25];
|
||||
Instruction link_inst = null;
|
||||
Instruction inst = null;
|
||||
List<Instruction> insts = null;
|
||||
@@ -157,7 +159,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
//
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
|
||||
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
|
||||
//开始任务/上报订单号
|
||||
if (phase == 0x01) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
@@ -196,11 +198,11 @@ 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){
|
||||
} 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);
|
||||
@@ -208,8 +210,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
}
|
||||
//充电成功
|
||||
}else if (phase == 0x65){
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station);
|
||||
} else if (phase == 0x65) {
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}", agvaddr, station);
|
||||
// log.info("AGV车号{}反馈充电成功,释放充电桩{}",agvaddr,station);
|
||||
// List<Dict> dictList= dictService.getDictByName("station");
|
||||
// for(Dict dict : dictList){
|
||||
@@ -221,24 +223,57 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
// }
|
||||
// }
|
||||
//充电取消上报
|
||||
}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){
|
||||
} 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 if (phase == 0x50) {
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
String is_enter = standardAutodoorDeviceDriver.getExtraValue().get("is_enter").toString();
|
||||
if (StrUtil.isNotBlank(is_enter) && !"true".equals(is_enter)) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
}
|
||||
|
||||
} else if (phase == 0x51) {
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
String is_enter = standardAutodoorDeviceDriver.getExtraValue().get("is_enter").toString();
|
||||
if (StrUtil.isNotBlank(is_enter) && !"true".equals(is_enter)) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info(device_code + "对应设备号为空!");
|
||||
}
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {
|
||||
device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(agvaddr));
|
||||
device = deviceAppService.findDeviceByCode("agv" + Integer.toString(agvaddr));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(arr[20]));
|
||||
device = deviceAppService.findDeviceByCode("agv" + Integer.toString(arr[20]));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
@@ -246,7 +281,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
agvNdcOneDeviceDriver.processSocket(arr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
|
||||
@@ -31,7 +31,7 @@ public enum DriverTypeEnum {
|
||||
|
||||
XGAGV(9, "xg_agv", "xg_agv", "agv"),
|
||||
|
||||
AUTODOOR(10, "standard_autodoor", "标准版-自动门", "autodoor"),
|
||||
AUTODOOR(10, "standard_autodoor", "标准版-自动门", "conveyor"),
|
||||
TUBANXIAN_SITE(11, "tubanxian_site", "涂板线", "conveyor"),
|
||||
GUHUASHI_SITE(12, "guhuashi_site", "固化室", "conveyor"),
|
||||
TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor"),
|
||||
|
||||
@@ -106,4 +106,12 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateRouteLock")
|
||||
@Log("wms下发锁定释放路线动作")
|
||||
@ApiOperation("wms下发锁定释放路线动作")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> updateRouteLock(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.updateRoute(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,5 +92,10 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
JSONObject notifyAcs(JSONObject param);
|
||||
|
||||
|
||||
/**
|
||||
* wms下发锁定释放路线
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Object updateRoute(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,16 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nl.basjes.shaded.org.springframework.util.Assert;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.common.IDriverService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.domain.DeviceExtra;
|
||||
import org.nl.acs.device.service.DeviceExtraService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
@@ -36,14 +40,12 @@ import org.nl.system.service.param.ISysParamService;
|
||||
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -59,6 +61,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
private final RouteLineService routeLineService;
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
private final StorageCellMapper storageCellMapper;
|
||||
@Autowired
|
||||
private DeviceExtraService deviceExtraService;
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
private String log_type = "LMS请求ACS";
|
||||
@@ -466,14 +470,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
for (int i = 0; i < reqs.size(); i++) {
|
||||
CreateTaskRequest req = reqs.get(i);
|
||||
String task_code = req.getTask_code();
|
||||
String task_id =req.getTask_id();
|
||||
String task_id = req.getTask_id();
|
||||
String start_device_code = req.getStart_device_code();
|
||||
String next_device_code = req.getNext_device_code();
|
||||
String priority = req.getPriority();
|
||||
String vehicle_code = req.getVehicle_code();
|
||||
String vehicle_type = req.getVehicle_type();
|
||||
String task_type = req.getTask_type();
|
||||
String agv_task_type=req.getAgv_task_type();
|
||||
String agv_task_type = req.getAgv_task_type();
|
||||
String remark = req.getRemark();
|
||||
Map<String, String> params = req.getParams();
|
||||
|
||||
@@ -577,7 +581,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("ext_task_id",task_id);
|
||||
jo.put("ext_task_id", task_id);
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("task_id", IdUtil.simpleUUID());
|
||||
jo.put("start_point_code", start_point_code);
|
||||
@@ -631,29 +635,30 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
public JSONObject notifyAcs(JSONObject param) {
|
||||
log.info("notifyAcs - 请求参数 {}", param);
|
||||
JSONObject result = new JSONObject();
|
||||
Integer type=param.getInteger("type");
|
||||
String device_code=param.getString("device_code");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);;
|
||||
switch(type){
|
||||
Integer type = param.getInteger("type");
|
||||
String device_code = param.getString("device_code");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
;
|
||||
switch (type) {
|
||||
case 1:
|
||||
//LMS通知固化室极板已进满信号,开始固化
|
||||
if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver();
|
||||
guhuashiSiteDeviceDriver.writing("VW70043",1);
|
||||
guhuashiSiteDeviceDriver.writing("VW70043", 1);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//LMS通知固化室在下班时未进满信号,开始固化
|
||||
if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver();
|
||||
guhuashiSiteDeviceDriver.writing("VW70045",1);
|
||||
guhuashiSiteDeviceDriver.writing("VW70045", 1);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
//LMS通知固化室极板已出完
|
||||
if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver();
|
||||
guhuashiSiteDeviceDriver.writing("VW70053",1);
|
||||
guhuashiSiteDeviceDriver.writing("VW70053", 1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -666,4 +671,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object updateRoute(JSONObject param) {
|
||||
Assert.notNull(param.getString("pointCode"), "参数Point不能为空");
|
||||
String pointCode = param.getString("pointCode");
|
||||
if (pointCode.contains(",")) {
|
||||
String[] split = pointCode.split(",");
|
||||
Arrays.stream(split).forEach(point -> {
|
||||
deviceExtraService.update(Wrappers.lambdaUpdate(DeviceExtra.class)
|
||||
.eq(DeviceExtra::getDevice_code, point)
|
||||
.eq(DeviceExtra::getExtra_name, "is_enter")
|
||||
.eq(DeviceExtra::getExtra_code, "is_enter")
|
||||
.set("0".equals(param.getString("status")),DeviceExtra::getExtra_value, "false")
|
||||
.set("1".equals(param.getString("status")),DeviceExtra::getExtra_value, "true")
|
||||
);
|
||||
});
|
||||
} else {
|
||||
deviceExtraService.update(Wrappers.lambdaUpdate(DeviceExtra.class)
|
||||
.eq(DeviceExtra::getDevice_code, pointCode)
|
||||
.eq(DeviceExtra::getExtra_name, "is_enter")
|
||||
.eq(DeviceExtra::getExtra_code, "is_enter")
|
||||
.set("0".equals(param.getString("status")),DeviceExtra::getExtra_value, "false")
|
||||
.set("1".equals(param.getString("status")),DeviceExtra::getExtra_value, "true")
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user