opt: 手持送气胀轴
This commit is contained in:
@@ -193,6 +193,9 @@ public class NbjPdaServiceImpl implements NbjPdaService {
|
|||||||
// param: point_code,row
|
// param: point_code,row
|
||||||
String pointCode = param.getString("point_code");
|
String pointCode = param.getString("point_code");
|
||||||
BstIvtCutpointivt tzzcPoint = bstIvtCutpointivtService.getPintByTrussCode(pointCode, false);
|
BstIvtCutpointivt tzzcPoint = bstIvtCutpointivtService.getPintByTrussCode(pointCode, false);
|
||||||
|
if (!"1".equals(tzzcPoint.getPoint_status())) {
|
||||||
|
throw new BadRequestException("系统检测到点位[" + pointCode + "]状态不为空, 如实际已经清空,请手持操作点位清除!");
|
||||||
|
}
|
||||||
JSONArray rows = param.getJSONArray("row");
|
JSONArray rows = param.getJSONArray("row");
|
||||||
List<PdmBiSlittingproductionplan> planList = rows.toJavaList(PdmBiSlittingproductionplan.class);
|
List<PdmBiSlittingproductionplan> planList = rows.toJavaList(PdmBiSlittingproductionplan.class);
|
||||||
List<String> orderIds = planList.stream()
|
List<String> orderIds = planList.stream()
|
||||||
@@ -358,29 +361,30 @@ public class NbjPdaServiceImpl implements NbjPdaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public JSONObject doSendShaft(JSONObject param) {
|
public JSONObject doSendShaft(JSONObject param) {
|
||||||
log.info("手持送气胀轴 - {}", param);
|
log.info("手持送气胀轴 - {}", param);
|
||||||
// param: point_code, device
|
// param: point_code, device
|
||||||
String pointCode = param.getString("point_code");
|
String pointCode = param.getString("point_code");
|
||||||
List<SchBaseTask> schBaseTasks = taskService.checkHaveTask(pointCode);
|
String device = param.getString("device");
|
||||||
|
BstIvtCutpointivt startPoint = bstIvtCutpointivtService.getPintByTrussCode(pointCode, false);
|
||||||
|
List<SchBaseTask> schBaseTasks = taskService.checkHaveTask(startPoint.getPoint_code());
|
||||||
if (CollectionUtil.isNotEmpty(schBaseTasks)) {
|
if (CollectionUtil.isNotEmpty(schBaseTasks)) {
|
||||||
throw new BadRequestException("该点:" + pointCode + "已经存在任务!");
|
throw new BadRequestException("该点:" + pointCode + "已经存在任务!");
|
||||||
}
|
}
|
||||||
String device = param.getString("device");
|
|
||||||
BstIvtCutpointivt startPoint = bstIvtCutpointivtService.getPintByTrussCode(pointCode, false);
|
|
||||||
// 组织参数,创建AGV任务
|
// 组织参数,创建AGV任务
|
||||||
JSONObject taskParam = new JSONObject();
|
JSONObject taskParam = new JSONObject();
|
||||||
taskParam.put("device_code", startPoint.getPoint_code());
|
taskParam.put("device_code", startPoint.getPoint_code());
|
||||||
taskParam.put("point_code1", startPoint.getPoint_code());
|
taskParam.put("point_code1", startPoint.getPoint_code());
|
||||||
taskParam.put("config_code", "PdaSendShaftAGVTask");
|
taskParam.put("config_code", "PdaSendShaftAGVTask");
|
||||||
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
|
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
|
||||||
if (device == null) {
|
if (ObjectUtil.isEmpty(device)) {
|
||||||
// 如果没有选择目的地,就是根据点位上维护的信息送
|
// 如果没有选择目的地,就是根据点位上维护的信息送
|
||||||
List<String> collect = Stream.of(startPoint.getQzz_no1(), startPoint.getQzz_no2())
|
List<String> collect = Stream.of(startPoint.getQzz_no1(), startPoint.getQzz_no2())
|
||||||
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.list(
|
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.list(
|
||||||
new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||||
.in(PdmBiSlittingproductionplan::getContainer_name, collect)
|
.in(PdmBiSlittingproductionplan::getQzzno, collect)
|
||||||
.eq(PdmBiSlittingproductionplan::getStatus, "01")
|
.eq(PdmBiSlittingproductionplan::getStatus, "01")
|
||||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
|
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
|
||||||
if (plans.size() == 0) {
|
if (plans.size() == 0) {
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
package org.nl.wms.sch.task_manage.tasks.nbj;
|
package org.nl.wms.sch.task_manage.tasks.nbj;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.CodeUtil;
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.pdm.bi.dao.PdmBiSlittingproductionplan;
|
||||||
|
import org.nl.wms.pdm.bi.service.IpdmBiSlittingproductionplanService;
|
||||||
import org.nl.wms.pdm.ivt.bcut.service.IBstIvtCutpointivtService;
|
import org.nl.wms.pdm.ivt.bcut.service.IBstIvtCutpointivtService;
|
||||||
import org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt;
|
import org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt;
|
||||||
import org.nl.wms.pdm.ivt.cut.service.IstIvtCutpointivtService;
|
import org.nl.wms.pdm.ivt.cut.service.IstIvtCutpointivtService;
|
||||||
@@ -22,7 +28,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||||
|
import static org.nl.wms.util.TaskUtils.updateOptMessageBySlitterPlan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: lyd
|
* @Author: lyd
|
||||||
@@ -39,6 +50,8 @@ public class PdaSendShaftAGVTask extends AbstractTask {
|
|||||||
private IBstIvtCutpointivtService bstIvtCutpointivtService;
|
private IBstIvtCutpointivtService bstIvtCutpointivtService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IstIvtCutpointivtService stIvtCutpointivtService;
|
private IstIvtCutpointivtService stIvtCutpointivtService;
|
||||||
|
@Autowired
|
||||||
|
private IpdmBiSlittingproductionplanService slittingproductionplanService;
|
||||||
@Override
|
@Override
|
||||||
public void create() throws BadRequestException {
|
public void create() throws BadRequestException {
|
||||||
|
|
||||||
@@ -71,9 +84,7 @@ public class PdaSendShaftAGVTask extends AbstractTask {
|
|||||||
checkTaskOptionStatus(taskObj);
|
checkTaskOptionStatus(taskObj);
|
||||||
JSONObject requestObj = JSONObject.parseObject(taskObj.getRequest_param());
|
JSONObject requestObj = JSONObject.parseObject(taskObj.getRequest_param());
|
||||||
String isFlag = requestObj.getString("is_flag");
|
String isFlag = requestObj.getString("is_flag");
|
||||||
String startPointCode = taskObj.getPoint_code1();
|
|
||||||
String endPointCode = taskObj.getPoint_code2();
|
String endPointCode = taskObj.getPoint_code2();
|
||||||
BstIvtCutpointivt startPoint = bstIvtCutpointivtService.getPintByAgvCode(startPointCode, false);
|
|
||||||
StIvtCutpointivt endPoint = stIvtCutpointivtService.getOneByCode(endPointCode);
|
StIvtCutpointivt endPoint = stIvtCutpointivtService.getOneByCode(endPointCode);
|
||||||
if ("1".equals(isFlag)) {
|
if ("1".equals(isFlag)) {
|
||||||
// 终点赋值
|
// 终点赋值
|
||||||
@@ -82,16 +93,16 @@ public class PdaSendShaftAGVTask extends AbstractTask {
|
|||||||
PointUtils.setCutUpdateByType(endPoint, taskFinishedType);
|
PointUtils.setCutUpdateByType(endPoint, taskFinishedType);
|
||||||
stIvtCutpointivtService.updateById(endPoint);
|
stIvtCutpointivtService.updateById(endPoint);
|
||||||
}
|
}
|
||||||
// 起点清空
|
// 有工单,则需要将工单设置入站完成:05
|
||||||
startPoint.setPoint_status("1");
|
List<String> collect = Stream.of(taskObj.getVehicle_code(), taskObj.getVehicle_code2()).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
||||||
startPoint.setUp_gx1("");
|
if (collect.size() > 0) {
|
||||||
startPoint.setUp_gx2("");
|
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNos(collect);
|
||||||
startPoint.setDown_gx1("");
|
plans.forEach(p -> {
|
||||||
startPoint.setDown_gx2("");
|
p.setStatus("05");
|
||||||
startPoint.setQzz_no1("");
|
updateOptMessageBySlitterPlan(p);
|
||||||
startPoint.setQzz_no2("");
|
});
|
||||||
PointUtils.setBCutUpdateByType(startPoint, taskFinishedType);
|
slittingproductionplanService.updateBatchById(plans);
|
||||||
bstIvtCutpointivtService.updateById(startPoint);
|
}
|
||||||
// 任务完成
|
// 任务完成
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
@@ -109,4 +120,23 @@ public class PdaSendShaftAGVTask extends AbstractTask {
|
|||||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void agvPickUpCompleted(SchBaseTask task) {
|
||||||
|
BstIvtCutpointivt startPoint = bstIvtCutpointivtService.getPintByAgvCode(task.getPoint_code1(), false);
|
||||||
|
// 起点清空
|
||||||
|
startPoint.setPoint_status("1");
|
||||||
|
startPoint.setQzz_no1("");
|
||||||
|
startPoint.setQzz_no2("");
|
||||||
|
PointUtils.setBCutUpdateByType(startPoint, TaskFinishedTypeEnum.AUTO_ACS);
|
||||||
|
bstIvtCutpointivtService.updateById(startPoint);
|
||||||
|
LambdaUpdateWrapper<SchBaseTask> lam = new LambdaUpdateWrapper<>();
|
||||||
|
lam.set(SchBaseTask::getTask_status, TaskStatus.PICK_UP_COMPLETED.getCode())
|
||||||
|
.set(SchBaseTask::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||||
|
.set(SchBaseTask::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||||
|
.set(SchBaseTask::getUpdate_time, DateUtil.now())
|
||||||
|
.eq(SchBaseTask::getTask_code, task.getTask_code());
|
||||||
|
boolean update = taskService.update(lam);
|
||||||
|
log.info("任务[{}]取货完成执行{}", task.getTask_code(), update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user