This commit is contained in:
loujf
2022-10-13 07:56:10 +08:00
parent c41887c1fa
commit 13ed468b00
3 changed files with 112 additions and 112 deletions

View File

@@ -393,115 +393,115 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
JSONObject joo = JSONObject.parseObject(jsonObject.get("data").toString());
String ext_task_uuid = joo.getString("ext_task_uuid");
String task_code = joo.getString("task_code");
String start_point_code = joo.getString("start_device_code");
String next_point_code = joo.getString("next_device_code");
String start_device_code = "";
String next_device_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");
}
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");
}
String priority = joo.getString("priority");
String vehicle_code = joo.getString("vehicle_code");
String vehicle_type = joo.getString("vehicle_type");
String route_plan_code = joo.getString("route_plan_code");
String task_type = joo.getString("task_type");
String remark = joo.getString("remark");
String params = joo.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";
}
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_point_code);
jo.put("next_parent_code", next_point_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));
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
taskserver.create(task_dto);
} catch (Exception e) {
e.printStackTrace();
}
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(task_dto.getRemark());
instdto.setMaterial(task_dto.getMaterial());
instdto.setQuantity(task_dto.getQuantity());
instdto.setTask_id(task_dto.getTask_id());
instdto.setTask_code(task_dto.getTask_code());
instdto.setVehicle_code(task_dto.getVehicle_code());
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
try {
instructionService.create(instdto);
} catch (Exception e) {
e.printStackTrace();
}
//创建指令后修改任务状态
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
task_dto.setTask_status("1");
//创建指令后修改任务状态
task_dto.setTask_status("1");
taskserver.update(task_dto);
// JSONObject joo = JSONObject.parseObject(jsonObject.get("data").toString());
// String ext_task_uuid = joo.getString("ext_task_uuid");
// String task_code = joo.getString("task_code");
// String start_point_code = joo.getString("start_device_code");
// String next_point_code = joo.getString("next_device_code");
// String start_device_code = "";
// String next_device_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");
// }
// 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");
// }
// String priority = joo.getString("priority");
// String vehicle_code = joo.getString("vehicle_code");
// String vehicle_type = joo.getString("vehicle_type");
// String route_plan_code = joo.getString("route_plan_code");
// String task_type = joo.getString("task_type");
// String remark = joo.getString("remark");
// String params = joo.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";
// }
//
// 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_point_code);
// jo.put("next_parent_code", next_point_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));
//
// TaskDto task_dto = jo.toJavaObject(TaskDto.class);
// try {
// taskserver.create(task_dto);
// } catch (Exception e) {
// e.printStackTrace();
//
// }
//
// Instruction instdto = new Instruction();
// instdto.setInstruction_id(IdUtil.simpleUUID());
// instdto.setRoute_plan_code(route_plan_code);
// instdto.setRemark(task_dto.getRemark());
// instdto.setMaterial(task_dto.getMaterial());
// instdto.setQuantity(task_dto.getQuantity());
// instdto.setTask_id(task_dto.getTask_id());
// instdto.setTask_code(task_dto.getTask_code());
// instdto.setVehicle_code(task_dto.getVehicle_code());
// String now = DateUtil.now();
// instdto.setCreate_time(now);
// instdto.setCreate_by("auto");
// instdto.setStart_device_code(start_device_code);
// instdto.setNext_device_code(next_device_code);
// instdto.setStart_point_code(start_point_code);
// instdto.setNext_point_code(next_point_code);
// instdto.setPriority(priority);
// instdto.setInstruction_status("0");
// instdto.setExecute_device_code(start_point_code);
//
// try {
// instructionService.create(instdto);
// } catch (Exception e) {
// e.printStackTrace();
//
// }
//
// //创建指令后修改任务状态
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
//
// task_dto.setTask_status("1");
// //创建指令后修改任务状态
// task_dto.setTask_status("1");
// taskserver.update(task_dto);
this.writing(1);
this.setRequireSucess(true);

View File

@@ -515,7 +515,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
public Map<String, Object> queryDevice(String jsonObject) throws Exception {
try {
MDC.put(log_file_type, log_type);
log.info("queryDevice--------------:输入参数" + jsonObject.toString());
// log.info("queryDevice--------------:输入参数" + jsonObject.toString());
JSONArray backja = new JSONArray();
JSONArray datas = JSONArray.parseArray(jsonObject);
@@ -1003,7 +1003,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
resultJson.put("status", HttpStatus.OK);
resultJson.put("message", "操作成功");
resultJson.put("data", backja);
log.info("queryDevice--------------:输出参数" + resultJson.toString());
// log.info("queryDevice--------------:输出参数" + resultJson.toString());
return resultJson;
} finally {
MDC.remove(log_file_type);

View File

@@ -116,7 +116,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (StrUtil.equals(area_type, AreaEnum.YZQY.getCode()) && stewing_time <= 0) {
//1.首先更新所有输送线的点位状态
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", "07").addParam("flag", "4").process().getResultJSONArray(0);
//PointUpdateUtil.updatePoint(pointarr);
PointUpdateUtil.updatePoint(pointarr);
//2.找一个合适的输送带
JSONObject pointObj = StructFindUtil.getConveyor(materiralObj);
//如果未找到合适的输送带 就去货架