opt: 拔轴机申请套轴优化

This commit is contained in:
yanps
2024-01-23 17:39:49 +08:00
parent bb99c99e68
commit 41904ecbb5
5 changed files with 4 additions and 1476 deletions

View File

@@ -147,7 +147,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
case 3:
break;
case 4:
if ((task1 > 0) && !requireSucess) {
if (!requireSucess) {
applyBushing();
}
break;
@@ -274,14 +274,14 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
private synchronized void applyBushing() {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
/*Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
String task_code1 = inst1.getTask_code();
if (Long.parseLong(task_code1) < 1) {
message = "任务ACS创建,不向LMS申请套轴";
return;
}
}*/
applyManipulatorActionRequest.setDevice_code(device_code);
applyManipulatorActionRequest.setTask_code1(task_code1);
//applyManipulatorActionRequest.setTask_code1(task_code1);
applyManipulatorActionRequest.setType("6");
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
if (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && ("1".equals(applyManipulatorActionResponse.getIs_bushing()))) {

View File

@@ -1,150 +0,0 @@
//package org.nl.acs.device_driver.conveyor.oven_manipulator;
//
//import cn.hutool.core.util.StrUtil;
//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_mode = "mode";
// /**
// * 光电信号
// */
// public static String item_move = "move";
// /**
// * 动作信号
// */
// public static String item_action = "action";
// /**
// * 行走列
// */
// public static String item_walk_y = "walk_y";
// /**
// * 报警
// */
// public static String item_error = "error";
// /**
// * 任务号
// */
// public static String item_task = "task";
//
// /**
// * 行走列
// */
// public static String item_to_command = "to_command";
// /**
// * 下发起始站
// */
// public static String item_to_onset = "to_onset";
// /**
// * 下发目标站
// */
// public static String item_to_target = "to_target";
// /**
// * 下发任务号
// */
// public static String item_to_task = "to_task";
//
//
// private OvenGantryManipulatorDeviceDriver driver;
//
// public ItemProtocol(OvenGantryManipulatorDeviceDriver 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);
// }
//
// public int getAction() {
// return this.getOpcIntegerValue(item_action);
// }
//
// public int getWalk_y() {
// return this.getOpcIntegerValue(item_walk_y);
// }
//
// public int getError() {
// return this.getOpcIntegerValue(item_error);
// }
//
// public int getTask() {
// return this.getOpcIntegerValue(item_task);
// }
//
//
//
//
// 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 String getOpcStringValue(String protocol) {
// String value = this.driver.getStringValue(protocol);
// if (StrUtil.isEmpty(value)) {
//
// } else {
// return value;
// }
// return "0";
// }
//
// public static List<ItemDto> getReadableItemDtos() {
// ArrayList list = new ArrayList();
// list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
// list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
// list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
// list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
// list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
// list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
// list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
// return list;
// }
//
// public static List<ItemDto> getWriteableItemDtos() {
// ArrayList list = new ArrayList();
// list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
// list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2"));
// list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4"));
// list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6"));
// return list;
// }
//
// @Override
// public String toString() {
// return "";
// }
//}
//

View File

@@ -1,62 +0,0 @@
//package org.nl.acs.device_driver.conveyor.oven_manipulator;
//
//import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
//import org.nl.acs.device.domain.Device;
//import org.nl.acs.device_driver.DeviceDriver;
//import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
//import org.nl.acs.device.enums.DeviceType;
//import org.springframework.stereotype.Service;
//
//import java.util.LinkedList;
//import java.util.List;
//
///**
// * 烘箱-行架机械手
// */
//@Service
//public class OvenGantryManipulatorDefination implements OpcDeviceDriverDefination {
// @Override
// public String getDriverCode() {
// return "oven_manipulator";
// }
//
// @Override
// public String getDriverName() {
// return "烘箱-行架机械手";
// }
//
// @Override
// public String getDriverDescription() {
// return "烘箱-行架机械手";
// }
//
// @Override
// public DeviceDriver getDriverInstance(Device device) {
// return (new OvenGantryManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
//
// }
//
// @Override
// public Class<? extends DeviceDriver> getDeviceDriverType() {
// return OvenGantryManipulatorDeviceDriver.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();
// }
//
//}

View File

@@ -1,56 +0,0 @@
package org.nl.acs.device_driver.conveyor.oven_manipulator;
import java.text.DecimalFormat;
public class Test {
public static String beautifyTime(double second) {
if (second <= 0) {
return "0";
}
final String[] units = new String[]{"", "分钟", "小时"};
int digitGroups = (int) (Math.log10(second) / Math.log10(60));
String value = "0";
if (digitGroups < 3) {
value = new DecimalFormat("#,##0.#").format(second / Math.pow(60, digitGroups)) + "" + units[digitGroups];
} else if (digitGroups >= 3) {
//如果超过了小时的表达范围则,则转换为天,小时,分,秒格式
value = secondToDate(second);
}
return value;
}
public static String secondToDate(double second) {
Long time = new Long(new Double(second).longValue());
String strTime = null;
Long days = time / (60 * 60 * 24);
Long hours = (time % (60 * 60 * 24)) / (60 * 60);
Long minutes = (time % (60 * 60)) / 60;
Long seconds = time % 60;
if (days > 0) {
strTime = days + "" + hours + "小时" + minutes + "分钟";
} else if (hours > 0) {
strTime = hours + "小时" + minutes + "分钟";
} else if (minutes > 0) {
strTime = minutes + "分钟" + seconds + "";
} else {
strTime = second + "";
}
return strTime;
}
public static void main(String[] args) {
Long time = new Long(new Double(7500).longValue());
Long hours = (time % (60 * 60 * 24)) / (60 * 60);
Long minutes = (time % (60 * 60)) / 60;
Long seconds = time % 60;
System.out.println(hours);
System.out.println(minutes);
System.out.println(seconds);
}
}