Browse Source

更新

master
张江玮 2 years ago
parent
commit
f7f86c9812
  1. 162
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java
  2. 8
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java
  3. 6
      acs/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java
  4. 36
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  5. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendMaterial/YzjSendMaterialTask.java

162
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java

@ -633,9 +633,11 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
} }
break; break;
case 9: case 9:
//获取托盘信息
if (!requireSucess && this.move != 0) {
getVehicle();
}
break; break;
} }
switch (flag) { switch (flag) {
@ -1117,4 +1119,160 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
public void setDeviceStatus(JSONObject data) { public void setDeviceStatus(JSONObject data) {
} }
/**
* 获取托盘信息
*
* @param
*/
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);
return false;
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code", device_code);
JSONObject jo = acsToWmsService.getVehicle(json);
if (ObjectUtil.isNotEmpty(jo)) {
JSONObject content = jo.getJSONObject("data");
String qty = content.getString("qty");
String material_code = content.getString("material_code");
String material_name = content.getString("material_name");
String product_code = content.getString("product_code");
String AlongSide = content.getString("AlongSide");
String BshortSide = content.getString("BshortSide");
String Htrapezoidal = content.getString("Htrapezoidal");
String Wthickness = content.getString("Wthickness");
String tray_qty = content.getString("tray_qty");
String tray_high = content.getString("tray_high");
String crib_category = content.getString("crib_category");
String palletX1_line = content.getString("palletx1_line");
String palletY1_row = content.getString("pallety1_row");
String palletA1_angle = content.getString("palleta1_angle");
String palletX2_line = content.getString("palletx2_line");
String palletY2_row = content.getString("pallety2_row");
String palletA2_angle = content.getString("palleta2_angle");
String palletX3_line = content.getString("palletx3_line");
String palletY3_row = content.getString("pallety3_row");
String palletA3_angle = content.getString("palleta3_angle");
String pressCribX1_line = content.getString("presscribx1_line");
String pressCribY1_row = content.getString("presscriby1_row");
String pressCribA1_angle = content.getString("presscriba1_angle");
String pressCribX2_line = content.getString("presscribx2_line");
String pressCribY2_row = content.getString("presscriby2_row");
String pressCribA2_angle = content.getString("presscriba2_angle");
String pressCribX3_line = content.getString("presscribx3_line");
String pressCribY3_row = content.getString("presscriby3_row");
String pressCribA3_angle = content.getString("presscriba3_angle");
String Zoffset = content.getString("zoffset");
String pallet_layerQty = content.getString("pallet_layerqty");
String pressCrib_layerQty = content.getString("presscrib_layerqty");
String codeLayerX1_interval = content.getString("codelayerx1_interval");
String codeLayerY1_interval = content.getString("codelayery1_interval");
String codeLayerX2_interval = content.getString("codelayerx2_interval");
String codeLayerY2_interval = content.getString("codelayery2_interval");
String codeLayerX3_interval = content.getString("codelayerx3_interval");
String codeLayerY3_interval = content.getString("codelayery3_interval");
String codeLayerX1_offset = content.getString("codelayerx1_offset");
String codeLayerY1_offset = content.getString("codelayery1_offset");
String codeLayerX2_offset = content.getString("codelayerx2_offset");
String codeLayerY2_offset = content.getString("codelayery2_offset");
String codeLayerX3_offset = content.getString("codelayerx3_offset");
String codeLayerY3_offset = content.getString("codelayery3_offset");
String pressLayerX1_interval = content.getString("presslayerx1_interval");
String pressLayerY1_interval = content.getString("presslayery1_interval");
String pressLayerX2_interval = content.getString("presslayerx2_interval");
String pressLayerY2_interval = content.getString("presslayery2_interval");
String pressLayerX3_interval = content.getString("presslayerx3_interval");
String pressLayerY3_interval = content.getString("presslayery3_interval");
String pressLayerX1_offset = content.getString("presslayerx1_offset");
String pressLayerY1_offset = content.getString("presslayery1_offset");
String pressLayerX2_offset = content.getString("presslayerx2_offset");
String pressLayerY2_offset = content.getString("presslayery2_offset");
String pressLayerX3_offset = content.getString("presslayerx3_offset");
String pressLayerY3_offset = content.getString("presslayery3_offset");
String tool_coordinate = content.getString("tool_coordinate");
this.writing("to_product_code", StrUtil.isEmpty(product_code) ? "0" : product_code);
// this.writing("to_material_code",material_code);
this.writing("to_AlongSide", StrUtil.isEmpty(AlongSide) ? "0" : AlongSide);
this.writing("to_BshortSide", StrUtil.isEmpty(BshortSide) ? "0" : BshortSide);
this.writing("to_Htrapezoidal", StrUtil.isEmpty(Htrapezoidal) ? "0" : Htrapezoidal);
this.writing("to_Wthickness", StrUtil.isEmpty(Wthickness) ? "0" : Wthickness);
//当前托盘砖数量
this.writing("to_tray_qty", StrUtil.isEmpty(qty) ? "0" : qty);
this.writing("to_tray_high", StrUtil.isEmpty(tray_high) ? "0" : tray_high);
this.writing("to_crib_category", StrUtil.isEmpty(crib_category) ? "0" : crib_category);
this.writing("to_palletX1_line", StrUtil.isEmpty(palletX1_line) ? "0" : palletX1_line);
this.writing("to_palletY1_row", StrUtil.isEmpty(palletY1_row) ? "0" : palletY1_row);
this.writing("to_palletA1_angle", StrUtil.isEmpty(palletA1_angle) ? "0" : palletA1_angle);
this.writing("to_palletX2_line", StrUtil.isEmpty(palletX2_line) ? "0" : palletX2_line);
this.writing("to_palletY2_row", StrUtil.isEmpty(palletY2_row) ? "0" : palletY2_row);
this.writing("to_palletA2_angle", StrUtil.isEmpty(palletA2_angle) ? "0" : palletA2_angle);
this.writing("to_palletX3_line", StrUtil.isEmpty(palletX3_line) ? "0" : palletX3_line);
this.writing("to_palletY3_row", StrUtil.isEmpty(palletY3_row) ? "0" : palletY3_row);
this.writing("to_palletA3_angle", StrUtil.isEmpty(palletA3_angle) ? "0" : palletA3_angle);
this.writing("to_pressCribX1_line", StrUtil.isEmpty(pressCribX1_line) ? "0" : pressCribX1_line);
this.writing("to_pressCribY1_row", StrUtil.isEmpty(pressCribY1_row) ? "0" : pressCribY1_row);
this.writing("to_pressCribA1_angle", StrUtil.isEmpty(pressCribA1_angle) ? "0" : pressCribA1_angle);
this.writing("to_pressCribX2_line", StrUtil.isEmpty(pressCribX2_line) ? "0" : pressCribX2_line);
this.writing("to_pressCribY2_row", StrUtil.isEmpty(pressCribY2_row) ? "0" : pressCribY2_row);
this.writing("to_pressCribA2_angle", StrUtil.isEmpty(pressCribA2_angle) ? "0" : pressCribA2_angle);
this.writing("to_pressCribX3_line", StrUtil.isEmpty(pressCribX3_line) ? "0" : pressCribX3_line);
this.writing("to_pressCribY3_row", StrUtil.isEmpty(pressCribY3_row) ? "0" : pressCribY3_row);
this.writing("to_pressCribA3_angle", StrUtil.isEmpty(pressCribA3_angle) ? "0" : pressCribA3_angle);
this.writing("to_Zoffset", StrUtil.isEmpty(Zoffset) ? "0" : Zoffset);
this.writing("to_pallet_layerQty", StrUtil.isEmpty(pallet_layerQty) ? "0" : pallet_layerQty);
this.writing("to_pressCrib_layerQty", StrUtil.isEmpty(pressCrib_layerQty) ? "0" : pressCrib_layerQty);
this.writing("to_codeLayerX1_interval", StrUtil.isEmpty(codeLayerX1_interval) ? "0" : codeLayerX1_interval);
this.writing("to_codeLayerY1_interval", StrUtil.isEmpty(codeLayerY1_interval) ? "0" : codeLayerY1_interval);
this.writing("to_codeLayerX2_interval", StrUtil.isEmpty(codeLayerX2_interval) ? "0" : codeLayerX2_interval);
this.writing("to_codeLayerY2_interval", StrUtil.isEmpty(codeLayerY2_interval) ? "0" : codeLayerY2_interval);
this.writing("to_codeLayerX3_interval", StrUtil.isEmpty(codeLayerX3_interval) ? "0" : codeLayerX3_interval);
this.writing("to_codeLayerY3_interval", StrUtil.isEmpty(codeLayerY3_interval) ? "0" : codeLayerY3_interval);
this.writing("to_codeLayerX1_offset", StrUtil.isEmpty(codeLayerX1_offset) ? "0" : codeLayerX1_offset);
this.writing("to_codeLayerY1_offset", StrUtil.isEmpty(codeLayerY1_offset) ? "0" : codeLayerY1_offset);
this.writing("to_codeLayerX2_offset", StrUtil.isEmpty(codeLayerX2_offset) ? "0" : codeLayerX2_offset);
this.writing("to_codeLayerY2_offset", StrUtil.isEmpty(codeLayerY2_offset) ? "0" : codeLayerY2_offset);
this.writing("to_codeLayerX3_offset", StrUtil.isEmpty(codeLayerX3_offset) ? "0" : codeLayerX3_offset);
this.writing("to_codeLayerY3_offset", StrUtil.isEmpty(codeLayerY3_offset) ? "0" : codeLayerY3_offset);
this.writing("to_pressLayerX1_interval", StrUtil.isEmpty(pressLayerX1_interval) ? "0" : pressLayerX1_interval);
this.writing("to_pressLayerY1_interval", StrUtil.isEmpty(pressLayerY1_interval) ? "0" : pressLayerY1_interval);
this.writing("to_pressLayerX2_interval", StrUtil.isEmpty(pressLayerX2_interval) ? "0" : pressLayerX2_interval);
this.writing("to_pressLayerY2_interval", StrUtil.isEmpty(pressLayerY2_interval) ? "0" : pressLayerY2_interval);
this.writing("to_pressLayerX3_interval", StrUtil.isEmpty(pressLayerX3_interval) ? "0" : pressLayerX3_interval);
this.writing("to_pressLayerY3_interval", StrUtil.isEmpty(pressLayerY3_interval) ? "0" : pressLayerY3_interval);
this.writing("to_pressLayerX1_offset", StrUtil.isEmpty(pressLayerX1_offset) ? "0" : pressLayerX1_offset);
this.writing("to_pressLayerY1_offset", StrUtil.isEmpty(pressLayerY1_offset) ? "0" : pressLayerY1_offset);
this.writing("to_pressLayerX2_offset", StrUtil.isEmpty(pressLayerX2_offset) ? "0" : pressLayerX2_offset);
this.writing("to_pressLayerY2_offset", StrUtil.isEmpty(pressLayerY2_offset) ? "0" : pressLayerY2_offset);
this.writing("to_pressLayerX3_offset", StrUtil.isEmpty(pressLayerX3_offset) ? "0" : pressLayerX3_offset);
this.writing("to_pressLayerY3_offset", StrUtil.isEmpty(pressLayerY3_offset) ? "0" : pressLayerY3_offset);
this.writing("to_tool_coordinate", StrUtil.isEmpty(tool_coordinate) ? "0" : tool_coordinate);
Thread.sleep(1000);
this.writing(this.mode);
this.setRequireSucess(true);
}
return true;
}
}
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);
}
} }

8
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java

@ -221,9 +221,9 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
break; break;
case 8: case 8:
//入窑扫码 //入窑扫码
if (!requireSucess && this.move != 0) { // if (!requireSucess && this.move != 0) {
reverseGroup(); // reverseGroup();
} // }
break; break;
} }
@ -300,7 +300,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isNotEmpty(result)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"),"200")) { if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"),"200")) {
this.writing(1); this.writing(this.mode);
this.setRequireSucess(true); this.setRequireSucess(true);
} }
} }

6
acs/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java

@ -327,11 +327,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//晟华工位模板 //晟华工位模板
if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) { if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver(); lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (lnshStationDeviceDriver.getMode() != 0 && lnshStationDeviceDriver.getMove() == 0 if (lnshStationDeviceDriver.getMode() != 0
&& lnshStationDeviceDriver.getMove() == 0
&& (lnshStationDeviceDriver.getAction() == 1 || lnshStationDeviceDriver.getAction() == 3)
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)) { && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)) {
inst.setExecute_status("3"); inst.setExecute_status("3");
instructionService.update(inst); instructionService.update(inst);
lnshStationDeviceDriver.writing(6); // lnshStationDeviceDriver.writing(6);
lnshStationDeviceDriver.writing(3,Integer.parseInt(inst.getInstruction_code())); lnshStationDeviceDriver.writing(3,Integer.parseInt(inst.getInstruction_code()));
data = AgvService.sendAgvOneModeInst(phase, index, 0); data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true; flag = true;

36
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -352,37 +352,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
*/ */
@Override @Override
public void manipulatorApply(JSONObject jsonObject) { public void manipulatorApply(JSONObject jsonObject) {
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject groupTab = WQLObject.getWQLObject("st_buss_vehiclegroup"); WQLObject groupTab = WQLObject.getWQLObject("st_buss_vehiclegroup");
//组盘 //组盘
JSONObject produceInfoByCode = new JSONObject(); JSONObject produceInfoByCode = new JSONObject();
String device_code = jsonObject.getString("device_code"); // 对接位 String device_code = jsonObject.getString("device_code"); // 对接位
// vehicle_code:不一定有,分拣码垛会提供木托盘载具号、压制码垛是不提供载具号 // vehicle_code 载具编码
String vehicle_code = jsonObject.getString("vehicle_code"); String vehicle_code = String.format("%04d", jsonObject.getIntValue("vehicle_code"));
String qty = String.valueOf(jsonObject.get("qty")); String qty = String.valueOf(jsonObject.get("qty"));
produceInfoByCode = this.getProduceInfoByCode(device_code); // 获取设备的 produceInfoByCode = this.getProduceInfoByCode(device_code); // 获取设备的
String material_id = (String) produceInfoByCode.get("material_id"); String material_id = produceInfoByCode.getString("material_id");
String cust_id = (String) produceInfoByCode.get("cust_id"); String cust_id = produceInfoByCode.getString("cust_id");
String producetask_id = (String) produceInfoByCode.get("workorder_id"); String producetask_id = produceInfoByCode.getString("workorder_id");
// 物料 // 物料
JSONObject materialObj = WQLObject JSONObject materialObj = WQLObject
.getWQLObject("MD_ME_MaterialBase") .getWQLObject("MD_ME_MaterialBase")
.query("material_id = '" + material_id + "'") .query("material_id = '" + material_id + "'")
.uniqueResult(0); .uniqueResult(0);
// 机械手下料位
JSONObject pointObj = pointTab.query("point_code = '" + device_code + "'").uniqueResult(0); groupTab.delete("vehicle_code = '" + vehicle_code + "'");
JSONObject groupObj = new JSONObject(); JSONObject groupObj = new JSONObject();
if (ObjectUtil.isNotEmpty(pointObj.getString("group_id"))) { // 存在组盘id,表示是半托 groupObj.put("group_id", IdUtil.getSnowflake(1, 1).nextId());
// 半托只需要修改参数即可 groupObj.put("vehicle_code", vehicle_code);
groupObj = groupTab.query("group_id = '" + pointObj.getString("group_id") + "'").uniqueResult(0);
jsonObject.put("group_id", pointObj.getString("group_id")); // 组盘标识
} else {
long nextId = IdUtil.getSnowflake(1, 1).nextId();
groupObj.put("group_id", nextId);
jsonObject.put("group_id", nextId); // 组盘标识
}
if (device_code.startsWith("FJ"))
groupObj.put("vehicle_code", String.format("%04d", Integer.parseInt(vehicle_code)));
groupObj.put("material_uuid", material_id); groupObj.put("material_uuid", material_id);
groupObj.put("material_code", materialObj.getString("material_code")); groupObj.put("material_code", materialObj.getString("material_code"));
groupObj.put("material_name", materialObj.getString("material_name")); groupObj.put("material_name", materialObj.getString("material_name"));
@ -446,14 +437,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
groupObj.put("create_id", "22"); groupObj.put("create_id", "22");
groupObj.put("create_name", "ACS系统"); groupObj.put("create_name", "ACS系统");
groupObj.put("create_time", DateUtil.now()); groupObj.put("create_time", DateUtil.now());
if (ObjectUtil.isNotEmpty(pointObj.getString("group_id"))) {
groupTab.update(groupObj);
// 清除对接位的组盘标识
pointObj.put("group_id", null);
pointTab.update(pointObj);
} else {
groupTab.insert(groupObj); groupTab.insert(groupObj);
}
// 入库 // 入库
jsonObject.put("type", "1"); jsonObject.put("type", "1");
this.apply(jsonObject); this.apply(jsonObject);

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendMaterial/YzjSendMaterialTask.java

@ -162,7 +162,7 @@ public class YzjSendMaterialTask extends AbstractAcsTask {
point2Obj.put("vehicle_code", taskObj.getString("vehicle_code")); point2Obj.put("vehicle_code", taskObj.getString("vehicle_code"));
point2Obj.put("vehicle_qty", "1"); // 入库为1个载具 point2Obj.put("vehicle_qty", "1"); // 入库为1个载具
point2Obj.put("is_full", requestObj.getString("is_full")); point2Obj.put("is_full", requestObj.getString("is_full"));
point2Obj.put("group_id", taskObj.getString("group_id")); // 组盘标识 // point2Obj.put("group_id", taskObj.getString("group_id")); // 组盘标识
// 解锁终点 // 解锁终点
point2Obj.put("lock_type", PointEnum.LOCK_TYPE_FALSE.getCode()); point2Obj.put("lock_type", PointEnum.LOCK_TYPE_FALSE.getCode());
point2Obj.put("point_status", PointEnum.POINT_STATUS_HAVE_MATERIAL.getCode()); point2Obj.put("point_status", PointEnum.POINT_STATUS_HAVE_MATERIAL.getCode());

Loading…
Cancel
Save