This commit is contained in:
2024-03-12 09:24:42 +08:00
28 changed files with 726 additions and 208 deletions

View File

@@ -410,7 +410,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.50</version>
<version>1.54</version>
</dependency>
<!--导出CSV相关-->

View File

@@ -0,0 +1,59 @@
package org.nl.acs.device_driver.manipulator_cache;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
//工作模式
public static String item_mode = "mode";
//动作信号
public static String item_action = "action";
private ManipulatorCacheDeviceDriver driver;
public ItemProtocol(ManipulatorCacheDeviceDriver driver) {
this.driver = driver;
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
return list;
}
}

View File

@@ -0,0 +1,49 @@
package org.nl.acs.device_driver.manipulator_cache;
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;
/**
* 扫码器
*/
@Service
public class ManipulatorCacheDefination implements DeviceDriverDefination {
@Override
public String getDriverCode() {
return "manipulator_cache";
}
@Override
public String getDriverName() {
return "行架对接缓存位";
}
@Override
public String getDriverDescription() {
return "行架对接缓存位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new ManipulatorCacheDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return ManipulatorCacheDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
}

View File

@@ -0,0 +1,113 @@
package org.nl.acs.device_driver.manipulator_cache;
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 lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.config.language.LangProcess;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 标准版扫码器
*/
@Slf4j
@Data
public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
protected ItemProtocol itemProtocol = new ItemProtocol(this);
//当前指令
Instruction inst = null;
private String error_type = "ssx_error_type";
//工作模式
int mode = 0;
int last_mode = 0;
//任务号
int action = 0;
int last_action = 0;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
action = this.itemProtocol.getAction();
mode = this.itemProtocol.getMode();
}
public boolean exe_business() {
return true;
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
Map<String, Object> itemMap = new HashMap<String, Object>();
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String move = "";
if (this.getMode() == 0) {
mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) {
mode = LangProcess.msg("universal_stand-alone");
} else if (this.getMode() == 2) {
mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) {
mode = LangProcess.msg("universal_operation");
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("action", action);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
@Override
public JSONObject feedLmsRealFailedInfo() {
return null;
}
}

View File

@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
@@ -359,8 +360,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Map<String, Object> map6 = new HashMap<>();
Map<String, Object> map7 = new HashMap<>();
Map<String, Object> map8 = new HashMap<>();
Map<String, Object> map9 = new HashMap<>();
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8);
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
@@ -399,6 +401,15 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getMode() !=1) {
notCreateInstMessage = "universal_notCreateInstMessage3";
return false;
}
}
String taskid = taskDto.getTask_id();
String taskcode = taskDto.getTask_code();
String start_point_code = taskDto.getStart_point_code();
@@ -427,8 +438,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Map<String, Object> map6 = new HashMap<>();
Map<String, Object> map7 = new HashMap<>();
Map<String, Object> map8 = new HashMap<>();
Map<String, Object> map9 = new HashMap<>();
try {
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8);
pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
@@ -446,7 +458,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8) {
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8,Map<String, Object> map9) {
List list = new ArrayList();
map1.put("code", "to_command");
map1.put("value", 1);
@@ -481,6 +493,12 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map8.put("value", interactionJsonDTO.getMaxNo());
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) {
map8.put("code", "to_barcode");
map8.put("value", interactionJsonDTO.getBarcode());
list.add(map9);
}
}
this.writing(list);
}

View File

@@ -24,5 +24,8 @@ public class InteractionJsonDTO {
private String lastOne;
/**
*子卷号
*/
private String barcode;
}

View File

@@ -19,6 +19,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
import org.nl.acs.enums.VolumeTwoTypeEnum;
import org.nl.acs.history.ErrorUtil;
@@ -397,6 +398,18 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
return false;
}
}
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getMode() !=1) {
notCreateInstMessage = "universal_notCreateInstMessage3";
return false;
}
}
String taskid = taskDto.getTask_id();
String taskcode = taskDto.getTask_code();
String start_point_code = taskDto.getStart_point_code();

View File

@@ -608,7 +608,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
action = LangProcess.msg("universal_releasing_completed");
}
if(error == 0 && iserror){
message = "信号连接异常!";
message = "universal_message11";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);

View File

@@ -165,7 +165,7 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
if(error == 0 && iserror){
message = "信号连接异常!";
message = "universal_message11";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode ==2 ? "待机": "脱机");

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.hongxiang_device;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
@@ -244,7 +245,31 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
this.control(itemMap);
}
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
/**
* 多个信号一起下发电气
*
* @param map
*/
public void writing(Map<String, Object> map) throws Exception {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.checkcontrol(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}
//将扩展表中的字符串数据转换成集合
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {
@@ -308,7 +333,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
jo.put("hasGoods", true);
}
if(error == 0 && iserror){
message = "信号连接异常!";
message = "universal_message11";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("temperature", temperature);

View File

@@ -187,7 +187,7 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
String mode = "";
String action = "";
if(iserror){
message = "信号连接异常!";
message = "universal_message11";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", "联机");

View File

@@ -383,9 +383,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false;
}
instruction.setInstruction_status("1");
/*instruction.setInstruction_status("1");
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);
instructionService.update(instruction);*/
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
@@ -410,8 +410,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map.put("to_target", next_addr);
map.put("to_task", instruction.getInstruction_code());
map.put("to_command", "1");
list.add(map);
this.writing(list);
try {
this.writing(map);
} catch (Exception e) {
e.printStackTrace();
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
@@ -743,6 +746,28 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return isClose;
}
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
/**
* 多个信号一起下发电气
*
* @param map
*/
public void writing(Map<String, Object> map) throws Exception {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.checkcontrol(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}
public synchronized void update_instruction_status() throws Exception {
Date date = new Date();
@@ -751,6 +776,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else {
this.instruction_update_time = date;
Map map = new HashMap();
//更改任务状态
if (task > 0) {
Instruction inst1 = checkInst();
@@ -758,6 +784,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
inst1.setInstruction_status("1");
inst1.setExecute_device_code(this.device_code);
inst1.setUpdate_time(DateUtil.now());
instructionService.update(inst1);
}
}
@@ -780,7 +807,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 1) {
if (this.getNow_steps_type() == 2) {
ArrayList list = new ArrayList();
Map map = new HashMap();
map.put("to_command", "2");
list.add(map);
this.writing(list);
@@ -809,7 +835,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else {
if (this.getNow_steps_type() == 2) {
ArrayList list = new ArrayList();
Map map = new HashMap();
map.put("to_command", "2");
list.add(map);
this.writing(list);
@@ -844,11 +869,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
map.put("to_close_door", "1");
hongXiangConveyorDeviceDriver.writing(map);
}
if (this.getNow_steps_type() == 3) {
ArrayList list = new ArrayList();
Map map = new HashMap();
map.put("to_command", "3");
list.add(map);
this.writing(list);
@@ -889,7 +914,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int move = hongXiangConveyorDeviceDriver.getMove();
if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 0) {
if (this.getNow_steps_type() == 4) {
this.writing("to_command", "4");
map.put("to_command", "4");
this.writing(map);
this.setNow_steps_type(5);
} else {
feedMessage = "未反馈电气信号原因:当前步骤不为允许放货now_steps_type=4";
@@ -916,7 +942,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
} else {
if (this.getNow_steps_type() == 4) {
this.writing("to_command", "4");
map.put("to_command", "4");
this.writing(map);
this.setNow_steps_type(5);
}
}
@@ -957,8 +984,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int time = Integer.parseInt(taskDto.getOven_time());
int hours = (time % (60 * 60 * 24)) / (60 * 60);
int minutes = (time % (60 * 60)) / 60;
hongXiangConveyorDeviceDriver.writing("to_time_house", String.valueOf(hours));
hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes));
map.put("to_time_house", String.valueOf(hours));
map.put("to_time_min", String.valueOf(minutes));
hongXiangConveyorDeviceDriver.writing(map);
}
}
@@ -984,7 +1012,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
this.writing("to_command", "5");
map.put("to_command", "5");
this.writing(map);
this.setNow_steps_type(6);
this.setNow_steps_type(0);
try {

View File

@@ -304,8 +304,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
break;
case 7:
if (!requireSucess && task > 0) {
//套管失败无库存
//todo
//申请拔轴
applyPullShaft(mode);
}
break;
case 8:
@@ -439,6 +439,38 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
/**
* 申请拔轴
*/
private synchronized void applyPullShaft(int mode) {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
TaskDto taskDto = taskserver.findByCode(task_code1);
if (ObjectUtil.isNotEmpty(taskDto)){
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
applyPlugPullSiteRequest.setType("4");
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成成功";
} else {
message = applyPlugPullSitResponse.getMessage();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 99);
this.writing(map);
requireSucess = true;
message = "申请拔轴失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
/**
* 缓存线已满,生成行架任务
*/
@@ -449,7 +481,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setType("4");
applyPlugPullSiteRequest.setType("5");
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);

View File

@@ -339,12 +339,12 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} else {
if (mode == 2) {
//if (!requireSucess) {
String remark = "";;
String remark = "";
if (mode != 2) {
remark = remark + "工作模式(mode)不是待机状态,";
remark = remark + "universal_remark2";
}
if (move != 0) {
remark = remark + "光电信号(move)为有货状态,";
remark = remark + "universal_remark3";
}
if (task != 0) {
remark = remark + "universal_remark4";
@@ -417,10 +417,12 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
@@ -512,7 +514,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
notCreateInstMessage = "";
notCreateTaskMessage = "";
} else {
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
notCreateInstMessage = "universal_notCreateInstMessage";
}
return true;
}
@@ -571,19 +573,19 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
String action = "";
String walk_y = "";
if (this.getMode() == 0) {
mode = "脱机";
mode = LangProcess.msg("universal_off-line");
} else if (this.getMode() == 1) {
mode = "单机";
mode = LangProcess.msg("universal_stand-alone");
} else if (this.getMode() == 2) {
mode = "待机";
mode = LangProcess.msg("universal_standby");
} else if (this.getMode() == 3) {
mode = "运行中";
mode = LangProcess.msg("universal_operation");
}
if (this.getMove() == 0) {
move = "无货";
move = LangProcess.msg("universal_no");
} else if (this.getMove() == 1) {
move = "有货";
move = LangProcess.msg("universal_yes");
}
String requireSucess = "0";
@@ -592,16 +594,15 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
jo.put("requireSucess", requireSucess);
if (this.getAction() == 1) {
action = "取货中";
action = LangProcess.msg("universal_delivery");
} else if (this.getAction() == 2) {
action = "取货完成";
action = LangProcess.msg("universal_completed");
} else if (this.getAction() == 3) {
action = "放货中";
action = LangProcess.msg("universal_releasing");
} else if (this.getAction() == 4) {
action = "放货完成";
action = LangProcess.msg("universal_releasing_completed");
}
if(error == 0 && this.itemProtocol.isError){
message = "信号连接异常!";
iserror = true;
}else if(error == 0 && !this.itemProtocol.isError){
iserror = false;

View File

@@ -10,7 +10,8 @@ public class ApplyPlugPullSiteRequest extends BaseRequest {
* 1-申请套管
* 2-套管完成
* 3-拔轴完成
* 4-缓存线已满,生成行架任务
* 4-申请拔轴
* 5-缓存线已满,生成行架任务
*/
private String type;

View File

@@ -250,6 +250,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
void finishAndCreateNextInst(Instruction dto) throws Exception;
/**
* 完成并创建指令
*
* @param
*/
void finishAndCreateHXInst(Instruction dto) throws Exception;
/**
* 取消指令
*

View File

@@ -372,6 +372,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if(regional(dto.getStart_device_code(), dto.getNext_device_code())){
throw new BadRequestException(LangProcess.msg("error_regional_max"));
}
if(StrUtil.isNotEmpty(dto.getTask_code())){
InstructionMybatis instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class)
.eq(InstructionMybatis::getTask_code, dto.getTask_code())).get(0);
if(ObjectUtil.isNotEmpty(instructionMybatis) && instructionMybatis.getStart_device_code().equals(dto.getStart_device_code())){
return;
}
}
String currentUsername = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -868,11 +875,28 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.one();
// =0 则不用再次请求
if (StrUtil.equals(task.getRequest_again(), "0")) {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
if(StrUtil.equals(task.getTask_type(),"8")){
//中转为空
if(StrUtil.isEmpty(task.getPut_device_code())){
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
finishAndCreateNextInst(ConvertUtil.convert(entity, Instruction.class));
}
} else {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(ConvertUtil.convert(entity, Instruction.class));
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
}
}
} else {
// finishAndCreateNextInst((Instruction) entity);
finishAndCreateNextInst(ConvertUtil.convert(entity, Instruction.class));
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
finishAndCreateNextInst(ConvertUtil.convert(entity, Instruction.class));
}
}
}
@@ -897,10 +921,28 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.one();
// =0 则不用再次请求
if (StrUtil.equals(task.getRequest_again(), "0")) {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
if(StrUtil.equals(task.getTask_type(),"8")){
//中转为空
if(StrUtil.isEmpty(task.getPut_device_code())){
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
finishAndCreateNextInst(ConvertUtil.convert(ins, Instruction.class));
}
} else {
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(ConvertUtil.convert(ins, Instruction.class));
} else if (StrUtil.equals(task.getPut_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
}
}
} else {
finishAndCreateNextInst(dto);
if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) {
taskService.finish(task.getTask_id());
} else {
finishAndCreateNextInst(ConvertUtil.convert(ins, Instruction.class));
}
}
}
@@ -1001,6 +1043,69 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void finishAndCreateHXInst(Instruction dto) {
dto = foramte(dto);
String device_code = dto.getNext_device_code();
Task task = taskService.getOne(Wrappers.lambdaQuery(Task.class).eq(Task::getTask_id, dto.getTask_id()));
TaskDto acsTask = ConvertUtil.convert(task, TaskDto.class);
String next_device_code = acsTask.getPut_device_code();
String start_device_code = dto.getNext_device_code();
String start_point_code = null;
String next_point_code = null;
String start_device =
deviceAppService
.findDeviceByCode(start_device_code)
.getDeviceDriverDefination()
.getFitDeviceTypes()
.get(0)
.name();
String next_device =
deviceAppService
.findDeviceByCode(next_device_code)
.getDeviceDriverDefination()
.getFitDeviceTypes()
.get(0)
.name();
if (StrUtil.equals("storage", start_device)) {
start_point_code = start_device_code + "-" + acsTask.getFrom_y() + "-" + acsTask.getFrom_z();
} else {
start_point_code = start_device_code;
}
if (StrUtil.equals("storage", next_device)) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(acsTask.getRoute_plan_code());
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity());
instdto.setTask_id(acsTask.getTask_id());
instdto.setTask_code(acsTask.getTask_code());
instdto.setVehicle_code(acsTask.getVehicle_code());
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(acsTask.getPriority());
instdto.setInstruction_status("0");
instdto.setExecute_device_code(dto.getNext_device_code());
try {
this.create(instdto);
} catch (Exception e) {
e.printStackTrace();
log.error("完成并创建下一条指令", e.getMessage());
}
}
@Override
public void cancel(String id) throws Exception {
// flag= true时取消指令

View File

@@ -118,6 +118,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
*/
private CopyOnWriteArrayList<TaskDto> tasks = new CopyOnWriteArrayList<>();
/**
* 烘箱任务类型
*/
private static final String TASK_TYPE = "8";
@Override
public PageInfo<TaskDto> queryAll(TaskQueryParam query, Pageable pageable) {
@@ -447,7 +452,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override
public List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code) {
return Optional
List<TaskDto> collect = Optional
.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>())
.stream()
@@ -455,6 +461,22 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex()))
.filter(task -> instructionService.findByTaskcodeAndStatus(task.getTask_code()) != null)
.collect(Collectors.toList());
if(CollUtil.isEmpty(collect)){
tasks.forEach(
task ->{
if(TASK_TYPE.equals(task.getTask_type()) && StrUtil.isNotEmpty(task.getPut_device_code())){
Instruction instruction = instructionService.findByDeviceCodeFromCache(task.getNext_device_code());
if (ObjectUtil.isNotEmpty(instruction)) {
if (StrUtil.equals(instruction.getStart_device_code(), device_code)) {
collect.add(task);
}
}
}
}
);
}
return collect;
}
@Override
@@ -534,7 +556,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String route_plan_code = dto.getRoute_plan_code();
dto.setCreate_by(currentUsername);
dto.setCreate_by(StrUtil.isNotEmpty(currentUsername) ? currentUsername : "LMS");
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);

View File

@@ -27,11 +27,20 @@ public class SecurityUtils {
JSONObject json = (JSONObject) StpUtil.getExtra("loginInfo");
if (ObjectUtil.isNotEmpty(json)) {
return json.toBean(CurrentUser.class);
} else {
CurrentUser currentUser = new CurrentUser();
currentUser.setId("2");
currentUser.setPresonName("LMS系统用户");
currentUser.setUsername("LMS");
return currentUser;
}
} catch (Exception e) {
return new CurrentUser();
CurrentUser currentUser = new CurrentUser();
currentUser.setId("2");
currentUser.setPresonName("LMS系统用户");
currentUser.setUsername("LMS");
return currentUser;
}
return null;
}
/**

View File

@@ -27,6 +27,7 @@ universal_message7=\u4EFB\u52A1\u5B8C\u6210...
universal_message8=\u8BFB\u53D6\u4FE1\u53F7\u503C\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message9=\u521B\u5EFA\u6307\u4EE4\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message10=\u4E0B\u53D1\u591A\u4E2A\u7535\u6C14\u4FE1\u53F7:
universal_message11=\u4FE1\u53F7\u8FDE\u63A5\u5F02\u5E38\uFF01
universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001
universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001
universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001
@@ -41,6 +42,7 @@ universal_feedMessage11=\u540E\u5DE5\u4F4D\u5149\u7535\u4FE1\u53F7\u4E0D\u5E94\u
universal_write_erro=\u5199\u5165\u4FE1\u53F7\u5931\u8D25
universal_notCreateInstMessage1=\u672A\u8BBE\u7F6E\u7535\u6C14\u8C03\u5EA6\u53F7!
universal_notCreateInstMessage2=\u5149\u7535\u65E0\u8D27,\u65E0\u6CD5\u751F\u6210\u6307\u4EE4!
universal_notCreateInstMessage3=\u8BBE\u5907\u5F85\u673A\u6216\u4E0D\u5141\u8BB8\u8FDB\u5165

View File

@@ -26,6 +26,7 @@ universal_message7=Mission accomplished...
universal_message8=An exception occurred when reading the signal value:
universal_message9=An exception occurred while creating the directive
universal_message10=Multiple electrical signals are issued
universal_message11=The signal connection is abnormal!
universal_feedMessage1=mode is not in the running state
universal_feedMessage2=action signal (action signal) is not a release completed status
universal_feedMessage3=Photoelectric signal (move) is not out of stock
@@ -41,3 +42,4 @@ universal_write_erro=Write signal failure
universal_notCreateInstMessage=Instructions cannot be created because the task for the associated device is not found
universal_notCreateInstMessage1=The electrical dispatch number is not set!
universal_notCreateInstMessage2=Photoelectric no goods, can not generate commands!
universal_notCreateInstMessage3=The device is in standby mode or is not allowed to enter

View File

@@ -26,6 +26,7 @@ universal_message7=Misi tercapai ...
universal_message8=Pengecualian terjadi saat membaca nilai sinyal:
universal_message9=Pengecualian terjadi saat membuat direktif
universal_message10=Beberapa sinyal listrik dikeluarkan
universal_message11=Koneksi sinyal tidak normal!
universal_feedMessage1=Mode kerja tidak untuk mode dalam mode
universal_feedMessage2=Sinyal aksi tidak lengkap untuk penempatan
universal_feedMessage3=tidak ada status pengiriman
@@ -41,3 +42,4 @@ universal_write_erro=Sinyal penulis gagal
universal_notCreateInstMessage=Misi untuk divais yang diasosiasikan tidak ditemukan, perintah tidak dapat dibuat
universal_notCreateInstMessage1=Nomor pengiriman listrik tidak diatur!
universal_notCreateInstMessage2=Photo-electric tidak tersedia dan tidak dapat menghasilkan perintah!
universal_notCreateInstMessage3=Siaga perangkat atau tidak diizinkan masuk

View File

@@ -26,6 +26,7 @@ universal_message7=\u4EFB\u52A1\u5B8Cuniversal_releasing_completed\u6210...
universal_message8=\u8BFB\u53D6\u4FE1\u53F7\u503C\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message9=\u521B\u5EFA\u6307\u4EE4\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message10=\u4E0B\u53D1\u591A\u4E2A\u7535\u6C14\u4FE1\u53F7
universal_message11=\u4FE1\u53F7\u8FDE\u63A5\u5F02\u5E38\uFF01
universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001
universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001
universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001
@@ -41,3 +42,5 @@ universal_write_erro=\u5199\u5165\u4FE1\u53F7\u5931\u8D25
universal_notCreateInstMessage=\u672A\u627E\u5230\u5173\u8054\u8BBE\u5907\u7684\u4EFB\u52A1\uFF0C\u6307\u4EE4\u65E0\u6CD5\u521B\u5EFA
universal_notCreateInstMessage1=\u672A\u8BBE\u7F6E\u7535\u6C14\u8C03\u5EA6\u53F7!
universal_notCreateInstMessage2=\u5149\u7535\u65E0\u8D27,\u65E0\u6CD5\u751F\u6210\u6307\u4EE4!
universal_notCreateInstMessage3=\u8BBE\u5907\u5F85\u673A\u6216\u4E0D\u5141\u8BB8\u8FDB\u5165

View File

@@ -1,11 +1,11 @@
<template>
<div style="overflow: hidden">
<el-select v-model="value" :placeholder="$t('auto.common.please')" @change="initStageData(value)">
<el-select v-model="stage_code" :placeholder="$t('auto.common.please')" @change="changeStage">
<el-option
v-for="item in stageParam"
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in Stages"
:key="item.stage_code"
:label="item.stage_name"
:value="item.stage_code"
/>
</el-select>
<el-row>
@@ -233,6 +233,7 @@ import '@logicflow/extension/lib/style/index.css'
import { LogicFlow } from '@logicflow/core'
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
import i18n from '@/i18n'
import { selectStageList } from '@/api/acs/stage/stage'
let data = {}
let lf = ''
@@ -257,14 +258,7 @@ export default {
dialogFormVisible8: false,
dialogFormVisible9: false,
dialogFormVisible10: false,
stageParam: [{// 舞台参数
value: 'age',
label: '一楼监控'
}, {
value: 'stage_code',
label: '二楼监控'
}],
value: 'age',
Stages: [],
stage_code: '',
form: {
device_code: '',
@@ -287,6 +281,11 @@ export default {
msgLeft: '200px'
}
},
created() {
selectStageList().then(data => {
this.Stages = data
})
},
mounted() {
this.init()
},
@@ -361,13 +360,9 @@ export default {
lf.render(data)
this.initStageData()
},
initStageData(var1) {
changeStage(var1) {
// 获取舞台数据
this.stage_code = var1
if (!this.stage_code) {
// 可以在这里设置一个默认的stage_code或者直接返回
this.stage_code = 'age'
}
crudStage.getNewStageDataByCode(this.stage_code).then(res => { // 通过舞台编码获取舞台数据并且赋值到lf对象
data = JSON.parse(res.stage_data)
lf.render(data)

View File

@@ -84,7 +84,9 @@ public class SalesServiceImpl implements SalesService {
String sales_code = dto.getSales_code();
SalesDto unitDto = this.findByCode(sales_code);
if (unitDto != null) {
throw new BadRequestException("存在相同的编码");
if (unitDto.getArea().equals(dto.getArea())) {
throw new BadRequestException("存在相同区域的业务员!");
}
}
dto.setSales_id(IdUtil.getSnowflake(1, 1).nextId());

View File

@@ -416,7 +416,9 @@ public class AutoSendSalesIvt {
// 调用接口传送图片名称
JSONObject resultParam = lmsToMesService.sendSalesIvtMsg(fileName);
// 查询此区域的所有业务员
/*
* 查询此区域的所有业务员
*/
String area = result.getString("value");
List<JSONObject> areaList = WQLObject.getWQLObject("md_cs_areasalesinfo")
@@ -431,6 +433,27 @@ public class AutoSendSalesIvt {
})
.collect(Collectors.toList());
// 查询领导对用区域
String region_boss = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("REGION_PIC_BOSS").getValue();
// 截取编码
String[] userArr = region_boss.split(",");
for (String user : userArr) {
// 人员编码
String user_code = user.substring(0, user.indexOf("-"));
// 对应的区域编码
String area_code = user.substring(user.indexOf("-") + 1,user.length());
// 判断是包含此区域
if (area_code.contains(area)) {
JSONObject jsonUser = new JSONObject();
jsonUser.put("User",user_code);
userList.add(jsonUser);
}
}
// 调用接口返回飞书
JSONObject paramFeiShu = new JSONObject();
paramFeiShu.put("UserList", userList);

View File

@@ -40,11 +40,13 @@
IF 输入.flag = "1"
QUERY
SELECT
cust.*,
cust.cust_code,
cust.cust_name,
SUBSTRING_INDEX(cust.sales_owner, '|', 1) AS sales_owner,
info1.area
FROM
md_cs_customerbase cust
INNER JOIN md_cs_areasalesinfo info1 ON info1.sales_name = cust.sales_owner
INNER JOIN md_cs_areasalesinfo info1 ON info1.sales_name = SUBSTRING_INDEX(cust.sales_owner, '|', 1)
WHERE
cust.is_delete = '0'
AND cust.is_used = '1'