acs兼容浙大和NDC系统

This commit is contained in:
psh
2023-12-28 16:57:47 +08:00
parent 9fbd0016c4
commit 262430da28
6 changed files with 119 additions and 121 deletions

View File

@@ -14,18 +14,14 @@ public interface AcsConfig {
String CREATETASKCHECK = "createTaskCheck";
//撤销任务检查
String CANCELTASKCHECK = "cancelTaskCheck";
//一楼agv系统接口地址
//agv系统接口地址
String AGVURL = "agvurl";
//AGV系统端口
String AGVPORT = "agvport";
//二楼1区agv系统接口地址
String AGVURL2 = "agvurl2";
//二楼1区AGV系统端口
String AGVPORT2 = "agvport2";
//二楼2区agv系统接口地址
String AGVURL22 = "agvurl22";
//二楼2区AGV系统端口
String AGVPORT22 = "agvport22";
//rgv系统接口地址
String RGVURL = "rgvurl";
//RGV系统端口
String RGVPORT = "rgvport";
//指定AGV系统
String AGVTYPE = "agvType";
//WMS系统接口地址

View File

@@ -36,6 +36,6 @@ public interface ZheDaAgvService {
* @param instCode
* @return
*/
public HttpResponse deleteZDAgvInst(String instCode);
public HttpResponse deleteZDAgvInst(String instCode) throws Exception;
}

View File

@@ -69,18 +69,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("destinations", destinations);
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvurl2 = paramService.findByCode(AcsConfig.AGVURL2).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
String agvport2 = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
//不同楼层下发不同的agv系统
if (task_type.equals("1")) {
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code();
} else {
agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code();
}
log.info("下发agv任务请求:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
@@ -101,14 +94,10 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String agvurl = "";
String agvport = "";
if (type.equals("1")) {
agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
}
if (type.equals("2")) {
agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue();
agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
}
agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/transportOrders";
HttpResponse result = HttpRequest.get(agvurl)
@@ -278,8 +267,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("destinations", destinations);
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
String url = agvurl + ":" + agvport + "/addDestinations";
log.info("下发agv任务请求:{}", url);
@@ -399,12 +388,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
log.info("反馈AGV请求数据:{}", requestjo);
System.out.println("back agv:" + requestjo);
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
if (inst.getInstruction_type().equals("4")) {
agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue();
}
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact";
HttpResponse result = HttpRequest.post(agvurl)
@@ -420,8 +405,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
public HttpResponse markComplete(String code) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete";
log.info("关闭agv运单序列请求:{}", agvurl);
@@ -554,14 +539,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse deleteZDAgvInst(String instCode) {
public HttpResponse deleteZDAgvInst(String instCode) throws Exception {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
Instruction instruction = instructionService.findByCode(instCode);
if (instruction.getInstruction_type().equals("1")) {
agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
}
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + instCode + "/withdrawal";
log.info("删除agv指令请求agvurl:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -18,6 +19,7 @@ import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.MagicAgvService;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.agv.server.ZheDaAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
@@ -450,12 +452,27 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
} else if (StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
HttpResponse result = zheDaAgvService.sendAgvInstToAgv(dto);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jo = JSON.parseObject(result.body());
if (jo.getInteger("status") != 200) {
dto.setSend_status("2");
} else {
dto.setSend_status("1");
}
} catch (Exception e) {
} else {
dto.setSend_status("2");
}
}
} catch(Exception e)
{
dto.setSend_status("2");
e.printStackTrace();
log.error("");
}
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
// wo.insert(json);
@@ -978,24 +995,22 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
entity.setRoute_plan_code(task.getRoute_plan_code());
}
// != 0 为agv任务 1=magic 2=NDC 3=XZ,4=ZHEDA
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "1")
// != 0 1=NDC任务 2=RGV任务
if (StrUtil.equals(task.getAgv_system_type(), "1")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
MagicAgvService magicAgvService = SpringContextHolder.getBean(MagicAgvService.class);
magicAgvService.deleteAgvInst(entity.getInstruction_code());
flag = true;
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
// NDC agv指令不当场取消指令,需要等agv上报
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
ndcAgvService.deleteAgvInstToNDC((Instruction)entity);
} else {
flag = true;
}
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
flag = true;
} else if (StrUtil.equals(task.getAgv_system_type(), "2")) {
try {
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
zheDaAgvService.deleteZDAgvInst(entity.getInstruction_code());
}catch (Exception e){
log.error("下发浙大取消指令失败{}",e.getMessage());
}
flag = true;
} else {
flag = true;

View File

@@ -34,7 +34,7 @@ public class AutoCreateInst {
* 根据任务状态创建指令、生成下一条指令
* 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货
*/
public void run() throws Exception {
public synchronized void run() throws Exception {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@@ -123,9 +123,9 @@ public class AutoCreateInst {
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
// if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
// continue;
// }
Device startdevice = appService.findDeviceByCode(start_device_code);
Device nextdevice = appService.findDeviceByCode(next_device_code);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {

View File

@@ -168,6 +168,7 @@
<template slot-scope="scope">
<span v-if="scope.row.type=='0' ">输送路由</span>
<span v-if="scope.row.type=='1' ">agv路由</span>
<span v-if="scope.row.type=='2' ">rgv路由</span>
</template>
</el-table-column>
<el-table-column prop="next_device_code" min-width="120" label="后置设备号" />
@@ -269,6 +270,10 @@ export default {
{
typeName: 'agv路由',
typeValue: '1'
},
{
typeName: 'rgv路由',
typeValue: '2'
}],
permission: {
add: ['admin', 'routeLine:add'],