rev
This commit is contained in:
@@ -260,31 +260,6 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
// case 5:
|
||||
// //获取托盘信息
|
||||
// if (!requireSucess) {
|
||||
// getVehicle();
|
||||
// }
|
||||
// break;
|
||||
// case 6:
|
||||
// //码垛完成
|
||||
// if (!requireSucess) {
|
||||
// applyEmpty();
|
||||
// palletizing();
|
||||
// }
|
||||
// break;
|
||||
// case 7:
|
||||
// //码垛强制完成
|
||||
// if (!requireSucess) {
|
||||
// mandatoryPalletizing();
|
||||
// }
|
||||
// break;
|
||||
// case 8:
|
||||
// //申请空盘
|
||||
// if (!requireSucess) {
|
||||
// applyEmpty();
|
||||
// }
|
||||
// break;
|
||||
case 4:
|
||||
//工单完成
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
@@ -295,6 +270,24 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// 报工
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", qty);
|
||||
this.reportForWork(json);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
// 工单暂停
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", qty);
|
||||
json.put("type", "3");
|
||||
enterProduction(json);
|
||||
}
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
@@ -632,6 +625,29 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean reportForWork(JSONObject json) {
|
||||
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;
|
||||
HttpResponse result = acsToWmsService.reportForWork(json);
|
||||
if (ObjectUtil.isNotEmpty(result) && HttpStatus.OK.value() == result.getStatus()) {
|
||||
JSONObject responseBody = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(responseBody)) {
|
||||
if (HttpStatus.OK.value() == responseBody.getIntValue("status")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(7);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1153,7 +1153,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
|
||||
json.put("pressLayerX3_offset", pressLayerX3_offset);
|
||||
json.put("pressLayerY3_offset", pressLayerY3_offset);
|
||||
json.put("tool_coordinate", tool_coordinate);
|
||||
HttpResponse response = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
HttpResponse response = acsToWmsService.fjPalletizationCompleted(json);
|
||||
if (ObjectUtil.isNotEmpty(response) && response.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject responseBody = JSONObject.parseObject(response.body());
|
||||
if (ObjectUtil.isNotEmpty(responseBody) && "200".equals(responseBody.getString("status"))) {
|
||||
@@ -1186,11 +1186,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
|
||||
}
|
||||
this.writing(23);
|
||||
} else {
|
||||
JSONObject write = new JSONObject();
|
||||
this.vd_id = data.getLongValue("ve_id");
|
||||
write.put("to_tray_qty", data.getString("qty"));
|
||||
write.put("to_command", 24);
|
||||
this.writing(write);
|
||||
this.vd_id = data.getLongValue("vd_id");
|
||||
this.writing("to_tray_qty", data.getString("qty"));
|
||||
this.writing(24);
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
|
||||
@@ -259,6 +259,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
json.put("avg_piece_weight", avg_piece_weight);
|
||||
this.reportForWork(json);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
// 工单暂停
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
|
||||
@@ -393,9 +393,14 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||
if (HttpStatus.OK.value() == jsonObject.getIntValue("status")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else if (HttpStatus.NO_CONTENT.value() == jsonObject.getIntValue("status")) {
|
||||
this.writing(18);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,6 +896,26 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
|
||||
} else if (deviceDriver.getMove() != 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 有货,无法生成指令。");
|
||||
} else if (deviceDriver.getError() != 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
|
||||
}
|
||||
int count = instructionService.queryDeviceInstCount(next_device_code);
|
||||
if (count > 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 已被占用,无法生成指令。");
|
||||
}
|
||||
} else if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver
|
||||
&& "true".equals(nextdevice.getExtraValue().get("inspect_in_stocck"))) {
|
||||
StandardInspectSiteDeviceDriver deviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
if (deviceDriver.getMode() == 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 未联机,无法生成指令。");
|
||||
} else if (deviceDriver.getMove() != 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 有货,无法生成指令。");
|
||||
} else if (deviceDriver.getError() != 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 异常,无法生成指令。");
|
||||
}
|
||||
int count = instructionService.queryDeviceInstCount(next_device_code);
|
||||
if (count > 0) {
|
||||
throw new BadRequestException("终点 [" + nextdevice.getDevice_name() + "] 已被占用,无法生成指令。");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,6 +947,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
|
||||
} else if (deviceDriver.getMove() == 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 无货,无法生成指令。");
|
||||
} else if (deviceDriver.getError() != 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
|
||||
}
|
||||
|
||||
int count = instructionService.queryDeviceInstCount(start_device_code);
|
||||
if (count > 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 已被占用,无法生成指令。");
|
||||
}
|
||||
} else if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver
|
||||
&& "true".equals(startdevice.getExtraValue().get("inspect_in_stocck"))) {
|
||||
StandardInspectSiteDeviceDriver deviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
if (deviceDriver.getMode() == 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 未联机,无法生成指令。");
|
||||
} else if (deviceDriver.getMove() == 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 无货,无法生成指令。");
|
||||
} else if (deviceDriver.getError() != 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 异常,无法生成指令。");
|
||||
}
|
||||
|
||||
int count = instructionService.queryDeviceInstCount(start_device_code);
|
||||
if (count > 0) {
|
||||
throw new BadRequestException("起点 [" + startdevice.getDevice_name() + "] 已被占用,无法生成指令。");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user