add: 添加仙工AGV,流量限制界面;实现流量限制国际化
This commit is contained in:
@@ -92,11 +92,11 @@
|
||||
|
||||
|
||||
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>tlog-all-spring-boot-starter</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
@@ -435,11 +435,11 @@
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package org.nl.acs.agv;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AgvWaitUtil {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService;
|
||||
|
||||
@Autowired
|
||||
InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
//取货前等待
|
||||
public JSONObject waitInGet(String startDeviceCode, Instruction inst) {
|
||||
log.info("仙工AGV请求取货,设备号 - {}", startDeviceCode);
|
||||
|
||||
/*JSONObject responseBody = acsToWmsService.queryStationState(inst);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(responseBody) && "200".equals(responseBody.getString("status"))) {
|
||||
JSONArray data = JSON.parseArray(responseBody.getString("data"));
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject datum = data.getJSONObject(i);
|
||||
if (startDeviceCode.equals(datum.getString("Station_Code")) && !datum.getBooleanValue("IsHasGoods")) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new BadRequestException("请求失败!");*/
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许取货!");
|
||||
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
||||
return map;
|
||||
}
|
||||
|
||||
//取货完成等待
|
||||
public JSONObject waitOutGet(String startDeviceCode, Instruction inst) {
|
||||
log.info("仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||
|
||||
inst.setExecute_status("2");
|
||||
instructionService.update(inst);
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许离开!");
|
||||
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||
return map;
|
||||
}
|
||||
|
||||
//放货前等待
|
||||
public JSONObject waitInPut(String endDeviceCode, Instruction inst) {
|
||||
log.info("仙工AGV请求放货,设备号 - {}", endDeviceCode);
|
||||
|
||||
Device doordevice = deviceAppService.findDeviceByCode(endDeviceCode);
|
||||
BoxStorageManipulatorDeviceDriver boxStorageManipulatorDeviceDriver;
|
||||
if(doordevice.getDeviceDriver() instanceof BoxStorageManipulatorDeviceDriver){
|
||||
boxStorageManipulatorDeviceDriver = (BoxStorageManipulatorDeviceDriver) doordevice.getDeviceDriver();
|
||||
if(boxStorageManipulatorDeviceDriver.getMode() != 2 && boxStorageManipulatorDeviceDriver.getMove() != 0){
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许放货!");
|
||||
log.info("允许仙工AGV放货,设备号 - {}", endDeviceCode);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
//放货完成等待
|
||||
public JSONObject waitOutPut(String endDeviceCode, Instruction inst) {
|
||||
log.info("仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许离开!");
|
||||
log.info("允许仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.nl.acs.agv;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时查询AGV状态
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("queryAGVStatus")
|
||||
public class QueryAGVStatus {
|
||||
|
||||
public void run() {
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
List<Instruction> allInstFromCache = instructionService.findAllInstFromCache();
|
||||
if(CollUtil.isEmpty(allInstFromCache) || allInstFromCache.size() < 1){
|
||||
return;
|
||||
}
|
||||
for (Instruction instruction : allInstFromCache) {
|
||||
if ("4".equals(instruction.getInstruction_type())) {
|
||||
String agvurl =paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
JSONObject param = new JSONObject();
|
||||
agvurl = agvurl + ":" + agvport + "/" + instruction.getInstruction_code();
|
||||
log.info("根据运单号查询运单状态的请求:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("根据运单号查询运单状态的请求反馈:{}", result);
|
||||
String body = result.body();
|
||||
JSONObject json = JSONObject.parseObject(body);
|
||||
if(result.getStatus() == 200 && json.getString("id").equals(instruction.getInstruction_code())){
|
||||
// 已创建=CREATED,
|
||||
// 待分配=TOBEDISPATCHED,
|
||||
// 正在执行=RUNNING,
|
||||
// 完成=FINISHED,
|
||||
// 失败=FAILED(主动失败),
|
||||
// 终止=STOPPED(被人为终止),
|
||||
// 无法执行=Error(参数错误),
|
||||
// 等待=WAITING
|
||||
//执行中
|
||||
String state = json.getString("state");
|
||||
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
||||
instruction.setInstruction_status("1");
|
||||
instructionService.update(instruction);
|
||||
} else if ("FINISHED".equals(state)) {
|
||||
instruction.setInstruction_status("2");
|
||||
try {
|
||||
instructionService.finish(instruction);
|
||||
} catch (Exception e) {
|
||||
log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
||||
instruction.setInstruction_status("1");
|
||||
instructionService.update(instruction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,30 @@
|
||||
package org.nl.acs.agv.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Configurable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
|
||||
@Controller
|
||||
public class XianGongAgvController {
|
||||
|
||||
@Autowired
|
||||
private XianGongAgvService xianGongAgentService;
|
||||
|
||||
@PostMapping("/waitPointRequest")
|
||||
@Log("仙工AGV请求取放货")
|
||||
public ResponseEntity<JSONObject> xgAGVWaitPointRequest(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(xianGongAgentService.xgAGVWaitPointRequest(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,4 +102,21 @@ public interface XianGongAgvService {
|
||||
*/
|
||||
public JSONObject createOrederData(Instruction inst, String type);
|
||||
|
||||
/**
|
||||
* 请求取货放货
|
||||
* @param requestParam
|
||||
* @return
|
||||
*/
|
||||
JSONObject xgAGVWaitPointRequest(JSONObject requestParam);
|
||||
|
||||
/**
|
||||
* 运单号查询运单状态
|
||||
*/
|
||||
public HttpResponse selectOrderByInstCode(String instCode);
|
||||
|
||||
|
||||
/**
|
||||
* 查询场景中指定机器人信息
|
||||
*/
|
||||
HttpResponse getRobotInfo(String robotCode);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.AgvUtil;
|
||||
import org.nl.acs.agv.AgvWaitUtil;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.angle.domain.AcsPointAngle;
|
||||
@@ -19,6 +20,7 @@ import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.LokiLog;
|
||||
import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -50,6 +52,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
@Autowired
|
||||
private IAcsPointAngleService acsPointAngleService;
|
||||
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
private AgvWaitUtil agvWaitUtil;
|
||||
|
||||
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
|
||||
|
||||
@@ -286,23 +293,47 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
}
|
||||
}
|
||||
|
||||
public com.alibaba.fastjson.JSONArray createBlocksData(Instruction inst) {
|
||||
/**
|
||||
* 下发运单
|
||||
* @param inst
|
||||
* @return
|
||||
*/
|
||||
public JSONArray createBlocksData(Instruction inst) {
|
||||
JSONArray ja = new JSONArray();
|
||||
Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code());
|
||||
sendStartDeviceOrder(ja,inst.getStart_device_code(), inst.getStart_point_code(),inst.getInstruction_code());
|
||||
sendEndDeviceOrder(ja,inst.getStart_device_code(),inst.getInstruction_code(),inst.getNext_point_code(),inst.getNext_device_code());
|
||||
if(StrUtil.isNotEmpty(inst.getStart_device_code2())){
|
||||
sendStartDeviceOrder(ja,inst.getStart_device_code2(), inst.getStart_point_code2(),inst.getInstruction_code());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(inst.getNext_device_code2())){
|
||||
sendEndDeviceOrder(ja,inst.getNext_device_code2(),inst.getInstruction_code(),inst.getNext_point_code2(),inst.getNext_device_code2());
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发取货
|
||||
* @param device_code
|
||||
* @param instCode
|
||||
*/
|
||||
public void sendStartDeviceOrder(JSONArray ja,String pointCode, String device_code,String instCode){
|
||||
|
||||
Device startDevice = deviceAppService.findDeviceByCode(device_code);
|
||||
//忽略取货校验
|
||||
if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) {
|
||||
//取货前等待
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("blockId", IdUtil.simpleUUID());
|
||||
jo.put("location", inst.getStart_point_code() + "INGET");
|
||||
jo.put("location", pointCode + "INGET");
|
||||
jo.put("operation", "script");
|
||||
jo.put("id", inst.getStart_point_code() + "INGET");
|
||||
jo.put("id", pointCode + "INGET");
|
||||
jo.put("script_name", "userpy/interact.py");
|
||||
JSONObject script_args = new JSONObject();
|
||||
script_args.put("addr", addr);
|
||||
JSONObject data = new JSONObject();
|
||||
JSONObject reach = new JSONObject();
|
||||
reach.put("task_code", inst.getInstruction_code());
|
||||
reach.put("address", inst.getStart_point_code() + "INGET");
|
||||
reach.put("task_code", instCode);
|
||||
reach.put("address", pointCode + "INGET");
|
||||
data.put("reach", reach);
|
||||
script_args.put("data", data);
|
||||
script_args.put("protocol", "HTTP");
|
||||
@@ -312,44 +343,52 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
|
||||
JSONObject jo1 = new JSONObject();
|
||||
jo1.put("blockId", IdUtil.simpleUUID());
|
||||
jo1.put("location", inst.getStart_point_code());
|
||||
jo1.put("location", pointCode);
|
||||
jo1.put("operation", "JackLoad");
|
||||
ja.add(jo1);
|
||||
|
||||
//取货完成等待
|
||||
JSONObject jo2 = new JSONObject();
|
||||
jo2.put("blockId", IdUtil.simpleUUID());
|
||||
jo2.put("location", inst.getStart_point_code() + "OUTGET");
|
||||
jo2.put("location", pointCode + "OUTGET");
|
||||
jo2.put("operation", "script");
|
||||
jo2.put("id", inst.getStart_point_code() + "OUTGET");
|
||||
jo2.put("id", pointCode + "OUTGET");
|
||||
jo2.put("script_name", "userpy/interact.py");
|
||||
JSONObject script_args2 = new JSONObject();
|
||||
script_args2.put("addr", addr);
|
||||
JSONObject data2 = new JSONObject();
|
||||
JSONObject reach2 = new JSONObject();
|
||||
reach2.put("task_code", inst.getInstruction_code());
|
||||
reach2.put("address", inst.getStart_point_code() + "OUTGET");
|
||||
reach2.put("task_code", instCode);
|
||||
reach2.put("address", pointCode + "OUTGET");
|
||||
data2.put("reach", reach2);
|
||||
script_args2.put("data", data2);
|
||||
script_args2.put("protocol", "HTTP");
|
||||
jo2.put("script_args", script_args2);
|
||||
ja.add(jo2);
|
||||
}
|
||||
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(inst.getNext_device_code());
|
||||
/**
|
||||
* 下发放货
|
||||
* @param device_code
|
||||
* @param instCode
|
||||
*/
|
||||
public void sendEndDeviceOrder(JSONArray ja,String device_code,String instCode,String pointCode,String nextDeviceCode){
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
//忽略放货校验
|
||||
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
|
||||
//放货前等待
|
||||
JSONObject jo3 = new JSONObject();
|
||||
jo3.put("blockId", IdUtil.simpleUUID());
|
||||
jo3.put("location", inst.getNext_point_code() + "INPUT");
|
||||
jo3.put("location", pointCode + "INPUT");
|
||||
jo3.put("operation", "script");
|
||||
jo3.put("id", inst.getNext_point_code() + "INPUT");
|
||||
jo3.put("id", pointCode + "INPUT");
|
||||
jo3.put("script_name", "userpy/interact.py");
|
||||
JSONObject script_args3 = new JSONObject();
|
||||
script_args3.put("addr", addr);
|
||||
JSONObject data3 = new JSONObject();
|
||||
JSONObject reach3 = new JSONObject();
|
||||
reach3.put("task_code", inst.getInstruction_code());
|
||||
reach3.put("address", inst.getNext_point_code() + "INPUT");
|
||||
reach3.put("task_code", instCode);
|
||||
reach3.put("address", pointCode + "INPUT");
|
||||
data3.put("reach", reach3);
|
||||
script_args3.put("data", data3);
|
||||
script_args3.put("protocol", "HTTP");
|
||||
@@ -359,7 +398,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
|
||||
//放货前下发旋转角度
|
||||
JSONObject json1 = new JSONObject();
|
||||
AcsPointAngle acsPointAngleDto = acsPointAngleService.findByCode(inst.getStart_device_code(),inst.getNext_device_code());
|
||||
AcsPointAngle acsPointAngleDto = acsPointAngleService.findByCode(device_code,nextDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(acsPointAngleDto)){
|
||||
log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString());
|
||||
com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject();
|
||||
@@ -367,38 +406,37 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
operation_args.put("increase_spin_angle",next_point_angle);//弧度值,如3.14
|
||||
operation_args.put("skill_name","GoByOdometer");
|
||||
json1.put("blockId", IdUtil.simpleUUID());
|
||||
json1.put("location", inst.getNext_point_code() + "INPUT");
|
||||
json1.put("location", pointCode + "INPUT");
|
||||
json1.put("operation_args",operation_args);
|
||||
ja.add(json1);
|
||||
}
|
||||
|
||||
com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject();
|
||||
jo4.put("blockId", IdUtil.simpleUUID());
|
||||
jo4.put("location", inst.getNext_point_code());
|
||||
jo4.put("location", pointCode);
|
||||
jo4.put("operation", "JackUnload");
|
||||
ja.add(jo4);
|
||||
|
||||
//忽略放货校验
|
||||
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
|
||||
//放货完成等待
|
||||
com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject();
|
||||
jo5.put("blockId", IdUtil.simpleUUID());
|
||||
jo5.put("location", inst.getNext_point_code() + "OUTPUT");
|
||||
jo5.put("location", pointCode + "OUTPUT");
|
||||
jo5.put("operation", "script");
|
||||
jo5.put("id", inst.getNext_point_code() + "OUTPUT");
|
||||
jo5.put("id", pointCode + "OUTPUT");
|
||||
jo5.put("script_name", "userpy/interact.py");
|
||||
com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject();
|
||||
script_args5.put("addr", addr);
|
||||
com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject();
|
||||
com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject();
|
||||
reach5.put("task_code", inst.getInstruction_code());
|
||||
reach5.put("address", inst.getNext_point_code() + "OUTPUT");
|
||||
reach5.put("task_code", instCode);
|
||||
reach5.put("address", pointCode + "OUTPUT");
|
||||
data5.put("reach", reach5);
|
||||
script_args5.put("data", data5);
|
||||
script_args5.put("protocol", "HTTP");
|
||||
jo5.put("script_args", script_args5);
|
||||
ja.add(jo5);
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@@ -632,4 +670,87 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
return AGVDeviceStatus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) {
|
||||
log.info("仙工AGV请求取放货,请求参数 - {}", requestParam);
|
||||
String inst_code = requestParam.getString("task_code");
|
||||
Instruction instructionDto = instructionService.findByCodeFromCache(inst_code);
|
||||
if (ObjectUtil.isEmpty(instructionDto)) {
|
||||
throw new BadRequestException("请求失败,未找到指令!");
|
||||
}
|
||||
String address = requestParam.getString("address");
|
||||
if (StrUtil.isBlank(address)) {
|
||||
throw new BadRequestException("请求失败,地址为空!");
|
||||
}
|
||||
|
||||
|
||||
if (address.contains("IN")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 5);
|
||||
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
||||
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
|
||||
}
|
||||
|
||||
if (address.contains("GET")) {
|
||||
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
|
||||
} else if (address.contains("PUT")) {
|
||||
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
|
||||
}
|
||||
}
|
||||
if (address.contains("OUT")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 6);
|
||||
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
||||
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
|
||||
}
|
||||
|
||||
if (address.contains("GET")) {
|
||||
return agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
|
||||
} else if (address.contains("PUT")) {
|
||||
return agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
|
||||
}
|
||||
}
|
||||
|
||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse selectOrderByInstCode(String instCode) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
String agvurl =paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
|
||||
param.put("id", instCode);
|
||||
param.put("disableVehicle", false);
|
||||
agvurl = agvurl + ":" + agvport + "/" + instCode;
|
||||
log.info("根据运单号查询运单状态的请求:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(param.toJSONString())
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("根据运单号查询运单状态的请求反馈:{}", result);
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse getRobotInfo(String robotCode) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
String agvurl =paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/"+ " robotsStatus?vehicles=" + robotCode;
|
||||
log.info("根据指定机器人查询状态的请求:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("根据指定机器人查询状态的请求反馈:{}", result);
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ public class CommonFinalParam {
|
||||
*/
|
||||
private final String BARRE = "-";
|
||||
private final String POINT = ".";
|
||||
/**
|
||||
* 开门
|
||||
*/
|
||||
|
||||
public static final String ONE = "1";
|
||||
|
||||
public static final String TWO = "2";
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.map.ListOrderedMap;
|
||||
import org.apache.commons.lang.LocaleUtils;
|
||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
@@ -653,8 +654,8 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
// String device_code = jo.getString("device_code");
|
||||
// String device_name = jo.getString("device_name");
|
||||
// Device device = appService.findDeviceByCode(device_code);
|
||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
// if (device.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (XgAgvCarDeviceDriver) device.getDeviceDriver();
|
||||
// int branchProtocol = standardOrdinarySiteDeviceDriver.getBranchProtocol();
|
||||
// devicejo.put("device_code",device_code);
|
||||
// devicejo.put("branchProtocol",branchProtocol);
|
||||
@@ -1893,6 +1894,9 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
String is_config = list.get(3).toString();
|
||||
String is_route = list.get(4).toString();
|
||||
String region = list.get(5).toString();
|
||||
String in_device_name = list.get(6).toString();
|
||||
String en_device_name = list.get(7).toString();
|
||||
String zh_device_name = list.get(8).toString();
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException(LangProcess.msg("error_checkNull", "device_code"));
|
||||
}
|
||||
@@ -1912,6 +1916,16 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
if (ObjectUtil.isNotEmpty(dto)) {
|
||||
continue;
|
||||
}
|
||||
if(StrUtil.isEmpty(zh_device_name)){
|
||||
//throw new BadRequestException(LangProcess.msg("zh_device_name_isNotNull"));
|
||||
zh_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code;
|
||||
}
|
||||
if(StrUtil.isEmpty(en_device_name)){
|
||||
en_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code;
|
||||
}
|
||||
if (StrUtil.isEmpty(in_device_name)){
|
||||
in_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code;
|
||||
}
|
||||
//按照列获取
|
||||
param.put("device_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("device_code", device_code);
|
||||
@@ -1924,8 +1938,10 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
param.put("update_by", nickName);
|
||||
param.put("update_time", now);
|
||||
param.put("region", region);
|
||||
param.put("in_device_name", in_device_name);
|
||||
param.put("en_device_name", en_device_name);
|
||||
param.put("zh_device_name", zh_device_name);
|
||||
|
||||
// wo.insert(param);
|
||||
Device entity = ConvertUtil.convert(param, Device.class);
|
||||
deviceMapper.insert(entity);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.acs.device_driver.agv.xg_agv_car;
|
||||
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 仙工AGV
|
||||
*/
|
||||
@Service
|
||||
public class XgAgvCarDefination implements DeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "xg_agv_car";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "仙工AGV车";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "仙工AGV车";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new XgAgvCarDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return XgAgvCarDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.agv);
|
||||
return types;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package org.nl.acs.device_driver.agv.xg_agv_car;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 普通站点仙工AGV
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@Autowired
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
@Autowired
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
@Autowired
|
||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
@Autowired
|
||||
private XianGongAgvService xianGongAgvService;
|
||||
|
||||
Integer hasGoods = 0;
|
||||
int error = 0;
|
||||
Boolean iserror = false;
|
||||
Boolean islock = false;
|
||||
|
||||
int branchProtocol = 0;
|
||||
int last_branchProtocol = 0;
|
||||
/**
|
||||
* 是否需要输入物料
|
||||
*/
|
||||
String input_material = "0";
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark = "";
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
String qty = "";
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
String batch = "";
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
String material = "";
|
||||
/**
|
||||
* 目标点位
|
||||
*/
|
||||
String purpose = "";
|
||||
/**
|
||||
* 当前指令
|
||||
*/
|
||||
Instruction inst = null;
|
||||
/**
|
||||
* 上次指令
|
||||
*/
|
||||
Instruction last_inst = null;
|
||||
|
||||
boolean requireSucess = false;
|
||||
|
||||
/**
|
||||
* 触摸屏手动触发任务
|
||||
*/
|
||||
private Boolean is_has_task = false;
|
||||
|
||||
/**
|
||||
* 申请搬运任务
|
||||
*/
|
||||
private Boolean apply_handling = false;
|
||||
/**
|
||||
* 申请物料
|
||||
*/
|
||||
private Boolean apply_material = false;
|
||||
|
||||
/**
|
||||
* 1取货完成 2放货完成 3进入区域 4离开区域
|
||||
*/
|
||||
private int flag;
|
||||
|
||||
/**
|
||||
* 人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
|
||||
*/
|
||||
private int manua_confirm = 0;
|
||||
|
||||
String device_code = null;
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out;
|
||||
|
||||
String message;
|
||||
|
||||
// 1 上位系统允许进入 2 上位系统允许离开
|
||||
int status = 0;
|
||||
|
||||
int agvphase = 0;
|
||||
int index = 0;
|
||||
|
||||
int mode = 2;
|
||||
|
||||
int move;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取机器人信息
|
||||
*/
|
||||
private void getAgvStatus() {
|
||||
HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name());
|
||||
if(robotInfo.getStatus() == 200){
|
||||
JSONObject jsonObject = JSONObject.parseObject(robotInfo.body());
|
||||
|
||||
}else{
|
||||
log.info("请求{}机器人状态失败", this.getDevice().getDevice_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
carrier_direction = this.itemProtocol.getCarrier_direction();
|
||||
qty = this.itemProtocol.getQty();
|
||||
weight = this.itemProtocol.getWeight();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
// barcode = this.itemProtocol.getBarcode();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -150,40 +150,40 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "251"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "7990"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "550"));
|
||||
list.add(new ItemDto(item_door, "门状态", "450"));
|
||||
list.add(new ItemDto(item_temperature, "工位温度", "7991"));
|
||||
list.add(new ItemDto(item_countdown_house, "恒温倒计时(时)", "80500"));
|
||||
list.add(new ItemDto(item_countdown_min, "恒温倒计时(分)", "80502"));
|
||||
list.add(new ItemDto(item_countdown_sec, "恒温倒计时(秒)", "80504"));
|
||||
list.add(new ItemDto(item_finish, "烘干完成", "8025"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "450"));
|
||||
list.add(new ItemDto(item_task, "任务号", "220"));
|
||||
list.add(new ItemDto(item_error, "故障", "8055"));
|
||||
list.add(new ItemDto(item_error1, "故障1", "216"));
|
||||
list.add(new ItemDto(item_material, "物料", "223"));
|
||||
list.add(new ItemDto(item_consumption, "电能耗", "8092"));
|
||||
list.add(new ItemDto(item_voltageA, "A相电压", "8080"));
|
||||
list.add(new ItemDto(item_voltageB, "B相电压", "8082"));
|
||||
list.add(new ItemDto(item_voltageC, "C相电压", "8084"));
|
||||
list.add(new ItemDto(item_currentA, "A相电流", "8086"));
|
||||
list.add(new ItemDto(item_currentB, "B相电流", "8088"));
|
||||
list.add(new ItemDto(item_currentC, "C相电流", "8090"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB118.B251"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB118.B7990"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "DB118.B550"));
|
||||
list.add(new ItemDto(item_door, "门状态", "DB118.B450"));
|
||||
list.add(new ItemDto(item_temperature, "工位温度", "DB118.B7991"));
|
||||
list.add(new ItemDto(item_countdown_house, "恒温倒计时(时)", "DB118.B80500"));
|
||||
list.add(new ItemDto(item_countdown_min, "恒温倒计时(分)", "DB118.B80502"));
|
||||
list.add(new ItemDto(item_countdown_sec, "恒温倒计时(秒)", "DB118.B80504"));
|
||||
list.add(new ItemDto(item_finish, "烘干完成", "DB118.B8025"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB118.B450"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB118.B220"));
|
||||
list.add(new ItemDto(item_error, "故障", "DB118.B8055"));
|
||||
list.add(new ItemDto(item_error1, "故障1", "DB118.B216"));
|
||||
list.add(new ItemDto(item_material, "物料", "DB118.B223"));
|
||||
list.add(new ItemDto(item_consumption, "电能耗", "DB118.B8092"));
|
||||
list.add(new ItemDto(item_voltageA, "A相电压", "DB118.B8080"));
|
||||
list.add(new ItemDto(item_voltageB, "B相电压", "DB118.B8082"));
|
||||
list.add(new ItemDto(item_voltageC, "C相电压", "DB118.B8084"));
|
||||
list.add(new ItemDto(item_currentA, "A相电流", "DB118.B8086"));
|
||||
list.add(new ItemDto(item_currentB, "B相电流", "DB118.B8088"));
|
||||
list.add(new ItemDto(item_currentC, "C相电流", "DB118.B8090"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "40226"));
|
||||
list.add(new ItemDto(item_to_open_door, "开门", "00111"));
|
||||
list.add(new ItemDto(item_to_close_door, "关门", "00112"));
|
||||
list.add(new ItemDto(item_to_temperature, "生产温度", "48100"));
|
||||
list.add(new ItemDto(item_to_material, "生产物料", "40229"));
|
||||
list.add(new ItemDto(item_to_time_house, "生产时间(时)", "48771"));
|
||||
list.add(new ItemDto(item_to_time_min, "生产时间(分)", "48770"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "40232"));
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB118.B40226"));
|
||||
list.add(new ItemDto(item_to_open_door, "开门", "DB118.B00111"));
|
||||
list.add(new ItemDto(item_to_close_door, "关门", "DB118.B00112"));
|
||||
list.add(new ItemDto(item_to_temperature, "生产温度", "DB118.B48100"));
|
||||
list.add(new ItemDto(item_to_material, "生产物料", "DB118.B40229"));
|
||||
list.add(new ItemDto(item_to_time_house, "生产时间(时)", "DB118.B48771"));
|
||||
list.add(new ItemDto(item_to_time_min, "生产时间(分)", "DB118.B48770"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB118.B40232"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,8 @@ public class ItemProtocol {
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isEmpty(value)) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
//throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)});
|
||||
|
||||
} else {
|
||||
return value;
|
||||
@@ -128,9 +129,6 @@ public class ItemProtocol {
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.oven_manipulator;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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 com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,7 +25,10 @@ import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -61,6 +66,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
@Autowired
|
||||
private LimitRegionalService limitRegionalService=SpringContextHolder.getBean(LimitRegionalService.class);
|
||||
|
||||
//工作模式
|
||||
int mode = 0;
|
||||
@@ -156,8 +163,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
to_command = this.itemProtocol.getTo_command();
|
||||
to_target = this.itemProtocol.getTo_target();
|
||||
to_command = this.itemProtocol.getTo_command();
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
to_onset = this.itemProtocol.getTo_onset();
|
||||
x_position = this.itemProtocol.getX_position();
|
||||
@@ -339,7 +346,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
// PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
|
||||
//PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
||||
@@ -401,10 +408,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
|
||||
+ ",指令终点:" + instruction.getNext_device_code());
|
||||
this.writing("to_onset", start_addr);
|
||||
this.writing("to_target", next_addr);
|
||||
this.writing("to_task", instruction.getInstruction_code());
|
||||
this.writing("to_command", "1");
|
||||
List list = new ArrayList<>();
|
||||
Map map = new HashMap();
|
||||
map.put("to_onset", start_addr);
|
||||
map.put("to_target", next_addr);
|
||||
map.put("to_task", instruction.getInstruction_code());
|
||||
map.put("to_command", "1");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
|
||||
@@ -520,7 +531,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (isCloseDoor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
@@ -550,10 +560,24 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
+ ",指令终点:" + instdto.getNext_device_code());
|
||||
this.writing("to_onset", start_addr);
|
||||
this.writing("to_target", next_addr);
|
||||
this.writing("to_task", instdto.getInstruction_code());
|
||||
this.writing("to_command", "1");
|
||||
List list = new ArrayList<>();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_onset");
|
||||
map.put("value",StrUtil.isNotBlank(start_addr)? start_addr : "0");
|
||||
Map map1 = new HashMap();
|
||||
map1.put("code", "to_target");
|
||||
map1.put("value",StrUtil.isNotBlank(next_addr)? next_addr : "0");
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code", "to_task");
|
||||
map2.put("value",instdto.getInstruction_code());
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code", "to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map);
|
||||
list.add(map1);
|
||||
list.add(map2);
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
//HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
@@ -579,7 +603,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
//判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
|
||||
public boolean judgeCloseDoor(String start_device_code, String next_device_code) {
|
||||
Boolean isClose = false;
|
||||
|
||||
try {
|
||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
@@ -1006,6 +1029,31 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + json.getString("code");
|
||||
itemMap.put(to_param, json.getString("value"));
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
@@ -5,9 +5,13 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.*;
|
||||
import org.nl.acs.ext.wms.data.one.*;
|
||||
<<<<<<< Updated upstream
|
||||
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.data.one.BaseRequest;
|
||||
=======
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
public interface AcsToWmsService {
|
||||
|
||||
@@ -129,6 +133,7 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
BlankingButtonResponse applyBlankButtonTask(BlankingButtonRequest param);
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
/**
|
||||
* 向lms申请反馈
|
||||
* @param param
|
||||
@@ -142,4 +147,14 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
ApplyPlugPullSitResponse applyPlugPullSiteRequest(ApplyPlugPullSiteRequest param);
|
||||
=======
|
||||
|
||||
/**
|
||||
* 查询站点有无货状态
|
||||
* @param inst
|
||||
* @return
|
||||
*/
|
||||
JSONObject queryStationState(Instruction inst);
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.data.one.BaseRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
@@ -226,7 +227,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
@Override
|
||||
public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) {
|
||||
log.info("向LMS申请反馈,请求参数{}",param);
|
||||
log.info("向LMS申请反馈,请求参数{}", param);
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
||||
@@ -254,6 +255,33 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return applyManipulatorActionResponse;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject queryStationState(Instruction inst) {
|
||||
try {
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("gccQueryStationState");
|
||||
String uri = wmsurl + addressDto.getMethods_url() + "?StartStationCode=" + inst.getStart_point_code() + "&EndStationCode=" + inst.getNext_point_code();
|
||||
|
||||
log.info("gccQueryStationState - 请求路径{}", uri);
|
||||
String responseBody = HttpRequest
|
||||
.get(uri)
|
||||
.execute()
|
||||
.body();
|
||||
log.info("gccQueryStationState - 响应参数{}", responseBody);
|
||||
|
||||
return JSONObject.parseObject(responseBody);
|
||||
} catch (Exception e) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package org.nl.acs.instruction.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.stream.CollectorUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -13,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -38,6 +42,8 @@ import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
@@ -104,6 +110,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
private AcsToLiKuService acsToLiKuService;
|
||||
@Autowired
|
||||
private XianGongAgvService xiangGongAgvService;
|
||||
@Autowired
|
||||
private LimitRegionalService limitRegionalService;
|
||||
|
||||
private List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
|
||||
@@ -445,6 +453,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
}
|
||||
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
|
||||
String startRegion = startdevice.getRegion();
|
||||
String nextRegion = nextdevice.getRegion();
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
@@ -832,9 +843,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return;
|
||||
}
|
||||
// 如果是无光电的设备 放货任务完成需要变更有货状态
|
||||
// StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
// if(device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
|
||||
// XgAgvCarDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
// if(device.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (XgAgvCarDeviceDriver)
|
||||
// device.getDeviceDriver();
|
||||
// standardOrdinarySiteDeviceDriver.setMove(2);
|
||||
// }
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.nl.acs.limit_regional.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("acs_regional_flow_control")
|
||||
public class LimitRegional {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 起始区域
|
||||
*/
|
||||
private String start_regional;
|
||||
|
||||
/**
|
||||
* 目标区域
|
||||
*/
|
||||
private String next_regional;
|
||||
|
||||
/**
|
||||
* 起始区域排除设备
|
||||
*/
|
||||
private String start_exclude_device;
|
||||
@TableField(exist = false)
|
||||
private List<String> startExcludeDevice;
|
||||
|
||||
/**
|
||||
* 目标区域排除设备
|
||||
*/
|
||||
private String next_exclude_device;
|
||||
@TableField(exist = false)
|
||||
private List<String> nextExcludeDevice;
|
||||
|
||||
/**
|
||||
* 最大数量
|
||||
*/
|
||||
private String max_num;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@NotBlank
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@NotBlank
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@NotBlank
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.acs.limit_regional.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/acsRegional")
|
||||
public class LimitRegionalController {
|
||||
|
||||
@Autowired
|
||||
private LimitRegionalService limitRegionalService;
|
||||
|
||||
@GetMapping
|
||||
@Log("分页查询流量限制")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(limitRegionalService.queryByPage(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("synchronous")
|
||||
@Log("同步流量限制")
|
||||
public ResponseEntity<Object> queryAll() {
|
||||
limitRegionalService.queryAll();
|
||||
return new ResponseEntity<>( HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增流量限制")
|
||||
public ResponseEntity<Object> add(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(limitRegionalService.add(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Log("修改流量限制")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
|
||||
limitRegionalService.update(json);
|
||||
return new ResponseEntity<>( HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除流量限制")
|
||||
public ResponseEntity<Object> del(@RequestBody String[] ids) {
|
||||
limitRegionalService.del(ids);
|
||||
return new ResponseEntity<>( HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("updateActive")
|
||||
@Log("修改流量限制状态")
|
||||
public ResponseEntity<Object> updateStatusById(@RequestParam Map whereJson) {
|
||||
limitRegionalService.updateStatusById(whereJson);
|
||||
return new ResponseEntity<>( HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.acs.limit_regional.server;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.limit_regional.domain.LimitRegional;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public interface LimitRegionalService extends CommonService<LimitRegional> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> queryByPage(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询全部流量限制
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
void queryAll();
|
||||
|
||||
/**
|
||||
* 新增流量限制
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
List<LimitRegional> add(JSONObject json);
|
||||
|
||||
|
||||
/**
|
||||
* 删除流量限制
|
||||
* @param json
|
||||
*/
|
||||
void del(String[] ids);
|
||||
|
||||
/**
|
||||
* 修改流量限制
|
||||
* @param json
|
||||
*/
|
||||
void update(JSONObject json);
|
||||
|
||||
/**
|
||||
* 修改流量限制状态
|
||||
* @param whereJson
|
||||
*/
|
||||
void updateStatusById(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根绝起点目标区域查询流量限制
|
||||
* @param startdevice
|
||||
* @param nextRegion
|
||||
*/
|
||||
LimitRegionalDto selectByReging(String startdevice, String nextRegion);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.acs.limit_regional.server.dto;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class LimitRegionalDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 起始区域
|
||||
*/
|
||||
private String start_regional;
|
||||
|
||||
/**
|
||||
* 目标区域
|
||||
*/
|
||||
private String next_regional;
|
||||
|
||||
/**
|
||||
* 起始区域排除设备
|
||||
*/
|
||||
private String start_exclude_device;
|
||||
private List<String> startExcludeDevice;
|
||||
|
||||
/**
|
||||
* 目标区域排除设备
|
||||
*/
|
||||
private String next_exclude_device;
|
||||
private List<String> nextExcludeDevice;
|
||||
|
||||
/**
|
||||
* 最大数量
|
||||
*/
|
||||
private String max_num;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.nl.acs.limit_regional.server.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.QueryHelpMybatisPlus;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.limit_regional.domain.LimitRegional;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
import org.nl.acs.limit_regional.server.mapper.LimitRegionalMapper;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.acs.utils.PageUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMapper, LimitRegional> implements LimitRegionalService {
|
||||
|
||||
@Autowired
|
||||
private LimitRegionalMapper limitRegionalMapper;
|
||||
|
||||
private List<LimitRegional> dataList;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryByPage(Map whereJson, Pageable page) {
|
||||
for (LimitRegional dto : dataList) {
|
||||
String next_exclude_device = dto.getNext_exclude_device();
|
||||
String elementStr = next_exclude_device.replaceAll("[\\[\\] ]", "");
|
||||
String[] elements = elementStr.split(",");
|
||||
List<String> list = new ArrayList<>();
|
||||
list.addAll(Arrays.asList(elements));
|
||||
String start_exclude_device = dto.getStart_exclude_device();
|
||||
String elementStr1 = start_exclude_device.replaceAll("[\\[\\] ]", "");
|
||||
String[] elements1 = elementStr1.split(",");
|
||||
List<String> list1 = new ArrayList<>();
|
||||
list1.addAll(Arrays.asList(elements1));
|
||||
dto.setNextExcludeDevice(list);
|
||||
dto.setStartExcludeDevice(list1);
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("content",dataList);
|
||||
jsonObject.put("totalElements",dataList.size());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void queryAll() {
|
||||
dataList = limitRegionalMapper.selectList(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<LimitRegional> add(JSONObject json) {
|
||||
LimitRegional limitRegional = new LimitRegional();
|
||||
limitRegional.setId(RandomUtil.randomString(8));
|
||||
limitRegional.setStart_regional(json.getString("start_regional"));
|
||||
limitRegional.setNext_regional(json.getString("next_regional"));
|
||||
limitRegional.setStart_exclude_device(json.getString("startExcludeDevice"));
|
||||
limitRegional.setNext_exclude_device(json.getString("nextExcludeDevice"));
|
||||
String max_num = json.getString("max_num");
|
||||
String regex = "\\d+";
|
||||
boolean isNumeric = max_num.matches(regex);
|
||||
if(!isNumeric){
|
||||
throw new RuntimeException("最大数请输入纯数字");
|
||||
}
|
||||
limitRegional.setMax_num(max_num);
|
||||
limitRegional.setCreate_by("auto");
|
||||
limitRegional.setCreate_time(DateUtil.now());
|
||||
limitRegionalMapper.insert(limitRegional);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void del(String[] ids) {
|
||||
if(CollUtil.isEmpty(Arrays.asList(ids)) || ids.length < 1){
|
||||
return;
|
||||
}
|
||||
for (String id : ids) {
|
||||
limitRegionalMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(JSONObject json) {
|
||||
LimitRegional limitRegional = new LimitRegional();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
limitRegional.setId(json.getString("id"));
|
||||
limitRegional.setStart_regional(json.getString("start_regional"));
|
||||
limitRegional.setNext_regional(json.getString("next_regional"));
|
||||
limitRegional.setStart_exclude_device(json.getString("startExcludeDevice"));
|
||||
limitRegional.setNext_exclude_device(json.getString("nextExcludeDevice"));
|
||||
limitRegional.setMax_num(json.getString("max_num"));
|
||||
limitRegional.setUpdate_by(currentUsername);
|
||||
limitRegional.setUpdate_time(DateUtil.now());
|
||||
limitRegionalMapper.updateById(limitRegional);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatusById(Map whereJson) {
|
||||
String id = whereJson.get("id").toString();
|
||||
if(StrUtil.isEmpty(id)){
|
||||
return;
|
||||
}
|
||||
LimitRegional limitRegional = new LimitRegional();
|
||||
limitRegional.setId(id);
|
||||
limitRegional.setIs_active(whereJson.get("is_active").toString());
|
||||
limitRegional.setUpdate_by(SecurityUtils.getCurrentUsername());
|
||||
limitRegional.setUpdate_time(DateUtil.now());
|
||||
limitRegionalMapper.updateById(limitRegional);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LimitRegionalDto selectByReging(String startRegion, String nextRegion) {
|
||||
for (LimitRegional limitRegional : dataList) {
|
||||
if (startRegion.equals(limitRegional.getStart_regional()) && nextRegion.equals(limitRegional.getNext_regional())){
|
||||
return ConvertUtil.convert(limitRegional, LimitRegionalDto.class);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.acs.limit_regional.server.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.acs.common.base.CommonMapper;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.limit_regional.domain.LimitRegional;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface LimitRegionalMapper extends CommonMapper<LimitRegional> {
|
||||
|
||||
}
|
||||
@@ -235,7 +235,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 5000 + random);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) (5000 + random));
|
||||
} else if (this.all_null < 6) {
|
||||
if (log.isWarnEnabled()) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class OpcServerManageDto {
|
||||
private String password;
|
||||
private String prog_id;
|
||||
private String cls_id;
|
||||
private String domain;
|
||||
private String domain = "";
|
||||
|
||||
public String getOpc_code() {
|
||||
return this.opc_code;
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.nl.config.thread;
|
||||
|
||||
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -29,6 +30,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class ThreadPoolExecutorUtil {
|
||||
|
||||
|
||||
public static ThreadPoolExecutor getPoll(){
|
||||
AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);
|
||||
return new ThreadPoolExecutor(
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "prod")
|
||||
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "dev")
|
||||
public class JobRunner implements ApplicationRunner {
|
||||
private static final Logger log = LoggerFactory.getLogger(JobRunner.class);
|
||||
private final ISysQuartzJobService quartzJobService;
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package org.nl.system.service.quartz.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
@@ -38,6 +45,7 @@ public class AutoCreateInst {
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
LimitRegionalService limitRegionalService = SpringContextHolder.getBean(LimitRegionalService.class);
|
||||
List<TaskDto> list = taskserver.queryAllByStatus("0");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TaskDto acsTask = list.get(i);
|
||||
@@ -173,6 +181,81 @@ public class AutoCreateInst {
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
Device startdevice = appService.findDeviceByCode(start_device_code);
|
||||
Device nextdevice = appService.findDeviceByCode(next_device_code);
|
||||
String startRegion = startdevice.getRegion();
|
||||
String nextRegion = nextdevice.getRegion();
|
||||
int count = 0;
|
||||
boolean startRegionalExit = true;
|
||||
boolean nextRegionalExit = true;
|
||||
//控制指令生成
|
||||
LimitRegionalDto limitRegionalDtos = limitRegionalService.selectByReging(startRegion, nextRegion);
|
||||
if (ObjectUtil.isNotEmpty(limitRegionalDtos)) {
|
||||
String next_exclude_device = limitRegionalDtos.getNext_exclude_device();
|
||||
if (StrUtil.isNotEmpty(next_exclude_device)) {
|
||||
String content = next_exclude_device.substring(1, next_exclude_device.length() - 1);
|
||||
boolean contains = content.contains(",");
|
||||
String[] array = contains ? content.split(",") : new String[]{content};
|
||||
List<String> list1 = Arrays.asList(array);
|
||||
for (String s : list1) {
|
||||
if (s.equals(next_device_code)) {
|
||||
nextRegionalExit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
String start_exclude_device = limitRegionalDtos.getStart_exclude_device();
|
||||
if (StrUtil.isNotEmpty(start_exclude_device)) {
|
||||
String content = start_exclude_device.substring(1, start_exclude_device.length() - 1);
|
||||
boolean contains = content.contains(",");
|
||||
String[] array = contains ? content.split(",") : new String[]{content};
|
||||
List<String> list1 = Arrays.asList(array);
|
||||
for (String s : list1) {
|
||||
if (s.equals(start_device_code)) {
|
||||
startRegionalExit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(limitRegionalDtos) && (startRegionalExit || nextRegionalExit)) {
|
||||
List<InstructionMybatis> instructionMybatis = instructionService.list(Wrappers.lambdaQuery(InstructionMybatis.class).le(InstructionMybatis::getInstruction_status, 1));
|
||||
for (InstructionMybatis instructionMybati : instructionMybatis) {
|
||||
Device startDevice = appService.findDeviceByCode(instructionMybati.getStart_device_code());
|
||||
Device nextDevice = appService.findDeviceByCode(instructionMybati.getNext_device_code());
|
||||
if ((StrUtil.isNotEmpty(startDevice.getRegion()) ? startDevice.getRegion() : "0").equals(startRegion) && (StrUtil.isNotEmpty(nextDevice.getRegion()) ? nextDevice.getRegion() : "0").equals(nextRegion)) {
|
||||
String start_exclude_device = limitRegionalDtos.getStart_exclude_device();
|
||||
if (StrUtil.isNotEmpty(start_exclude_device)) {
|
||||
String content = start_exclude_device.substring(1, start_exclude_device.length() - 1);
|
||||
boolean contains = content.contains(",");
|
||||
String[] array = contains ? content.split(",") : new String[]{content};
|
||||
List<String> list1 = Arrays.asList(array);
|
||||
for (String s : list1) {
|
||||
if (s.equals(instructionMybati.getStart_device_code())) {
|
||||
startRegionalExit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
String next_exclude_device = limitRegionalDtos.getNext_exclude_device();
|
||||
if (StrUtil.isNotEmpty(next_exclude_device)) {
|
||||
String content = next_exclude_device.substring(1, next_exclude_device.length() - 1);
|
||||
boolean contains = content.contains(",");
|
||||
String[] array = contains ? content.split(",") : new String[]{content};
|
||||
List<String> list2 = Arrays.asList(array);
|
||||
for (String s : list2) {
|
||||
if (s.equals(instructionMybati.getNext_device_code())) {
|
||||
nextRegionalExit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (startRegionalExit || nextRegionalExit) {
|
||||
++count;
|
||||
}
|
||||
if (count >= Integer.parseInt(limitRegionalDtos.getMax_num())) {
|
||||
log.info("同区域指令数量过多,等待指令完成再此创建");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -38,9 +38,11 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
/**
|
||||
* 该处仅供参考
|
||||
*/
|
||||
@Autowired
|
||||
/* @Autowired
|
||||
@Qualifier("threadPoolExecutor")
|
||||
private ThreadPoolExecutor EXECUTOR;
|
||||
private ThreadPoolExecutor EXECUTOR;*/
|
||||
|
||||
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,3 +23,4 @@ error_sys=系统繁忙,稍后在试
|
||||
error_sysAuth=权限不足,操作失败
|
||||
error_sysFile=上传失败
|
||||
error_sysLimit=访问次数限制\!
|
||||
zh_device_name_isNotNull = 中文设备名称不能位空
|
||||
|
||||
@@ -23,3 +23,4 @@ error_sys=The system is busy, please try again later
|
||||
error_sysAuth=Insufficient permissions, operation failed
|
||||
error_sysFile=Upload failed
|
||||
error_sysLimit=Access limit\!
|
||||
zh_device_name_isNotNull = Chinese device name cannot be empty\!
|
||||
|
||||
@@ -23,3 +23,4 @@ error_sys=Sistemnya sibuk, tolong coba lagi nanti
|
||||
error_sysAuth=Keizinan tidak cukup, operasi gagal
|
||||
error_sysFile=Upload gagal
|
||||
error_sysLimit=Batas akses\!
|
||||
zh_device_name_isNotNull= Nama perangkat dalam bahasa Cina tidak boleh kosong!
|
||||
|
||||
@@ -23,3 +23,4 @@ error_sys=系统繁忙,稍后在试
|
||||
error_sysAuth=权限不足,操作失败
|
||||
error_sysFile=上传失败
|
||||
error_sysLimit=访问次数限制\!
|
||||
zh_device_name_isNotNull = 中文设备名称不能为空
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
window.g = {
|
||||
dev: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
|
||||
VUE_APP_BASE_API: 'http://192.168.101.1:8011'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
|
||||
VUE_APP_BASE_API: 'http://192.168.101.1:8011'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
41
acs2/nladmin-ui/src/api/acs/regional/acsRegional.js
Normal file
41
acs2/nladmin-ui/src/api/acs/regional/acsRegional.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/acsRegional',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/acsRegional/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/acsRegional',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function reload() {
|
||||
return request({
|
||||
url: 'api/acsRegional/synchronous',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function updateOn(id, is_active) {
|
||||
return request({
|
||||
url: '/api/acsRegional/updateActive?id=' + id + '&is_active=' + is_active,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, updateOn, reload }
|
||||
@@ -22,6 +22,7 @@ import role from './role/zh'
|
||||
import department from './department/zh'
|
||||
import dict from './dict/zh'
|
||||
import angle from './angle/zh'
|
||||
import regional from './regional/zh'
|
||||
|
||||
export default {
|
||||
...zhLocale,
|
||||
@@ -47,6 +48,7 @@ export default {
|
||||
...role,
|
||||
...department,
|
||||
...dict,
|
||||
...angle
|
||||
...angle,
|
||||
...regional
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import role from './role/en'
|
||||
import department from './department/en'
|
||||
import dict from './dict/en'
|
||||
import angle from './angle/en'
|
||||
import regional from './regional/en'
|
||||
|
||||
export default {
|
||||
...enLocale,
|
||||
@@ -47,6 +48,7 @@ export default {
|
||||
...role,
|
||||
...department,
|
||||
...dict,
|
||||
...angle
|
||||
...angle,
|
||||
...regional
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import role from './role/in'
|
||||
import department from './department/in'
|
||||
import dict from './dict/in'
|
||||
import angle from './angle/in'
|
||||
import regional from './regional/in'
|
||||
|
||||
export default {
|
||||
...idLocale,
|
||||
@@ -48,5 +49,6 @@ export default {
|
||||
...role,
|
||||
...department,
|
||||
...dict,
|
||||
...angle
|
||||
...angle,
|
||||
...regional
|
||||
}
|
||||
|
||||
17
acs2/nladmin-ui/src/i18n/langs/regional/en.js
Normal file
17
acs2/nladmin-ui/src/i18n/langs/regional/en.js
Normal file
@@ -0,0 +1,17 @@
|
||||
export default {
|
||||
'regional': {
|
||||
'table': {
|
||||
'origin_region': 'Wilayah Asal',
|
||||
'target_region': 'Wilayah Tujuan',
|
||||
'origin_region_excluded_devices': 'Wilayah Asal Yang Dikecualikan Perangkat',
|
||||
'target_region_excluded_devices': 'Wilayah Tujuan Yang Dikecualikan Perangkat',
|
||||
'maximum_quantity': 'Jumlah Maksimum',
|
||||
'data_limit': 'Batas Data',
|
||||
'origin_region_cannot_be_empty': 'Wilayah Asal Tidak Boleh Kosong',
|
||||
'destination_region_cannot_be_empty': 'Wilayah Tujuan Tidak Boleh Kosong',
|
||||
'maximum_number_cannot_be_empty': 'Jumlah Maksimum Tidak Boleh Kosong',
|
||||
'disabled': 'Nonaktif',
|
||||
'enabled': 'Diaktifkan'
|
||||
}
|
||||
}
|
||||
}
|
||||
17
acs2/nladmin-ui/src/i18n/langs/regional/in.js
Normal file
17
acs2/nladmin-ui/src/i18n/langs/regional/in.js
Normal file
@@ -0,0 +1,17 @@
|
||||
export default {
|
||||
'regional': {
|
||||
'table': {
|
||||
'origin_region': 'Origin Region',
|
||||
'target_region': 'Target Region',
|
||||
'origin_region_excluded_devices': 'Origin Region Excluded Devices',
|
||||
'target_region_excluded_devices': 'Target Region Excluded Devices',
|
||||
'maximum_quantity': 'Maximum Quantity',
|
||||
'data_limit': 'Data Limit',
|
||||
'origin_region_cannot_be_empty': 'Origin Region Cannot Be Empty',
|
||||
'destination_region_cannot_be_empty': 'Destination Region Cannot Be Empty',
|
||||
'maximum_number_cannot_be_empty': 'Maximum Number Cannot Be Empty',
|
||||
'disabled': 'Disabled',
|
||||
'enabled': 'Enabled'
|
||||
}
|
||||
}
|
||||
}
|
||||
17
acs2/nladmin-ui/src/i18n/langs/regional/zh.js
Normal file
17
acs2/nladmin-ui/src/i18n/langs/regional/zh.js
Normal file
@@ -0,0 +1,17 @@
|
||||
export default {
|
||||
'regional': {
|
||||
'table': {
|
||||
'origin_region': '起始区域',
|
||||
'target_region': '目标区域',
|
||||
'origin_region_excluded_devices': '起始区域排除设备',
|
||||
'target_region_excluded_devices': '目标区域排除设备',
|
||||
'maximum_quantity': '最大数量',
|
||||
'data_limit': '流量限制',
|
||||
'origin_region_cannot_be_empty': '起始区域不能为空',
|
||||
'destination_region_cannot_be_empty': '目标区域不能为空',
|
||||
'maximum_number_cannot_be_empty': '最大数不能为空',
|
||||
'disabled': '停用',
|
||||
'enabled': '启用'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,18 @@ export default {
|
||||
'Task_code': 'Task Code',
|
||||
'Task': 'Task',
|
||||
'start_or_end': 'Origin Or Destination',
|
||||
'time': 'Time'
|
||||
'time': 'Time',
|
||||
'extension_field': 'Extension Field'
|
||||
},
|
||||
'select': {
|
||||
'automated_warehouse_task_type': 'Automated Warehouse Task Type',
|
||||
'Placeholder': 'Select',
|
||||
'Start_point': 'Start Point',
|
||||
'Start_point2': 'Start Point 2',
|
||||
'Starting_column': 'Starting Column',
|
||||
'Starting_layer': 'Starting Layer',
|
||||
'Destination': 'Destination',
|
||||
'Destination2': 'Destination 2',
|
||||
'Ending_column': 'Ending Column',
|
||||
'Ending_layer': 'Ending Layer',
|
||||
'Description': 'Description',
|
||||
|
||||
@@ -15,14 +15,18 @@ export default {
|
||||
'Task_code': 'Nomor Tugas',
|
||||
'Task': 'Tugas',
|
||||
'start_or_end': 'Asal Atau Tujuan',
|
||||
'time': 'Waktu'
|
||||
'time': 'Waktu',
|
||||
'extension_field': 'Bidang Perluasan'
|
||||
},
|
||||
'select': {
|
||||
'automated_warehouse_task_type': 'Jenis Tugas Gudang Otomatis',
|
||||
'Placeholder': 'Pilih',
|
||||
'Start_point': 'Titik Awal',
|
||||
'Start_point2': 'Titik Awal 2',
|
||||
'Starting_column': 'Kolom Awal',
|
||||
'Starting_layer': 'Lapisan Awal',
|
||||
'Destination': 'Tujuan',
|
||||
'Destination2': 'Tujuan 2',
|
||||
'Ending_column': 'Kolom Akhir',
|
||||
'Ending_layer': 'Lapisan Akhir',
|
||||
'Description': 'Deskripsi',
|
||||
|
||||
@@ -15,14 +15,18 @@ export default {
|
||||
'Task_code': '任务号',
|
||||
'Task': '任务',
|
||||
'start_or_end': '起点或终点',
|
||||
'time': '时间段'
|
||||
'time': '时间段',
|
||||
'extension_field': '扩展字段'
|
||||
},
|
||||
'select': {
|
||||
'automated_warehouse_task_type': '立库任务类型',
|
||||
'Placeholder': '请选择',
|
||||
'Start_point2': '起点2',
|
||||
'Start_point': '起点',
|
||||
'Starting_column': '起点-列',
|
||||
'Starting_layer': '起点-层',
|
||||
'Destination': '终点',
|
||||
'Destination2': '终点2',
|
||||
'Ending_column': '终点-列',
|
||||
'Ending_layer': '终点-层',
|
||||
'Description': '描述信息',
|
||||
|
||||
@@ -127,6 +127,7 @@ import finished_product_out_with_bind_lable_conveyor from '@/views/acs/device/dr
|
||||
import fold_disc_site from '@/views/acs/device/driver/one_conveyor/fold_disc_site.vue'
|
||||
import scanner_weight_conveyor from '@/views/acs/device/driver/one_conveyor/scanner_weight_conveyor.vue'
|
||||
import un_box_lable_conveyor from '@/views/acs/device/driver/one_conveyor/un_box_lable_conveyor.vue'
|
||||
import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue'
|
||||
export default {
|
||||
name: 'DeviceConfig',
|
||||
components: {
|
||||
@@ -184,6 +185,7 @@ export default {
|
||||
pull_tail_manipulator,
|
||||
inflatable_shaft_library,
|
||||
green_foil_machine_button,
|
||||
xg_agv_car
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
423
acs2/nladmin-ui/src/views/acs/device/driver/agv/xg_agv_car.vue
Normal file
423
acs2/nladmin-ui/src/views/acs/device/driver/agv/xg_agv_car.vue
Normal file
@@ -0,0 +1,423 @@
|
||||
<template>
|
||||
<!--自动门-->
|
||||
<div>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">设备协议:</span>
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
OpcServer:
|
||||
<el-select
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcservers"
|
||||
:key="item.opc_id"
|
||||
:label="item.opc_name"
|
||||
:value="item.opc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
PLC:
|
||||
<el-select
|
||||
v-model="plc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
@change="changePlc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcPlcs"
|
||||
:key="item.plc_id"
|
||||
:label="item.plc_name"
|
||||
:value="item.plc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">输送系统:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="车辆ip" label-width="150px">
|
||||
<el-input v-model="form.agv_ip" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="休息点" prop="next_point_code" label-width="150px">
|
||||
<el-select
|
||||
v-model="form.relax_point"
|
||||
style="width: 190px;"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="充电点" prop="charge_point" label-width="150px">
|
||||
<el-select
|
||||
v-model="form.charge_point"
|
||||
style="width: 190px;"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="最小电量" label-width="150px">
|
||||
<el-input v-model="form.min_electric" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="最大电量" label-width="150px">
|
||||
<el-input v-model="form.cancle_electric" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="可执行任务电量" label-width="150px">
|
||||
<el-input v-model="form.task_electric" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC读取字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data1"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data1[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishReadEdit(data1[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC写入字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data2"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data2[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishWriteEdit(data2[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value2">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbw_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig,
|
||||
testRead,
|
||||
testwrite
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
import { selectOpcList } from '@/api/acs/device/opc'
|
||||
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||
import crud from '@/mixins/crud'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
export default {
|
||||
name: 'StandardAutodoor',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
require: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
opc_id: '',
|
||||
opc_code: '',
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
inspect_in_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.parentForm) {
|
||||
const arr = Object.keys(data.parentForm)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.opc_code = data.parentForm.opc_code
|
||||
this.plc_code = data.parentForm.plc_code
|
||||
}
|
||||
}
|
||||
this.data1 = data.rs
|
||||
this.data2 = data.ws
|
||||
this.sliceItem()
|
||||
})
|
||||
selectPlcList().then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||
})
|
||||
selectOpcList().then(data => {
|
||||
this.dataOpcservers = data
|
||||
this.opc_id = this.$props.parentForm.opc_server_id
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach(item => {
|
||||
if (item.opc_id === val) {
|
||||
this.opc_code = item.opc_code
|
||||
}
|
||||
})
|
||||
selectListByOpcID(val).then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = ''
|
||||
this.plc_code = ''
|
||||
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||
}
|
||||
this.sliceItem()
|
||||
})
|
||||
},
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changePlc(val) {
|
||||
this.dataOpcPlcs.forEach(item => {
|
||||
if (item.plc_id === val) {
|
||||
this.plc_code = item.plc_code
|
||||
this.sliceItem()
|
||||
return
|
||||
}
|
||||
})
|
||||
},
|
||||
test_read1() {
|
||||
testRead(this.data1, this.opc_id).then(data => {
|
||||
this.data1 = data
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_read2() {
|
||||
testRead(this.data2, this.opc_id).then(data => {
|
||||
this.data2 = data
|
||||
console.log(this.data2)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_write1() {
|
||||
testwrite(this.data2, this.opc_id).then(data => {
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
parentForm.is_route = true
|
||||
parentForm.plc_id = this.plc_id
|
||||
parentForm.opc_id = this.opc_id
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sliceItem() { // 拼接DB的Item值
|
||||
this.data1.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
this.data2.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
303
acs2/nladmin-ui/src/views/acs/regional/index.vue
Normal file
303
acs2/nladmin-ui/src/views/acs/regional/index.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
@click="reload"
|
||||
>
|
||||
{{ $t('auto.common.synchronous') }}
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu"
|
||||
:title="crud.status.title"
|
||||
width="650px"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
size="small"
|
||||
label-width="160px"
|
||||
>
|
||||
<el-form-item
|
||||
v-if="false"
|
||||
label="id标识"
|
||||
>
|
||||
<el-input v-model="form.id" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('regional.table.origin_region')"
|
||||
prop="start_regional"
|
||||
>
|
||||
<el-input v-model="form.start_regional" :disabled="crud.status.edit" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('regional.table.target_region')"
|
||||
prop="next_regional"
|
||||
>
|
||||
<el-input v-model="form.next_regional" :disabled="crud.status.edit" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('regional.table.origin_region_excluded_devices')"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.startExcludeDevice"
|
||||
filterable
|
||||
clearable
|
||||
reserve-keyword
|
||||
multiple
|
||||
:placeholder="$t('auto.common.please')"
|
||||
style="width: 370px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('regional.table.target_region_excluded_devices')"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.nextExcludeDevice"
|
||||
filterable
|
||||
clearable
|
||||
reserve-keyword
|
||||
multiple
|
||||
:placeholder="$t('auto.common.please')"
|
||||
style="width: 370px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('regional.table.maximum_quantity')"
|
||||
prop="max_num"
|
||||
>
|
||||
<el-input v-model="form.max_num" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">{{ $t('task.select.Cancel') }}</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">{{ $t('task.select.Confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column
|
||||
v-if="false"
|
||||
prop="id"
|
||||
label="id标识"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="start_regional"
|
||||
:label="$t('regional.table.origin_region')"
|
||||
:min-width="flexWidth('start_regional',crud.data,$t('regional.table.origin_region'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="next_regional"
|
||||
:label="$t('regional.table.target_region')"
|
||||
:min-width="flexWidth('next_regional',crud.data,$t('regional.table.target_region'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="start_exclude_device"
|
||||
:label="$t('regional.table.origin_region_excluded_devices')"
|
||||
:min-width="flexWidth('start_exclude_device',crud.data,$t('regional.table.origin_region_excluded_devices'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="next_exclude_device"
|
||||
:label="$t('regional.table.target_region_excluded_devices')"
|
||||
:min-width="flexWidth('next_exclude_device',crud.data,$t('regional.table.target_region_excluded_devices'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="max_num"
|
||||
:label="$t('regional.table.maximum_quantity')"
|
||||
:min-width="flexWidth('max_num',crud.data,$t('regional.table.maximum_quantity'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="is_active"
|
||||
:label="$t('angle.table.is_on')"
|
||||
:min-width="flexWidth('is_active',crud.data,$t('angle.table.is_on'))"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.is_active"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="updateIsOn(scope.row.id,scope.row.is_active)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="create_by"
|
||||
:label="$t('angle.table.create_by')"
|
||||
:min-width="flexWidth('create_by',crud.data,$t('angle.table.create_by'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="create_time"
|
||||
:label="$t('angle.table.create_time')"
|
||||
:min-width="flexWidth('create_time',crud.data,$t('angle.table.create_time'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="update_by"
|
||||
:label="$t('angle.table.update_by')"
|
||||
:min-width="flexWidth('update_by',crud.data,$t('angle.table.update_by'))"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="update_time"
|
||||
:label="$t('angle.table.update_time')"
|
||||
:min-width="flexWidth('update_time',crud.data,$t('angle.table.update_time'))"
|
||||
/>
|
||||
<el-table-column
|
||||
v-permission="['admin','acsRegional:edit','acsRegional:del']"
|
||||
:label="$t('angle.table.operate')"
|
||||
width="150px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudAcsRegional from '@/api/acs/regional/acsRegional'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
import i18n from '@/i18n'
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
start_regional: null,
|
||||
next_regional: null,
|
||||
start_exclude_device: [],
|
||||
startExcludeDevice: [],
|
||||
next_exclude_device: [],
|
||||
nextExcludeDevice: [],
|
||||
max_num: null,
|
||||
remark: null,
|
||||
is_active: null,
|
||||
create_by: null,
|
||||
create_time: null,
|
||||
update_by: null,
|
||||
update_time: null
|
||||
}
|
||||
export default {
|
||||
name: 'AcsRegional',
|
||||
components: { pagination, crudOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: i18n.t('regional.table.data_limit'),
|
||||
url: 'api/acsRegional',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudAcsRegional }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
deviceList: [],
|
||||
permission: {
|
||||
add: ['admin', 'acsRegional:add'],
|
||||
edit: ['admin', 'acsRegional:edit'],
|
||||
del: ['admin', 'acsRegional:del']
|
||||
},
|
||||
rules: {
|
||||
is_active: [
|
||||
{
|
||||
required: true,
|
||||
message: '是否启用不能为空',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
start_regional: [
|
||||
{ required: true, message: this.$t('regional.table.origin_region_cannot_be_empty'), trigger: 'blur' }
|
||||
],
|
||||
next_regional: [
|
||||
{ required: true, message: this.$t('regional.table.destination_region_cannot_be_empty'), trigger: 'blur' }
|
||||
],
|
||||
max_num: [
|
||||
{ required: true, message: this.$t('regional.table.maximum_number_cannot_be_empty'), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
reload() {
|
||||
crudAcsRegional.reload().then(res => {
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
updateIsOn(id, is_active) {
|
||||
var msg = this.$t('regional.table.disabled')
|
||||
if (is_active === '1') {
|
||||
msg = this.$t('regional.table.enabled')
|
||||
}
|
||||
crudAcsRegional.updateOn(id, is_active)
|
||||
.then(res => {
|
||||
this.crud.notify(msg + ' ' + this.$t('Inst.table.succeed'), CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -307,7 +307,6 @@ export default {
|
||||
weights: [
|
||||
{ required: true, message: '权值不能为空', trigger: 'blur' }
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -689,7 +689,7 @@ export default {
|
||||
to_y2: null,
|
||||
to_z2: null,
|
||||
agv_system_type: '1',
|
||||
interaction_json: {}
|
||||
interactionJson: null
|
||||
},
|
||||
extension: [{
|
||||
name: '',
|
||||
@@ -751,7 +751,7 @@ export default {
|
||||
saveForm() {
|
||||
// 保存表单数据
|
||||
// 你可以在这里处理保存逻辑,并发送请求保存表单数据
|
||||
this.form.interaction_json = this.extension.reduce((extension, item) => {
|
||||
this.form.interactionJson = this.extension.reduce((extension, item) => {
|
||||
extension[item.name] = item.value
|
||||
return extension
|
||||
}, {})
|
||||
|
||||
Reference in New Issue
Block a user