fix:分切下料修改
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.cutpointivt_type_site;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
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.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检测站点驱动定义
|
||||
* 说明:该站点为普通带光电检测站点
|
||||
*/
|
||||
@Service
|
||||
public class CutpointivtTypeSiteDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "cutpointivt_type_site";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "分切下料-检测站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "分切下料-检测站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new CutpointivtTypeSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return CutpointivtTypeSiteDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.cutpointivt_type_site;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
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.DeviceDriver;
|
||||
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.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class CutpointivtTypeSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
|
||||
TaskMapper taskMapper;
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
|
||||
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
/**
|
||||
* 放货准备锁
|
||||
*/
|
||||
String putReadyLock = null;
|
||||
/**
|
||||
* 有货标记
|
||||
*/
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
private Date time = new Date();
|
||||
|
||||
|
||||
int move1 = 0;
|
||||
int move2 = 0;
|
||||
int move3 = 0;
|
||||
int move4 = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
|
||||
int option = 0;
|
||||
|
||||
|
||||
boolean hasVehicle = false;
|
||||
boolean isReady = false;
|
||||
protected int instruction_num = 0;
|
||||
protected int instruction_num_truth = 0;
|
||||
boolean isFold = false;
|
||||
private String assemble_check_tag;
|
||||
|
||||
protected String current_stage_instruction_message;
|
||||
protected String last_stage_instruction_message;
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out;
|
||||
boolean requireSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
String qty;
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
String material;
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
String batch;
|
||||
/**
|
||||
* 当前指令
|
||||
*/
|
||||
Instruction inst = null;
|
||||
/**
|
||||
* 上次指令
|
||||
*/
|
||||
Instruction last_inst = null;
|
||||
|
||||
/**
|
||||
* 触摸屏手动触发任务
|
||||
*/
|
||||
private Boolean is_has_task = false;
|
||||
|
||||
/**
|
||||
* 满盅入库请求标记
|
||||
*/
|
||||
boolean Sucess = false;
|
||||
|
||||
/**
|
||||
* 暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
*/
|
||||
int flag;
|
||||
|
||||
String devicecode;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
|
||||
devicecode = this.getDeviceCode();
|
||||
|
||||
move1 = this.itemProtocol.getMove1();
|
||||
move2 = this.itemProtocol.getMove2();
|
||||
move3 = this.itemProtocol.getMove3();
|
||||
move4 = this.itemProtocol.getMove4();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean instruction_require(String container_code) {
|
||||
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求指令
|
||||
*
|
||||
* @param container_code
|
||||
* @param container_type
|
||||
*/
|
||||
public synchronized boolean instruction_require(String container_code, String container_type) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
TaskDto dto = new TaskDto();
|
||||
String now = DateUtil.now();
|
||||
dto.setTask_id(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(this.getDevice().getDevice_code());
|
||||
dto.setUpdate_by(this.getDevice().getDevice_code());
|
||||
dto.setStart_point_code(this.getDevice().getDevice_code());
|
||||
dto.setVehicle_code(container_code);
|
||||
dto.setVehicle_type(container_type);
|
||||
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
dto.setTask_code("-" + taskcode);
|
||||
dto.setTask_status(TaskStatusEnum.READY.getIndex());
|
||||
dto.setPriority("101");
|
||||
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||
String next_device_codecode = jo.getNext_device_code();
|
||||
if (StrUtil.isEmpty(next_device_codecode)) {
|
||||
throw new RuntimeException("该设备未找到对应路由");
|
||||
}
|
||||
dto.setNext_point_code(next_device_codecode);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
//
|
||||
// wo.insert(json);
|
||||
|
||||
Task entity = ConvertUtil.convert(dto, Task.class);
|
||||
taskMapper.insert(entity);
|
||||
requireSucess = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move1", move1);
|
||||
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* lms申请任务
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply(Integer type) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.cutpointivt_type_site;
|
||||
|
||||
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_heartbeat = "heartbeat";
|
||||
public static String item_move1 = "move1";
|
||||
public static String item_move2 = "move2";
|
||||
public static String item_move3 = "move3";
|
||||
public static String item_move4 = "move4";
|
||||
|
||||
|
||||
|
||||
private CutpointivtTypeSiteDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(CutpointivtTypeSiteDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getMove1() {
|
||||
return this.getOpcIntegerValue(item_move1);
|
||||
}
|
||||
|
||||
public int getMove2() {
|
||||
return this.getOpcIntegerValue(item_move2);
|
||||
}
|
||||
|
||||
public int getMove3() {
|
||||
return this.getOpcIntegerValue(item_move3);
|
||||
}
|
||||
public int getMove4() {
|
||||
return this.getOpcIntegerValue(item_move4);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*是否有货
|
||||
*/
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDto(item_move1, "光电开关信号1", "DB600.B3"));
|
||||
list.add(new ItemDto(item_move2, "光电开关信号2", "DB600.B3"));
|
||||
list.add(new ItemDto(item_move3, "光电开关信号3", "DB600.B3"));
|
||||
list.add(new ItemDto(item_move4, "光电开关信号4", "DB600.B3"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -118,4 +118,12 @@ public class WmsToAcsController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getCutpointivtType")
|
||||
@Log("分切下料缓存信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getCutpointivtType(@RequestBody String whereJson) throws Exception {
|
||||
return new ResponseEntity<>(wmstoacsService.getCutpointivtType(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -118,4 +118,6 @@ public interface WmsToAcsService {
|
||||
Map<String, Object> putWeightAction(String jsonObject) throws Exception;
|
||||
|
||||
Map<String, Object> getTubeMes(String whereJson) throws Exception;
|
||||
|
||||
Map<String, Object> getCutpointivtType(String whereJson)throws Exception;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -27,6 +28,7 @@ import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletiz
|
||||
import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
|
||||
import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.blank_manipulator.BlankManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.cutpointivt_type_site.CutpointivtTypeSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library.InflatableShaftLibraryDeviceDriver;
|
||||
@@ -757,6 +759,53 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCutpointivtType(String jsonObject) throws Exception {
|
||||
log.info("分切下料缓存信息--------------:输入参数" + jsonObject);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code("分切下料缓存信息")
|
||||
.content("分切下料缓存信息-----输入参数:" + jsonObject)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
|
||||
HashMap<String, String> cutpointivtTypeMap = new HashMap<>();
|
||||
Device device = deviceAppService.findDeviceByCode("GVL_UA");
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + "GVL_UA");
|
||||
}
|
||||
CutpointivtTypeSiteDeviceDriver linkDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof CutpointivtTypeSiteDeviceDriver) {
|
||||
linkDeviceDriver = (CutpointivtTypeSiteDeviceDriver) device.getDeviceDriver();
|
||||
int move1 = linkDeviceDriver.getMove1();
|
||||
int move2 = linkDeviceDriver.getMove2();
|
||||
int move3 = linkDeviceDriver.getMove3();
|
||||
int move4 = linkDeviceDriver.getMove4();
|
||||
//value 1、长轴 2、短轴
|
||||
if (move1 == 1) {
|
||||
cutpointivtTypeMap.put("A1_TZZC03", "1");
|
||||
}
|
||||
if (move2 == 1) {
|
||||
cutpointivtTypeMap.put("A1_TZZC03", "2");
|
||||
}
|
||||
if (move3 == 1) {
|
||||
cutpointivtTypeMap.put("A1_TZZC04", "1");
|
||||
}
|
||||
if (move4 == 1) {
|
||||
cutpointivtTypeMap.put("A1_TZZC04", "2");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", cutpointivtTypeMap);
|
||||
return resultJson;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevice(String jsonObject) throws Exception {
|
||||
try {
|
||||
@@ -833,7 +882,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min());
|
||||
jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec());
|
||||
//温度需要除以10
|
||||
jo.put("temperature", Math.round(hongXiangConveyorDeviceDriver.getTo_temperature() / 10));
|
||||
jo.put("temperature", Math.round(hongXiangConveyorDeviceDriver.getTo_temperature() / 10));
|
||||
jo.put("now_temperature", Math.round(hongXiangConveyorDeviceDriver.getTemperature() / 10));
|
||||
jo.put("door", hongXiangConveyorDeviceDriver.getDoor());
|
||||
jo.put("finish", hongXiangConveyorDeviceDriver.getFinish());
|
||||
|
||||
Reference in New Issue
Block a user