代码更新
This commit is contained in:
@@ -8,11 +8,9 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
@@ -25,7 +23,6 @@ import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.TaskService;
|
||||
import org.nl.wms.sch.service.dto.TaskDto;
|
||||
import org.nl.wms.sch.tasks.*;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -114,11 +111,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
result.put("errArr", errArr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
@Override
|
||||
public Map<String, Object> receivePointStatusFromAcs(Map<String, String> jsonObject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
@Override
|
||||
public Map<String, Object> orderFinish(String string) {
|
||||
@@ -172,286 +171,199 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
* 7.油漆线->输送线
|
||||
* 8.豪凯自动线下料入库
|
||||
*/
|
||||
JSONObject resuft = new JSONObject();
|
||||
try {
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
// 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
// 插入空载具作业记录表
|
||||
JSONObject jsonEmpParam = new JSONObject();
|
||||
jsonEmpParam.put("vehicle_qty", vehicle_num);
|
||||
jsonEmpParam.put("task_id", task_id);
|
||||
jsonEmpParam.put("io_type", "1");
|
||||
this.createEmp(jsonEmpParam);
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0")))
|
||||
throw new BadRequestException("物料数量不能为空或者为0");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code); // 满料位
|
||||
|
||||
SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param); // 创建任务
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
// 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.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);
|
||||
// 插入区域出入库表
|
||||
param.put("next_point_code", jsonTask.getString("next_point_code"));
|
||||
param.put("qty", qty);
|
||||
param.put("task_id", task_id);
|
||||
param.put("io_type", "0");
|
||||
JSONObject json = this.inCreateRegion(param);
|
||||
// 回显任务载具类型
|
||||
jsonTask.put("vehicle_type", json.getString("vehicle_type"));
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "3")) {
|
||||
// 3.油漆线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
// 插入空载具作业记录表
|
||||
JSONObject jsonEmpParam = new JSONObject();
|
||||
jsonEmpParam.put("vehicle_qty", vehicle_num);
|
||||
jsonEmpParam.put("task_id", task_id);
|
||||
jsonEmpParam.put("io_type", "1");
|
||||
this.createEmp(jsonEmpParam);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "4")) {
|
||||
// 4.油漆线申请物料: 调用物料出库库处理类创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code", point_code);
|
||||
param.put("io_type", "1");
|
||||
// 插入区域出库单
|
||||
JSONObject json = this.outCreateRegion(param);
|
||||
|
||||
param.put("vehicle_type", json.getString("vehicle_type"));
|
||||
param.put("material_id", json.getString("material_id"));
|
||||
param.put("create_mode", json.getString("create_mode"));
|
||||
param.put("iostorinv_id", json.getString("iostorinv_id"));
|
||||
// 创建任务
|
||||
CallMaterialTask taskBean = SpringContextHolder.getBean(CallMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
// 回显出库单:起始点位、起始区域、任务id
|
||||
JSONObject jsonRegion = regionTab.query("iostorinv_id = '" + json.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
jsonRegion.put("start_point_code", jsonTask.getString("start_point_code"));
|
||||
Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("start_point_code")).getRegion_id();
|
||||
jsonRegion.put("start_region_id", String.valueOf(start_region_id));
|
||||
jsonRegion.put("task_id", Long.valueOf(task_id));
|
||||
regionTab.update(jsonRegion);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "5")) {
|
||||
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
// 插入空载具作业记录表
|
||||
JSONObject jsonEmpParam = new JSONObject();
|
||||
jsonEmpParam.put("vehicle_qty", vehicle_num);
|
||||
jsonEmpParam.put("task_id", task_id);
|
||||
jsonEmpParam.put("io_type", "0");
|
||||
this.createEmp(jsonEmpParam);
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "6")) {
|
||||
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
// 查询载具号对应的数量
|
||||
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);
|
||||
}
|
||||
|
||||
param.put("qty", jsonVeQty.getString("qty"));
|
||||
param.put("start_point_code", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
// 插入空载具作业记录表
|
||||
JSONObject jsonEmpParam = new JSONObject();
|
||||
jsonEmpParam.put("vehicle_qty", jsonVeQty.getString("qty"));
|
||||
jsonEmpParam.put("task_id", task_id);
|
||||
jsonEmpParam.put("io_type", "0");
|
||||
this.createEmp(jsonEmpParam);
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
// 更新载具对应数量表
|
||||
// veQtyTab.update(jsonVeQty);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "7")) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
// 1.生成起点确定的任务
|
||||
SpringContextHolder.getBean(PointToPointTask.class).createTask(param);
|
||||
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
} else if (StrUtil.equals(type, "8")) {
|
||||
// 8.豪凯自动线下料入库
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
// 插入区域出入库表
|
||||
param.put("next_point_code", jsonTask.getString("next_point_code"));
|
||||
if (ObjectUtil.isEmpty(qty)) {
|
||||
param.put("qty", "1"); // 为空先写死1
|
||||
} else {
|
||||
param.put("qty", qty);
|
||||
}
|
||||
param.put("task_id", task_id);
|
||||
param.put("io_type", "0");
|
||||
JSONObject json = this.inCreateRegion(param);
|
||||
// 回显任务载具类型
|
||||
jsonTask.put("vehicle_type", json.getString("vehicle_type"));
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
resuft.put("status", "200");
|
||||
resuft.put("message", "");
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0")))
|
||||
throw new BadRequestException("物料数量不能为空或者为0");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code); // 满料位
|
||||
|
||||
SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param); // 创建任务
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
// 插入区域出入库表
|
||||
param.put("next_point_code", jsonTask.getString("next_point_code"));
|
||||
param.put("qty", qty);
|
||||
param.put("task_id", task_id);
|
||||
param.put("io_type", "0");
|
||||
JSONObject json = this.inCreateRegion(param);
|
||||
// 回显任务载具类型
|
||||
jsonTask.put("vehicle_type", json.getString("vehicle_type"));
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "3")) {
|
||||
// 3.油漆线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.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", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "4")) {
|
||||
// 4.油漆线申请物料: 调用物料出库库处理类创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code", point_code);
|
||||
param.put("io_type", "1");
|
||||
// 插入区域出库单
|
||||
JSONObject json = this.outCreateRegion(param);
|
||||
|
||||
param.put("vehicle_type", json.getString("vehicle_type"));
|
||||
param.put("material_id", json.getString("material_id"));
|
||||
param.put("create_mode", json.getString("create_mode"));
|
||||
param.put("iostorinv_id", json.getString("iostorinv_id"));
|
||||
// 创建任务
|
||||
CallMaterialTask taskBean = SpringContextHolder.getBean(CallMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
// 回显出库单:起始点位、起始区域、任务id
|
||||
JSONObject jsonRegion = regionTab.query("iostorinv_id = '" + json.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
jsonRegion.put("start_point_code", jsonTask.getString("start_point_code"));
|
||||
Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("start_point_code")).getRegion_id();
|
||||
jsonRegion.put("start_region_id", String.valueOf(start_region_id));
|
||||
jsonRegion.put("task_id", Long.valueOf(task_id));
|
||||
regionTab.update(jsonRegion);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "5")) {
|
||||
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.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", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "6")) {
|
||||
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
// 查询载具号对应的数量
|
||||
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);
|
||||
}
|
||||
|
||||
param.put("qty", jsonVeQty.getString("qty"));
|
||||
param.put("start_point_code", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.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", "05");
|
||||
taskTab.update(jsonTask);
|
||||
// 更新载具对应数量表
|
||||
// veQtyTab.update(jsonVeQty);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} else if (StrUtil.equals(type, "7")) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
// 1.生成起点确定的任务
|
||||
SpringContextHolder.getBean(PointToPointTask.class).createTask(param);
|
||||
} else if (StrUtil.equals(type, "8")) {
|
||||
// 8.豪凯自动线下料入库
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
// 插入区域出入库表
|
||||
param.put("next_point_code", jsonTask.getString("next_point_code"));
|
||||
if (ObjectUtil.isEmpty(qty)) {
|
||||
param.put("qty", "1"); // 为空先写死1
|
||||
} else {
|
||||
param.put("qty", qty);
|
||||
}
|
||||
param.put("task_id", task_id);
|
||||
param.put("io_type", "0");
|
||||
JSONObject json = this.inCreateRegion(param);
|
||||
// 回显任务载具类型
|
||||
jsonTask.put("vehicle_type", json.getString("vehicle_type"));
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
resuft.put("status", ((BadRequestException) e).getStatus());
|
||||
resuft.put("message", e.getMessage());
|
||||
}
|
||||
return resuft;
|
||||
return null;
|
||||
}
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createEmp(JSONObject json) {
|
||||
String vehicle_qty = json.getString("vehicle_qty");
|
||||
String task_id = json.getString("task_id");
|
||||
String io_type = json.getString("io_type");
|
||||
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");// 空载具作业记录表
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");// 空载具作业记录表
|
||||
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
JSONObject jsonEmp = new JSONObject();
|
||||
jsonEmp.put("record_uuid", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonEmp.put("bill_code", CodeUtil.getNewCode("KZJ_BILL_CODE"));
|
||||
jsonEmp.put("io_type", io_type);
|
||||
jsonEmp.put("bill_status", "20");
|
||||
jsonEmp.put("vehicle_qty", vehicle_qty);
|
||||
jsonEmp.put("start_point_code", jsonTask.getString("start_point_code"));
|
||||
Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("start_point_code")).getRegion_id();
|
||||
jsonEmp.put("start_region_id", start_region_id);
|
||||
jsonEmp.put("next_point_code", jsonTask.getString("next_point_code"));
|
||||
Long next_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("next_point_code")).getRegion_id();
|
||||
jsonEmp.put("end_region_id", next_region_id);
|
||||
jsonEmp.put("task_uuid", task_id);
|
||||
jsonEmp.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
jsonEmp.put("create_time", DateUtil.now());
|
||||
empTab.insert(jsonEmp);
|
||||
}
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject inCreateRegion(JSONObject json) {
|
||||
@@ -462,7 +374,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String io_type = json.getString("io_type");
|
||||
|
||||
WQLObject regionTab = WQLObject.getWQLObject("SCH_IVT_regionIO");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
|
||||
|
||||
@@ -505,13 +417,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
resuft.put("create_mode", jsonRegion.getString("create_mode"));
|
||||
return resuft;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject outCreateRegion(JSONObject json) {
|
||||
String next_point_code = json.getString("next_point_code");
|
||||
String io_type = json.getString("io_type");
|
||||
|
||||
WQLObject regionTab = WQLObject.getWQLObject("SCH_IVT_regionIO");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
|
||||
JSONObject jsonRegion = new JSONObject();
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
|
||||
@Override
|
||||
public List<ProduceshiftorderDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(ProduceshiftorderDto.class);
|
||||
return null;
|
||||
@@ -91,7 +91,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
|
||||
@Override
|
||||
public ProduceshiftorderDto findById(Long workorder_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(ProduceshiftorderDto.class);
|
||||
@@ -101,7 +101,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
|
||||
@Override
|
||||
public ProduceshiftorderDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(ProduceshiftorderDto.class);
|
||||
@@ -128,7 +128,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
json.put("sysdeptid", deptId);
|
||||
json.put("syscompanyid", deptId);
|
||||
@@ -149,7 +149,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
for (Long workorder_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("workorder_id", String.valueOf(workorder_id));
|
||||
@@ -180,7 +180,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
JSONObject json = wo.query("workorder_id = '" + param.getString("workorder_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json.getString("device_id"))) throw new BadRequestException("请先绑定设备");
|
||||
|
||||
|
||||
Binary file not shown.
@@ -41,7 +41,6 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
@@ -77,9 +76,8 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
|
||||
// 1.更新点位数量 2.解锁点位
|
||||
JSONObject jsonEmp = empTab.query("task_uuid = '" + task_id + "'").uniqueResult(0);
|
||||
int vehicle_qty = JSONObject.parseObject(JSON.toJSONString(start_point_code)).getIntValue("vehicle_qty");
|
||||
BigDecimal vehicle_qty_point = NumberUtil.sub(String.valueOf(vehicle_qty), String.valueOf(jsonEmp.getIntValue("vehicle_qty")));
|
||||
BigDecimal vehicle_qty_point = NumberUtil.sub(String.valueOf(vehicle_qty), String.valueOf(1));
|
||||
|
||||
start_point_code.setVehicle_qty(Integer.valueOf(vehicle_qty_point.toString()));
|
||||
if (StrUtil.equals(vehicle_qty_point.toString(), "0")) {
|
||||
@@ -88,13 +86,6 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
}
|
||||
start_point_code.setLock_type("00");
|
||||
pointTab.update(JSONObject.parseObject(JSON.toJSONString(start_point_code)));
|
||||
|
||||
// 完成单据状态
|
||||
jsonEmp.put("bill_status", "50");
|
||||
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonEmp.put("update_time", DateUtil.now());
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +103,11 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
String qty = form.getString("qty");
|
||||
String record_uuid = form.getString("record_uuid");
|
||||
String vehicle_type = form.getString("vehicle_type");
|
||||
|
||||
// 出库终点不能为空
|
||||
@@ -127,7 +116,7 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
} else {
|
||||
// 判断终点是否有正在执行的任务
|
||||
JSONObject beforTaskObj = taskTab.query("is_delete='0' and next_point_code='" + next_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在任务号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
// 载具数量不能为空
|
||||
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("载具数量不能为空");
|
||||
@@ -174,12 +163,6 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
jsonPoint.put("lock_type", "02");
|
||||
pointTab.update(jsonPoint);
|
||||
|
||||
// 更新空载具单据状态
|
||||
if (ObjectUtil.isNotEmpty(record_uuid)) {
|
||||
JSONObject jsonEmp = empTab.query("record_uuid ='" + record_uuid + "'").uniqueResult(0);
|
||||
jsonEmp.put("bill_status","20");
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@@ -209,7 +192,7 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
// 根据终点区域判断优先的起点区域
|
||||
JSONObject jsonPointEnd = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPointEnd)) throw new BadRequestException("终点点位不存在");
|
||||
|
||||
@@ -218,7 +218,7 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
|
||||
WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region"); // 区域表
|
||||
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder"); //空载具记录表
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder"); //空载具记录表
|
||||
WQLObject velicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); // 载具表
|
||||
// 根据起点区域判断优先的终点区域
|
||||
JSONObject jsonPointStart = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0);
|
||||
|
||||
Binary file not shown.
@@ -198,7 +198,7 @@ public class RegionioInServiceImpl implements RegionioInService {
|
||||
String iostorinv_id = jsonObject.getString("iostorinv_id");
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("SCH_IVT_regionIO");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
|
||||
JSONObject jsonIn = wo.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
String start_point_code = jsonIn.getString("start_point_code");
|
||||
|
||||
Reference in New Issue
Block a user