音来码垛机械手新驱动

This commit is contained in:
loujf
2022-10-29 13:16:20 +08:00
parent a6ccdac531
commit c9112ec03d
11 changed files with 627 additions and 829 deletions

View File

@@ -1,9 +0,0 @@
package org.nl.acs.agv.server;
/**
* @Author: lyd
* @Description:
* @Date: 2022-08-15
*/
public interface ZheDaAgvService {
}

View File

@@ -13,6 +13,7 @@ import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator.LnshPalletizingManipulatorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceDriver;
@@ -423,6 +424,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
LnshStationDeviceDriver lnshStationDeviceDriver;
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
//请求进入
if ("onEntry".equals(type)) {
@@ -539,6 +541,29 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
}
}
//嘉耐音来码垛机械手工位
if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
if ("Load".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() != 0 && lnshPalletizingManipulatorDeviceDriver.getMove() > 0
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("1");
lnshPalletizingManipulatorDeviceDriver.setFlag(1);
lnshPalletizingManipulatorDeviceDriver.writing(12);
is_feedback = true;
}
//请求放货
} else if ("Unload".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() != 0 && lnshPalletizingManipulatorDeviceDriver.getMove() == 0
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("3");
lnshPalletizingManipulatorDeviceDriver.setFlag(3);
lnshPalletizingManipulatorDeviceDriver.writing(13);
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
@@ -597,7 +622,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
if (lnshStationDeviceDriver.getMode() != 0 && lnshStationDeviceDriver.getMove() == 0) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
// lnshStationDeviceDriver.writing(2);
lnshStationDeviceDriver.writing(7);
is_feedback = true;
}
//放货完成
@@ -605,6 +630,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
if (lnshStationDeviceDriver.getMode() != 0 && lnshStationDeviceDriver.getMove() > 0) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
lnshStationDeviceDriver.writing(8);
is_feedback = true;
}
}
@@ -774,6 +800,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
StandardStorageDeviceDriver standardStorageDeviceDriver;
LnshStationDeviceDriver lnshStationDeviceDriver;
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
//mes = AgvClientXZ.mes(zlbh, device, type);
@@ -855,6 +882,29 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
}
}
if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver();
// flag = true;
log.info("agvstatus:" + lnshPalletizingManipulatorDeviceDriver.getFlag() + "");
//取货完成离开
if (lnshPalletizingManipulatorDeviceDriver.getFlag() == 1) {
if (lnshPalletizingManipulatorDeviceDriver.getMove() == 0
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2)) {
flag = true;
lnshPalletizingManipulatorDeviceDriver.setFlag(0);
lnshPalletizingManipulatorDeviceDriver.writing(10);
}
}
//放货完成离开
if (lnshPalletizingManipulatorDeviceDriver.getFlag() == 3) {
if (lnshPalletizingManipulatorDeviceDriver.getMove() == 1
&& (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2)) {
flag = true;
lnshPalletizingManipulatorDeviceDriver.setFlag(0);
lnshPalletizingManipulatorDeviceDriver.writing(11);
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();

View File

@@ -1,551 +0,0 @@
package org.nl.acs.agv.server.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.ZheDaAgvService;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.utils.SpringContextHolder;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
@Slf4j
@Service
@RequiredArgsConstructor
public class ZheDaAgvServiceImpl implements ZheDaAgvService {
private final AcsConfigService acsConfigService;
@Override
//ZDAGV
public HttpResponse sendAgvInstToZDAgv(Instruction inst) throws Exception {
JSONObject jo = new JSONObject();
String start_point_code = inst.getStart_point_code();
String next_point_code = inst.getNext_point_code();
//1、叠盘架追加任务2、养生区需要追加任务在缓存点等待3、二楼普通任务4、一楼普通任务
String task_type = inst.getInstruction_type();
jo.put("deadline", getNextDay(1));
//判断是否追加任务
if (task_type.equals("2") || task_type.equals("1")) {
jo.put("complete", "false");
} else {
jo.put("complete", "true");
}
jo.put("task_code", inst.getInstruction_code());
//根据任务,下发指令类型
JSONArray destinations = new JSONArray();
if (task_type.equals("1")) {
destinations.add(destination(start_point_code, "Wait", "5", "1"));
} else {
destinations.add(destination(start_point_code, "Load", "1", "1"));
if (task_type.equals("2")) {
destinations.add(destination(next_point_code, "Wait", "5", "1"));
} else {
destinations.add(destination(next_point_code, "Unload", "5", "1"));
}
}
jo.put("destinations", destinations);
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
String url = "";
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvurl2 = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL2);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
//不同楼层下发不同的agv系统
if (task_type.equals("8")) {
url = agvurl2;
} else {
url = agvurl;
}
url = url + ":" + agvport + "v1/transportOrders/" + inst.getInstruction_code();
log.info("下发agv任务请求:{}", url);
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(jo))//表单内容
.timeout(20000)//超时,毫秒
.execute();
log.info("下发agv任务请求反馈:{}", result);
return result;
} else {
return null;
}
}
@Override
//ZDAGV
public HttpResponse queryZDAgvInstStatus(String type) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
String agvurl = "";
if (type.equals("1")) {
agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
}
if (type.equals("2")) {
agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL2);
}
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
agvurl = agvurl + ":" + agvport + "/transportOrders";
HttpResponse result = HttpRequest.get(agvurl)
.timeout(20000)//超时,毫秒
.execute();
System.out.println("查询agv指令数据:" + result.body());
return result;
} else {
return null;
}
}
@Override
//ZDAGV
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) {
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action);
//释放AGV资源继续后续动作
boolean is_feedback = false;
String str = "";
String backaddress = address;
if (address.indexOf(".") > 0) {
str = address.substring(address.indexOf(".") + 1, address.length());
address = address.substring(0, address.indexOf("."));
} else if (address.indexOf("-") > 0) {
address = address.substring(0, address.indexOf("-"));
}
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
Instruction inst = instructionService.findByCodeFromCache(jobno);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device addressdevice = appService.findDeviceByCode(address);
CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver;
EmptyVehicleStackingPositionDeviceDriver emptyVehicleStackingPositionDeviceDriver;
HailiangSmartplcTestDeviceDriver hailiangSmartplcTestDeviceDriver;
HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver;
PaintConveyorDeviceDriver paintConveyorDeviceDriver;
//取货的进入前等待和离开等待
if (action.equals("Load")) {
if ("EntryRequired".equals(type)) {
//共挤线三工位
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//叠盘位
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
int number = emptyVehicleStackingPositionDeviceDriver.getNumber();
if (number < Integer.valueOf(str)) {
log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!");
return null;
}
inst.setExecute_status("1");
is_feedback = true;
}
//货梯对接线
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//豪凯自动线对接位
if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((haoKaiAutoConveyorDeviceDriver.getAction() == 1 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//油漆线
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
}
if ("PauseOnStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
hailiangSmartplcTestDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
emptyVehicleStackingPositionDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
cargoLiftConveyorDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
haoKaiAutoConveyorDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
paintConveyorDeviceDriver.writing(2);
is_feedback = true;
}
}
}
//等待点等待
if (action.equals("Wait")) {
if ("Wait".equals(type)) {
JSONObject jo = new JSONObject();
jo.put("task_code", inst.getInstruction_code());
JSONArray destinations = new JSONArray();
String inst_type = inst.getInstruction_type();
//如果任务类型为1在点位进行等待则查询当前叠盘位的数量取当前数量的层数进行追加任务
if ("1".equals(inst_type)) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber();
if (current_num > 12) {
log.info("当前叠盘架:" + jobno + "已放满!");
return null;
}
String start_point_code = inst.getStart_point_code();
String next_point_code = inst.getNext_point_code();
start_point_code = start_point_code + "." + (current_num + 1);
destinations.add(destination(start_point_code, "Load", "1", "1"));
destinations.add(destination(next_point_code, "Unload", "1", "1"));
}
//如果任务类型为2在点位进行等待则调用LMS的货位申请接口
if ("2".equals(inst_type)) {
String next_point_code = "";
//调用LMS接口
destinations.add(destination(next_point_code, "Unload", "5", "1"));
}
jo.put("destinations", destinations);
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
String url = agvurl + ":" + agvport + "addDestinations";
log.info("下发agv任务请求:{}", url);
HttpResponse result = HttpRequest.post(url)
.body(String.valueOf(jo))//表单内容
.timeout(20000)//超时,毫秒
.execute();
log.info("下发agv任务请求反馈:{}", result);
//对任务进行封口
JSONObject complete = new JSONObject();
complete.put("task_code", inst.getInstruction_code());
String url2 = agvurl + ":" + agvport + "markComplete";
log.info("下发agv任务请求:{}", url2);
HttpResponse result2 = HttpRequest.post(url2)
.body(String.valueOf(complete))//表单内容
.timeout(20000)//超时,毫秒
.execute();
log.info("下发agv任务请求反馈:{}", result2);
}
}
//放货的进入前等待和离开等待
if (action.equals("Unload")) {
if ("EntryRequired".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
int number = emptyVehicleStackingPositionDeviceDriver.getNumber();
if (number >= Integer.valueOf(str)) {
log.info("叠盘位:" + jobno + "" + str + "上有货!");
return null;
}
inst.setExecute_status("3");
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((haoKaiAutoConveyorDeviceDriver.getAction() == 2 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
}
if ("PauseOnStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
hailiangSmartplcTestDeviceDriver.writing(3);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
emptyVehicleStackingPositionDeviceDriver.writing(3);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
cargoLiftConveyorDeviceDriver.writing(3);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
haoKaiAutoConveyorDeviceDriver.writing(3);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
paintConveyorDeviceDriver.writing(3);
is_feedback = true;
}
}
}
JSONObject requestjo = new JSONObject();
if (is_feedback) {
requestjo.put("task_code",jobno);
requestjo.put("operation",action);
if (type.equals("entryRequired") || type.equals("EntryRequired")){
requestjo.put("entryRequired","true");
}else {
requestjo.put("pauseOnStation","true");
}
log.info("反馈AGV请求数据:{}", requestjo);
System.out.println("back agv:" + requestjo);
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
if (inst.getInstruction_type().equals("4")){
agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL2);
}
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact";
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(requestjo))
.timeout(20000)//超时,毫秒
.execute();
}
return requestjo.toString();
}
@Override
//ZDAGV
public HttpResponse markComplete(String code) throws Exception {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete";
log.info("关闭agv运单序列请求:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
//.body(String.valueOf(orderjo))//表单内容
.timeout(20000)//超时,毫秒
.execute();
log.info("关闭agv运单序列请求反馈:{}", result);
return result;
} else {
return null;
}
}
/**
* 返回一个点位操作子任务
*
* @param locationName 点位
* @param operation 点位操作
* @param propertiesType 子任务类型
* @param pro 子任务参数
* 调用demo:destination("sh15p", "Spin", "2", "3.14")
* demo:destination("cz14", "JackUnload", "3", "")
* @return
*/
//ZDAGV
public static JSONObject destination(String locationName, String operation, String propertiesType, String pro) {
//新增业务订单
JSONObject destinationOrder = new JSONObject();
//目标工作站
destinationOrder.put("locationName", locationName);
//机器人在工作站要执行的操作
destinationOrder.put("operation", operation);
if (propertiesType.equals("1")) {//取货前等待、取货后等待
//pro 1 进入离开等待
if ("1".equals(pro)) {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "True");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "True");
properties.add(pro2);
destinationOrder.put("properties", properties);
//进入等待 离开不等待
} else if ("2".equals(pro)) {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "True");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "False");
properties.add(pro2);
destinationOrder.put("properties", properties);
//进入不等待 离开等待
} else if ("3".equals(pro)) {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "False");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "True");
properties.add(pro2);
destinationOrder.put("properties", properties);
//不等待
} else {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "False");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "False");
properties.add(pro2);
destinationOrder.put("properties", properties);
}
} else if (propertiesType.equals("2")) {//Spin转动
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "global_spin_angle");//坐标系类型global_spin_angle为全局坐标系
pro1.put("value", pro);//弧度值如3.14
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "spin_direction");//固定值
pro2.put("value", "0");//弧度值如0
properties.add(pro2);
destinationOrder.put("properties", properties);
} else if (propertiesType.equals("3")) {//JackUnload,Jackload不操作
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "recognize");//固定值
pro1.put("value", "false");//固定值
properties.add(pro1);
destinationOrder.put("properties", properties);
} else if (propertiesType.equals("4")) {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "robot_spin_angle");//坐标系类型robot_spin_angle为机器人坐标系
pro1.put("value", pro);//弧度值如3.14
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "spin_direction");//固定值
pro2.put("value", "0");//弧度值如0
properties.add(pro2);
destinationOrder.put("properties", properties);
} else if (propertiesType.equals("5")) {//在该点进行等待
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "Wait");
pro1.put("value", "True");
properties.add(pro1);
destinationOrder.put("properties", properties);
}
return destinationOrder;
}
/**
* 获得之后num个天的时间
*
* @param num
* @return
*/
public static String getNextDay(int num) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, num);
Date date = calendar.getTime();
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
df.setTimeZone(tz);
String nowAsISO = df.format(date);
return nowAsISO;
}
}

View File

@@ -37,7 +37,7 @@ public enum DriverTypeEnum {
STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"),
LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "嘉耐-码垛机械手", "station"),
LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "嘉耐-音来码垛机械手", "station"),
LNSH_KILN_LANE(42, "lnsh_kiln_lane", "嘉耐-窑车道", "station"),

View File

@@ -1445,10 +1445,25 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
} else {
//西门子200
if (datatype.indexOf(".") == -1) {
datatype = "Byte";
} else {
datatype = "Boolean";
// if (datatype.indexOf(".") == -1) {
// datatype = "Byte";
// } else {
// datatype = "Boolean";
// }
//VW0 嘉耐smart200
String headtype = datatype.substring(1, 2);
if (headtype.startsWith("B")) {
if (headtype.contains(".")) {
datatype = "Boolean";
} else {
datatype = "Byte";
}
} else if (headtype.startsWith("W")) {
datatype = "Word";
} else if (headtype.startsWith("D")) {
datatype = "DWord";
} else if (headtype.startsWith("S")) {
datatype = "String";
}
}

View File

@@ -1,10 +1,10 @@
package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator;
import cn.hutool.core.util.ObjectUtil;
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 org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
import java.util.ArrayList;
import java.util.List;
@@ -15,18 +15,30 @@ public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_status = "status";
public static String item_move = "move";
public static String item_action = "action";
public static String item_ioaction = "ioaction";
public static String item_error = "error";
public static String item_put_station = "put_station";
public static String item_task = "task";
public static String item_weight = "weight";
public static String item_material = "material";
public static String item_encoder_qty = "encoder_qty";
public static String item_batch = "batch";
public static String item_barcode = "barcode";
public static String item_specifications = "specifications";
public static String item_batch = "batch";
public static String item_AlongSide = "AlongSide";
public static String item_BshortSide = "BshortSide";
public static String item_Htrapezoidal = "Htrapezoidal";
public static String item_Wthickness = "Wthickness";
public static String item_status = "status";
public static String item_unqualified_qty = "unqualified_qty";
public static String item_encoder_qty = "encoder_qty";
public static String item_order_No = "order_No";
public static String item_order_qty = "order_qty";
public static String item_to_feedback = "to_feedback";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_to_barcode = "to_barcode";
public static String item_to_error = "to_error";
public static String item_to_allow_pallet_qty = "to_allow_pallet_qty";
public static String item_to_material_type = "to_material_type";
@@ -35,6 +47,9 @@ public class ItemProtocol {
public static String item_to_product_code = "to_product_code";
public static String item_to_order_qty = "to_order_qty";
Boolean isonline;
private LnshPalletizingManipulatorDeviceDriver driver;
public ItemProtocol(LnshPalletizingManipulatorDeviceDriver driver) {
@@ -49,48 +64,96 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_mode);
}
public int getStatus() {
return this.getOpcIntegerValue(item_status);
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getIoAction() {
return this.getOpcIntegerValue(item_ioaction);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getPut_station() {
return this.getOpcIntegerValue(item_put_station);
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getWeight() {
return this.getOpcIntegerValue(item_weight);
}
public String getMaterial() {
return this.getOpcStringValue(item_material);
}
public int getEncoder_qty() {
return this.getOpcIntegerValue(item_encoder_qty);
}
public int getBatch() {
return this.getOpcIntegerValue(item_batch);
}
public int getOrder_qty() {
return this.getOpcIntegerValue(item_order_qty);
public int getBarcode() {
return this.getOpcIntegerValue(item_barcode);
}
public String getSpecifications() {
return this.getOpcStringValue(item_specifications);
}
public int getBatch() {
return this.getOpcIntegerValue(item_batch);
}
public int getAlongSide() {
return this.getOpcIntegerValue(item_AlongSide);
}
public int getBshortSide() {
return this.getOpcIntegerValue(item_BshortSide);
}
public int getHtrapezoidal() {
return this.getOpcIntegerValue(item_Htrapezoidal);
}
public int getWthickness() {
return this.getOpcIntegerValue(item_Wthickness);
}
public int getStatus() {
return this.getOpcIntegerValue(item_status);
}
public int getEncoder_qty() {
return this.getOpcIntegerValue(item_encoder_qty);
}
public int getUnqualified_qty() {
return this.getOpcIntegerValue(item_unqualified_qty);
}
public int getOrder_qty() {
return this.getOpcIntegerValue(item_order_qty);
}
public String getOrder_No() {
return this.getOpcStringValue(item_order_No);
}
public int getTo_feedback() {
return this.getOpcIntegerValue(item_to_feedback);
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getToTarget() {
return this.getOpcIntegerValue(item_to_target);
}
public int getToTask() {
return this.getOpcIntegerValue(item_to_task);
}
public int getTo_barcode() {
return this.getOpcIntegerValue(item_to_barcode);
}
public int getTo_error() {
@@ -105,8 +168,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_material_type);
}
public int getTo_material_code() {
return this.getOpcIntegerValue(item_to_material_code);
public String getTo_material_code() {
return this.getOpcStringValue(item_to_material_code);
}
public String getTo_order_No() {
@@ -121,7 +184,11 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_order_qty);
}
Boolean isonline;
//是否有货
public int hasGoods(int move) {
return move;
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
@@ -133,19 +200,7 @@ public class ItemProtocol {
return value;
}
return 0;
}
public Float getOpcFloatValue(String protocol) {
Float value = this.driver.getFloatValue(protocol);
if (ObjectUtil.isEmpty(value)) {
} else {
return value;
}
return 0.0f;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
@@ -153,36 +208,49 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return "";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB11010.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB11010.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_status, "设备状态", "DB11010.B2"));
list.add(new ItemDto(item_action, "动作", "DB11010.B3"));
list.add(new ItemDto(item_error, "故障代码", "DB11010.B4"));
list.add(new ItemDto(item_put_station, "当前码盘工位", "DB110.B5"));
list.add(new ItemDto(item_material, "码盘工位当前物料", "DB110.S6"));
list.add(new ItemDto(item_specifications, "规格", "DB110.S262"));
list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "DB110.D518"));
list.add(new ItemDto(item_batch, "批次", "DB110.D522"));
list.add(new ItemDto(item_order_qty, "当前工单数量", "DB110.D526"));
list.add(new ItemDto(item_order_No, "工单号", "DB110.S530"));
list.add(new ItemDto(item_heartbeat, "心跳", "VB0"));
list.add(new ItemDto(item_mode, "工作状态", "VB1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "VB2"));
list.add(new ItemDto(item_action, "取放信号", "VB3"));
list.add(new ItemDto(item_ioaction, "进出信号", "VB4"));
list.add(new ItemDto(item_error, "报警信号", "VB5"));
list.add(new ItemDto(item_task, "任务号", "VD6"));
list.add(new ItemDto(item_weight, "重量", "VD10"));
list.add(new ItemDto(item_batch, "批次", "VD14"));
list.add(new ItemDto(item_specifications, "规格", "VS18"));
list.add(new ItemDto(item_material, "物料", "VS68"));
list.add(new ItemDto(item_barcode, "条码", "VW118"));
list.add(new ItemDto(item_AlongSide, "A长边", "VW120"));
list.add(new ItemDto(item_BshortSide, "B短边", "VW122"));
list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "VW124"));
list.add(new ItemDto(item_Wthickness, "W厚度", "VW126"));
list.add(new ItemDto(item_status, "设备状态", "VB128"));
list.add(new ItemDto(item_unqualified_qty, "不合格数量", "VD130"));
list.add(new ItemDto(item_encoder_qty, "码盘位当前码盘数量", "VD134"));
list.add(new ItemDto(item_order_qty, "当前工单数量", "VD138"));
list.add(new ItemDto(item_order_No, "工单号", "VS142"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_feedback, "机器人动作反馈", "DB111.B0"));
list.add(new ItemDto(item_to_error, "故障代码", "DB111.B1"));
list.add(new ItemDto(item_to_allow_pallet_qty, "允许码垛数量", "DB111.W2"));
list.add(new ItemDto(item_to_material_type, "托盘类型", "DB111.D4"));
list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB111.D8"));
list.add(new ItemDto(item_to_order_qty, "下发工单数量", "DB111.D12"));
list.add(new ItemDto(item_to_product_code, "产品编号", "DB111.D16"));
list.add(new ItemDto(item_to_order_No, "工单号", "DB111.S20"));
list.add(new ItemDto(item_to_command, "作业命令", "VW1000", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "VW1002"));
list.add(new ItemDto(item_to_task, "任务号", "VD1004"));
list.add(new ItemDto(item_to_barcode, "条码", "VW1008"));
list.add(new ItemDto(item_to_error, "故障代码", "VB1010"));
list.add(new ItemDto(item_to_allow_pallet_qty, "允许码垛数量", "VW1012"));
list.add(new ItemDto(item_to_material_type, "托盘类型", "VD1014"));
// list.add(new ItemDto(item_to_material_code, "下发物料编号", "VD272"));
list.add(new ItemDto(item_to_order_qty, "下发工单数量", "VD1018"));
list.add(new ItemDto(item_to_product_code, "产品编号", "VD1022"));
list.add(new ItemDto(item_to_order_No, "工单号", "VS1026"));
list.add(new ItemDto(item_to_material_code, "下发物料编号", "VS1076"));
return list;
}

View File

@@ -12,7 +12,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 嘉耐码垛机械手
* 嘉耐音来码垛机械手
*
*/
@Service
@@ -24,12 +24,12 @@ public class LnshPalletizingManipulatorDefination implements OpcDeviceDriverDefi
@Override
public String getDriverName() {
return "嘉耐-码垛机械手";
return "嘉耐-音来码垛机械手";
}
@Override
public String getDriverDescription() {
return "嘉耐-码垛机械手";
return "嘉耐-音来码垛机械手";
}
@Override
@@ -57,18 +57,27 @@ public class LnshPalletizingManipulatorDefination implements OpcDeviceDriverDefi
public static List<ItemDto> getReadableItemDtos2() {
ArrayList list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB110.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB110.B1", Boolean.valueOf(true)));
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB110.B2"));
list.add(new ItemDto(ItemProtocol.item_action, "动作", "DB110.B3"));
list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB110.B4"));
list.add(new ItemDto(ItemProtocol.item_put_station, "当前码盘工位", "DB110.B5"));
list.add(new ItemDto(ItemProtocol.item_material, "码盘工位当前物料", "DB110.S6"));
list.add(new ItemDto(ItemProtocol.item_specifications, "规格", "DB110.S262"));
list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB110.D518"));
list.add(new ItemDto(ItemProtocol.item_batch, "批次", "DB110.D522"));
list.add(new ItemDto(ItemProtocol.item_order_qty, "当前工单数量", "DB110.D526"));
list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB110.S530"));
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "VB0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "VB1", Boolean.valueOf(true)));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "VB2"));
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "VB3"));
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "VB4"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "VB5"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "VD6"));
list.add(new ItemDto(ItemProtocol.item_weight, "重量", "VD10"));
list.add(new ItemDto(ItemProtocol.item_batch, "批次", "VD14"));
list.add(new ItemDto(ItemProtocol.item_specifications, "规格", "VS18"));
list.add(new ItemDto(ItemProtocol.item_material, "物料", "VS68"));
list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "VW118"));
list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "VW120"));
list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "VW122"));
list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "VW124"));
list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "VW126"));
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "VB128"));
list.add(new ItemDto(ItemProtocol.item_unqualified_qty, "不合格数量", "VD130"));
list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "VD134"));
list.add(new ItemDto(ItemProtocol.item_order_qty, "当前工单数量", "VD138"));
list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "VS142"));
return list;
}

View File

@@ -19,8 +19,6 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.route.service.RouteLineService;
@@ -29,10 +27,13 @@ import org.nl.utils.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 嘉耐码垛机械手
* 嘉耐-音来码垛机械手
*/
@Slf4j
@Data
@@ -53,59 +54,85 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl");
@Autowired
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
String device_code;
int mode = 0;
int error = 0;
int action = 0;
int last_action = 0;
int move = 0;
int action;
int io_action;
int task = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
int last_action = 0;
int last_ioaction = 0;
Boolean isonline = true;
int hasGoods = 0;
String message = null;
Boolean iserror = false;
protected int instruction_num = 0;
protected int instruction_num_truth = 0;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private int instruction_require_time_out;
private int instruction_require_time_out = 3000;
boolean requireSucess = false;
private int instruction_finished_time_out;
int heartbeat;
int last_heartbeat;
private Date checkHeartbeattime = new Date();
private Date last_checkHeartbeattime = new Date();
int branchProtocol = 0;
//当前指令
Instruction inst = null;
//上次指令
Instruction last_inst = null;
float a = 0f;
float b = 0f;
//触摸屏手动触发任务
private Boolean is_has_task = false;
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
String device_code;
int status = 0;
int last_status = 0;
int put_station = 0;
int last_put_station = 0;
//批次
String message;
int weight = 0;
int last_weight = 0;
String material;
String last_material;
int barcode = 0;
int last_barcode = 0;
String specifications = "";
String last_specifications = "";
int AlongSide = 0;
int last_AlongSide = 0;
int BshortSide = 0;
int last_BshortSide = 0;
int Htrapezoidal = 0;
int last_Htrapezoidal = 0;
int Wthickness = 0;
int last_Wthickness = 0;
int batch = 0;
int last_batch = 0;
int status = 0;
int last_status = 0;
int unqualified_qty = 0;
int last_unqualified_qty = 0;
int encoder_qty = 0;
int last_encoder_qty = 0;
int order_qty = 0;
int last_order_qty = 0;
String order_No = "";
String last_order_No = "";
//规格
String specifications = "";
String last_specifications = "";
String material;
String last_material;
int encoder_qty = 0;
int last_encoder_qty = 0;
@Override
public Device getDevice() {
@@ -114,58 +141,101 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
@Override
public void execute() {
public void execute() throws Exception {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
status = this.itemProtocol.getStatus();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
put_station = this.itemProtocol.getPut_station();
move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
io_action = this.itemProtocol.getIoAction();
action = this.itemProtocol.getAction();
weight = this.itemProtocol.getWeight();
material = this.itemProtocol.getMaterial();
encoder_qty = this.itemProtocol.getEncoder_qty();
barcode = this.itemProtocol.getBarcode();
batch = this.itemProtocol.getBatch();
specifications = this.itemProtocol.getSpecifications();
AlongSide = this.itemProtocol.getAlongSide();
BshortSide = this.itemProtocol.getBshortSide();
Htrapezoidal = this.itemProtocol.getHtrapezoidal();
Wthickness = this.itemProtocol.getWthickness();
order_qty = this.itemProtocol.getOrder_qty();
order_No = this.itemProtocol.getOrder_No();
encoder_qty = this.itemProtocol.getEncoder_qty();
status = this.itemProtocol.getStatus();
unqualified_qty = this.itemProtocol.getUnqualified_qty();
if (mode != last_mode) {
this.setRequireSucess(false);
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code,"","","信号mode" + last_mode + "->" + mode);
}
if (status != last_status) {
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
logServer.deviceExecuteLog(this.device_code,"","","信号status" + last_status + "->" + status);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code,"action" ,String.valueOf(action));
logServer.deviceExecuteLog(this.device_code,"","","信号action" + last_action + "->" + action);
if (move != last_move) {
logServer.deviceItemValue(this.device_code,"move" ,String.valueOf(move));
logServer.deviceExecuteLog(this.device_code,"","","信号move" + last_move + "->" + move);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error));
logServer.deviceExecuteLog(this.device_code,"","","信号error" + last_error + "->" + error);
}
if (put_station != last_put_station) {
logServer.deviceItemValue(this.device_code,"put_station" ,String.valueOf(put_station));
logServer.deviceExecuteLog(this.device_code,"","","信号put_station" + last_put_station + "->" + put_station);
if (task != last_task) {
logServer.deviceItemValue(this.device_code,"task",String.valueOf(task));
logServer.deviceExecuteLog(this.device_code,"","","信号task" + last_task + "->" + task);
}
if (encoder_qty != last_encoder_qty) {
logServer.deviceItemValue(this.device_code,"encoder_qty" ,String.valueOf(encoder_qty));
logServer.deviceExecuteLog(this.device_code,"","","信号encoder_qty" + last_encoder_qty + "->" + encoder_qty);
if (action != last_action) {
logServer.deviceItemValue(this.device_code,"action",String.valueOf(action));
logServer.deviceExecuteLog(this.device_code,"","","信号action" + last_action + "->" + action);
}
if (io_action != last_ioaction) {
logServer.deviceItemValue(this.device_code,"io_action",String.valueOf(io_action));
logServer.deviceExecuteLog(this.device_code,"","","信号io_action: " + last_ioaction + "->" + io_action);
}
if (weight != last_weight) {
logServer.deviceItemValue(this.device_code,"weight",String.valueOf(weight));
logServer.deviceExecuteLog(this.device_code,"","","信号weight: " + last_weight + "->" + weight);
}
if (batch != last_batch) {
logServer.deviceItemValue(this.device_code,"batch" ,String.valueOf(batch));
logServer.deviceExecuteLog(this.device_code,"","","信号batch" + last_batch + "->" + batch);
logServer.deviceItemValue(this.device_code,"batch",String.valueOf(batch));
logServer.deviceExecuteLog(this.device_code,"","","信号batch: " + last_batch + "->" + batch);
}
if (!StrUtil.equals(material,last_material)) {
logServer.deviceItemValue(this.device_code,"material", material);
logServer.deviceExecuteLog(this.device_code,"","","信号material" + last_material + "->" + material);
}
if (barcode != last_barcode) {
logServer.deviceItemValue(this.device_code,"barcode", String.valueOf(barcode));
logServer.deviceExecuteLog(this.device_code,"","","信号barcode" + last_barcode + "->" + barcode);
}
if (!StrUtil.equals(specifications,last_specifications)) {
logServer.deviceItemValue(this.device_code,"specifications", specifications);
logServer.deviceExecuteLog(this.device_code,"","","信号specifications" + last_specifications + "->" + specifications);
}
if (!StrUtil.equals(material,last_material)) {
logServer.deviceItemValue(this.device_code,"material", material);
logServer.deviceExecuteLog(this.device_code,"","","信号material" + last_material + "->" + material);
if (AlongSide != last_AlongSide) {
logServer.deviceItemValue(this.device_code,"AlongSide",String.valueOf(AlongSide));
logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide: " + last_AlongSide + "->" + AlongSide);
}
if (BshortSide != last_BshortSide) {
logServer.deviceItemValue(this.device_code,"BshortSide",String.valueOf(BshortSide));
logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide: " + last_BshortSide + "->" + BshortSide);
}
if (Htrapezoidal != last_Htrapezoidal) {
logServer.deviceItemValue(this.device_code,"Htrapezoidal",String.valueOf(Htrapezoidal));
logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal: " + last_Htrapezoidal + "->" + Htrapezoidal);
}
if (Wthickness != last_Wthickness) {
logServer.deviceItemValue(this.device_code,"Wthickness",String.valueOf(Wthickness));
logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness: " + last_Wthickness + "->" + Wthickness);
}
if (status != last_status) {
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
logServer.deviceExecuteLog(this.device_code,"","","信号status" + last_status + "->" + status);
}
if (encoder_qty != last_encoder_qty) {
logServer.deviceItemValue(this.device_code,"encoder_qty" ,String.valueOf(encoder_qty));
logServer.deviceExecuteLog(this.device_code,"","","信号encoder_qty" + last_encoder_qty + "->" + encoder_qty);
}
if (!StrUtil.equals(order_No,last_order_No)) {
logServer.deviceItemValue(this.device_code,"order_No", order_No);
@@ -175,12 +245,20 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
logServer.deviceItemValue(this.device_code,"order_qty" ,String.valueOf(order_qty));
logServer.deviceExecuteLog(this.device_code,"","","信号order_qty" + last_order_qty + "->" + order_qty);
}
if (unqualified_qty != last_unqualified_qty) {
logServer.deviceItemValue(this.device_code,"unqualified_qty" ,String.valueOf(unqualified_qty));
logServer.deviceExecuteLog(this.device_code,"","","信号unqualified_qty" + last_unqualified_qty + "->" + unqualified_qty);
}
} catch (Exception var17) {
return;
}
if (!this.itemProtocol.getIsonline()) {
//急停
if (this.isStop()) {
//未在线无心跳
} else if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false);
this.setIserror(true);
message = "信号量同步异常";
@@ -204,10 +282,8 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
return;
case 2:
break;
case 3:
case 2:
break;
case 4:
//排产单确认
@@ -221,22 +297,28 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
enterProduction(json);
}
break;
case 5:
//申请空盘
if (!requireSucess && this.move == 0) {
applyEmpty();
}
break;
case 6:
//码垛完成
if (!requireSucess && put_station>0 ) {
palletizing();
//申请入库
if (!requireSucess && this.move != 0) {
putStorage();
}
break;
case 7:
//码垛强制完成
//码垛完成
if (!requireSucess) {
mandatoryPalletizing();
palletizing();
}
break;
case 8:
//申请空盘
//码垛强制完成
if (!requireSucess) {
applyEmpty();
mandatoryPalletizing();
}
break;
case 9:
@@ -251,40 +333,58 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
enterProduction(json);
}
break;
}
switch (flag) {
//取货完成
case 1:
writing(2);
return;
//货完成
case 2:
writing(3);
return;
//请求取货
// case 1:
// writing(12);
// return;
// //货完成
// case 2:
// writing(10);
// return;
// //请求放货
// case 3:
// writing(13);
// return;
// //放货完成
// case 4:
// writing(11);
// return;
}
}
last_mode = mode;
last_status = status;
last_action = action;
last_error = error;
last_put_station = put_station;
last_move = move;
last_task = task;
last_action = action;
last_ioaction = io_action;
last_weight = weight;
last_material = material;
last_encoder_qty = encoder_qty;
last_batch = batch;
last_barcode = barcode;
last_specifications = specifications;
last_batch = batch;
last_AlongSide = AlongSide;
last_BshortSide = BshortSide;
last_Htrapezoidal = Htrapezoidal;
last_Wthickness = Wthickness;
last_order_No = order_No;
last_order_qty = order_qty;
last_encoder_qty = encoder_qty;
last_status = status;
last_unqualified_qty = unqualified_qty;
}
/**
* 获取托盘信息
* 申请空盘
*
* @param
*/
public synchronized boolean getVehicle() {
public synchronized boolean applyEmpty() {
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);
@@ -293,19 +393,16 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
JSONObject jo = acsToWmsService.getVehicle(json);
if (jo.getInteger("status") == 200) {
JSONObject content = jo.getJSONObject("content");
String qty = content.getString("qty");
String material_code = content.getString("material_code");
String material_name = content.getString("material_name");
this.writing(this.mode);
this.writing("to_materialQty",qty);
this.writing("to_material_code",material_code);
}
requireSucess = true;
json.put("type","4");
// json.put("vehicle_code",barcode);
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
}
return true;
}
}
@@ -354,15 +451,16 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
// String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
// String demosub = linkobj.substring(1,linkobj.length()-1);
// String demoArray[] = demosub.split(",");
// List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",this.device_code);
json.put("material_code",material);
json.put("qty",encoder_qty);
json.put("batch",batch);
json.put("producetask_code",order_No);
json.put("unqualified_qty",unqualified_qty);
json.put("is_full","1");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
@@ -389,17 +487,17 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
// String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
// String demosub = linkobj.substring(1,linkobj.length()-1);
// String demoArray[] = demosub.split(",");
// List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",this.device_code);
json.put("material_code",material);
json.put("qty",encoder_qty);
json.put("unqualified_qty",unqualified_qty);
json.put("batch",batch);
json.put("producetask_code",order_No);
json.put("is_full","1");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -413,11 +511,11 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
}
/**
* 申请空盘
* 申请入库
*
* @param
*/
public synchronized boolean applyEmpty() {
public synchronized boolean putStorage() {
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);
@@ -425,13 +523,13 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("type","4");
json.put("device_code",this.device_code);
json.put("type","1");
json.put("material_code",material);
// json.put("vehicle_code",barcode);
json.put("qty",encoder_qty);
json.put("unqualified_qty",unqualified_qty);
json.put("is_full","1");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -444,6 +542,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
}
}
public boolean exe_error() {
if (this.error == 0) {
return true;
@@ -457,6 +558,58 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
return true;
}
protected void executing(Instruction instruction) {
this.executing(1, instruction, "");
}
public void executing(int command, Instruction instruction, String appendMessage) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_task;
if (appendMessage == null) {
appendMessage = "";
}
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
}
public void writing(int type, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
} else if (type == 2) {
itemMap.put(to_target, command);
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
@@ -464,55 +617,62 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
// itemMap.put(to_param, Integer.parseInt(value));
ReadUtil.write(itemMap, server);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
}
public synchronized void OpenOrClose(String type) {
//进入区域
if ("1".equals(type)) {
writing(5);
} else {
//离开区域
writing(6);
}
}
public String toString() {
return "";
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String status = "";
String action = "";
String io_action = "";
String move = "";
String status = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "工作中";
} else if (this.getMode() == 4) {
mode = "获取托盘信息";
mode = "人工排产确认";
} else if (this.getMode() == 5) {
mode = "码垛完成";
} else if (this.getMode() == 6) {
mode = "码垛强制完成";
} else if (this.getMode() == 7) {
mode = "申请空盘";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
} else if (this.getMode() == 6) {
mode = "申请入库";
} else if (this.getMode() == 7) {
mode = "码垛完成";
} else if (this.getMode() == 8) {
mode = "码垛强制完成";
} else if (this.getMode() == 9) {
mode = "工单完成";
}
if (this.getAction() == 0) {
@@ -524,20 +684,54 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else if (this.getAction() == 3) {
action = "允许取放";
}
if (this.getIo_action() == 0) {
io_action = "禁止进出";
} else if (this.getIo_action() == 1) {
io_action = "允许进入";
} else if (this.getIo_action() == 2) {
io_action = "允许离开";
} else if (this.getIo_action() == 3) {
io_action = "允许进出";
}
if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
} else if (this.getStatus() == 3) {
status = "故障";
}
if (this.getMove() == 0) {
move = "无货";
} else if (this.getMove() == 1) {
move = "有货";
} else if (this.getMove() == 2) {
move = "有托盘有货";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("move", move);
jo.put("action", action);
jo.put("status", status);
jo.put("io_action", io_action);
jo.put("hasGoods", this.getHasGoods());
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("put_station", this.getPut_station());
jo.put("material", this.getMaterial());
jo.put("encoder_qty", this.getEncoder_qty());
jo.put("specifications", this.getSpecifications());
jo.put("batch", this.getBatch());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("task", this.getTask());
jo.put("weight", this.getWeight());
jo.put("material", this.getMaterial());
jo.put("barcode", this.getBarcode());
jo.put("specifications", this.getSpecifications());
jo.put("AlongSide", this.getAlongSide());
jo.put("BshortSide", this.getBshortSide());
jo.put("Htrapezoidal", this.getHtrapezoidal());
jo.put("Wthickness", this.getWthickness());
jo.put("batch", this.getBatch());
jo.put("order_No", this.getOrder_No());
jo.put("order_qty", this.getOrder_qty());
return jo;
}
@@ -545,18 +739,4 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
public void setDeviceStatus(JSONObject data) {
}
// public void writing(int type, int command) {
// String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
// + "." + ItemProtocol.item_to_material_code;
// String opcservcerid = this.getDevice().getOpc_server_id();
// Server server = ReadUtil.getServer(opcservcerid);
// Map<String, Object> itemMap = new HashMap<String, Object>();
// if (type == 2) {
// itemMap.put(to_material_code, command);
// }
// ReadUtil.write(itemMap, server);
//
// }
}

View File

@@ -608,17 +608,24 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletizingManipulatorDeviceDriver.getMode());
jo.put("status", lnshPalletizingManipulatorDeviceDriver.getStatus());
jo.put("move", lnshPalletizingManipulatorDeviceDriver.getMove());
jo.put("action", lnshPalletizingManipulatorDeviceDriver.getAction());
jo.put("io_action", lnshPalletizingManipulatorDeviceDriver.getIo_action());
jo.put("hasGoods", lnshPalletizingManipulatorDeviceDriver.getHasGoods());
jo.put("isOnline", lnshPalletizingManipulatorDeviceDriver.getIsonline());
jo.put("error", lnshPalletizingManipulatorDeviceDriver.getError());
jo.put("put_station", lnshPalletizingManipulatorDeviceDriver.getPut_station());
jo.put("material", lnshPalletizingManipulatorDeviceDriver.getMaterial());
jo.put("encoder_qty", lnshPalletizingManipulatorDeviceDriver.getEncoder_qty());
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("isError", lnshPalletizingManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPalletizingManipulatorDeviceDriver.getMessage());
jo.put("task", lnshPalletizingManipulatorDeviceDriver.getTask());
jo.put("weight", lnshPalletizingManipulatorDeviceDriver.getWeight());
jo.put("material", lnshPalletizingManipulatorDeviceDriver.getMaterial());
jo.put("barcode", lnshPalletizingManipulatorDeviceDriver.getBarcode());
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("AlongSide", lnshPalletizingManipulatorDeviceDriver.getAlongSide());
jo.put("BshortSide", lnshPalletizingManipulatorDeviceDriver.getBshortSide());
jo.put("Htrapezoidal", lnshPalletizingManipulatorDeviceDriver.getHtrapezoidal());
jo.put("Wthickness", lnshPalletizingManipulatorDeviceDriver.getWthickness());
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
@@ -856,17 +863,24 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletizingManipulatorDeviceDriver.getMode());
jo.put("status", lnshPalletizingManipulatorDeviceDriver.getStatus());
jo.put("move", lnshPalletizingManipulatorDeviceDriver.getMove());
jo.put("action", lnshPalletizingManipulatorDeviceDriver.getAction());
jo.put("io_action", lnshPalletizingManipulatorDeviceDriver.getIo_action());
jo.put("hasGoods", lnshPalletizingManipulatorDeviceDriver.getHasGoods());
jo.put("isOnline", lnshPalletizingManipulatorDeviceDriver.getIsonline());
jo.put("error", lnshPalletizingManipulatorDeviceDriver.getError());
jo.put("put_station", lnshPalletizingManipulatorDeviceDriver.getPut_station());
jo.put("material", lnshPalletizingManipulatorDeviceDriver.getMaterial());
jo.put("encoder_qty", lnshPalletizingManipulatorDeviceDriver.getEncoder_qty());
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("isError", lnshPalletizingManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPalletizingManipulatorDeviceDriver.getMessage());
jo.put("task", lnshPalletizingManipulatorDeviceDriver.getTask());
jo.put("weight", lnshPalletizingManipulatorDeviceDriver.getWeight());
jo.put("material", lnshPalletizingManipulatorDeviceDriver.getMaterial());
jo.put("barcode", lnshPalletizingManipulatorDeviceDriver.getBarcode());
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("AlongSide", lnshPalletizingManipulatorDeviceDriver.getAlongSide());
jo.put("BshortSide", lnshPalletizingManipulatorDeviceDriver.getBshortSide());
jo.put("Htrapezoidal", lnshPalletizingManipulatorDeviceDriver.getHtrapezoidal());
jo.put("Wthickness", lnshPalletizingManipulatorDeviceDriver.getWthickness());
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());

View File

@@ -657,11 +657,15 @@ public class StageServiceImpl implements StageService {
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 4) {
mode = "叫料";
mode = "工单确认";
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 5) {
mode = "申请空盘";
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 6) {
mode = "申请入库";
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 7) {
mode = "码垛完成";
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 8) {
mode = "码垛强制完成";
} else if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 9) {
mode = "工单完成";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 0) {
@@ -718,24 +722,16 @@ public class StageServiceImpl implements StageService {
mode = "单机";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 3) {
mode = "工作中";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 4) {
mode = "获取托盘信息";
mode = "工单确认";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 5) {
mode = "码垛完成";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 6) {
mode = "码垛强制完成";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 7) {
mode = "申请空盘";
}
if (lnshPalletizingManipulatorDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshPalletizingManipulatorDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshPalletizingManipulatorDeviceDriver.getStatus() == 3) {
status = "故障";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 7) {
mode = "码垛完成";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 8) {
mode = "码垛强制完成";
} else if (lnshPalletizingManipulatorDeviceDriver.getMode() == 9) {
mode = "工单完成";
}
if (lnshPalletizingManipulatorDeviceDriver.getAction() == 0) {
@@ -747,20 +743,43 @@ public class StageServiceImpl implements StageService {
} else if (lnshPalletizingManipulatorDeviceDriver.getAction() == 3) {
action = "允许取放";
}
if (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 0) {
io_action = "禁止进出";
} else if (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1) {
io_action = "允许进入";
} else if (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2) {
io_action = "允许离开";
} else if (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3) {
io_action = "允许进出";
}
if (lnshPalletizingManipulatorDeviceDriver.getMove() == 0) {
move = "无货";
} else if (lnshPalletizingManipulatorDeviceDriver.getMove() == 1) {
move = "有货";
} else if (lnshPalletizingManipulatorDeviceDriver.getMove() == 2) {
move = "有托盘有货";
}
obj.put("device_name", lnshPalletizingManipulatorDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("move", move);
jo.put("action", action);
jo.put("io_action", io_action);
jo.put("hasGoods", lnshPalletizingManipulatorDeviceDriver.getHasGoods());
jo.put("isOnline", lnshPalletizingManipulatorDeviceDriver.getIsonline());
jo.put("error", lnshPalletizingManipulatorDeviceDriver.getError());
jo.put("put_station", lnshPalletizingManipulatorDeviceDriver.getPut_station());
jo.put("material", lnshPalletizingManipulatorDeviceDriver.getMaterial());
jo.put("encoder_qty", lnshPalletizingManipulatorDeviceDriver.getEncoder_qty());
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
jo.put("isError", lnshPalletizingManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPalletizingManipulatorDeviceDriver.getMessage());
jo.put("task", lnshPalletizingManipulatorDeviceDriver.getTask());
jo.put("weight", lnshPalletizingManipulatorDeviceDriver.getWeight());
jo.put("material", lnshPalletizingManipulatorDeviceDriver.getMaterial());
jo.put("barcode", lnshPalletizingManipulatorDeviceDriver.getBarcode());
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("AlongSide", lnshPalletizingManipulatorDeviceDriver.getAlongSide());
jo.put("BshortSide", lnshPalletizingManipulatorDeviceDriver.getBshortSide());
jo.put("Htrapezoidal", lnshPalletizingManipulatorDeviceDriver.getHtrapezoidal());
jo.put("Wthickness", lnshPalletizingManipulatorDeviceDriver.getWthickness());
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
if (lnshKilnLaneDeviceDriver.getMode() == 0) {

View File

@@ -174,5 +174,8 @@ https://juejin.cn/post/6844903775631572999
<logger name="org.openscada.opc.lib.da.Server" level="ERROR" additivity="false">
<appender-ref ref="lokiAppender" />
</logger>
<logger name="org.jinterop" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
</springProfile>
</configuration>