package org.springblade.mdm.flow.task.dispatch;
|
|
import lombok.extern.slf4j.Slf4j;
|
import org.flowable.engine.delegate.DelegateExecution;
|
import org.springblade.core.tool.utils.BeanUtil;
|
import org.springblade.mdm.program.entity.NcProgram;
|
import org.springblade.mdm.program.service.NcProgramService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
@Slf4j
|
@Component("programEmptyUpgradeProcessEdtionTask")
|
public class ProgramEmptyUpgradeProcessEdtionTask {
|
@Autowired
|
private NcProgramService ncProgramService;
|
public void execute(DelegateExecution execution) {
|
//空升版,新加入一条程序数据,并且将工序版次processEdition设置为用户输入的新版本
|
|
NcProgram ncProgram = (NcProgram)execution.getVariable("curedNcProgram");
|
//将现有程序设置为非最新的
|
ncProgram.setIsLastEdition(0);
|
ncProgramService.updateById(ncProgram);
|
|
NcProgram newNcProgram = new NcProgram();
|
BeanUtil.copyProperties(ncProgram, newNcProgram);
|
newNcProgram.setIsLastEdition(1);
|
newNcProgram.setId(null);
|
ncProgramService.save(newNcProgram);
|
|
log.info("空升版完成,新的程序id为{}",newNcProgram.getId());
|
}
|
}
|