下发RGV托盘类型更新
This commit is contained in:
@@ -29,6 +29,7 @@ import org.nl.wql.core.bean.WQLObject;
|
|||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -655,6 +656,23 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
|||||||
ReadUtil.write(itemMap, server);
|
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
|
@Override
|
||||||
public JSONObject getDeviceStatusName() {
|
public JSONObject getDeviceStatusName() {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
|
|||||||
@@ -495,6 +495,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
LnshSplitManipulatorDeviceDriver lnshSplitManipulatorDeviceDriver;
|
LnshSplitManipulatorDeviceDriver lnshSplitManipulatorDeviceDriver;
|
||||||
//拆码垛机械手
|
//拆码垛机械手
|
||||||
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
|
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
|
||||||
|
//双工位RGV
|
||||||
|
LnshRGVDeviceDriver lnshRGVDeviceDriver;
|
||||||
|
|
||||||
//晟华覆膜机
|
//晟华覆膜机
|
||||||
if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
|
if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
|
||||||
@@ -523,6 +525,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
}
|
}
|
||||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing(code, value);
|
rljnPackagePalletSplitManipulatorDeviceDriver.writing(code, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
|
||||||
|
lnshRGVDeviceDriver = (LnshRGVDeviceDriver) device.getDeviceDriver();
|
||||||
|
org.nl.acs.device_driver.lnsh.lnsh_rgv.ItemProtocol itemProtocol = new org.nl.acs.device_driver.lnsh.lnsh_rgv.ItemProtocol(lnshRGVDeviceDriver);
|
||||||
|
if (!lnshRGVDeviceDriver.isExistFieldName(code, itemProtocol)) {
|
||||||
|
throw new Exception("设备:" + device_code + "未找到对应信号:" + code);
|
||||||
|
}
|
||||||
|
lnshRGVDeviceDriver.writing(code, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
JSONObject resultJson = new JSONObject();
|
JSONObject resultJson = new JSONObject();
|
||||||
resultJson.put("status", HttpStatus.OK);
|
resultJson.put("status", HttpStatus.OK);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
fmjToPackIngTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
fmjToPackIngTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||||
//生成到包装位的任务时,下发托盘类型给RGV
|
//生成到包装位的任务时,下发托盘类型给RGV
|
||||||
String point_id = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("point_id");
|
String point_id = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("point_id");
|
||||||
String material_id = structivtTable.query("point_id ='" + point_id + "'").uniqueResult(0).getString("material_id");
|
String material_id = structivtTable.query("struct_id ='" + point_id + "'").uniqueResult(0).getString("material_id");
|
||||||
JSONObject materiralObj1 = WQLObject.getWQLObject("md_me_material").query("material_id = '" + material_id + "'").uniqueResult(0);
|
JSONObject materiralObj1 = WQLObject.getWQLObject("md_me_material").query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||||
//寻找对应的托盘类型
|
//寻找对应的托盘类型
|
||||||
String vehicle_type = vehicleService.getVehicleType(materiralObj1.getString("vehicle_type"));
|
String vehicle_type = vehicleService.getVehicleType(materiralObj1.getString("vehicle_type"));
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public class ProducetaskServiceImpl implements ProducetaskService {
|
|||||||
//根据物料去找木托盘类型
|
//根据物料去找木托盘类型
|
||||||
JSONObject materialObj = WQLObject.getWQLObject("md_me_material").query("material_id = '" + material_id + "'").uniqueResult(0);
|
JSONObject materialObj = WQLObject.getWQLObject("md_me_material").query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||||
String vehicle_type = materialObj.getString("vehicle_type");
|
String vehicle_type = materialObj.getString("vehicle_type");
|
||||||
if (StrUtil.isEmpty(vehicle_type)) {
|
if (StrUtil.isEmpty(vehicle_type) || StrUtil.equals(vehicle_type,"0")) {
|
||||||
throw new RuntimeException("木托盘类型不可为空!");
|
throw new RuntimeException("木托盘类型不可为空!");
|
||||||
}
|
}
|
||||||
dto.setVehicle_type(vehicle_type);
|
dto.setVehicle_type(vehicle_type);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class FmjToPackIngTask extends AbstractAcsTask {
|
|||||||
String next_point_code = "BZSLW";
|
String next_point_code = "BZSLW";
|
||||||
String material_id = ivtObj.getString("material_id");
|
String material_id = ivtObj.getString("material_id");
|
||||||
String is_full = ivtObj.getString("is_full");
|
String is_full = ivtObj.getString("is_full");
|
||||||
String qty = ivtObj.getString("qty");
|
String qty = ivtObj.getString("canuse_qty");
|
||||||
String pcsn = ivtObj.getString("pcsn");
|
String pcsn = ivtObj.getString("pcsn");
|
||||||
String vehicle_code = ivtObj.getString("vehicle_code");
|
String vehicle_code = ivtObj.getString("vehicle_code");
|
||||||
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
|
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
|||||||
Reference in New Issue
Block a user