|
|
|
|
@@ -2,6 +2,7 @@ package org.nl.wms.sch.tasks;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
@@ -144,31 +145,41 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
|
|
|
|
|
|
|
|
|
// 如果此时point_code2为空则生成起点确认的任务
|
|
|
|
|
if (ObjectUtil.isEmpty(point_code2)) {
|
|
|
|
|
JSONObject jsonTask = new JSONObject();
|
|
|
|
|
jsonTask.put("task_id", IdUtil.getSnowflake(1,1).nextId());
|
|
|
|
|
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
|
|
|
|
jsonTask.put("task_type", "");
|
|
|
|
|
jsonTask.put("task_status", "2");
|
|
|
|
|
jsonTask.put("point_code1", point_code1);
|
|
|
|
|
jsonTask.put("vehicle_type", jsonVehicle.getString("vehicle_type"));
|
|
|
|
|
jsonTask.put("vehicle_qty", qty);
|
|
|
|
|
jsonTask.put("vehicle_code", jsonVehicle.getString("vehicle_code"));
|
|
|
|
|
jsonTask.put("priority", "1");
|
|
|
|
|
jsonTask.put("handle_class", THIS_CLASS);
|
|
|
|
|
jsonTask.put("sort_seq", "1");
|
|
|
|
|
jsonTask.put("acs_task_type", "1");
|
|
|
|
|
jsonTask.put("create_time", DateUtil.now());
|
|
|
|
|
taskTab.insert(jsonTask);
|
|
|
|
|
task_id = jsonTask.getString("task_id");
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("task_status","2");
|
|
|
|
|
param.put("point_code1",point_code1);
|
|
|
|
|
param.put("vehicle_type",jsonVehicle.getString("vehicle_type"));
|
|
|
|
|
param.put("vehicle_qty",qty);
|
|
|
|
|
param.put("vehicle_code",jsonVehicle.getString("vehicle_code"));
|
|
|
|
|
task_id = this.pubCreateTask(param);
|
|
|
|
|
} else {
|
|
|
|
|
// 说明货梯无任务:找终点
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("vehicle_type", jsonVehicle.getString("vehicle_type"));
|
|
|
|
|
param.put("qty", qty);
|
|
|
|
|
String endPoint = this.endPoint(param);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果终点为空则创建起点确定的任务
|
|
|
|
|
if (ObjectUtil.isEmpty(endPoint)) {
|
|
|
|
|
JSONObject param2 = new JSONObject();
|
|
|
|
|
param2.put("task_status","2");
|
|
|
|
|
param2.put("point_code1",point_code1);
|
|
|
|
|
param2.put("vehicle_type",jsonVehicle.getString("vehicle_type"));
|
|
|
|
|
param2.put("vehicle_qty",qty);
|
|
|
|
|
param2.put("vehicle_code",jsonVehicle.getString("vehicle_code"));
|
|
|
|
|
task_id = this.pubCreateTask(param2);
|
|
|
|
|
} else {
|
|
|
|
|
// 不为空则创建到养生A区等待点的任务
|
|
|
|
|
JSONObject param2 = new JSONObject();
|
|
|
|
|
param2.put("task_status","4");
|
|
|
|
|
param2.put("point_code1",point_code1);
|
|
|
|
|
param2.put("point_code2",endPoint);
|
|
|
|
|
param2.put("vehicle_type",jsonVehicle.getString("vehicle_type"));
|
|
|
|
|
param2.put("vehicle_qty",qty);
|
|
|
|
|
param2.put("vehicle_code",jsonVehicle.getString("vehicle_code"));
|
|
|
|
|
task_id = this.pubCreateTask(param2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return task_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -209,14 +220,82 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
|
|
|
|
*/
|
|
|
|
|
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
|
|
|
|
|
|
|
|
|
|
String end_code = "";
|
|
|
|
|
|
|
|
|
|
String vehicle_type = param.getString("vehicle_type");
|
|
|
|
|
String qty = param.getString("qty");
|
|
|
|
|
|
|
|
|
|
// 1.找到对应类型的叠盘架
|
|
|
|
|
// pointTab.query("region_id = '"+Ta+"'")
|
|
|
|
|
JSONObject jsonDpjEnd = pointTab.query("region_id = '" + RegionTypeEnum.DPJQA.getId() + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDpjEnd)) {
|
|
|
|
|
// 判断数量 + 叠盘架的数量是否超过此叠盘架的最大数量
|
|
|
|
|
double add_num = NumberUtil.add(param.getIntValue("qty"), jsonDpjEnd.getIntValue("vehicle_qty"));
|
|
|
|
|
|
|
|
|
|
if (jsonDpjEnd.getDoubleValue("vehicle_max_qty") >= add_num) {
|
|
|
|
|
end_code = jsonDpjEnd.getString("point_code");
|
|
|
|
|
} else {
|
|
|
|
|
// 如果数量大于此叠盘架最大数量则查找叠盘架缓存位是否有对应空位
|
|
|
|
|
JSONObject jsonZcwEnd = pointTab.query("region_id = '" + RegionTypeEnum.KTPHCQA.getId() + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonZcwEnd)) {
|
|
|
|
|
end_code = jsonZcwEnd.getString("point_code");
|
|
|
|
|
} else {
|
|
|
|
|
// 为空就去养生A区的等待位
|
|
|
|
|
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and row_num = '1' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonEmpWait)) {
|
|
|
|
|
// 判断是否有任务
|
|
|
|
|
boolean is_point = this.isTask(jsonEmpWait.getString("point_code"));
|
|
|
|
|
if (is_point) {
|
|
|
|
|
JSONArray jsonEmpArr = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and col_num = '" + jsonEmpWait.getString("col_num") + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonEmpArr)) end_code = jsonEmpWait.getString("point_code");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 2.叠盘架没有空位去找叠盘暂存位
|
|
|
|
|
JSONObject jsonZcwEnd = pointTab.query("region_id = '" + RegionTypeEnum.KTPHCQA.getId() + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonZcwEnd)) {
|
|
|
|
|
end_code = jsonZcwEnd.getString("point_code");
|
|
|
|
|
} else {
|
|
|
|
|
// 为空就去养生A区的等待位
|
|
|
|
|
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and row_num = '1' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonEmpWait)) {
|
|
|
|
|
// 判断是否有任务
|
|
|
|
|
boolean is_point = this.isTask(jsonEmpWait.getString("point_code"));
|
|
|
|
|
if (is_point) {
|
|
|
|
|
JSONArray jsonEmpArr = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and col_num = '" + jsonEmpWait.getString("col_num") + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonEmpArr)) end_code = jsonEmpWait.getString("point_code");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return end_code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public String pubCreateTask(JSONObject param) {
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
|
|
|
|
|
|
|
|
|
JSONObject jsonTask = new JSONObject();
|
|
|
|
|
jsonTask.put("task_id", IdUtil.getSnowflake(1,1).nextId());
|
|
|
|
|
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
|
|
|
|
jsonTask.put("task_type", "");
|
|
|
|
|
jsonTask.put("task_status", param.getString("task_status"));
|
|
|
|
|
jsonTask.put("point_code1", param.getString("point_code1"));
|
|
|
|
|
jsonTask.put("point_code2", param.getString("point_code2"));
|
|
|
|
|
jsonTask.put("vehicle_type", param.getString("vehicle_type"));
|
|
|
|
|
jsonTask.put("vehicle_qty", param.getString("vehicle_qty"));
|
|
|
|
|
jsonTask.put("vehicle_code", param.getString("vehicle_code"));
|
|
|
|
|
jsonTask.put("priority", "1");
|
|
|
|
|
jsonTask.put("handle_class", THIS_CLASS);
|
|
|
|
|
jsonTask.put("sort_seq", "1");
|
|
|
|
|
jsonTask.put("acs_task_type", "1");
|
|
|
|
|
jsonTask.put("create_time", DateUtil.now());
|
|
|
|
|
taskTab.insert(jsonTask);
|
|
|
|
|
return jsonTask.getString("task_id");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
@@ -226,10 +305,10 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
|
|
|
|
|
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
|
|
JSONObject jsonPointCode1 = tab.query("point_code1 = '" + point_code + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode2 = tab.query("point_code2 = '" + point_code + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode3 = tab.query("point_code3 = '" + point_code + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode4 = tab.query("point_code4 = '" + point_code + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode1 = tab.query("point_code1 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode2 = tab.query("point_code2 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode3 = tab.query("point_code3 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
JSONObject jsonPointCode4 = tab.query("point_code4 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(jsonPointCode1) && ObjectUtil.isEmpty(jsonPointCode2) && ObjectUtil.isEmpty(jsonPointCode3) && ObjectUtil.isEmpty(jsonPointCode4)) {
|
|
|
|
|
result = true;
|
|
|
|
|
|