Merge remote-tracking branch 'origin/master_merge' into master_merge
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
package org.nl.b_lms.pdm.info.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 子卷下线记录表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author author
|
||||||
|
* @since 2024-07-19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("bst_ivt_cutrelevance")
|
||||||
|
public class BstIvtcutrelevance implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始设备
|
||||||
|
*/
|
||||||
|
private String origin_device;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联设备
|
||||||
|
*/
|
||||||
|
private String target_device;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nl.b_lms.pdm.info.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.nl.b_lms.pdm.info.dao.BstIvtcutrelevance;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 子卷下线记录表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author author
|
||||||
|
* @since 2024-07-19
|
||||||
|
*/
|
||||||
|
public interface BstIvtCutrelevanceMapper extends BaseMapper<BstIvtcutrelevance> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.nl.b_lms.pdm.info.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nl.b_lms.pdm.info.dao.BstIvtcutrelevance;
|
||||||
|
import org.nl.b_lms.pdm.info.dao.PdmBiOrderbominfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单BOM信息 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author author
|
||||||
|
* @since 2024-07-19
|
||||||
|
*/
|
||||||
|
public interface IBstIvtCutrelevanceService extends IService<BstIvtcutrelevance> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package org.nl.b_lms.pdm.info.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.nl.b_lms.pdm.info.dao.BstIvtcutrelevance;
|
||||||
|
import org.nl.b_lms.pdm.info.dao.PdmBiContainerinbound;
|
||||||
|
import org.nl.b_lms.pdm.info.mapper.BstIvtCutrelevanceMapper;
|
||||||
|
import org.nl.b_lms.pdm.info.mapper.PdmBiContainerinboundMapper;
|
||||||
|
import org.nl.b_lms.pdm.info.service.IBstIvtCutrelevanceService;
|
||||||
|
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinboundService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 子卷下线记录表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author author
|
||||||
|
* @since 2024-07-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BstIvtCutrelevanceServiceImpl extends ServiceImpl<BstIvtCutrelevanceMapper, BstIvtcutrelevance> implements IBstIvtCutrelevanceService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
package org.nl.b_lms.sch.tasks.slitter;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||||
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||||
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||||
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||||
|
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt;
|
||||||
|
import org.nl.b_lms.sch.point.service.IstIvtCutpointivtService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
|
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||||
|
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
|
||||||
|
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.common.utils.TaskUtils;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.sch.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description: 分切拼单桁架任务(2/4点任务)
|
||||||
|
* @Date: 2024/2/1
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class SlitterPinDanTrussTask extends AbstractAcsTask {
|
||||||
|
private final String THIS_CLASS = SlitterPinDanTrussTask.class.getName();
|
||||||
|
@Autowired
|
||||||
|
private IschBaseTaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private IPdmBiSlittingproductionplanService slittingproductionplanService;
|
||||||
|
@Autowired
|
||||||
|
private IBstIvtCutpointivtService bcutpointivtService;
|
||||||
|
@Autowired
|
||||||
|
private IstIvtCutpointivtService cutpointivtService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask() {
|
||||||
|
/*
|
||||||
|
* 下发给ACS时需要特殊处理
|
||||||
|
*/
|
||||||
|
List<SchBaseTask> taskList = taskService.getIssueTasks(THIS_CLASS);
|
||||||
|
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
String agv_system_type = "2";
|
||||||
|
for (SchBaseTask task : taskList) {
|
||||||
|
String requestParam = task.getRequest_param();
|
||||||
|
JSONObject requestParamObj = JSONObject.parseObject(requestParam);
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(task.getTask_id())
|
||||||
|
.task_code(task.getTask_code())
|
||||||
|
.task_type(task.getAcs_task_type())
|
||||||
|
.start_device_code(task.getPoint_code1())
|
||||||
|
.next_device_code(task.getPoint_code2())
|
||||||
|
.start_device_code2(task.getPoint_code3())
|
||||||
|
.next_device_code2(task.getPoint_code4())
|
||||||
|
.vehicle_code(task.getVehicle_code())
|
||||||
|
.truss_type(requestParamObj.getString("truss_type"))
|
||||||
|
.empty_site(requestParamObj.getString("empty_site"))
|
||||||
|
.agv_system_type(agv_system_type)
|
||||||
|
.priority(task.getPriority())
|
||||||
|
.remark(task.getRemark())
|
||||||
|
.product_area(task.getProduct_area())
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
task.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
//清除起点库存
|
||||||
|
String point_code1 = task.getPoint_code1();
|
||||||
|
String point_code2 = task.getPoint_code2();
|
||||||
|
if (point_code1.endsWith("A")) {
|
||||||
|
bcutpointivtService.update(new LambdaUpdateWrapper<BstIvtCutpointivt>()
|
||||||
|
.eq(BstIvtCutpointivt::getTruss_point_code1, point_code1)
|
||||||
|
.set(BstIvtCutpointivt::getQzz_no1, ""));
|
||||||
|
} else {
|
||||||
|
bcutpointivtService.update(new LambdaUpdateWrapper<BstIvtCutpointivt>()
|
||||||
|
.eq(BstIvtCutpointivt::getTruss_point_code2, point_code1)
|
||||||
|
.set(BstIvtCutpointivt::getQzz_no2, ""));
|
||||||
|
}
|
||||||
|
//更新终点库存
|
||||||
|
if (point_code2.endsWith("A")) {
|
||||||
|
bcutpointivtService.update(new LambdaUpdateWrapper<BstIvtCutpointivt>()
|
||||||
|
.eq(BstIvtCutpointivt::getTruss_point_code1, point_code2)
|
||||||
|
.set(BstIvtCutpointivt::getQzz_no1, task.getVehicle_code()));
|
||||||
|
} else {
|
||||||
|
bcutpointivtService.update(new LambdaUpdateWrapper<BstIvtCutpointivt>()
|
||||||
|
.eq(BstIvtCutpointivt::getTruss_point_code2, point_code2)
|
||||||
|
.set(BstIvtCutpointivt::getQzz_no2, task.getVehicle_code()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消
|
||||||
|
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||||
|
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
task.setIs_delete("1");
|
||||||
|
}
|
||||||
|
task.setUpdate_time(DateUtil.now());
|
||||||
|
taskService.updateById(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
|
SchBaseTask task = new SchBaseTask();
|
||||||
|
task.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||||
|
task.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||||
|
task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode());
|
||||||
|
task.setPoint_code1(form.getString("point_code1"));
|
||||||
|
task.setPoint_code2(form.getString("point_code2"));
|
||||||
|
task.setVehicle_code(form.getString("vehicle_code"));
|
||||||
|
task.setAcs_task_type("6");
|
||||||
|
task.setIs_delete("0");
|
||||||
|
task.setRequest_param(form.toJSONString());
|
||||||
|
task.setTask_type(form.getString("task_type"));
|
||||||
|
task.setProduct_area(form.getString("product_area"));
|
||||||
|
task.setCreate_id(currentUserId);
|
||||||
|
task.setCreate_name(currentUsername);
|
||||||
|
task.setCreate_time(DateUtil.now());
|
||||||
|
task.setHandle_class(THIS_CLASS);
|
||||||
|
//根据类型获取对应的任务优先级
|
||||||
|
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", task.getTask_type()).process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||||
|
task.setPriority("1");
|
||||||
|
} else {
|
||||||
|
task.setPriority(priority_jo.getString("value"));
|
||||||
|
}
|
||||||
|
taskService.save(task);
|
||||||
|
this.immediateNotifyAcs(null);
|
||||||
|
return task.getTask_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
this.updateTaskStatus(taskObj, "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user