代码更新
This commit is contained in:
@@ -155,8 +155,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");//
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");// 任务表
|
||||
WQLObject regionTab = WQLObject.getWQLObject("ST_IVT_regionIO"); // 区域出入库表
|
||||
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
|
||||
// WQLObject veQtyTab = WQLObject.getWQLObject("PDM_BI_vehicleQty"); // 托盘对应数量表
|
||||
|
||||
|
||||
@@ -288,7 +289,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 查询载具号对应的数量
|
||||
JSONObject jsonVeQty = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(qty)) {
|
||||
// jsonVeQty = veQtyTab.query("vehicle_code = '" + vehicle_code + "' and is_task = '0' order by create_time DESC").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
|
||||
} else {
|
||||
jsonVeQty.put("qty", qty);
|
||||
@@ -298,19 +298,26 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
|
||||
HtSendEmpVehicleTask taskBean = SpringContextHolder.getBean(HtSendEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskTab.update(jsonTask);
|
||||
// 更新载具对应数量表
|
||||
// veQtyTab.update(jsonVeQty);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonTask.getString("task_status"), "4")) {
|
||||
// 起点终点确定则下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 更新任务状态
|
||||
jsonTask.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskTab.update(jsonTask);
|
||||
// 更新终点点位状态
|
||||
JSONObject jsonEndPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonEndPoint.put("lock_type", "2");
|
||||
pointTab.update(jsonEndPoint);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "7")) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
|
||||
@@ -7,7 +7,7 @@ public enum TaskStatusEnum {
|
||||
START_AND_POINT("4", "起点终点确认"),
|
||||
ISSUE("5", "下发"),
|
||||
EXECUTING("6", "执行中"),
|
||||
FINISHED("99", "完成");
|
||||
FINISHED("7", "完成");
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -14,7 +14,8 @@ public enum RegionTypeEnum {
|
||||
KTPHCQA(8, "KTPHCQA01", "空托盘缓存A区","1558015810096730112"),
|
||||
KTPHCQB(9, "KTPHCQB01", "空托盘缓存B区","1558015870570205184"),
|
||||
HKQY(10, "HKQY01", "豪凯区域","1564862312702152704"),
|
||||
SSX(12, "SSX01", "输送线区域","1559374522581389312");
|
||||
SSX(12, "SSX01", "输送线区域","1559374522581389312"),
|
||||
YSAQKTPQ01(13, "YSAQKTPQ01", "养生A空托盘区","1582909373552922624");
|
||||
|
||||
private int index;
|
||||
private String code;
|
||||
|
||||
Reference in New Issue
Block a user