拆码垛机械手更新
This commit is contained in:
@@ -482,7 +482,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
boolean flag = false;
|
||||
//循环遍历所有的fields
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getName().equals(fieldName)) {
|
||||
if (fields[i].getName().equals("item_" + fieldName)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
public void execute() throws InterruptedException {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -886,7 +886,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean queryCribbingInfo() {
|
||||
public synchronized boolean queryCribbingInfo() throws InterruptedException {
|
||||
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);
|
||||
@@ -968,7 +968,6 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
String two_qty = content.getString("two_qty");
|
||||
String tool_coordinate = content.getString("tool_coordinate");
|
||||
|
||||
this.writing(this.mode);
|
||||
this.writing("to_material_qty",qty);
|
||||
this.writing("to_material_code",material_code);
|
||||
this.writing("to_product_code",product_code);
|
||||
@@ -976,7 +975,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
this.writing("to_BshortSide",BshortSide);
|
||||
this.writing("to_Htrapezoidal",Htrapezoidal);
|
||||
this.writing("to_Wthickness",Wthickness);
|
||||
this.writing("to_tray_qty",tray_qty);
|
||||
this.writing("to_tray_qty",qty);
|
||||
this.writing("to_tray_high",tray_high);
|
||||
this.writing("to_crib_category",crib_category);
|
||||
this.writing("to_palletX1_line",palletX1_line);
|
||||
@@ -1030,6 +1029,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
this.writing("to_two_qty",two_qty);
|
||||
this.writing("to_tool_coordinate",tool_coordinate);
|
||||
|
||||
Thread.sleep(1000);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
@@ -1055,7 +1056,13 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
String demoArray[] = demosub.split(",");
|
||||
List<String> demoList = Arrays.asList(demoArray);
|
||||
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||
json.put("qty",qty);
|
||||
//如果是1号对接位请求,那么数量就传1号垛数量
|
||||
if (put_station == 1) {
|
||||
json.put("qty",one_qty);
|
||||
} else if (put_station == 2) {
|
||||
json.put("qty",two_qty);
|
||||
}
|
||||
|
||||
json.put("vehicle_code",barcode);
|
||||
json.put("is_full","1");
|
||||
json.put("product_code",product_code);
|
||||
@@ -1148,7 +1155,13 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
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("qty",qty);
|
||||
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||
//如果是1号对接位请求,那么数量就传1号垛数量
|
||||
if (put_station == 1) {
|
||||
json.put("qty",one_qty);
|
||||
} else if (put_station == 2) {
|
||||
json.put("qty",two_qty);
|
||||
}
|
||||
json.put("vehicle_code",barcode);
|
||||
json.put("is_full",type);
|
||||
json.put("product_code",product_code);
|
||||
|
||||
@@ -519,8 +519,8 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
requireSucess2 = true;
|
||||
|
||||
|
||||
String start_addr = startdevice.getAddress();
|
||||
String next_addr = nextdevice.getAddress();
|
||||
String start_addr = startdevice.getExtraValue().get("OPCServer").toString();
|
||||
String next_addr = nextdevice.getExtraValue().get("OPCServer").toString();
|
||||
|
||||
writing("to_command2","1");
|
||||
writing("to_onset2",start_addr);
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -246,7 +247,7 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
public void execute() throws InterruptedException {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -906,7 +907,7 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean getVehicle() {
|
||||
public synchronized boolean getVehicle() throws InterruptedException {
|
||||
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);
|
||||
@@ -986,15 +987,15 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
String two_qty = content.getString("two_qty");
|
||||
String tool_coordinate = content.getString("tool_coordinate");
|
||||
|
||||
this.writing(this.mode);
|
||||
|
||||
this.writing("to_product_code",product_code);
|
||||
this.writing("to_material_qty",qty);
|
||||
this.writing("to_material_code",material_code);
|
||||
this.writing("to_AlongSide",AlongSide);
|
||||
this.writing("to_BshortSide",BshortSide);
|
||||
this.writing("to_Htrapezoidal",Htrapezoidal);
|
||||
this.writing("to_Wthickness",Wthickness);
|
||||
this.writing("to_tray_qty",tray_qty);
|
||||
//当前托盘砖数量
|
||||
this.writing("to_tray_qty",qty);
|
||||
this.writing("to_tray_high",tray_high);
|
||||
this.writing("to_crib_category",crib_category);
|
||||
this.writing("to_palletX1_line",palletX1_line);
|
||||
@@ -1048,6 +1049,9 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
this.writing("to_two_qty",two_qty);
|
||||
this.writing("to_tool_coordinate",tool_coordinate);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
@@ -1168,6 +1172,23 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
|
||||
if (obj == null || StrUtil.isEmpty(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() {
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
@@ -261,7 +261,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
public void execute() throws InterruptedException {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -720,7 +720,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
case 5:
|
||||
//获取托盘信息
|
||||
if (!requireSucess) {
|
||||
getVehicle();
|
||||
queryCribbingInfo();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@@ -773,11 +773,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
if (!requireSucess) {
|
||||
applyEmptyIn();
|
||||
}
|
||||
case 13:
|
||||
//申请空盘入库
|
||||
if (!requireSucess) {
|
||||
queryCribbingInfo();
|
||||
}
|
||||
// case 13:
|
||||
// //申请空盘入库
|
||||
// if (!requireSucess) {
|
||||
// queryCribbingInfo();
|
||||
// }
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
@@ -959,7 +959,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean getVehicle() {
|
||||
public synchronized boolean getVehicle() throws InterruptedException {
|
||||
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);
|
||||
@@ -1039,7 +1039,6 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
String two_qty = content.getString("two_qty");
|
||||
String tool_coordinate = content.getString("tool_coordinate");
|
||||
|
||||
this.writing(this.mode);
|
||||
this.writing("to_product_code",product_code);
|
||||
this.writing("to_material_qty",qty);
|
||||
this.writing("to_material_code",material_code);
|
||||
@@ -1047,7 +1046,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
this.writing("to_BshortSide",BshortSide);
|
||||
this.writing("to_Htrapezoidal",Htrapezoidal);
|
||||
this.writing("to_Wthickness",Wthickness);
|
||||
this.writing("to_tray_qty",tray_qty);
|
||||
this.writing("to_tray_qty",qty);
|
||||
this.writing("to_tray_high",tray_high);
|
||||
this.writing("to_crib_category",crib_category);
|
||||
this.writing("to_palletX1_line",palletX1_line);
|
||||
@@ -1101,6 +1100,8 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
this.writing("to_two_qty",two_qty);
|
||||
this.writing("to_tool_coordinate",tool_coordinate);
|
||||
|
||||
Thread.sleep(1000);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
return true;
|
||||
@@ -1112,7 +1113,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean queryCribbingInfo() {
|
||||
public synchronized boolean queryCribbingInfo() throws InterruptedException {
|
||||
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);
|
||||
@@ -1194,7 +1195,6 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
String two_qty = content.getString("two_qty");
|
||||
String tool_coordinate = content.getString("tool_coordinate");
|
||||
|
||||
this.writing(this.mode);
|
||||
this.writing("to_material_qty", qty);
|
||||
this.writing("to_material_code", material_code);
|
||||
this.writing("to_product_code", product_code);
|
||||
@@ -1202,7 +1202,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
this.writing("to_BshortSide", BshortSide);
|
||||
this.writing("to_Htrapezoidal", Htrapezoidal);
|
||||
this.writing("to_Wthickness", Wthickness);
|
||||
this.writing("to_tray_qty", tray_qty);
|
||||
this.writing("to_tray_qty", qty);
|
||||
this.writing("to_tray_high", tray_high);
|
||||
this.writing("to_crib_category", crib_category);
|
||||
this.writing("to_palletX1_line", palletX1_line);
|
||||
@@ -1256,6 +1256,8 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
this.writing("to_two_qty", two_qty);
|
||||
this.writing("to_tool_coordinate", tool_coordinate);
|
||||
|
||||
Thread.sleep(1000);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
@@ -1282,7 +1284,12 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
String demoArray[] = demosub.split(",");
|
||||
List<String> demoList = Arrays.asList(demoArray);
|
||||
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||
json.put("qty",qty);
|
||||
//如果是1号对接位请求,那么数量就传1号垛数量
|
||||
if (put_station == 1) {
|
||||
json.put("qty",one_qty);
|
||||
} else if (put_station == 2) {
|
||||
json.put("qty",two_qty);
|
||||
}
|
||||
json.put("vehicle_code",barcode);
|
||||
json.put("is_full","1");
|
||||
json.put("product_code",product_code);
|
||||
@@ -1374,7 +1381,12 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
||||
String demoArray[] = demosub.split(",");
|
||||
List<String> demoList = Arrays.asList(demoArray);
|
||||
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||
json.put("qty",qty);
|
||||
//如果是1号对接位请求,那么数量就传1号垛数量
|
||||
if (put_station == 1) {
|
||||
json.put("qty",one_qty);
|
||||
} else if (put_station == 2) {
|
||||
json.put("qty",two_qty);
|
||||
}
|
||||
json.put("vehicle_code",barcode);
|
||||
json.put("material_code",material);
|
||||
json.put("is_full",type);
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.ItemProtocol;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_labeling_machine.LnshLabelingMachineDeviceDriver;
|
||||
@@ -268,6 +269,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String product_code = json.getString("product_code");
|
||||
String material_code = json.getString("material_code");
|
||||
String material_name = json.getString("material_name");
|
||||
String vehicle_type = json.getString("vehicle_type");
|
||||
String cust_code = json.getString("cust_code");
|
||||
String cust_name = json.getString("cust_name");
|
||||
String model = json.getString("model");
|
||||
@@ -331,6 +333,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No", producetask_code);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_order_qty", qty);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_type", vehicle_type);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing(3);
|
||||
is_flag = true;
|
||||
}
|
||||
@@ -346,6 +349,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_order_No", producetask_code);
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_order_qty", qty);
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_material_code", material_code);
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_material_type", vehicle_type);
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing(3);
|
||||
is_flag = true;
|
||||
}
|
||||
@@ -443,6 +447,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
|
||||
//分拣拆垛机械手
|
||||
LnshSplitManipulatorDeviceDriver lnshSplitManipulatorDeviceDriver;
|
||||
//拆码垛机械手
|
||||
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
|
||||
|
||||
//晟华覆膜机
|
||||
if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
|
||||
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver();
|
||||
@@ -452,6 +461,24 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
lnshLaminatingMachineDeviceDriver.writing(code, value);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
|
||||
lnshSplitManipulatorDeviceDriver = (LnshSplitManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.ItemProtocol itemProtocol = new org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.ItemProtocol(lnshSplitManipulatorDeviceDriver);
|
||||
if (!lnshSplitManipulatorDeviceDriver.isExistFieldName(code, itemProtocol)) {
|
||||
throw new Exception("设备:" + device_code + "未找到对应信号:" + code);
|
||||
}
|
||||
lnshSplitManipulatorDeviceDriver.writing(code, value);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) {
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver = (RljnPackagePalletSplitManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
org.nl.acs.device_driver.lnsh.rljn_package_palletSplit_manipulator.ItemProtocol itemProtocol = new org.nl.acs.device_driver.lnsh.rljn_package_palletSplit_manipulator.ItemProtocol(rljnPackagePalletSplitManipulatorDeviceDriver);
|
||||
if (!rljnPackagePalletSplitManipulatorDeviceDriver.isExistFieldName(code, itemProtocol)) {
|
||||
throw new Exception("设备:" + device_code + "未找到对应信号:" + code);
|
||||
}
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing(code, value);
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
|
||||
Reference in New Issue
Block a user