|
|
|
|
@@ -14,7 +14,6 @@ import net.sf.json.JSONArray;
|
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
import org.nl.exception.BadRequestException;
|
|
|
|
|
import org.nl.modules.system.util.CodeUtil;
|
|
|
|
|
import org.nl.service.LocalStorageService;
|
|
|
|
|
import org.nl.utils.FileUtil;
|
|
|
|
|
import org.nl.utils.SecurityUtils;
|
|
|
|
|
import org.nl.wms.pdm.enu.ProducStatus;
|
|
|
|
|
@@ -25,7 +24,6 @@ import org.nl.wms.sch.tasks.InEmptyVehicleTask;
|
|
|
|
|
import org.nl.wms.sch.tasks.MaterialBackTask;
|
|
|
|
|
import org.nl.wms.sch.tasks.TaskTypeEnum;
|
|
|
|
|
import org.nl.wms.st.core.IOStoreMst;
|
|
|
|
|
import org.nl.wms.st.core.service.EmptyVehicleService;
|
|
|
|
|
import org.nl.wms.st.core.service.IOStoreService;
|
|
|
|
|
import org.nl.wms.st.util.StructFindUtil;
|
|
|
|
|
import org.nl.wql.WQL;
|
|
|
|
|
@@ -49,9 +47,9 @@ import java.util.*;
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class ProduceTaskServiceImpl implements ProduceTaskService {
|
|
|
|
|
private final LocalStorageService localStorageService;
|
|
|
|
|
private final IOStoreService ioStoreService;
|
|
|
|
|
private final EmptyVehicleService emptyVehicleService;
|
|
|
|
|
|
|
|
|
|
private final Object lockObj=new Object();
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|
|
|
|
@@ -266,7 +264,6 @@ public class ProduceTaskServiceImpl implements ProduceTaskService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public JSONArray querAllTask() {
|
|
|
|
|
JSONArray arr = WQL.getWO("QPDM_BIGSCREEN_001").addParam("flag", "1").process().getResultJSONArray(0);
|
|
|
|
|
return arr;
|
|
|
|
|
@@ -282,100 +279,102 @@ public class ProduceTaskServiceImpl implements ProduceTaskService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void callMaterial(Map map) {
|
|
|
|
|
if (ObjectUtil.isEmpty(map)) {
|
|
|
|
|
throw new BadRequestException("没有要执行的任务");
|
|
|
|
|
synchronized (lockObj) {
|
|
|
|
|
if (ObjectUtil.isEmpty(map)) {
|
|
|
|
|
throw new BadRequestException("没有要执行的任务");
|
|
|
|
|
}
|
|
|
|
|
String produce_uuid = MapUtil.getStr(map, "produce_uuid");
|
|
|
|
|
//生产任务表【pdm_base_produceTask】
|
|
|
|
|
WQLObject produceTaskTab = WQLObject.getWQLObject("pdm_base_produceTask");
|
|
|
|
|
JSONObject produceTaskObj = produceTaskTab.query("is_delete='0' and produce_uuid = '" + produce_uuid + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(produceTaskObj)) throw new BadRequestException("生产任务已完成或被删除,操作失败!");
|
|
|
|
|
|
|
|
|
|
String point_code = produceTaskObj.optString("device_code");
|
|
|
|
|
|
|
|
|
|
//判断是否有到该设备的未完成的AGV任务
|
|
|
|
|
//任务基础表【sch_base_task】
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
|
|
|
JSONObject taskObj = taskTab.query(" is_delete='0' and task_status<>'06' and next_point_code = '" + point_code + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("有到该设备有未完成的搬运任务,不能重复操作!");
|
|
|
|
|
|
|
|
|
|
//准备数据
|
|
|
|
|
JSONObject jsonAll = new JSONObject();
|
|
|
|
|
JSONArray dtlArray = new JSONArray();
|
|
|
|
|
JSONObject jsonMst = new JSONObject();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
String nowDate = String.format(now, "yyyy-MM-dd");
|
|
|
|
|
//出库主表数据
|
|
|
|
|
jsonMst.put("buss_type", "20");
|
|
|
|
|
jsonMst.put("optType", "add");
|
|
|
|
|
jsonMst.put("bussdtl_type", "202");
|
|
|
|
|
jsonMst.put("buss_date", nowDate);
|
|
|
|
|
//出库明细表数据
|
|
|
|
|
JSONObject jsonDtl = new JSONObject();
|
|
|
|
|
//查询有没有改物料可以出库的物料
|
|
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("label_uuid", produceTaskObj.optString("label_uuid"));
|
|
|
|
|
jo.put("area_type", "03");
|
|
|
|
|
JSONArray outStructArr = StructFindUtil.getOutStruct(jo);
|
|
|
|
|
if (ObjectUtil.isEmpty(outStructArr)) {
|
|
|
|
|
throw new BadRequestException("库存中没有可用的物料");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jsonDtl.put("label_uuid", produceTaskObj.optString("label_uuid"));
|
|
|
|
|
jsonDtl.put("qty", "1");
|
|
|
|
|
jsonDtl.put("weight", "1");
|
|
|
|
|
dtlArray.add(jsonDtl);
|
|
|
|
|
//调用出库新增、提交、分配方法
|
|
|
|
|
jsonAll.put("mst", jsonMst);
|
|
|
|
|
jsonAll.put("dtl", dtlArray);
|
|
|
|
|
IOStoreMst ioStoreMst = ioStoreService.create(jsonAll); //新增 返回主表
|
|
|
|
|
ioStoreService.submit(ioStoreMst.getBill_uuid()); //提交
|
|
|
|
|
//分配 准备数据
|
|
|
|
|
JSONObject jsonDiSAll = new JSONObject();
|
|
|
|
|
JSONArray DisDtlArray = new JSONArray();
|
|
|
|
|
JSONObject jsonDisMst = new JSONObject();
|
|
|
|
|
//分配表数据
|
|
|
|
|
JSONArray DtlArr = WQLObject.getWQLObject("st_buss_IOStoreDtl")
|
|
|
|
|
.query("bill_uuid = '" + ioStoreMst.getBill_uuid() + "'").getResultJSONArray(0);
|
|
|
|
|
for (int i = 0; i < DtlArr.size(); i++) {
|
|
|
|
|
JSONObject json = DtlArr.getJSONObject(i);
|
|
|
|
|
JSONObject jsonDisDtl = new JSONObject();
|
|
|
|
|
|
|
|
|
|
jsonDisDtl.put("assign_qty", json.optString("assign_qty"));
|
|
|
|
|
jsonDisDtl.put("assign_weight", json.optString("assign_weight"));
|
|
|
|
|
jsonDisDtl.put("bill_status", json.optString("bill_status"));
|
|
|
|
|
jsonDisDtl.put("bill_uuid", json.optString("bill_uuid"));
|
|
|
|
|
jsonDisDtl.put("billdtl_uuid", json.optString("billdtl_uuid"));
|
|
|
|
|
jsonDisDtl.put("buss_type", json.optString("buss_type"));
|
|
|
|
|
jsonDisDtl.put("label_uuid", produceTaskObj.optString("label_uuid"));
|
|
|
|
|
jsonDisDtl.put("pcsn", json.optString("pcsn"));
|
|
|
|
|
jsonDisDtl.put("qty", json.optString("qty"));
|
|
|
|
|
jsonDisDtl.put("qty_unit_uuid", json.optString("qty_unit_uuid"));
|
|
|
|
|
jsonDisDtl.put("realassign_qty", json.optString("unassign_qty"));
|
|
|
|
|
jsonDisDtl.put("seq_num", json.optString("seq_num"));
|
|
|
|
|
jsonDisDtl.put("unassign_qty", json.optString("unassign_qty"));
|
|
|
|
|
jsonDisDtl.put("unassign_weight", json.optString("unassign_weight"));
|
|
|
|
|
jsonDisDtl.put("weight", json.optString("weight"));
|
|
|
|
|
jsonDisDtl.put("weight_unit_uuid", json.optString("weight_unit_uuid"));
|
|
|
|
|
DisDtlArray.add(jsonDisDtl);
|
|
|
|
|
}
|
|
|
|
|
//任务表数据
|
|
|
|
|
String next_point_code = (String) map.get("device_code");
|
|
|
|
|
jsonDisMst.put("buss_type", ioStoreMst.getBuss_type());
|
|
|
|
|
jsonDisMst.put("next_point_code", next_point_code);
|
|
|
|
|
jsonDisMst.put("optType", "dis");
|
|
|
|
|
jsonDiSAll.put("dtl", DisDtlArray);
|
|
|
|
|
jsonDiSAll.put("mst", jsonDisMst);
|
|
|
|
|
ioStoreService.saveDis(jsonDiSAll);
|
|
|
|
|
//锁住点位
|
|
|
|
|
JSONObject jsonPoint = WQLObject.getWQLObject("sch_base_point").query("point_code='" + next_point_code + "'").uniqueResult(0);
|
|
|
|
|
jsonPoint.put("lock_type", "01");
|
|
|
|
|
WQLObject.getWQLObject("sch_base_point").update(jsonPoint);
|
|
|
|
|
//回显生产表生产状态
|
|
|
|
|
map.put("produce_status", ProducStatus.IN_PRODUCTION.getCode());
|
|
|
|
|
map.put("start_time", now);
|
|
|
|
|
WQLObject.getWQLObject("pdm_base_producetask").update(map);
|
|
|
|
|
}
|
|
|
|
|
String produce_uuid = MapUtil.getStr(map, "produce_uuid");
|
|
|
|
|
//生产任务表【pdm_base_produceTask】
|
|
|
|
|
WQLObject produceTaskTab = WQLObject.getWQLObject("pdm_base_produceTask");
|
|
|
|
|
JSONObject produceTaskObj = produceTaskTab.query("is_delete='0' and produce_uuid = '" + produce_uuid + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(produceTaskObj)) throw new BadRequestException("生产任务已完成或被删除,操作失败!");
|
|
|
|
|
|
|
|
|
|
String point_code = produceTaskObj.optString("device_code");
|
|
|
|
|
|
|
|
|
|
//判断是否有到该设备的未完成的AGV任务
|
|
|
|
|
//任务基础表【sch_base_task】
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
|
|
|
JSONObject taskObj = taskTab.query(" is_delete='0' and task_status<>'06' and next_point_code = '" + point_code + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("有到该设备有未完成的搬运任务,不能重复操作!");
|
|
|
|
|
|
|
|
|
|
//准备数据
|
|
|
|
|
JSONObject jsonAll = new JSONObject();
|
|
|
|
|
JSONArray dtlArray = new JSONArray();
|
|
|
|
|
JSONObject jsonMst = new JSONObject();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
String nowDate = String.format(now, "yyyy-MM-dd");
|
|
|
|
|
//出库主表数据
|
|
|
|
|
jsonMst.put("buss_type", "20");
|
|
|
|
|
jsonMst.put("optType", "add");
|
|
|
|
|
jsonMst.put("bussdtl_type", "202");
|
|
|
|
|
jsonMst.put("buss_date", nowDate);
|
|
|
|
|
//出库明细表数据
|
|
|
|
|
JSONObject jsonDtl = new JSONObject();
|
|
|
|
|
//查询有没有改物料可以出库的物料
|
|
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("label_uuid", produceTaskObj.optString("label_uuid"));
|
|
|
|
|
jo.put("area_type", "03");
|
|
|
|
|
JSONArray outStructArr = StructFindUtil.getOutStruct(jo);
|
|
|
|
|
if (ObjectUtil.isEmpty(outStructArr)) {
|
|
|
|
|
throw new BadRequestException("库存中没有可用的物料");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jsonDtl.put("label_uuid", produceTaskObj.optString("label_uuid"));
|
|
|
|
|
jsonDtl.put("qty", "1");
|
|
|
|
|
jsonDtl.put("weight", "1");
|
|
|
|
|
dtlArray.add(jsonDtl);
|
|
|
|
|
//调用出库新增、提交、分配方法
|
|
|
|
|
jsonAll.put("mst", jsonMst);
|
|
|
|
|
jsonAll.put("dtl", dtlArray);
|
|
|
|
|
IOStoreMst ioStoreMst = ioStoreService.create(jsonAll); //新增 返回主表
|
|
|
|
|
ioStoreService.submit(ioStoreMst.getBill_uuid()); //提交
|
|
|
|
|
//分配 准备数据
|
|
|
|
|
JSONObject jsonDiSAll = new JSONObject();
|
|
|
|
|
JSONArray DisDtlArray = new JSONArray();
|
|
|
|
|
JSONObject jsonDisMst = new JSONObject();
|
|
|
|
|
//分配表数据
|
|
|
|
|
JSONArray DtlArr = WQLObject.getWQLObject("st_buss_IOStoreDtl")
|
|
|
|
|
.query("bill_uuid = '" + ioStoreMst.getBill_uuid() + "'").getResultJSONArray(0);
|
|
|
|
|
for (int i = 0; i < DtlArr.size(); i++) {
|
|
|
|
|
JSONObject json = DtlArr.getJSONObject(i);
|
|
|
|
|
JSONObject jsonDisDtl = new JSONObject();
|
|
|
|
|
|
|
|
|
|
jsonDisDtl.put("assign_qty", json.optString("assign_qty"));
|
|
|
|
|
jsonDisDtl.put("assign_weight", json.optString("assign_weight"));
|
|
|
|
|
jsonDisDtl.put("bill_status", json.optString("bill_status"));
|
|
|
|
|
jsonDisDtl.put("bill_uuid", json.optString("bill_uuid"));
|
|
|
|
|
jsonDisDtl.put("billdtl_uuid", json.optString("billdtl_uuid"));
|
|
|
|
|
jsonDisDtl.put("buss_type", json.optString("buss_type"));
|
|
|
|
|
jsonDisDtl.put("label_uuid", produceTaskObj.optString("label_uuid"));
|
|
|
|
|
jsonDisDtl.put("pcsn", json.optString("pcsn"));
|
|
|
|
|
jsonDisDtl.put("qty", json.optString("qty"));
|
|
|
|
|
jsonDisDtl.put("qty_unit_uuid", json.optString("qty_unit_uuid"));
|
|
|
|
|
jsonDisDtl.put("realassign_qty", json.optString("unassign_qty"));
|
|
|
|
|
jsonDisDtl.put("seq_num", json.optString("seq_num"));
|
|
|
|
|
jsonDisDtl.put("unassign_qty", json.optString("unassign_qty"));
|
|
|
|
|
jsonDisDtl.put("unassign_weight", json.optString("unassign_weight"));
|
|
|
|
|
jsonDisDtl.put("weight", json.optString("weight"));
|
|
|
|
|
jsonDisDtl.put("weight_unit_uuid", json.optString("weight_unit_uuid"));
|
|
|
|
|
DisDtlArray.add(jsonDisDtl);
|
|
|
|
|
}
|
|
|
|
|
//任务表数据
|
|
|
|
|
String next_point_code = (String) map.get("device_code");
|
|
|
|
|
jsonDisMst.put("buss_type", ioStoreMst.getBuss_type());
|
|
|
|
|
jsonDisMst.put("next_point_code", next_point_code);
|
|
|
|
|
jsonDisMst.put("optType", "dis");
|
|
|
|
|
jsonDiSAll.put("dtl", DisDtlArray);
|
|
|
|
|
jsonDiSAll.put("mst", jsonDisMst);
|
|
|
|
|
ioStoreService.saveDis(jsonDiSAll);
|
|
|
|
|
//锁住点位
|
|
|
|
|
JSONObject jsonPoint = WQLObject.getWQLObject("sch_base_point").query("point_code='" + next_point_code + "'").uniqueResult(0);
|
|
|
|
|
jsonPoint.put("lock_type", "01");
|
|
|
|
|
WQLObject.getWQLObject("sch_base_point").update(jsonPoint);
|
|
|
|
|
//回显生产表生产状态
|
|
|
|
|
map.put("produce_status", ProducStatus.IN_PRODUCTION.getCode());
|
|
|
|
|
map.put("start_time", now);
|
|
|
|
|
WQLObject.getWQLObject("pdm_base_producetask").update(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -463,89 +462,93 @@ public class ProduceTaskServiceImpl implements ProduceTaskService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void materialBack(Map map) {
|
|
|
|
|
if (ObjectUtil.isEmpty(map)) {
|
|
|
|
|
throw new BadRequestException("没有要完成的任务");
|
|
|
|
|
}
|
|
|
|
|
String produce_uuid = MapUtil.getStr(map, "produce_uuid");
|
|
|
|
|
//生产任务表【pdm_base_produceTask】
|
|
|
|
|
WQLObject produceTaskTab = WQLObject.getWQLObject("pdm_base_produceTask");
|
|
|
|
|
JSONObject produceTaskObj = produceTaskTab.query("is_delete='0' and produce_uuid = '" + produce_uuid + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(produceTaskObj)) throw new BadRequestException("生产任务已完成或被删除,操作失败!");
|
|
|
|
|
String point_code = produceTaskObj.optString("device_code");
|
|
|
|
|
//判断点位上有没有托盘,没有托盘不允许回库
|
|
|
|
|
JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_code='" + point_code + "'").uniqueResult(0);
|
|
|
|
|
String vehicle_code = pointObj.optString("vehicle_code");
|
|
|
|
|
synchronized (lockObj) {
|
|
|
|
|
if (ObjectUtil.isEmpty(map)) {
|
|
|
|
|
throw new BadRequestException("没有要完成的任务");
|
|
|
|
|
}
|
|
|
|
|
String produce_uuid = MapUtil.getStr(map, "produce_uuid");
|
|
|
|
|
//生产任务表【pdm_base_produceTask】
|
|
|
|
|
WQLObject produceTaskTab = WQLObject.getWQLObject("pdm_base_produceTask");
|
|
|
|
|
JSONObject produceTaskObj = produceTaskTab.query("is_delete='0' and produce_uuid = '" + produce_uuid + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(produceTaskObj)) throw new BadRequestException("生产任务已完成或被删除,操作失败!");
|
|
|
|
|
String point_code = produceTaskObj.optString("device_code");
|
|
|
|
|
//判断点位上有没有托盘,没有托盘不允许回库
|
|
|
|
|
JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_code='" + point_code + "'").uniqueResult(0);
|
|
|
|
|
String vehicle_code = pointObj.optString("vehicle_code");
|
|
|
|
|
/* if (StrUtil.isEmpty(vehicle_code)) {
|
|
|
|
|
throw new BadRequestException("点位为【'" + point_code + "'】上没有托盘!");
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
//判断是否已经点击完成
|
|
|
|
|
//判断是否有到该设备的未完成的AGV任务
|
|
|
|
|
//任务基础表【sch_base_task】
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
|
|
|
JSONObject taskJson = taskTab.query(" is_delete='0' and task_status<>'06' and start_point_code = '" + point_code + "' and handle_class = '" + MaterialBackTask.class.getName() + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskJson)) throw new BadRequestException("该设备有未完成的搬运任务,不能重复操作!");
|
|
|
|
|
//判断是否有可以使用的下一个点位
|
|
|
|
|
//点位基础表【sch_base_point】
|
|
|
|
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
|
|
|
|
//JSONObject nextPoint = pointTab.query("area_type ='03' and point_status ='00' and lock_type='00' and is_active='1' and is_delete='0'").uniqueResult(0);
|
|
|
|
|
JSONObject nextPoint = new JSONObject();
|
|
|
|
|
String material_code = WQLObject.getWQLObject("md_base_materiallabelmst")
|
|
|
|
|
.query("label_uuid ='" + produceTaskObj.getString("label_uuid") + "'").uniqueResult(0).getString("material_code");
|
|
|
|
|
if (StrUtil.equals(material_code, "1")) {
|
|
|
|
|
nextPoint = pointTab.query("area_type = '03' and point_status ='00' and lock_type='00' and is_active='1' and is_delete='0' and point_name like'%01层%'").uniqueResult(0);
|
|
|
|
|
} else {
|
|
|
|
|
nextPoint = pointTab.query("area_type = '03' and point_status ='00' and lock_type='00' and is_active='1' and is_delete='0' and point_name not like'%01层%'").uniqueResult(0);
|
|
|
|
|
//判断是否已经点击完成
|
|
|
|
|
//判断是否有到该设备的未完成的AGV任务
|
|
|
|
|
//任务基础表【sch_base_task】
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
|
|
|
JSONObject taskJson = taskTab.query(" is_delete='0' and task_status<>'06' and start_point_code = '" + point_code + "' and handle_class = '" + MaterialBackTask.class.getName() + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskJson)) throw new BadRequestException("该设备有未完成的搬运任务,不能重复操作!");
|
|
|
|
|
//判断是否有可以使用的下一个点位
|
|
|
|
|
//点位基础表【sch_base_point】
|
|
|
|
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
|
|
|
|
//JSONObject nextPoint = pointTab.query("area_type ='03' and point_status ='00' and lock_type='00' and is_active='1' and is_delete='0'").uniqueResult(0);
|
|
|
|
|
JSONObject nextPoint = new JSONObject();
|
|
|
|
|
String material_code = WQLObject.getWQLObject("md_base_materiallabelmst")
|
|
|
|
|
.query("label_uuid ='" + produceTaskObj.getString("label_uuid") + "'").uniqueResult(0).getString("material_code");
|
|
|
|
|
if (StrUtil.equals(material_code, "1")) {
|
|
|
|
|
nextPoint = pointTab.query("area_type = '03' and point_status ='00' and lock_type='00' and is_active='1' and is_delete='0' and point_name like'%01层%'").uniqueResult(0);
|
|
|
|
|
} else {
|
|
|
|
|
nextPoint = pointTab.query("area_type = '03' and point_status ='00' and lock_type='00' and is_active='1' and is_delete='0' and point_name not like'%01层%'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isEmpty(nextPoint)) throw new BadRequestException("库内无可用位置,无法操作!");
|
|
|
|
|
JSONObject startPoint = pointTab.query("point_code = '" + point_code + "'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
//生成搬运任务
|
|
|
|
|
JSONObject taskObj = new JSONObject();
|
|
|
|
|
taskObj.put("task_uuid", IdUtil.simpleUUID());
|
|
|
|
|
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
|
|
|
|
taskObj.put("task_type", TaskTypeEnum.MATERIAL_BACK_TASK.getCode());
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
|
|
|
|
taskObj.put("start_point_code", startPoint.optString("point_code"));
|
|
|
|
|
taskObj.put("next_point_code", nextPoint.optString("point_code"));
|
|
|
|
|
taskObj.put("vehicle_code", startPoint.optString("vehicle_code"));
|
|
|
|
|
taskObj.put("handle_class", MaterialBackTask.class.getName());
|
|
|
|
|
|
|
|
|
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
taskObj.put("create_by", currentUsername);
|
|
|
|
|
taskObj.put("create_time", now);
|
|
|
|
|
taskObj.put("update_by", currentUsername);
|
|
|
|
|
taskObj.put("update_time", now);
|
|
|
|
|
taskTab.insert(taskObj);
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isEmpty(nextPoint)) throw new BadRequestException("库内无可用位置,无法操作!");
|
|
|
|
|
JSONObject startPoint = pointTab.query("point_code = '" + point_code + "'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
//生成搬运任务
|
|
|
|
|
JSONObject taskObj = new JSONObject();
|
|
|
|
|
taskObj.put("task_uuid", IdUtil.simpleUUID());
|
|
|
|
|
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
|
|
|
|
taskObj.put("task_type", TaskTypeEnum.MATERIAL_BACK_TASK.getCode());
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
|
|
|
|
taskObj.put("start_point_code", startPoint.optString("point_code"));
|
|
|
|
|
taskObj.put("next_point_code", nextPoint.optString("point_code"));
|
|
|
|
|
taskObj.put("vehicle_code", startPoint.optString("vehicle_code"));
|
|
|
|
|
taskObj.put("handle_class", MaterialBackTask.class.getName());
|
|
|
|
|
|
|
|
|
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
taskObj.put("create_by", currentUsername);
|
|
|
|
|
taskObj.put("create_time", now);
|
|
|
|
|
taskObj.put("update_by", currentUsername);
|
|
|
|
|
taskObj.put("update_time", now);
|
|
|
|
|
taskTab.insert(taskObj);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void emptyVehicleBack(Map map) {
|
|
|
|
|
String id = MapUtil.getStr(map, "id");
|
|
|
|
|
if (StrUtil.isEmpty(id)) throw new BadRequestException("所选屏位置不能为空!");
|
|
|
|
|
|
|
|
|
|
String point_code = "BCPSL0" + id;
|
|
|
|
|
//判断点位上有没有托盘,没有托盘不允许回库
|
|
|
|
|
// JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_code='" + point_code + "'").uniqueResult(0);
|
|
|
|
|
// String vehicle_code = pointObj.optString("vehicle_code");
|
|
|
|
|
|
|
|
|
|
//判断是否有到该设备的未完成的AGV任务
|
|
|
|
|
//任务基础表【sch_base_task】
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
|
|
|
JSONObject taskJson = taskTab.query(" is_delete='0' and task_status<>'06' and start_point_code = '" + point_code + "' and handle_class = '" + InEmptyVehicleTask.class.getName() + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskJson)) throw new BadRequestException("该设备有未完成的搬运任务,不能重复操作!");
|
|
|
|
|
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("start_point_code", point_code);
|
|
|
|
|
InEmptyVehicleTask inEmptyVehicleTask = new InEmptyVehicleTask();
|
|
|
|
|
inEmptyVehicleTask.createTask(param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void emptyVehicleBack(Map map) {
|
|
|
|
|
synchronized (lockObj) {
|
|
|
|
|
String id = MapUtil.getStr(map, "id");
|
|
|
|
|
if (StrUtil.isEmpty(id)) throw new BadRequestException("所选屏位置不能为空!");
|
|
|
|
|
|
|
|
|
|
String point_code = "BCPSL0" + id;
|
|
|
|
|
//判断点位上有没有托盘,没有托盘不允许回库
|
|
|
|
|
// JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_code='" + point_code + "'").uniqueResult(0);
|
|
|
|
|
// String vehicle_code = pointObj.optString("vehicle_code");
|
|
|
|
|
|
|
|
|
|
//判断是否有到该设备的未完成的AGV任务
|
|
|
|
|
//任务基础表【sch_base_task】
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
|
|
|
JSONObject taskJson = taskTab.query(" is_delete='0' and task_status<>'06' and start_point_code = '" + point_code + "' and handle_class = '" + InEmptyVehicleTask.class.getName() + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskJson)) throw new BadRequestException("该设备有未完成的搬运任务,不能重复操作!");
|
|
|
|
|
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("start_point_code", point_code);
|
|
|
|
|
InEmptyVehicleTask inEmptyVehicleTask = new InEmptyVehicleTask();
|
|
|
|
|
inEmptyVehicleTask.createTask(param);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONArray queryIdDevice(String id) {
|
|
|
|
|
String device_code = "BCPSL0" + id;
|
|
|
|
|
JSONArray arr = WQL.getWO("QPDM_PRODUCETASK_003").addParam("flag", "1").addParam("id", device_code).process().getResultJSONArray(0);
|
|
|
|
|
@@ -560,7 +563,6 @@ public class ProduceTaskServiceImpl implements ProduceTaskService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public JSONArray queryOne() {
|
|
|
|
|
JSONArray arr = WQLObject.getWQLObject("pdm_base_producetask").query("device_code = 'BCPSL01' and produce_status = '00' and is_delete = '0'", "order_seq ASC").getResultJSONArray(0);
|
|
|
|
|
return arr;
|
|
|
|
|
|