解决一个任务未完成导致后续任务不处理
This commit is contained in:
@@ -71,108 +71,111 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
try {
|
try {
|
||||||
JSONArray errArr = new JSONArray();
|
JSONArray errArr = new JSONArray();
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
JSONObject task = tasks.getJSONObject(i);
|
String ext_task_uuid = null;
|
||||||
String ext_task_uuid = task.getString("ext_task_uuid");
|
String task_code = null;
|
||||||
String task_code = task.getString("task_code");
|
|
||||||
String start_point_code = task.getString("start_device_code");
|
|
||||||
String next_point_code = task.getString("next_device_code");
|
|
||||||
String start_device_code = "";
|
|
||||||
String next_device_code = "";
|
|
||||||
String start_parent_code = "";
|
|
||||||
String next_parent_code = "";
|
|
||||||
if (StrUtil.isEmpty(task_code)) {
|
|
||||||
throw new WDKException("任务号不能为空");
|
|
||||||
}
|
|
||||||
if (StrUtil.isEmpty(start_point_code)) {
|
|
||||||
throw new WDKException("起点不能为空");
|
|
||||||
}
|
|
||||||
if (StrUtil.isEmpty(next_point_code)) {
|
|
||||||
throw new WDKException("终点不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
|
|
||||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
|
||||||
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("storage_code");
|
|
||||||
start_parent_code = start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("parent_storage_code");
|
|
||||||
}
|
|
||||||
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0);
|
|
||||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
|
||||||
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
|
||||||
next_parent_code = next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("parent_storage_code");
|
|
||||||
}
|
|
||||||
String priority = task.getString("priority");
|
|
||||||
String vehicle_code = task.getString("vehicle_code");
|
|
||||||
String vehicle_type = task.getString("vehicle_type");
|
|
||||||
String route_plan_code = task.getString("route_plan_code");
|
|
||||||
String task_type = task.getString("task_type");
|
|
||||||
String remark = task.getString("remark");
|
|
||||||
String params = task.getString("params");
|
|
||||||
|
|
||||||
if (start_point_code.indexOf("-") > 0) {
|
|
||||||
String str[] = start_point_code.split("-");
|
|
||||||
start_device_code = str[0];
|
|
||||||
} else {
|
|
||||||
start_device_code = start_point_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (next_point_code.indexOf("-") > 0) {
|
|
||||||
String str[] = next_point_code.split("-");
|
|
||||||
next_device_code = str[0];
|
|
||||||
} else {
|
|
||||||
next_device_code = next_point_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isEmpty(route_plan_code)) {
|
|
||||||
route_plan_code = "normal";
|
|
||||||
}
|
|
||||||
List<RouteLineDto> list = RouteLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(list)) {
|
|
||||||
throw new WDKException("路由不通!");
|
|
||||||
}
|
|
||||||
TaskDto taskDto = TaskService.findByCodeFromCache(task_code);
|
|
||||||
if (taskDto != null) {
|
|
||||||
throw new WDKException("不能存在相同的任务号!");
|
|
||||||
}
|
|
||||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
|
||||||
TaskDto vehicle_dto = TaskService.findByContainer(vehicle_code);
|
|
||||||
if (vehicle_dto != null) {
|
|
||||||
throw new WDKException("已存在该载具号的任务!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
jo.put("task_code", task_code);
|
|
||||||
jo.put("ext_task_uuid", ext_task_uuid);
|
|
||||||
jo.put("start_point_code", start_point_code);
|
|
||||||
jo.put("next_point_code", next_point_code);
|
|
||||||
jo.put("start_parent_code", start_parent_code);
|
|
||||||
jo.put("next_parent_code", next_parent_code);
|
|
||||||
jo.put("start_device_code", start_device_code);
|
|
||||||
jo.put("next_device_code", next_device_code);
|
|
||||||
jo.put("priority", priority);
|
|
||||||
jo.put("vehicle_code", vehicle_code);
|
|
||||||
jo.put("vehicle_type", vehicle_type);
|
|
||||||
jo.put("remark", remark);
|
|
||||||
jo.put("params", params);
|
|
||||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
|
||||||
// 如果是无光电的设备 指令完成变更起点、终点状态
|
|
||||||
JSONObject startjo = new JSONObject();
|
|
||||||
startjo.put("device_code", start_device_code);
|
|
||||||
startjo.put("hasGoodStatus", "2");
|
|
||||||
startjo.put("material_type", "");
|
|
||||||
startjo.put("batch", "");
|
|
||||||
startjo.put("islock", "false");
|
|
||||||
DeviceService.changeDeviceStatus(startjo);
|
|
||||||
|
|
||||||
JSONObject nextjo = new JSONObject();
|
|
||||||
nextjo.put("device_code", next_device_code);
|
|
||||||
nextjo.put("hasGoodStatus", "0");
|
|
||||||
nextjo.put("material_type", "");
|
|
||||||
nextjo.put("batch", "");
|
|
||||||
nextjo.put("islock", "false");
|
|
||||||
DeviceService.changeDeviceStatus(nextjo);
|
|
||||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
|
||||||
try {
|
try {
|
||||||
|
JSONObject task = tasks.getJSONObject(i);
|
||||||
|
ext_task_uuid = task.getString("ext_task_uuid");
|
||||||
|
task_code = task.getString("task_code");
|
||||||
|
String start_point_code = task.getString("start_device_code");
|
||||||
|
String next_point_code = task.getString("next_device_code");
|
||||||
|
String start_device_code = "";
|
||||||
|
String next_device_code = "";
|
||||||
|
String start_parent_code = "";
|
||||||
|
String next_parent_code = "";
|
||||||
|
if (StrUtil.isEmpty(task_code)) {
|
||||||
|
throw new WDKException("任务号不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(start_point_code)) {
|
||||||
|
throw new WDKException("起点不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(next_point_code)) {
|
||||||
|
throw new WDKException("终点不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
|
||||||
|
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||||
|
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("storage_code");
|
||||||
|
start_parent_code = start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("parent_storage_code");
|
||||||
|
}
|
||||||
|
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0);
|
||||||
|
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||||
|
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
||||||
|
next_parent_code = next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("parent_storage_code");
|
||||||
|
}
|
||||||
|
String priority = task.getString("priority");
|
||||||
|
String vehicle_code = task.getString("vehicle_code");
|
||||||
|
String vehicle_type = task.getString("vehicle_type");
|
||||||
|
String route_plan_code = task.getString("route_plan_code");
|
||||||
|
String task_type = task.getString("task_type");
|
||||||
|
String remark = task.getString("remark");
|
||||||
|
String params = task.getString("params");
|
||||||
|
|
||||||
|
if (start_point_code.indexOf("-") > 0) {
|
||||||
|
String str[] = start_point_code.split("-");
|
||||||
|
start_device_code = str[0];
|
||||||
|
} else {
|
||||||
|
start_device_code = start_point_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (next_point_code.indexOf("-") > 0) {
|
||||||
|
String str[] = next_point_code.split("-");
|
||||||
|
next_device_code = str[0];
|
||||||
|
} else {
|
||||||
|
next_device_code = next_point_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isEmpty(route_plan_code)) {
|
||||||
|
route_plan_code = "normal";
|
||||||
|
}
|
||||||
|
List<RouteLineDto> list = RouteLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(list)) {
|
||||||
|
throw new WDKException("路由不通!");
|
||||||
|
}
|
||||||
|
TaskDto taskDto = TaskService.findByCodeFromCache(task_code);
|
||||||
|
if (taskDto != null) {
|
||||||
|
throw new WDKException("不能存在相同的任务号!");
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
|
TaskDto vehicle_dto = TaskService.findByContainer(vehicle_code);
|
||||||
|
if (vehicle_dto != null && !StrUtil.equals(vehicle_code, "999") && !StrUtil.equals(vehicle_code, "0000")) {
|
||||||
|
throw new WDKException("已存在该载具号的任务!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("task_code", task_code);
|
||||||
|
jo.put("ext_task_uuid", ext_task_uuid);
|
||||||
|
jo.put("start_point_code", start_point_code);
|
||||||
|
jo.put("next_point_code", next_point_code);
|
||||||
|
jo.put("start_parent_code", start_parent_code);
|
||||||
|
jo.put("next_parent_code", next_parent_code);
|
||||||
|
jo.put("start_device_code", start_device_code);
|
||||||
|
jo.put("next_device_code", next_device_code);
|
||||||
|
jo.put("priority", priority);
|
||||||
|
jo.put("vehicle_code", vehicle_code);
|
||||||
|
jo.put("vehicle_type", vehicle_type);
|
||||||
|
jo.put("remark", remark);
|
||||||
|
jo.put("params", params);
|
||||||
|
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||||
|
// 如果是无光电的设备 指令完成变更起点、终点状态
|
||||||
|
JSONObject startjo = new JSONObject();
|
||||||
|
startjo.put("device_code", start_device_code);
|
||||||
|
startjo.put("hasGoodStatus", "2");
|
||||||
|
startjo.put("material_type", "");
|
||||||
|
startjo.put("batch", "");
|
||||||
|
startjo.put("islock", "false");
|
||||||
|
DeviceService.changeDeviceStatus(startjo);
|
||||||
|
|
||||||
|
JSONObject nextjo = new JSONObject();
|
||||||
|
nextjo.put("device_code", next_device_code);
|
||||||
|
nextjo.put("hasGoodStatus", "0");
|
||||||
|
nextjo.put("material_type", "");
|
||||||
|
nextjo.put("batch", "");
|
||||||
|
nextjo.put("islock", "false");
|
||||||
|
DeviceService.changeDeviceStatus(nextjo);
|
||||||
|
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||||
|
|
||||||
TaskService.create(task_dto);
|
TaskService.create(task_dto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -201,7 +204,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
log.info("createFromWms--------------:输出参数:" + resultJson.toString());
|
log.info("createFromWms--------------:输出参数:" + resultJson.toString());
|
||||||
}
|
}
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +252,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resultJson.put("data", new JSONObject());
|
resultJson.put("data", new JSONObject());
|
||||||
log.info("cancelFromWms--------------:输出参数" + resultJson.toString());
|
log.info("cancelFromWms--------------:输出参数" + resultJson.toString());
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,21 +380,21 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing(3);
|
rljnPackagePalletSplitManipulatorDeviceDriver.writing(3);
|
||||||
is_flag = true;
|
is_flag = true;
|
||||||
}
|
}
|
||||||
//下发成功后,写入工单信息表记录
|
//下发成功后,写入工单信息表记录
|
||||||
ProduceshiftorderDto dto = new ProduceshiftorderDto();
|
ProduceshiftorderDto dto = new ProduceshiftorderDto();
|
||||||
dto.setOrder_code(producetask_code);
|
dto.setOrder_code(producetask_code);
|
||||||
dto.setProduct_type(product_type);
|
dto.setProduct_type(product_type);
|
||||||
dto.setDevice_code(device_code);
|
dto.setDevice_code(device_code);
|
||||||
dto.setOrder_status("0");
|
dto.setOrder_status("0");
|
||||||
dto.setMaterial_code(material_code);
|
dto.setMaterial_code(material_code);
|
||||||
dto.setMaterial_name(material_name);
|
dto.setMaterial_name(material_name);
|
||||||
dto.setCust_code(cust_code);
|
dto.setCust_code(cust_code);
|
||||||
dto.setCust_name(cust_name);
|
dto.setCust_name(cust_name);
|
||||||
dto.setModel(model);
|
dto.setModel(model);
|
||||||
dto.setMolten_pool(molten_pool);
|
dto.setMolten_pool(molten_pool);
|
||||||
dto.setWeight(weight);
|
dto.setWeight(weight);
|
||||||
dto.setQty(qty);
|
dto.setQty(qty);
|
||||||
produceshiftorderService.create(dto);
|
produceshiftorderService.create(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject resultJson = new JSONObject();
|
JSONObject resultJson = new JSONObject();
|
||||||
@@ -430,7 +433,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resultJson.put("data", new JSONObject());
|
resultJson.put("data", new JSONObject());
|
||||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +453,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resultJson.put("data", new JSONObject());
|
resultJson.put("data", new JSONObject());
|
||||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -510,7 +513,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resultJson.put("data", new JSONObject());
|
resultJson.put("data", new JSONObject());
|
||||||
log.info("putAction--------------:输出参数" + resultJson.toString());
|
log.info("putAction--------------:输出参数" + resultJson.toString());
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -604,7 +607,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
jo.put("Htrapezoidal", lnshPalletizingManipulatorSiteDeviceDriver.getHtrapezoidal());
|
jo.put("Htrapezoidal", lnshPalletizingManipulatorSiteDeviceDriver.getHtrapezoidal());
|
||||||
jo.put("Wthickness", lnshPalletizingManipulatorSiteDeviceDriver.getWthickness());
|
jo.put("Wthickness", lnshPalletizingManipulatorSiteDeviceDriver.getWthickness());
|
||||||
jo.put("batch", lnshPalletizingManipulatorSiteDeviceDriver.getBatch());
|
jo.put("batch", lnshPalletizingManipulatorSiteDeviceDriver.getBatch());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
|
||||||
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
|
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
|
||||||
jo.put("device_code", device.getDevice_code());
|
jo.put("device_code", device.getDevice_code());
|
||||||
jo.put("mode", lnshPalletizingManipulatorDeviceDriver.getMode());
|
jo.put("mode", lnshPalletizingManipulatorDeviceDriver.getMode());
|
||||||
@@ -626,7 +629,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
jo.put("Htrapezoidal", lnshPalletizingManipulatorDeviceDriver.getHtrapezoidal());
|
jo.put("Htrapezoidal", lnshPalletizingManipulatorDeviceDriver.getHtrapezoidal());
|
||||||
jo.put("Wthickness", lnshPalletizingManipulatorDeviceDriver.getWthickness());
|
jo.put("Wthickness", lnshPalletizingManipulatorDeviceDriver.getWthickness());
|
||||||
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
|
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
|
||||||
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
|
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
|
||||||
jo.put("device_code", device.getDevice_code());
|
jo.put("device_code", device.getDevice_code());
|
||||||
jo.put("mode", lnshKilnLaneDeviceDriver.getMode());
|
jo.put("mode", lnshKilnLaneDeviceDriver.getMode());
|
||||||
@@ -1023,7 +1026,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resultJson.put("data", backja);
|
resultJson.put("data", backja);
|
||||||
// log.info("queryDevice--------------:输出参数" + resultJson.toString());
|
// log.info("queryDevice--------------:输出参数" + resultJson.toString());
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user