add 布料机反馈重量和泥料 rev写入方法修改
This commit is contained in:
@@ -37,6 +37,21 @@ public interface DeviceDriver {
|
||||
}
|
||||
return devicesList;
|
||||
}
|
||||
//关联设备字符串数组数据转换成集合
|
||||
default List<String> getExtraDeviceCodes1(String extraName) {
|
||||
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
|
||||
if (StrUtil.isEmpty(extraValue)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String devicesString = extraValue.substring(0, extraValue.length());
|
||||
List<String> devicesList = new ArrayList<>();
|
||||
String[] devices = devicesString.split(",");
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
String s = devices[i].replace("\"", "").replace("\"", "");
|
||||
devicesList.add(s);
|
||||
}
|
||||
return devicesList;
|
||||
}
|
||||
|
||||
default String getModeName(String mode){
|
||||
if(StrUtil.equals("0",mode)){
|
||||
|
||||
@@ -46,8 +46,9 @@ public enum RequestMethodEnum {
|
||||
|
||||
apply_get_put_station(18, "apply_get_put_station", "反馈当前抓取放置位","0"),
|
||||
|
||||
press_request_material(19, "pressRequestMaterial", "压机叫料","0");
|
||||
press_request_material(19, "pressRequestMaterial", "压机叫料","0"),
|
||||
|
||||
apply_one_cloth(20, "apply_one_cloth", "布料机反馈重量和泥料","0");
|
||||
|
||||
|
||||
//驱动索引
|
||||
|
||||
@@ -236,8 +236,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 1)) {
|
||||
inst.setExecute_status("1");
|
||||
instructionService.update(inst);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(2);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",2);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(map);
|
||||
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command()==2){
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}else {
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(2);
|
||||
}
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
} else {
|
||||
@@ -272,7 +278,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshStationDeviceDriver.getAction() == 3 || lnshStationDeviceDriver.getAction() == 1)){
|
||||
inst.setExecute_status("1");
|
||||
instructionService.update(inst);
|
||||
lnshStationDeviceDriver.writing(2);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",2);
|
||||
lnshStationDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshStationDeviceDriver.setMessage("");
|
||||
flag=true;
|
||||
@@ -365,7 +373,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
) {
|
||||
inst.setExecute_status("1");
|
||||
instructionService.update(inst);
|
||||
conveyorBarcodeDeviceDriver.writing(2);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",2);
|
||||
conveyorBarcodeDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
conveyorBarcodeDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -395,7 +405,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// && (lnshFoldDiscSiteDeviceDriver.getAction() == 3 || lnshFoldDiscSiteDeviceDriver.getAction() == 1)
|
||||
inst.setExecute_status("1");
|
||||
instructionService.update(inst);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(2);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",2);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshFoldDiscSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -498,9 +510,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2)
|
||||
) {
|
||||
inst.setExecute_status("5");
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(3);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",3);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(map);
|
||||
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command()==3){
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}else {
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(3);
|
||||
}
|
||||
instructionService.update(inst);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
} else {
|
||||
@@ -532,7 +550,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
) {
|
||||
inst.setExecute_status("5");
|
||||
instructionService.update(inst);
|
||||
lnshStationDeviceDriver.writing(3);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",3);
|
||||
lnshStationDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshStationDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -613,7 +633,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
|
||||
if (conveyorBarcodeDeviceDriver.getMode() != 0) {
|
||||
inst.setExecute_status("5");
|
||||
conveyorBarcodeDeviceDriver.writing(3);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",3);
|
||||
conveyorBarcodeDeviceDriver.writing(map);
|
||||
instructionService.update(inst);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
conveyorBarcodeDeviceDriver.setMessage("");
|
||||
@@ -643,7 +665,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// && (lnshFoldDiscSiteDeviceDriver.getIo_action() == 3 || lnshFoldDiscSiteDeviceDriver.getIo_action() == 2)
|
||||
) {
|
||||
inst.setExecute_status("5");
|
||||
lnshFoldDiscSiteDeviceDriver.writing(3);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",3);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(map);
|
||||
instructionService.update(inst);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshFoldDiscSiteDeviceDriver.setMessage("");
|
||||
@@ -762,8 +786,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 2 || lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 3)) {
|
||||
inst.setExecute_status("3");
|
||||
instructionService.update(inst);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(4);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",4);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(map);
|
||||
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command()==4){
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}else {
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(4);
|
||||
}
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
} else {
|
||||
@@ -798,7 +828,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshStationDeviceDriver.getAction() == 2 || lnshStationDeviceDriver.getAction() == 3)) {
|
||||
inst.setExecute_status("3");
|
||||
instructionService.update(inst);
|
||||
lnshStationDeviceDriver.writing(4);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",4);
|
||||
lnshStationDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshStationDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -886,7 +918,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (conveyorBarcodeDeviceDriver.getMode() == 2&& conveyorBarcodeDeviceDriver.getMove()==0){
|
||||
inst.setExecute_status("3");
|
||||
instructionService.update(inst);
|
||||
conveyorBarcodeDeviceDriver.writing(4);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",4);
|
||||
conveyorBarcodeDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
conveyorBarcodeDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -917,7 +951,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
) {
|
||||
inst.setExecute_status("3");
|
||||
instructionService.update(inst);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(4);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",4);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshFoldDiscSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -1016,8 +1052,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3)) {
|
||||
inst.setExecute_status("6");
|
||||
instructionService.update(inst);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(5);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",5);
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(map);
|
||||
if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command()==5){
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}else {
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.writing(5);
|
||||
}
|
||||
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
} else {
|
||||
@@ -1048,7 +1090,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
&& (lnshStationDeviceDriver.getIo_action() == 2 || lnshStationDeviceDriver.getIo_action() == 3)) {
|
||||
inst.setExecute_status("6");
|
||||
instructionService.update(inst);
|
||||
lnshStationDeviceDriver.writing(5);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",5);
|
||||
lnshStationDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshStationDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
@@ -1146,7 +1190,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if(ObjectUtil.isNotEmpty(inst.getVehicle_code())){
|
||||
conveyorBarcodeDeviceDriver.writing("to_barcode",inst.getVehicle_code());
|
||||
}
|
||||
conveyorBarcodeDeviceDriver.writing(5);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",5);
|
||||
conveyorBarcodeDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
TaskDto task=taskService.findByCode(inst.getTask_code());
|
||||
String material=task.getDirection();
|
||||
@@ -1179,7 +1225,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
) {
|
||||
inst.setExecute_status("6");
|
||||
instructionService.update(inst);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(5);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",5);
|
||||
lnshFoldDiscSiteDeviceDriver.writing(map);
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
lnshFoldDiscSiteDeviceDriver.setMessage("");
|
||||
flag = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.driver;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jinterop.dcom.common.JIException;
|
||||
import org.nl.acs.opc.*;
|
||||
@@ -104,7 +105,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
|
||||
while(var24.hasNext()) {
|
||||
String itemString = (String)var24.next();
|
||||
if (!ObjectUtl.isEquals(itemValues.get(itemString), JsonUtl.parse(read.get(itemString)))) {
|
||||
if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) {
|
||||
check = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ public class ConveyorPressStationDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
String last_material=null;
|
||||
int barcode=0;
|
||||
int last_barcode=0;
|
||||
String to_mix_num=null;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -148,6 +149,7 @@ public class ConveyorPressStationDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
weight = this.itemProtocol.getWeight();
|
||||
material = this.itemProtocol.getMaterial();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
to_mix_num=this.itemProtocol.getToMixNum();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
@@ -727,6 +729,7 @@ public class ConveyorPressStationDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
if(StrUtil.equals(resp.getIs_standing_finish(),"1")){
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
map.put("to_mix_num",resp.getMudBatch());
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求成功" + resp.getMessage();
|
||||
|
||||
@@ -95,8 +95,8 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_barcode);
|
||||
}
|
||||
|
||||
public int getToMixNum() {
|
||||
return this.getOpcIntegerValue(item_to_mix_num);
|
||||
public String getToMixNum() {
|
||||
return this.getOpcStringValue(item_to_mix_num);
|
||||
}
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_material_distribution;
|
||||
|
||||
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_status = "status";
|
||||
public static String item_error = "error";
|
||||
public static String item_action = "action";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_slip = "slip";
|
||||
public static String item_set_weight = "set_weight";
|
||||
public static String item_weight = "weight";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_error = "to_error";
|
||||
public static String item_to_slip = "to_slip";
|
||||
private LnshMaterialDistributionDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(LnshMaterialDistributionDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return this.getOpcIntegerValue(item_status);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public String getOpen_time() {
|
||||
return this.getOpcStringValue(item_open_time);
|
||||
}
|
||||
|
||||
public int getStandby_time() {
|
||||
return this.getOpcIntegerValue(item_standby_time);
|
||||
}
|
||||
|
||||
public int getProduction_time() {
|
||||
return this.getOpcIntegerValue(item_production_time);
|
||||
}
|
||||
|
||||
public int getError_time() {
|
||||
return this.getOpcIntegerValue(item_error_time);
|
||||
}
|
||||
|
||||
public String getSlip() { return this.getOpcStringValue(item_slip); }
|
||||
|
||||
public Float getSetWeight() { return this.getFloatValue(item_set_weight); }
|
||||
|
||||
public Float getWeight() { return this.getFloatValue(item_weight); }
|
||||
|
||||
public int getTo_command() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getTo_error() {
|
||||
return this.getOpcIntegerValue(item_to_error);
|
||||
}
|
||||
|
||||
public int getTo_slip() {
|
||||
return this.getOpcIntegerValue(item_to_slip);
|
||||
}
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Float getFloatValue(String protocol) {
|
||||
Float value = this.driver.getFloatValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error("读取错误!");
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB200.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB200.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB200.B2"));
|
||||
list.add(new ItemDto(item_action, "动作", "DB200.B3"));
|
||||
list.add(new ItemDto(item_error, "故障", "DB200.B4"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB200.STRING6.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB200.D58"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB200.D62"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB200.D66"));
|
||||
list.add(new ItemDto(item_slip, "泥料批次", "DB200.STRING70.50"));
|
||||
list.add(new ItemDto(item_set_weight, "设定重量", "DB200.REAL122"));
|
||||
list.add(new ItemDto(item_weight, "称重重量", "DB200.REAL126"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "反馈", "DB201.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_error, "物料不一致", "DB200.B2"));
|
||||
list.add(new ItemDto(item_to_slip, "下发泥料批次", "DB201.STRING4.50"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_material_distribution;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class LnshMaterialDistributionDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "lnsh_material_distribution";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "标准版-布料机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "标准版-布料机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new LnshMaterialDistributionDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return LnshMaterialDistributionDeviceDriver.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,491 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_material_distribution;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.*;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.conveyor_press_station.ConveyorPressStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyDeviceDto;
|
||||
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.AcsToWmsData.cloth.ClothRequest;
|
||||
import org.nl.acs.ext.wms.data.AcsToWmsData.grab.GrabRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.heartbeat.HeartbeatEvent;
|
||||
import org.nl.acs.heartbeat.dto.HeartbeatManageDto;
|
||||
import org.nl.acs.heartbeat.enums.HeartbeatType;
|
||||
import org.nl.acs.heartbeat.service.HeartbeatUnifiedService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
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.ObjectUtl;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class LnshMaterialDistributionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol=new ItemProtocol(this);
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
|
||||
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl");
|
||||
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean("deviceAppServiceImpl");
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out = 3000;
|
||||
boolean requireSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
|
||||
String device_code;
|
||||
int status = 0;
|
||||
int last_status = 0;
|
||||
String slip=null;
|
||||
String last_slip=null;
|
||||
String open_time = null;
|
||||
String last_open_time = null;
|
||||
|
||||
int standby_time = 0;
|
||||
int last_standby_time = 0;
|
||||
int production_time = 0;
|
||||
int last_production_time = 0;
|
||||
int error_time = 0;
|
||||
int last_error_time = 0;
|
||||
float set_weight=0f;
|
||||
float weight=0f;
|
||||
float last_set_weight=0f;
|
||||
float last_weight=0f;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
status = this.itemProtocol.getStatus();
|
||||
open_time = this.itemProtocol.getOpen_time();
|
||||
standby_time = this.itemProtocol.getStandby_time();
|
||||
production_time = this.itemProtocol.getProduction_time();
|
||||
error_time = this.itemProtocol.getError_time();
|
||||
slip=this.itemProtocol.getSlip();
|
||||
set_weight=this.itemProtocol.getSetWeight();
|
||||
weight = this.itemProtocol.getWeight();
|
||||
|
||||
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 (error != last_error) {
|
||||
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + " -> " + error);
|
||||
}
|
||||
if (status != last_status) {
|
||||
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
||||
}
|
||||
if (!open_time.equals(last_open_time)) {
|
||||
logServer.deviceItemValue(this.device_code, "open_time", String.valueOf(open_time));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号open_time:" + last_open_time + " -> " + open_time);
|
||||
}
|
||||
if (standby_time != last_standby_time) {
|
||||
logServer.deviceItemValue(this.device_code, "standby_time", String.valueOf(standby_time));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号standby_time:" + last_standby_time + " -> " + standby_time);
|
||||
}
|
||||
if (production_time != last_production_time) {
|
||||
logServer.deviceItemValue(this.device_code, "production_time", String.valueOf(production_time));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号production_time:" + last_production_time + " -> " + production_time);
|
||||
}
|
||||
if (error_time != last_error_time) {
|
||||
logServer.deviceItemValue(this.device_code, "error_time", String.valueOf(error_time));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error_time:" + last_error_time + " -> " + error_time);
|
||||
}
|
||||
if (weight != last_weight) {
|
||||
logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight + " -> " + weight);
|
||||
}
|
||||
if (set_weight != last_set_weight) {
|
||||
logServer.deviceItemValue(this.device_code, "set_weight", String.valueOf(set_weight));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号set_weight:" + last_set_weight + " -> " + set_weight);
|
||||
}
|
||||
|
||||
if (slip != last_slip) {
|
||||
logServer.deviceItemValue(this.device_code, "slip", String.valueOf(slip));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号slip:" + last_slip + " -> " + slip);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
log.info(var17.getMessage());
|
||||
message = "错误:" + var17.getMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
//未联机
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
|
||||
|
||||
if (mode > 2 && !requireSucess) {
|
||||
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) {
|
||||
String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString();
|
||||
try {
|
||||
applyRequest(modethod);
|
||||
} catch (Exception e) {
|
||||
message = "错误:" + e.getMessage();
|
||||
this.setIserror(true);
|
||||
}
|
||||
} else {
|
||||
message = "无效模式请求,驱动未配置此请求方法";
|
||||
}
|
||||
} else {
|
||||
message = "无请求";
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_status = status;
|
||||
last_error = error;
|
||||
last_open_time = open_time;
|
||||
last_standby_time = standby_time;
|
||||
last_production_time = production_time;
|
||||
last_error_time = error_time;
|
||||
last_weight = weight;
|
||||
last_set_weight=set_weight;
|
||||
last_slip=slip;
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.debug("设备报警");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyRequest(String modethod) throws Exception {
|
||||
Object obj1 = this;
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
Object obj = this.getClass().getDeclaredConstructor().newInstance();
|
||||
Method method1 = this.getClass().getMethod(modethod, null);
|
||||
method1.invoke(this, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 布料机反馈重量和泥料
|
||||
* @return
|
||||
*/
|
||||
public boolean apply_one_cloth() {
|
||||
ClothRequest request = new ClothRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
List<String> LinkDeviceCodeList = this.getExtraDeviceCodes1("link_device_code");
|
||||
LnshMaterialDistributionDeviceDriver lnshMaterialDistributionDeviceDriver;
|
||||
for (int i = 0; i < LinkDeviceCodeList.size(); i++) {
|
||||
Device getDevice = deviceAppService.findDeviceByCode(LinkDeviceCodeList.get(i).toString());
|
||||
if(ObjectUtil.isEmpty(getDevice)){
|
||||
continue;
|
||||
}
|
||||
ConveyorPressStationDeviceDriver conveyorPressStationDeviceDriver;
|
||||
if(getDevice.getDeviceDriver() instanceof ConveyorPressStationDeviceDriver){
|
||||
conveyorPressStationDeviceDriver=(ConveyorPressStationDeviceDriver) getDevice.getDeviceDriver();
|
||||
request.setSlip(conveyorPressStationDeviceDriver.getTo_mix_num());
|
||||
}
|
||||
}
|
||||
request.setSet_weight(set_weight);
|
||||
request.setWeight(weight);
|
||||
message = RequestMethodEnum.getName("apply_one_cloth") + "apply_one_cloth 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "参数:" + JSON.toJSONString(request));
|
||||
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
|
||||
if (resp.getCode() == 200) {
|
||||
this.writing(200);
|
||||
this.setRequireSucess(true);
|
||||
message = RequestMethodEnum.getName("apply_one_cloth") + "apply_one_cloth 接口请求成功" + resp.getMessage();
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_one_cloth") + "apply_one_cloth 接口请求失败" + resp.getMessage();
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp)));
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
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()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
if (appendMessage == null) {
|
||||
appendMessage = "";
|
||||
}
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
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);
|
||||
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
|
||||
}
|
||||
/**
|
||||
* 多个信号一起下发电气
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
|
||||
public void writing(Map<String, Object> map) {
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try{
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(), "下发多个电气信号:" + itemMap));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 抽取统一下发电气信号前缀
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getToParam() {
|
||||
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, "to_command 写入 " + command));
|
||||
}
|
||||
|
||||
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
|
||||
if (obj == null || StrUtil.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
//获取这个类的所有属性
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
boolean flag = false;
|
||||
//循环遍历所有的fields
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getName().equals("item_" + fieldName)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() throws Exception {
|
||||
String status;
|
||||
switch (this.status) {
|
||||
case 1:
|
||||
status = "待机";
|
||||
break;
|
||||
case 2:
|
||||
status = "生产中";
|
||||
break;
|
||||
case 3:
|
||||
status = "故障";
|
||||
break;
|
||||
default:
|
||||
status = String.valueOf(this.status);
|
||||
}
|
||||
|
||||
String error;
|
||||
switch (this.error) {
|
||||
case 1:
|
||||
error = "急停中";
|
||||
break;
|
||||
case 2:
|
||||
error = "光幕报警";
|
||||
break;
|
||||
case 3:
|
||||
error = "本体报警";
|
||||
break;
|
||||
case 4:
|
||||
error = "未排产报警";
|
||||
break;
|
||||
case 5:
|
||||
error = "扫码故障";
|
||||
break;
|
||||
default:
|
||||
error = String.valueOf(this.error);
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
Object requestNo = this.getExtraValue().get(String.valueOf(this.mode));
|
||||
if(ObjectUtil.isNotEmpty(requestNo)){
|
||||
jo.put("modeName", this.getModeName(String.valueOf(requestNo)));
|
||||
} else {
|
||||
jo.put("modeName", "无效的请求,驱动中未配置");
|
||||
}
|
||||
jo.put("status", status);
|
||||
jo.put("error", error);
|
||||
jo.put("open_time", open_time);
|
||||
jo.put("standby_time", standby_time);
|
||||
jo.put("production_time", production_time);
|
||||
jo.put("error_time", error_time);
|
||||
jo.put("weight", weight);
|
||||
jo.put("isError", iserror);
|
||||
jo.put("isOnline", isonline);
|
||||
jo.put("message", message);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -550,10 +550,12 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("捕获到异常e:" + e.getMessage(), e);
|
||||
try{
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1){
|
||||
e1.printStackTrace();
|
||||
log.error("捕获到异常e1:" + e.getMessage(), e1);
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
|
||||
@@ -91,6 +91,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
|
||||
int last_task = 0;
|
||||
int last_action = 0;
|
||||
int last_ioaction = 0;
|
||||
int to_command=0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
Boolean iserror = false;
|
||||
@@ -331,6 +332,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
|
||||
pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset();
|
||||
tool_coordinate = this.itemProtocol.getTool_coordinate();
|
||||
tool_coordinate = this.itemProtocol.getTool_coordinate();
|
||||
to_command=this.itemProtocol.getToCommand();
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
if(mode==2){
|
||||
|
||||
@@ -1206,14 +1206,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
this.isSetAddress(nextDevice);
|
||||
String start_addr = startDevice.getExtraValue().get("OPCServer").toString();
|
||||
String next_addr = nextDevice.getExtraValue().get("OPCServer").toString();
|
||||
this.writing("to_onset1", start_addr);
|
||||
this.writing("to_onset1", start_addr);
|
||||
this.writing("to_target1", next_addr);
|
||||
this.writing("to_target1", next_addr);
|
||||
this.writing("to_task1", dto.getInstruction_code());
|
||||
this.writing("to_task1", dto.getInstruction_code());
|
||||
this.writing("to_command1", "1");
|
||||
this.writing("to_command1", "1");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_onset1", start_addr);
|
||||
map.put("to_onset1", start_addr);
|
||||
map.put("to_target1", next_addr);
|
||||
map.put("to_target1", next_addr);
|
||||
map.put("to_task1", dto.getInstruction_code());
|
||||
map.put("to_task1", dto.getInstruction_code());
|
||||
map.put("to_command1", "1");
|
||||
map.put("to_command1", "1");
|
||||
this.writing(map);
|
||||
log.info("下发前工位任务起始站{}目标站{}任务号{}",start_addr,next_addr,dto.getInstruction_code());
|
||||
}
|
||||
/**
|
||||
@@ -1229,14 +1231,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
this.isSetAddress(nextDevice);
|
||||
String start_addr = startDevice.getExtraValue().get("OPCServer").toString();
|
||||
String next_addr = nextDevice.getExtraValue().get("OPCServer").toString();
|
||||
this.writing("to_onset2", start_addr);
|
||||
this.writing("to_onset2", start_addr);
|
||||
this.writing("to_target2", next_addr);
|
||||
this.writing("to_target2", next_addr);
|
||||
this.writing("to_task2", dto.getInstruction_code());
|
||||
this.writing("to_task2", dto.getInstruction_code());
|
||||
this.writing("to_command2", "1");
|
||||
this.writing("to_command2", "1");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_onset2", start_addr);
|
||||
map.put("to_onset2", start_addr);
|
||||
map.put("to_target2", next_addr);
|
||||
map.put("to_target2", next_addr);
|
||||
map.put("to_task2", dto.getInstruction_code());
|
||||
map.put("to_task2", dto.getInstruction_code());
|
||||
map.put("to_command2", "1");
|
||||
map.put("to_command2", "1");
|
||||
this.writing(map);
|
||||
log.info("下发后工位任务起始站{}目标站{}任务号{}",start_addr,next_addr,dto.getInstruction_code());
|
||||
}
|
||||
|
||||
@@ -1261,21 +1265,23 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
String next_addr = nextDevice.getExtraValue().get("OPCServer").toString();
|
||||
String start_addr2 = startDevice2.getExtraValue().get("OPCServer").toString();
|
||||
String next_addr2 = nextDevice2.getExtraValue().get("OPCServer").toString();
|
||||
this.writing("to_onset1", start_addr);
|
||||
this.writing("to_onset1", start_addr);
|
||||
this.writing("to_target1", next_addr);
|
||||
this.writing("to_target1", next_addr);
|
||||
this.writing("to_task1", dto.getInstruction_code());
|
||||
this.writing("to_task1", dto.getInstruction_code());
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_onset1", start_addr);
|
||||
map.put("to_onset1", start_addr);
|
||||
map.put("to_target1", next_addr);
|
||||
map.put("to_target1", next_addr);
|
||||
map.put("to_task1", dto.getInstruction_code());
|
||||
map.put("to_task1", dto.getInstruction_code());
|
||||
//this.writing("to_command1", "1");
|
||||
this.writing("to_onset2", start_addr2);
|
||||
this.writing("to_onset2", start_addr2);
|
||||
this.writing("to_target2", next_addr2);
|
||||
this.writing("to_target2", next_addr2);
|
||||
this.writing("to_task2", dto.getInstruction_code());
|
||||
this.writing("to_task2", dto.getInstruction_code());
|
||||
this.writing("to_command2", "1");
|
||||
this.writing("to_command2", "1");
|
||||
map.put("to_onset2", start_addr2);
|
||||
map.put("to_onset2", start_addr2);
|
||||
map.put("to_target2", next_addr2);
|
||||
map.put("to_target2", next_addr2);
|
||||
map.put("to_task2", dto.getInstruction_code());
|
||||
map.put("to_task2", dto.getInstruction_code());
|
||||
map.put("to_command2", "1");
|
||||
map.put("to_command2", "1");
|
||||
this.writing(map);
|
||||
log.info("下发前后工位任务前起始站{}前目标站{}任务号{}后起始站{}后目标站{}",start_addr,next_addr,dto.getInstruction_code(),start_addr2,next_addr2);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,10 @@ public class ApplyTaskResponse extends BaseResponse {
|
||||
* 是否码满规定托盘数
|
||||
*/
|
||||
private int is_satisfy;
|
||||
/**
|
||||
* 泥料批次
|
||||
*/
|
||||
private String mudBatch;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.acs.ext.wms.data.AcsToWmsData.cloth;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyDeviceDto;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ClothRequest extends BaseRequest {
|
||||
/**
|
||||
* 泥料批次
|
||||
*/
|
||||
private String slip;
|
||||
|
||||
/**
|
||||
* 设定重量
|
||||
*/
|
||||
private Float set_weight;
|
||||
|
||||
/**
|
||||
* 称量重量
|
||||
*/
|
||||
private Float weight;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.nl.acs.ext.wms.data.AcsToWmsData.cloth;
|
||||
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
|
||||
public class ClothResponse extends BaseResponse {
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.AgvUtil;
|
||||
@@ -57,8 +58,9 @@ import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -342,16 +344,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Override
|
||||
public JSONObject createOrder(JSONObject param) throws Exception {
|
||||
try{
|
||||
Date date=new Date();
|
||||
log.info("lms下发工单的当前时间是{}",date);
|
||||
MDC.put(log_file_type, log_type);
|
||||
CreateOrderRequest orders = JSON.toJavaObject(param, CreateOrderRequest.class);
|
||||
CreateOrderResponse resp = new CreateOrderResponse();
|
||||
String request_no = orders.getRequestNo();
|
||||
JSONArray errArr = new JSONArray();
|
||||
log.info("CreateOrderRequest - 请求参数 {}", orders.toString());
|
||||
|
||||
for (int i = 0; i < orders.getList().size(); i++) {
|
||||
Boolean is_flag = false;
|
||||
|
||||
OrderDto orderDto = orders.getList().get(i);
|
||||
String order_code = orderDto.getWorkorder_code();
|
||||
String device_code = orderDto.getDevice_code();
|
||||
@@ -373,8 +375,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String standard_size_height4 = orderDto.getStandard_size_height4();
|
||||
String standard_weight = orderDto.getStandard_weight();
|
||||
String detection_error = orderDto.getDetection_error();
|
||||
|
||||
|
||||
if (StrUtil.isEmpty(order_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("order_code", order_code);
|
||||
@@ -433,7 +433,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
|
||||
|
||||
lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
|
||||
if (lnshPressDeviceDriver.getMode() == 0) {
|
||||
JSONObject json = new JSONObject();
|
||||
@@ -480,7 +479,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
map.put("to_standard_size_height3", standard_size_height3);
|
||||
map.put("to_standard_size_height4", standard_size_height4);
|
||||
map.put("to_command",100);
|
||||
// delayed(device_code,map);
|
||||
lnshPressDeviceDriver.writing(map);
|
||||
Date date1=new Date();
|
||||
log.info("压机下发工单的当前时间是{}",date1);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
||||
@@ -509,9 +511,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("product_code~~");
|
||||
sb.append("formula");
|
||||
String formula1=brick_code+"~"+formula;
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_order_No", order_code);
|
||||
map.put("to_material", material_code);
|
||||
@@ -521,8 +521,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
map.put("to_Htrapezoidal", Htrapezoidal);
|
||||
map.put("to_Wthickness", Wthickness);
|
||||
map.put("to_feedback",100);
|
||||
map.put("to_formula",sb);
|
||||
map.put("to_formula",formula1);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing(map);
|
||||
// delayed(device_code,map);
|
||||
Date date2=new Date();
|
||||
log.info("分拣下发工单的当前时间是{}",date2);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
|
||||
@@ -602,6 +605,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
.method(orders.getRequest_medthod_code())
|
||||
.build();
|
||||
lucene.interfaceExecuteLog(logDto);
|
||||
Date date3=new Date();
|
||||
log.info("下发工单成功的当前时间是{}",date3);
|
||||
return (JSONObject) JSON.toJSON(resp);
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
@@ -1378,4 +1383,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
log.info("writeVehicle - 返回参数 {}", result);
|
||||
return result;
|
||||
}
|
||||
LnshPressDeviceDriver lnshPressDeviceDriver;
|
||||
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
|
||||
// @Async
|
||||
// protected void delayed(String device_code,Map map){
|
||||
// Device device = DeviceAppService.findDeviceByCode(device_code);
|
||||
// if(device.getDeviceDriver() instanceof LnshPressDeviceDriver ){
|
||||
// lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
|
||||
// lnshPressDeviceDriver.writing(map);
|
||||
// }
|
||||
// if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
||||
// lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
// lnshPackagePalletManipulatorDeviceDriver.writing(map);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user