opt: 手持送气胀轴

This commit is contained in:
2024-08-30 18:00:36 +08:00
parent 0f139656ca
commit 3587a2acc4
2 changed files with 51 additions and 17 deletions

View File

@@ -193,6 +193,9 @@ public class NbjPdaServiceImpl implements NbjPdaService {
// param: point_coderow
String pointCode = param.getString("point_code");
BstIvtCutpointivt tzzcPoint = bstIvtCutpointivtService.getPintByTrussCode(pointCode, false);
if (!"1".equals(tzzcPoint.getPoint_status())) {
throw new BadRequestException("系统检测到点位[" + pointCode + "]状态不为空, 如实际已经清空,请手持操作点位清除!");
}
JSONArray rows = param.getJSONArray("row");
List<PdmBiSlittingproductionplan> planList = rows.toJavaList(PdmBiSlittingproductionplan.class);
List<String> orderIds = planList.stream()
@@ -358,29 +361,30 @@ public class NbjPdaServiceImpl implements NbjPdaService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject doSendShaft(JSONObject param) {
log.info("手持送气胀轴 - {}", param);
// param: point_code, device
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)) {
throw new BadRequestException("该点:" + pointCode + "已经存在任务!");
}
String device = param.getString("device");
BstIvtCutpointivt startPoint = bstIvtCutpointivtService.getPintByTrussCode(pointCode, false);
// 组织参数创建AGV任务
JSONObject taskParam = new JSONObject();
taskParam.put("device_code", startPoint.getPoint_code());
taskParam.put("point_code1", startPoint.getPoint_code());
taskParam.put("config_code", "PdaSendShaftAGVTask");
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())
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.list(
new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
.in(PdmBiSlittingproductionplan::getContainer_name, collect)
.in(PdmBiSlittingproductionplan::getQzzno, collect)
.eq(PdmBiSlittingproductionplan::getStatus, "01")
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
if (plans.size() == 0) {

View File

@@ -1,10 +1,16 @@
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.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
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.dao.BstIvtCutpointivt;
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.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.updateOptMessageBySlitterPlan;
/**
* @Author: lyd
@@ -39,6 +50,8 @@ public class PdaSendShaftAGVTask extends AbstractTask {
private IBstIvtCutpointivtService bstIvtCutpointivtService;
@Autowired
private IstIvtCutpointivtService stIvtCutpointivtService;
@Autowired
private IpdmBiSlittingproductionplanService slittingproductionplanService;
@Override
public void create() throws BadRequestException {
@@ -71,9 +84,7 @@ public class PdaSendShaftAGVTask extends AbstractTask {
checkTaskOptionStatus(taskObj);
JSONObject requestObj = JSONObject.parseObject(taskObj.getRequest_param());
String isFlag = requestObj.getString("is_flag");
String startPointCode = taskObj.getPoint_code1();
String endPointCode = taskObj.getPoint_code2();
BstIvtCutpointivt startPoint = bstIvtCutpointivtService.getPintByAgvCode(startPointCode, false);
StIvtCutpointivt endPoint = stIvtCutpointivtService.getOneByCode(endPointCode);
if ("1".equals(isFlag)) {
// 终点赋值
@@ -82,16 +93,16 @@ public class PdaSendShaftAGVTask extends AbstractTask {
PointUtils.setCutUpdateByType(endPoint, taskFinishedType);
stIvtCutpointivtService.updateById(endPoint);
}
// 起点清空
startPoint.setPoint_status("1");
startPoint.setUp_gx1("");
startPoint.setUp_gx2("");
startPoint.setDown_gx1("");
startPoint.setDown_gx2("");
startPoint.setQzz_no1("");
startPoint.setQzz_no2("");
PointUtils.setBCutUpdateByType(startPoint, taskFinishedType);
bstIvtCutpointivtService.updateById(startPoint);
// 有工单则需要将工单设置入站完成05
List<String> collect = Stream.of(taskObj.getVehicle_code(), taskObj.getVehicle_code2()).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
if (collect.size() > 0) {
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNos(collect);
plans.forEach(p -> {
p.setStatus("05");
updateOptMessageBySlitterPlan(p);
});
slittingproductionplanService.updateBatchById(plans);
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setFinished_type(taskFinishedType.getCode());
@@ -109,4 +120,23 @@ public class PdaSendShaftAGVTask extends AbstractTask {
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
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);
}
}