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)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) { if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
JSONObject joo = JSONObject.parseObject(jsonObject.get("data").toString()); // JSONObject joo = JSONObject.parseObject(jsonObject.get("data").toString());
String ext_task_uuid = joo.getString("ext_task_uuid"); // String ext_task_uuid = joo.getString("ext_task_uuid");
String task_code = joo.getString("task_code"); // String task_code = joo.getString("task_code");
String start_point_code = joo.getString("start_device_code"); // String start_point_code = joo.getString("start_device_code");
String next_point_code = joo.getString("next_device_code"); // String next_point_code = joo.getString("next_device_code");
String start_device_code = ""; // String start_device_code = "";
String next_device_code = ""; // String next_device_code = "";
if (StrUtil.isEmpty(task_code)) { // if (StrUtil.isEmpty(task_code)) {
throw new WDKException("任务号不能为空"); // throw new WDKException("任务号不能为空");
} // }
if (StrUtil.isEmpty(start_point_code)) { // if (StrUtil.isEmpty(start_point_code)) {
throw new WDKException("起点不能为空"); // throw new WDKException("起点不能为空");
} // }
if (StrUtil.isEmpty(next_point_code)) { // if (StrUtil.isEmpty(next_point_code)) {
throw new WDKException("终点不能为空"); // throw new WDKException("终点不能为空");
} // }
//
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0); // JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) { // 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_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); // JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(next_device_json)) { // 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_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 priority = joo.getString("priority");
String vehicle_code = joo.getString("vehicle_code"); // String vehicle_code = joo.getString("vehicle_code");
String vehicle_type = joo.getString("vehicle_type"); // String vehicle_type = joo.getString("vehicle_type");
String route_plan_code = joo.getString("route_plan_code"); // String route_plan_code = joo.getString("route_plan_code");
String task_type = joo.getString("task_type"); // String task_type = joo.getString("task_type");
String remark = joo.getString("remark"); // String remark = joo.getString("remark");
String params = joo.getString("params"); // String params = joo.getString("params");
//
if (start_point_code.indexOf("-") > 0) { // if (start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-"); // String str[] = start_point_code.split("-");
start_device_code = str[0]; // start_device_code = str[0];
} else { // } else {
start_device_code = start_point_code; // start_device_code = start_point_code;
} // }
//
if (next_point_code.indexOf("-") > 0) { // if (next_point_code.indexOf("-") > 0) {
String str[] = next_point_code.split("-"); // String str[] = next_point_code.split("-");
next_device_code = str[0]; // next_device_code = str[0];
} else { // } else {
next_device_code = next_point_code; // next_device_code = next_point_code;
} // }
//
if (StrUtil.isEmpty(route_plan_code)) { // if (StrUtil.isEmpty(route_plan_code)) {
route_plan_code = "normal"; // route_plan_code = "normal";
} // }
//
JSONObject jo = new JSONObject(); // JSONObject jo = new JSONObject();
jo.put("task_code", task_code); // jo.put("task_code", task_code);
jo.put("ext_task_uuid", ext_task_uuid); // jo.put("ext_task_uuid", ext_task_uuid);
jo.put("start_point_code", start_point_code); // jo.put("start_point_code", start_point_code);
jo.put("next_point_code", next_point_code); // jo.put("next_point_code", next_point_code);
jo.put("start_parent_code", start_point_code); // jo.put("start_parent_code", start_point_code);
jo.put("next_parent_code", next_point_code); // jo.put("next_parent_code", next_point_code);
jo.put("start_device_code", start_device_code); // jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code); // jo.put("next_device_code", next_device_code);
jo.put("priority", priority); // jo.put("priority", priority);
jo.put("vehicle_code", vehicle_code); // jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_type", vehicle_type); // jo.put("vehicle_type", vehicle_type);
jo.put("remark", remark); // jo.put("remark", remark);
jo.put("params", params); // jo.put("params", params);
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); // jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
//
TaskDto task_dto = jo.toJavaObject(TaskDto.class); // TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try { // try {
taskserver.create(task_dto); // taskserver.create(task_dto);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
//
} // }
//
Instruction instdto = new Instruction(); // Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID()); // instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code); // instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(task_dto.getRemark()); // instdto.setRemark(task_dto.getRemark());
instdto.setMaterial(task_dto.getMaterial()); // instdto.setMaterial(task_dto.getMaterial());
instdto.setQuantity(task_dto.getQuantity()); // instdto.setQuantity(task_dto.getQuantity());
instdto.setTask_id(task_dto.getTask_id()); // instdto.setTask_id(task_dto.getTask_id());
instdto.setTask_code(task_dto.getTask_code()); // instdto.setTask_code(task_dto.getTask_code());
instdto.setVehicle_code(task_dto.getVehicle_code()); // instdto.setVehicle_code(task_dto.getVehicle_code());
String now = DateUtil.now(); // String now = DateUtil.now();
instdto.setCreate_time(now); // instdto.setCreate_time(now);
instdto.setCreate_by("auto"); // instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code); // instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code); // instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code); // instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code); // instdto.setNext_point_code(next_point_code);
instdto.setPriority(priority); // instdto.setPriority(priority);
instdto.setInstruction_status("0"); // instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code); // instdto.setExecute_device_code(start_point_code);
//
try { // try {
instructionService.create(instdto); // instructionService.create(instdto);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
//
} // }
//
//创建指令后修改任务状态 // //创建指令后修改任务状态
WQLObject taskwo = WQLObject.getWQLObject("acs_task"); // WQLObject taskwo = WQLObject.getWQLObject("acs_task");
//
task_dto.setTask_status("1"); // task_dto.setTask_status("1");
//创建指令后修改任务状态 // //创建指令后修改任务状态
task_dto.setTask_status("1"); // task_dto.setTask_status("1");
taskserver.update(task_dto); // taskserver.update(task_dto);
this.writing(1); this.writing(1);
this.setRequireSucess(true); this.setRequireSucess(true);

View File

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

View File

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