songxiaopeng
8 months ago
21 changed files with 653 additions and 1242 deletions
@ -0,0 +1,23 @@ |
|||
package org.nl.wms.sch.task_manage.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* @author sp |
|||
* 载具类型 |
|||
*/ |
|||
|
|||
@Getter |
|||
@AllArgsConstructor |
|||
public enum VehicleTypeEnum { |
|||
|
|||
GTP("0", "钢托盘"), |
|||
LK_RO1("1", "笼框R01"), |
|||
LK_RO2("2", "笼框R02"), |
|||
LJ_S04("3", "S04料架"), |
|||
LJ_A06("4", "A06料架"); |
|||
|
|||
private final String code; |
|||
private final String label; |
|||
} |
@ -1,226 +0,0 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.wms.ext.service.WmsToAcsService; |
|||
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|||
import org.nl.wms.pdm.service.IPdmBdWorkorderService; |
|||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|||
import org.nl.wms.sch.point.service.ISchBasePointService; |
|||
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Lazy; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Author: psh |
|||
* @Description: 点对点任务 |
|||
* @Date: 2023/1/24 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@TaskType("POINTTask") |
|||
@Lazy |
|||
public class POINTTask extends AbstractTask { |
|||
private static String TASK_CONFIG_CODE = "POINTTask"; |
|||
/** |
|||
* 入口 |
|||
*/ |
|||
private static String ENTRANCE = "1"; |
|||
@Autowired |
|||
private ISchBasePointService pointService; |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
@Autowired |
|||
private IPdmBdWorkorderService workorderService; |
|||
@Autowired |
|||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; |
|||
@Autowired |
|||
private PointMapper pointMapper; |
|||
@Autowired |
|||
private WmsToAcsService wmsToAcsService; |
|||
|
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void create() throws BadRequestException { |
|||
// 获取任务
|
|||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
|||
// 配置信息
|
|||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|||
for (SchBaseTask task : tasks) { |
|||
|
|||
task.setTask_status(TaskStatus.CREATED.getCode()); |
|||
task.setRemark(""); |
|||
SchBasePoint schBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1())); |
|||
task.setVehicle_code(schBasePoint.getVehicle_code()); |
|||
task.setVehicle_code2(schBasePoint.getVehicle_code2()); |
|||
taskService.update(task); |
|||
|
|||
//发起任务时先把点位占用,防止发起重复任务
|
|||
// point.setIng_task_code(task.getTask_code());
|
|||
// pointService.update(point);
|
|||
|
|||
//下发
|
|||
this.renotifyAcs(task); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 点对点任务暂定不需要等待点 |
|||
* |
|||
* @param extGroupData |
|||
* @return |
|||
*/ |
|||
private SchBasePoint findNextPoint(JSONObject extGroupData,SchBaseTask task) { |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 1.取货完毕后起点减少最后一份组盘,并且该组盘视为已结束 |
|||
* 2.包片机LMS不记录点位信息,由人工对组盘进行操作 |
|||
*/ |
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getById(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|||
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
|||
SchBasePoint startPointObj = pointService.getById(startPoint); |
|||
SchBasePoint endPointObj = pointService.getById(endPoint); |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|||
String vehicleCode=taskObj.getVehicle_code(); |
|||
String vehicleCode2= taskObj.getVehicle_code2(); |
|||
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|||
GroupBindMaterialStatusEnum.BOUND.getValue())); |
|||
if (ObjectUtil.isNotEmpty(one)) { |
|||
// throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
|
|||
// }
|
|||
one.setTask_code(taskObj.getTask_code()); |
|||
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
|
|||
one.setPoint_name(endPointObj.getPoint_name()); |
|||
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|||
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); |
|||
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|||
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|||
one.setUpdate_time(DateUtil.now()); |
|||
vehiclematerialgroupService.updateById(one); |
|||
} |
|||
one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode2) |
|||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|||
GroupBindMaterialStatusEnum.BOUND.getValue())); |
|||
if (ObjectUtil.isNotEmpty(one)) { |
|||
// throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
|
|||
// }
|
|||
one.setTask_code(taskObj.getTask_code()); |
|||
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
|
|||
one.setPoint_name(endPointObj.getPoint_name()); |
|||
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|||
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); |
|||
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|||
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|||
one.setUpdate_time(DateUtil.now()); |
|||
vehiclematerialgroupService.updateById(one); |
|||
} |
|||
// 终点解锁
|
|||
endPointObj.setIng_task_code(""); |
|||
endPointObj.setVehicle_code(taskObj.getVehicle_code()); |
|||
endPointObj.setVehicle_code2(taskObj.getVehicle_code2()); |
|||
endPointObj.setVehicle_qty(1); |
|||
pointService.update(endPointObj); |
|||
// 起点清空
|
|||
startPointObj.setVehicle_code(""); |
|||
startPointObj.setVehicle_code2(""); |
|||
startPointObj.setVehicle_qty(0); |
|||
startPointObj.setIng_task_code(""); |
|||
startPointObj.setUpdate_time(DateUtil.now()); |
|||
pointService.updateById(startPointObj); |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setGroup_id(one.getGroup_id()); |
|||
taskObj.setRemark("任务完成"); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
|||
// 终点解锁
|
|||
if (ObjectUtil.isNotEmpty(endPointObj)) { |
|||
endPointObj.setIng_task_code(""); |
|||
pointService.update(endPointObj); |
|||
} |
|||
// 起点解锁
|
|||
if (ObjectUtil.isNotEmpty(startPointObj)) { |
|||
startPointObj.setIng_task_code(""); |
|||
pointService.update(endPointObj); |
|||
} |
|||
taskObj.setRemark("任务取消"); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
} |
|||
taskService.update(taskObj); |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.FINISHED); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.CANCELED); |
|||
} |
|||
|
|||
@Override |
|||
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { |
|||
//重算最优点
|
|||
JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data()); |
|||
SchBasePoint point = this.findNextPoint(jsonObject,schBaseTask); |
|||
//正极板现在不堆叠
|
|||
if( "1".equals(jsonObject.getString("material_type"))) { |
|||
schBaseTask.setPoint_code1(point.getPoint_code()+"0"+(point.getVehicle_qty())); |
|||
}else{ |
|||
schBaseTask.setPoint_code1(point.getPoint_code().replace("HCQ","QHQ")); |
|||
} |
|||
//重算点位时把点位占用
|
|||
point.setIng_task_code(schBaseTask.getTask_code()); |
|||
//如果是正极板对接位则直接减库存
|
|||
if ((point.getPoint_code().startsWith("ZJBDJW"))) { |
|||
point.setVehicle_qty(point.getVehicle_qty() - 1); |
|||
} |
|||
pointService.update(point); |
|||
} |
|||
} |
@ -1,236 +0,0 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks; |
|||
|
|||
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.query.LambdaQueryWrapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.wms.ext.service.AcsToWmsService; |
|||
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|||
import org.nl.wms.pdm.service.IPdmBdWorkorderService; |
|||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder; |
|||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|||
import org.nl.wms.sch.point.service.ISchBasePointService; |
|||
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; |
|||
import org.nl.wms.sch.task_manage.enums.GroupStatusEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|||
import org.nl.wms.util.PointUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Lazy; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: psh |
|||
* @Description: 输送线补空架 |
|||
* @Date: 2024/1/24 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@TaskType("SSXBKJTask") |
|||
@Lazy |
|||
public class SSXBKJTask extends AbstractTask { |
|||
private static String TASK_CONFIG_CODE = "SSXBKJTask"; |
|||
/** |
|||
* 入口 |
|||
*/ |
|||
private static String ENTRANCE = "1"; |
|||
@Autowired |
|||
private ISchBasePointService pointService; |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
@Autowired |
|||
private IPdmBdWorkorderService workorderService; |
|||
@Autowired |
|||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; |
|||
@Autowired |
|||
private PointMapper pointMapper; |
|||
@Autowired |
|||
private AcsToWmsService acsToWmsService; |
|||
|
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void create() throws BadRequestException { |
|||
// 获取任务
|
|||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
|||
// 配置信息
|
|||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|||
for (SchBaseTask task : tasks) { |
|||
// 找终点
|
|||
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1())); |
|||
String extGroupData = task.getExt_group_data(); |
|||
JSONObject jsonObject = JSONObject.parseObject(extGroupData); |
|||
// String materialType = jsonObject.getString("material_type");
|
|||
SchBasePoint point = findNextPoint(); |
|||
if (ObjectUtil.isEmpty(point)) { |
|||
task.setRemark("未找到所需点位!"); |
|||
taskService.update(task); |
|||
// 消息通知
|
|||
log.info("原材料入库未找到当前符合条件的点位!"); |
|||
continue; |
|||
} |
|||
// 设置终点并修改创建成功状态
|
|||
task.setPoint_code2(point.getPoint_code()); |
|||
task.setTask_status(TaskStatus.CREATED.getCode()); |
|||
task.setRemark(""); |
|||
taskService.update(task); |
|||
|
|||
//发起任务时先把点位占用,防止发起重复任务
|
|||
point.setIng_task_code(task.getTask_code()); |
|||
// point.setVehicle_type(materialType);
|
|||
pointService.update(point); |
|||
|
|||
//下发
|
|||
this.renotifyAcs(task); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 判断目标点位 |
|||
* |
|||
* @return |
|||
*/ |
|||
private SchBasePoint findNextPoint() { |
|||
String regionCode = "YL"; |
|||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "2"); |
|||
for (SchBasePoint schBasePoint : schBasePointList) { |
|||
if ("2".equals(schBasePoint.getPoint_status()) |
|||
&& schBasePoint.getVehicle_qty() ==0) { |
|||
log.info("原材料入库找到当前符合条件的点位{}", schBasePoint.getPoint_code()); |
|||
return schBasePoint; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getById(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 获取参数
|
|||
JSONObject extGroupData = ObjectUtil.isNotEmpty(taskObj.getExt_group_data()) |
|||
? JSONObject.parseObject(taskObj.getExt_group_data()) |
|||
: null; |
|||
// 载具编码:没有就创建一个
|
|||
String vehicle_code = ObjectUtil.isNotEmpty(taskObj.getVehicle_code()) |
|||
? taskObj.getVehicle_code() |
|||
: IdUtil.getSnowflake(1, 1).nextIdStr(); |
|||
PdmBdWorkorder workorderCode = null; |
|||
if (extGroupData != null) { |
|||
workorderCode = ObjectUtil.isNotEmpty(extGroupData.getString("workorder_code")) |
|||
? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>() |
|||
.eq(PdmBdWorkorder::getWorkorder_code, extGroupData.getString("workorder_code"))) |
|||
: null; |
|||
} |
|||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|||
String endPoint = ObjectUtil.isNotEmpty(taskObj.getPoint_code2())?taskObj.getPoint_code2().substring(0,taskObj.getPoint_code2().length()-2):"0"; // 获取终点
|
|||
SchBasePoint startPointObj = pointService.getById(startPoint); |
|||
SchBasePoint endPointObj = pointService.getById(endPoint); |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|||
// 起点清空
|
|||
if (ObjectUtil.isNotEmpty(startPointObj)) { |
|||
PointUtils.clearPoint(startPointObj); |
|||
} |
|||
// 终点解锁
|
|||
endPointObj.setIng_task_code(""); |
|||
endPointObj.setVehicle_code(ObjectUtil.isEmpty(endPointObj.getVehicle_code()) ? vehicle_code + "," : endPointObj.getVehicle_code() + vehicle_code + ","); |
|||
endPointObj.setVehicle_qty(1); |
|||
pointService.update(endPointObj); |
|||
// 要把数据存到组盘表 -> 改造公共方法,返回id
|
|||
//todo 组盘表需要关联外部mes晶棒数据,一对多
|
|||
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); |
|||
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
groupEntity.setCreate_id("2"); |
|||
groupEntity.setCreate_name("ACS"); |
|||
groupEntity.setCreate_time(DateUtil.now()); |
|||
groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderCode) |
|||
? workorderCode.getMaterial_id() |
|||
: ""); |
|||
groupEntity.setStanding_time(ObjectUtil.isNotEmpty(workorderCode) |
|||
? workorderCode.getStanding_time() |
|||
: 0); |
|||
groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(extGroupData) |
|||
? extGroupData.getBigDecimal("material_qty") |
|||
: BigDecimal.valueOf(0)); |
|||
groupEntity.setWorkorder_code(ObjectUtil.isNotEmpty(workorderCode) |
|||
? workorderCode.getWorkorder_code() |
|||
: ""); |
|||
groupEntity.setVehicle_code(vehicle_code); |
|||
groupEntity.setVehicle_type(taskObj.getVehicle_type()); |
|||
groupEntity.setPoint_code(startPoint); |
|||
groupEntity.setPoint_name(startPointObj.getPoint_name()); |
|||
groupEntity.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd")); |
|||
groupEntity.setInstorage_time(DateUtil.now()); |
|||
groupEntity.setTask_code(taskObj.getTask_code()); |
|||
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定
|
|||
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
|
|||
groupEntity.setIs_delete(false); |
|||
groupEntity.setMove_way(startPoint); |
|||
vehiclematerialgroupService.save(groupEntity); |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setGroup_id(groupEntity.getGroup_id()); |
|||
taskObj.setRemark("任务完成"); |
|||
try { |
|||
//todo 入库成功后上报mes
|
|||
}catch (Exception e){ |
|||
log.error("原材料入库上报MES失败{}",e.getMessage(),e); |
|||
} |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
|||
// 终点解锁
|
|||
if (ObjectUtil.isNotEmpty(endPointObj)) { |
|||
endPointObj.setIng_task_code(""); |
|||
//任务取消把原先占用的位置释放
|
|||
pointService.update(endPointObj); |
|||
} |
|||
taskObj.setRemark("任务取消"); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
} |
|||
taskService.update(taskObj); |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.FINISHED); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.CANCELED); |
|||
} |
|||
|
|||
@Override |
|||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|||
//该场景无需重算等待点
|
|||
} |
|||
} |
@ -1,245 +0,0 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks; |
|||
|
|||
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.query.LambdaQueryWrapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.config.MapOf; |
|||
import org.nl.wms.ext.service.WmsToAcsService; |
|||
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|||
import org.nl.wms.pdm.service.IPdmBdWorkorderService; |
|||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder; |
|||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|||
import org.nl.wms.sch.point.service.ISchBasePointService; |
|||
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; |
|||
import org.nl.wms.sch.task_manage.enums.GroupStatusEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|||
import org.nl.wms.util.PointUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Lazy; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Author: psh |
|||
* @Description: 原材料出库 |
|||
* @Date: 2023/1/24 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@TaskType("YCLCKTask") |
|||
@Lazy |
|||
public class YCLCKTask extends AbstractTask { |
|||
private static String TASK_CONFIG_CODE = "YCLCKTask"; |
|||
/** |
|||
* 入口 |
|||
*/ |
|||
private static String ENTRANCE = "1"; |
|||
@Autowired |
|||
private ISchBasePointService pointService; |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
@Autowired |
|||
private IPdmBdWorkorderService workorderService; |
|||
@Autowired |
|||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; |
|||
@Autowired |
|||
private PointMapper pointMapper; |
|||
@Autowired |
|||
private WmsToAcsService wmsToAcsService; |
|||
|
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void create() throws BadRequestException { |
|||
// 获取任务
|
|||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
|||
// 配置信息
|
|||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|||
for (SchBaseTask task : tasks) { |
|||
SchBasePoint point = findNextPoint(task); |
|||
if (ObjectUtil.isEmpty(point)) { |
|||
task.setRemark("未找到所需点位!"); |
|||
taskService.update(task); |
|||
// 消息通知
|
|||
log.info("原材料出库未找到所需点位!"); |
|||
continue; |
|||
} |
|||
// 设置起点并修改创建成功状态
|
|||
task.setPoint_code2(point.getPoint_code()); |
|||
task.setTask_status(TaskStatus.CREATED.getCode()); |
|||
task.setRemark(""); |
|||
SchBasePoint schBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1())); |
|||
task.setVehicle_code(schBasePoint.getVehicle_code()); |
|||
task.setVehicle_code2(schBasePoint.getVehicle_code2()); |
|||
taskService.update(task); |
|||
|
|||
//发起任务时先把点位占用,防止发起重复任务
|
|||
// point.setIng_task_code(task.getTask_code());
|
|||
// point.setVehicle_qty(point.getVehicle_qty() - 1);
|
|||
// point.setVehicle_type(materialType);
|
|||
// pointService.update(point);
|
|||
|
|||
//下发
|
|||
this.renotifyAcs(task); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* todo 待确认怎么区分普通回温和快速回温 |
|||
* todo 设置回温时间 |
|||
* |
|||
* @return |
|||
*/ |
|||
private SchBasePoint findNextPoint(SchBaseTask task) { |
|||
String regionCode = "HW"; |
|||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"0"); |
|||
for (SchBasePoint schBasePoint : schBasePointList) { |
|||
//已锁定直接返回
|
|||
if(task.getTask_code().equals(schBasePoint.getIng_task_code())){ |
|||
return schBasePoint; |
|||
} |
|||
if (schBasePoint.getIs_used() |
|||
&& schBasePoint.getVehicle_qty() ==0) { |
|||
log.info("原材料出库任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code()); |
|||
return schBasePoint; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* todo 任务完成设置完成时间为开始固化时间 |
|||
*/ |
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getById(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|||
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
|||
SchBasePoint startPointObj = pointService.getById(startPoint); |
|||
SchBasePoint endPointObj = pointService.getById(endPoint); |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|||
String vehicleCode=taskObj.getVehicle_code(); |
|||
String vehicleCode2= taskObj.getVehicle_code2(); |
|||
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|||
GroupBindMaterialStatusEnum.BOUND.getValue())); |
|||
if (ObjectUtil.isNotEmpty(one)) { |
|||
// throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
|
|||
// }
|
|||
one.setTask_code(taskObj.getTask_code()); |
|||
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
|
|||
one.setPoint_name(endPointObj.getPoint_name()); |
|||
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|||
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|||
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|||
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|||
one.setUpdate_time(DateUtil.now()); |
|||
vehiclematerialgroupService.updateById(one); |
|||
} |
|||
one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode2) |
|||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|||
GroupBindMaterialStatusEnum.BOUND.getValue())); |
|||
if (ObjectUtil.isNotEmpty(one)) { |
|||
// throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
|
|||
// }
|
|||
one.setTask_code(taskObj.getTask_code()); |
|||
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
|
|||
one.setPoint_name(endPointObj.getPoint_name()); |
|||
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|||
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|||
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|||
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|||
one.setUpdate_time(DateUtil.now()); |
|||
vehiclematerialgroupService.updateById(one); |
|||
} |
|||
// 终点解锁
|
|||
endPointObj.setIng_task_code(""); |
|||
endPointObj.setVehicle_code(taskObj.getVehicle_code()); |
|||
endPointObj.setVehicle_code2(taskObj.getVehicle_code2()); |
|||
endPointObj.setVehicle_qty(1); |
|||
endPointObj.setUpdate_time(DateUtil.now()); |
|||
pointService.update(endPointObj); |
|||
// 起点清空
|
|||
startPointObj.setVehicle_code(""); |
|||
startPointObj.setVehicle_code2(""); |
|||
startPointObj.setIng_task_code(""); |
|||
startPointObj.setUpdate_time(DateUtil.now()); |
|||
pointService.updateById(startPointObj); |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setGroup_id(one.getGroup_id()); |
|||
taskObj.setRemark("任务完成"); |
|||
try { |
|||
//todo 出库成功后上报mes
|
|||
}catch (Exception e){ |
|||
log.error("原材料出库上报MES失败{}",e.getMessage(),e); |
|||
} |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
|||
// 终点解锁
|
|||
if (ObjectUtil.isNotEmpty(endPointObj)) { |
|||
endPointObj.setIng_task_code(""); |
|||
pointService.update(endPointObj); |
|||
} |
|||
// 起点解锁
|
|||
if (ObjectUtil.isNotEmpty(startPointObj)) { |
|||
startPointObj.setIng_task_code(""); |
|||
pointService.update(startPointObj); |
|||
} |
|||
taskObj.setRemark("任务取消"); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
} |
|||
taskService.update(taskObj); |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.FINISHED); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.CANCELED); |
|||
} |
|||
|
|||
@Override |
|||
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { |
|||
//该场景无需重算等待点
|
|||
} |
|||
} |
@ -1,249 +0,0 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks; |
|||
|
|||
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.query.LambdaQueryWrapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.wms.ext.service.AcsToWmsService; |
|||
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|||
import org.nl.wms.pdm.service.IPdmBdWorkorderService; |
|||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder; |
|||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|||
import org.nl.wms.sch.point.service.ISchBasePointService; |
|||
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; |
|||
import org.nl.wms.sch.task_manage.enums.GroupStatusEnum; |
|||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|||
import org.nl.wms.util.PointUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Lazy; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.HashSet; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @Author: psh |
|||
* @Description: 原材料入库 |
|||
* @Date: 2024/1/24 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@TaskType("YCLRKTask") |
|||
@Lazy |
|||
public class YCLRKTask extends AbstractTask { |
|||
private static String TASK_CONFIG_CODE = "YCLRKTask"; |
|||
/** |
|||
* 入口 |
|||
*/ |
|||
private static String ENTRANCE = "1"; |
|||
@Autowired |
|||
private ISchBasePointService pointService; |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
@Autowired |
|||
private IPdmBdWorkorderService workorderService; |
|||
@Autowired |
|||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; |
|||
@Autowired |
|||
private PointMapper pointMapper; |
|||
@Autowired |
|||
private AcsToWmsService acsToWmsService; |
|||
|
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void create() throws BadRequestException { |
|||
// 获取任务
|
|||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
|||
// 配置信息
|
|||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|||
for (SchBaseTask task : tasks) { |
|||
// 找终点
|
|||
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1())); |
|||
String extGroupData = task.getExt_group_data(); |
|||
JSONObject jsonObject = JSONObject.parseObject(extGroupData); |
|||
// String materialType = jsonObject.getString("material_type");
|
|||
SchBasePoint point = findNextPoint(); |
|||
if (ObjectUtil.isEmpty(point)) { |
|||
task.setRemark("未找到所需点位!"); |
|||
taskService.update(task); |
|||
// 消息通知
|
|||
log.info("原材料入库未找到当前符合条件的点位!"); |
|||
continue; |
|||
} |
|||
// 设置终点并修改创建成功状态
|
|||
task.setPoint_code2(point.getPoint_code()); |
|||
task.setTask_status(TaskStatus.CREATED.getCode()); |
|||
task.setVehicle_code(jsonObject.getString("mother_tray")); |
|||
task.setVehicle_code2(jsonObject.getString("sub_tray")); |
|||
task.setRemark(""); |
|||
taskService.update(task); |
|||
|
|||
//发起任务时先把点位占用,防止发起重复任务
|
|||
point.setIng_task_code(task.getTask_code()); |
|||
// point.setVehicle_type(materialType);
|
|||
pointService.update(point); |
|||
|
|||
//下发
|
|||
this.renotifyAcs(task); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 判断目标点位 |
|||
* |
|||
* @return |
|||
*/ |
|||
private SchBasePoint findNextPoint() { |
|||
String regionCode = "YL"; |
|||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "0"); |
|||
for (SchBasePoint schBasePoint : schBasePointList) { |
|||
if (schBasePoint.getIs_used() |
|||
&& schBasePoint.getVehicle_qty() ==0) { |
|||
log.info("原材料入库找到当前符合条件的点位{}", schBasePoint.getPoint_code()); |
|||
return schBasePoint; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getById(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 获取参数
|
|||
JSONObject extGroupData = ObjectUtil.isNotEmpty(taskObj.getExt_group_data()) |
|||
? JSONObject.parseObject(taskObj.getExt_group_data()) |
|||
: null; |
|||
PdmBdWorkorder workorderCode = null; |
|||
if (extGroupData != null) { |
|||
workorderCode = ObjectUtil.isNotEmpty(extGroupData.getString("workorder_code")) |
|||
? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>() |
|||
.eq(PdmBdWorkorder::getWorkorder_code, extGroupData.getString("workorder_code"))) |
|||
: null; |
|||
} |
|||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|||
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
|||
SchBasePoint startPointObj = pointService.getById(startPoint); |
|||
SchBasePoint endPointObj = pointService.getById(endPoint); |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|||
// 起点清空
|
|||
if (ObjectUtil.isNotEmpty(startPointObj)) { |
|||
PointUtils.clearPoint(startPointObj); |
|||
} |
|||
// 终点解锁
|
|||
endPointObj.setIng_task_code(""); |
|||
endPointObj.setVehicle_code(taskObj.getVehicle_code()); |
|||
endPointObj.setVehicle_code2(taskObj.getVehicle_code2()); |
|||
endPointObj.setVehicle_qty(1); |
|||
pointService.update(endPointObj); |
|||
// 要把数据存到组盘表 -> 改造公共方法,返回id
|
|||
//组盘表需要关联外部mes晶棒数据,一对多
|
|||
SchBaseVehiclematerialgroup groupEntity = getSchBaseVehiclematerialgroup(taskObj, extGroupData, workorderCode, startPoint, startPointObj); |
|||
groupEntity.setVehicle_code(taskObj.getVehicle_code()); |
|||
groupEntity.setVehicle_type("0"); |
|||
vehiclematerialgroupService.save(groupEntity); |
|||
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
groupEntity.setVehicle_code(taskObj.getVehicle_code2()); |
|||
groupEntity.setVehicle_type("1"); |
|||
vehiclematerialgroupService.save(groupEntity); |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setGroup_id(groupEntity.getGroup_id()); |
|||
taskObj.setRemark("任务完成"); |
|||
try { |
|||
//todo 入库成功后上报mes
|
|||
}catch (Exception e){ |
|||
log.error("原材料入库上报MES失败{}",e.getMessage(),e); |
|||
} |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
|||
// 终点解锁
|
|||
if (ObjectUtil.isNotEmpty(endPointObj)) { |
|||
endPointObj.setIng_task_code(""); |
|||
//任务取消把原先占用的位置释放
|
|||
pointService.update(endPointObj); |
|||
} |
|||
taskObj.setRemark("任务取消"); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
} |
|||
taskService.update(taskObj); |
|||
} |
|||
|
|||
private static SchBaseVehiclematerialgroup getSchBaseVehiclematerialgroup(SchBaseTask taskObj, JSONObject extGroupData, PdmBdWorkorder workorderCode, String startPoint, SchBasePoint startPointObj) { |
|||
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); |
|||
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
groupEntity.setCreate_id("2"); |
|||
groupEntity.setCreate_name("ACS"); |
|||
groupEntity.setCreate_time(DateUtil.now()); |
|||
groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderCode) |
|||
? workorderCode.getMaterial_id() |
|||
: ""); |
|||
groupEntity.setStanding_time(ObjectUtil.isNotEmpty(workorderCode) |
|||
? workorderCode.getStanding_time() |
|||
: 0); |
|||
groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(extGroupData) |
|||
? extGroupData.getBigDecimal("material_qty") |
|||
: BigDecimal.valueOf(0)); |
|||
groupEntity.setWorkorder_code(ObjectUtil.isNotEmpty(workorderCode) |
|||
? workorderCode.getWorkorder_code() |
|||
: ""); |
|||
groupEntity.setPoint_code(startPoint); |
|||
groupEntity.setPoint_name(startPointObj.getPoint_name()); |
|||
groupEntity.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd")); |
|||
groupEntity.setInstorage_time(DateUtil.now()); |
|||
groupEntity.setTask_code(taskObj.getTask_code()); |
|||
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定
|
|||
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
|
|||
groupEntity.setIs_delete(false); |
|||
groupEntity.setMove_way(startPoint); |
|||
return groupEntity; |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.FINISHED); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
this.updateStatus(task_code, TaskStatus.CANCELED); |
|||
} |
|||
|
|||
@Override |
|||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|||
//该场景无需重算等待点
|
|||
} |
|||
} |
Loading…
Reference in new issue