add:木箱入库桁架
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -163,8 +163,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
/**
|
||||
* 下发任务号
|
||||
*/
|
||||
String to_task = null;
|
||||
String last_to_task = null;
|
||||
int to_task = 0;
|
||||
int last_to_task = 0;
|
||||
/**
|
||||
* 下发接纯数字托盘号
|
||||
*/
|
||||
@@ -511,9 +511,9 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
this.instruction_require_time = date;
|
||||
//查找有没有对应的指令
|
||||
Instruction inst;
|
||||
if ("RK1032".equals(this.device_code)||"RK1034".equals(this.device_code)||"RK1035".equals(this.device_code)){
|
||||
if ("RK1032".equals(this.device_code) || "RK1034".equals(this.device_code) || "RK1035".equals(this.device_code)) {
|
||||
inst = instructionService.findByStartCodeAndReady2(this.device_code);
|
||||
}else {
|
||||
} else {
|
||||
inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(inst)) {
|
||||
@@ -803,8 +803,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
// led_message = getLedMessage(instdto);
|
||||
//写完信号to_task写成功后更新指令为执行中
|
||||
inst = checkInst();
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
if (Integer.parseInt(to_task)>0 && to_task.equals(inst.getInstruction_code())) {
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
if (to_task > 0 && to_task == Integer.parseInt(inst.getInstruction_code())) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
|
||||
@@ -110,8 +110,8 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public String getTo_task() {
|
||||
return this.getOpcStringValue(item_to_task);
|
||||
public int getTo_task() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class ItemProtocol {
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
return "0";
|
||||
}
|
||||
|
||||
public int[] getOpcArrayValue(String protocol) {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.nl.acs.device_driver.conveyor.optoele_docking_station;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
private OptoeleDockingStationDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(OptoeleDockingStationDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有货
|
||||
* @param move
|
||||
* @return
|
||||
*/
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
|
||||
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 String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isBlank(value)) {
|
||||
// log.error("读取错误!");
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB81.B10"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB81.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB81.B2"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.acs.device_driver.conveyor.optoele_docking_station;
|
||||
|
||||
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 OptoeleDockingStationDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "optoele_docking_station";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "标准版-普通光电对接点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "标准版-普通光电对接点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new OptoeleDockingStationDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return OptoeleDockingStationDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.station);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.acs.device_driver.conveyor.optoele_docking_station;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
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.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.StandardRequestMethod;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
|
||||
|
||||
/**
|
||||
* 标准版-普通光电对接点
|
||||
*/
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class OptoeleDockingStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
|
||||
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
int move = 0;
|
||||
int last_move = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
|
||||
last_mode = mode;
|
||||
last_move = move;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() throws Exception {
|
||||
JSONObject jo = new JSONObject();
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -22,6 +23,7 @@ import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceD
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
@@ -45,6 +47,8 @@ import org.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -72,6 +76,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
|
||||
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -80,8 +85,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int last_action = 0;
|
||||
int error = 0;
|
||||
int task = 0;
|
||||
String barcode = null;
|
||||
float weight = 0.0f;
|
||||
int heartbeat = 0;
|
||||
int to_command = 0;
|
||||
int last_to_command = 0;
|
||||
int to_target = 0;
|
||||
int to_onset = 0;
|
||||
|
||||
@@ -141,6 +149,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
action = this.itemProtocol.getAction();
|
||||
weight = new BigDecimal(Float.toString(this.itemProtocol.getWeight()))
|
||||
.setScale(1, RoundingMode.HALF_UP)
|
||||
.floatValue();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
@@ -154,9 +166,31 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (mode != last_mode) {
|
||||
requireSucess = false;
|
||||
}
|
||||
if(action == last_action){
|
||||
if(action != last_action){
|
||||
requireActionSucess = false;
|
||||
}
|
||||
|
||||
//以防出现未知问题,桁架称重完成变成6后,给桁架反馈6
|
||||
if (action == 6 && !this.requireActionSucess){
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 6);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
this.requireActionSucess = true;
|
||||
}
|
||||
|
||||
//清除下发桁架的6
|
||||
if (to_command != last_to_command && to_command == 6){
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 0);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
}
|
||||
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0 && !requireActionSucess) {
|
||||
updateInstructionStatus();
|
||||
@@ -190,7 +224,6 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
} else {
|
||||
String remark = "";
|
||||
;
|
||||
if (mode != 2) {
|
||||
remark = "universal_remark2";
|
||||
}
|
||||
@@ -227,7 +260,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
last_mode =mode;
|
||||
last_action = action;
|
||||
|
||||
last_to_command = to_command;
|
||||
}
|
||||
|
||||
private void updateInstructionStatus() {
|
||||
@@ -248,6 +281,24 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
}
|
||||
|
||||
if (action == 2 && move == 1 && weight > 0){
|
||||
Map<String,Object> request = new HashMap<>();
|
||||
request.put("task_code",inst.getTask_code());
|
||||
request.put("barcode",barcode);
|
||||
// request.put("weight",weight);
|
||||
request.put("weight", String.format("%.1f", weight));
|
||||
HttpResponse resp = acsToWmsService.feedBoxWeight(request);
|
||||
if (resp != null && resp.getStatus() == 200){
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 2);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
this.requireActionSucess = true;
|
||||
}
|
||||
}
|
||||
|
||||
//任务完成
|
||||
if (action == 5 && move == 0) {
|
||||
if (inst != null) {
|
||||
@@ -595,7 +646,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("message", LangProcess.msg(message));
|
||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||
jo.put("driver_type", "box_storage_manipulator");
|
||||
jo.put("is_click", true);
|
||||
|
||||
@@ -32,6 +32,14 @@ public class ItemProtocol {
|
||||
* 任务号
|
||||
*/
|
||||
public static String item_task = "task";
|
||||
/**
|
||||
* 木箱重量
|
||||
*/
|
||||
public static String item_weight = "weight";
|
||||
/**
|
||||
* 条码
|
||||
*/
|
||||
public static String item_barcode = "barcode";
|
||||
/**
|
||||
* 报警
|
||||
*/
|
||||
@@ -146,6 +154,12 @@ public class ItemProtocol {
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
public Float getWeight() {
|
||||
return this.getOpcFloatValue(item_weight);
|
||||
}
|
||||
public String getBarcode() {
|
||||
return this.getOpcStringValue(item_barcode);
|
||||
}
|
||||
|
||||
|
||||
public int getWalk_y() {
|
||||
@@ -220,6 +234,8 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB1.D6"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB1.D6"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
|
||||
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
|
||||
|
||||
@@ -611,7 +611,6 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.applyPullShaft_time.getTime() < (long) this.applyPullShaft_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.applyPullShaft_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.applyPullShaft_time = date;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴");
|
||||
|
||||
@@ -10,6 +10,8 @@ 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;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface AcsToWmsService {
|
||||
|
||||
|
||||
@@ -225,4 +227,6 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
|
||||
|
||||
HttpResponse feedBoxWeight(Map<String, Object> request);
|
||||
}
|
||||
|
||||
@@ -818,6 +818,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return manipulatorApplyPointResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedBoxWeight(Map<String, Object> request) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
HttpResponse result = null;
|
||||
log.info("feedBoxWeight反馈LMS机械手重量-----请求参数{}", request.toString());
|
||||
AddressDto addressDto = addressService.findByCode("feedBoxWeight");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
try {
|
||||
result = HttpRequest.post(wmsurl + methods_url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(JSON.toJSONString(request))
|
||||
.execute();
|
||||
log.info("feedBoxWeight反馈LMS机械手重量-----输出参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
// //System.out.println(msg);
|
||||
log.info("feedBoxWeight反馈LMS机械手重量-----输出参数{}", msg);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionFinishRequest2(JSONObject jsonObject) {
|
||||
HttpResponse execute = null;
|
||||
|
||||
@@ -72,7 +72,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!-- <appender-ref ref="asyncFileAppender"/>-->
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
<!-- <logger name="jdbc" level="ERROR" additivity="true">
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="org.springframework" level="ERROR" additivity="true">
|
||||
@@ -95,7 +95,10 @@ https://juejin.cn/post/6844903775631572999
|
||||
</logger>
|
||||
<logger name="org.jinterop" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>-->
|
||||
</logger>
|
||||
<logger name="org.openscada" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
<!--测试环境:打印控制台-->
|
||||
|
||||
Reference in New Issue
Block a user