|
|
@ -633,9 +633,11 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic |
|
|
|
} |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
|
|
|
|
//获取托盘信息
|
|
|
|
if (!requireSucess && this.move != 0) { |
|
|
|
getVehicle(); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
switch (flag) { |
|
|
@ -1117,4 +1119,160 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|