opt: 套轴优先托盘有管芯、套轴看板优化、看板可直接恢复套轴计划、套轴计划过滤天数
This commit is contained in:
@@ -164,6 +164,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
.anyMatch(prefix -> p.getResource_name().startsWith(prefix)) &&
|
||||
checkComputationPoint(p, empty) && checkHasTask(p))
|
||||
.collect(Collectors.toList());
|
||||
log.info("SQL查询后过滤区域、是否有套过轴的数据:{}", plans);
|
||||
if (plans.size() == 0) {
|
||||
stepErrorInfo.add("找不到需要套轴的信息,只做拔轴。");
|
||||
// 如果不需要套轴,就只做拔轴
|
||||
@@ -173,7 +174,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
// 过滤相比当前时间大于1小时
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime cutoffTime = LocalDateTime.now().minusHours(1);
|
||||
List<SlitterPlanDistinctDto> filteredList = planAll.stream()
|
||||
List<SlitterPlanDistinctDto> filteredList = plans.stream()
|
||||
.filter(p -> {
|
||||
try {
|
||||
LocalDateTime startTime = LocalDateTime.parse(p.getStart_time(), formatter);
|
||||
@@ -183,7 +184,6 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
List<PdmBiSlittingproductionplan> filterCheckPlans = null;
|
||||
if (filteredList.size() > 0) {
|
||||
log.info("过滤时间之后的数据:{}", filteredList);
|
||||
// 获取当前三个位置的所有管芯信息
|
||||
@@ -193,18 +193,13 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
.map(MdPbPapervehicle::getMaterial_code)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 获取所有dto中的分切计划信息
|
||||
List<String> parents = filteredList.stream()
|
||||
.map(SlitterPlanDistinctDto::getParent_container_name)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<PdmBiSlittingproductionplan> checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getParent_container_name, parents)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||
filterCheckPlans = checkPlans.stream()
|
||||
.filter(p -> tubeCodes.contains("1".equals(p.getPaper_tube_or_FRP()) ? p.getPaper_tube_material() : p.getFRP_material()))
|
||||
.collect(Collectors.toList());
|
||||
if (tubeCodes.size() > 0) {
|
||||
// 获取所有dto中的分切计划信息
|
||||
List<SlitterPlanDistinctDto> filteredListT = getSlitterPlanByTubesDtos(filteredList, papers, tubeCodes);
|
||||
if (CollectionUtil.isNotEmpty(filteredListT)) {
|
||||
plans = filteredListT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("获取过滤后的分切计划数据:{}", JSON.toJSONString(plans));
|
||||
@@ -291,10 +286,6 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||
}
|
||||
// 如果过滤出来的需要套轴的信息,则直接获取
|
||||
if (CollectionUtil.isNotEmpty(filterCheckPlans)) {
|
||||
needPlans = filterCheckPlans;
|
||||
}
|
||||
log.info("通过dto获取的分切计划:{}", needPlans);
|
||||
// 获取其中一条
|
||||
PdmBiSlittingproductionplan needPlan = needPlans.get(0);
|
||||
@@ -417,6 +408,42 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
stepStr += ",97";
|
||||
}
|
||||
|
||||
public List<SlitterPlanDistinctDto> getSlitterPlanByTubesDtos(List<SlitterPlanDistinctDto> filteredList
|
||||
, List<MdPbPapervehicle> papers
|
||||
, List<String> tubeCodes) {
|
||||
List<SlitterPlanDistinctDto> filteredListT;
|
||||
filteredListT = filteredList.stream().filter(dto -> {
|
||||
List<PdmBiSlittingproductionplan> checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getResource_name, dto.getResource_name())
|
||||
.eq(PdmBiSlittingproductionplan::getParent_container_name, dto.getParent_container_name())
|
||||
.eq(PdmBiSlittingproductionplan::getUp_or_down, dto.getUp_or_down())
|
||||
.eq(PdmBiSlittingproductionplan::getSplit_group, dto.getSplit_group())
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||
if (checkPlans.size() == 0) {
|
||||
// 可能是改切,所以换成restruct_container_name来使用
|
||||
checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getResource_name, dto.getResource_name())
|
||||
.eq(PdmBiSlittingproductionplan::getRestruct_container_name, dto.getParent_container_name())
|
||||
.eq(PdmBiSlittingproductionplan::getUp_or_down, dto.getUp_or_down())
|
||||
.eq(PdmBiSlittingproductionplan::getSplit_group, dto.getSplit_group())
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||
}
|
||||
if (CollectionUtil.isEmpty(checkPlans)) {
|
||||
return false;
|
||||
}
|
||||
List<String> needTubes = checkPlans.stream().map(p -> {
|
||||
if ("1".equals(p.getPaper_tube_or_FRP())) {
|
||||
return p.getPaper_tube_material();
|
||||
}
|
||||
return p.getFRP_material();
|
||||
}).distinct().collect(Collectors.toList());
|
||||
return SlitterTaskUtil.containsAllTubes(tubeCodes, needTubes, papers);
|
||||
}).collect(Collectors.toList());
|
||||
return filteredListT;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是不是有空位置
|
||||
* @param planD
|
||||
|
||||
@@ -52,4 +52,11 @@ public class SlitterController {
|
||||
public ResponseEntity<Object> tzTaskINfo(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(slitterService.tzTaskINfo(entity), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/recover")
|
||||
@Log("恢复计划")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> recover(@RequestBody JSONObject entity){
|
||||
slitterService.recover(entity);
|
||||
return new ResponseEntity<>( HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,8 @@
|
||||
p.is_paper_ok,
|
||||
MIN(p.start_time) AS start_time,
|
||||
IF(p.paper_tube_or_FRP = '1', p.paper_tube_description, p.FRP_description) AS tube,
|
||||
MIN(p.`status`) AS `status`
|
||||
MIN(p.`status`) AS `status`,
|
||||
MAX(p.qzzno) AS qzzno
|
||||
FROM `pdm_bi_slittingproductionplan` p
|
||||
WHERE p.`status` <![CDATA[ < ]]> '09'
|
||||
AND p.is_delete = '0'
|
||||
|
||||
@@ -46,4 +46,5 @@ public class CallPlanViewVO implements Serializable {
|
||||
private String qzz_generation;
|
||||
private String start_time;
|
||||
private String is_paper_ok;
|
||||
private String qzzno;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -371,4 +372,6 @@ public interface SlitterService {
|
||||
JSONObject cutCacheInventory(JSONObject param);
|
||||
|
||||
JSONObject tzTaskINfo(JSONObject entity);
|
||||
|
||||
void recover(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -2323,11 +2322,38 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@Override
|
||||
public List<CallPlanViewVO> showManualView(JSONObject param) {
|
||||
// 获取穿拔轴点位数据
|
||||
List<BstIvtShafttubeivt> shaftPoints = shafttubeivtService.getAllByPointType("2", true);
|
||||
Param useXn = paramService.findByCode(USE_XN);
|
||||
List<CallPlanViewVO> callPlanViewVOS;
|
||||
if (ObjectUtil.isNotEmpty(useXn) && "1".equals(useXn.getValue())) {
|
||||
return slitterMapper.showManualView();
|
||||
callPlanViewVOS = slitterMapper.showManualView();
|
||||
} else {
|
||||
callPlanViewVOS = slitterMapper.showManualViewNoXn();
|
||||
}
|
||||
return slitterMapper.showManualViewNoXn();
|
||||
for (CallPlanViewVO callPlanViewVO : callPlanViewVOS) {
|
||||
if ("2".equals(callPlanViewVO.getIs_paper_ok())) {
|
||||
// 已下发
|
||||
callPlanViewVO.setIs_paper_ok("4");
|
||||
for (BstIvtShafttubeivt shaftPoint : shaftPoints) {
|
||||
if (shaftPoint.getContainer_name1().equals(callPlanViewVO.getContainer_name())
|
||||
|| shaftPoint.getContainer_name2().equals(callPlanViewVO.getContainer_name())) {
|
||||
// 正在套轴
|
||||
callPlanViewVO.setIs_paper_ok("3");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!"3".equals(callPlanViewVO.getIs_paper_ok()) && ObjectUtil.isNotEmpty(callPlanViewVO.getQzzno())) {
|
||||
// 已套轴
|
||||
callPlanViewVO.setIs_paper_ok("2");
|
||||
}
|
||||
if (!"3".equals(callPlanViewVO.getIs_paper_ok())
|
||||
&& ObjectUtil.isEmpty(callPlanViewVO.getQzzno())) {
|
||||
callPlanViewVO.setIs_paper_ok("99");
|
||||
}
|
||||
}
|
||||
}
|
||||
return callPlanViewVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2818,6 +2844,23 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover(JSONObject param) {
|
||||
// container_name
|
||||
String containerName = param.getString("container_name");
|
||||
List<BstIvtShafttubeivt> shaftPoints = shafttubeivtService.getAllByPointType("2", true);
|
||||
for (BstIvtShafttubeivt shaftPoint : shaftPoints) {
|
||||
if (shaftPoint.getContainer_name1().equals(containerName)
|
||||
|| shaftPoint.getContainer_name2().equals(containerName)) {
|
||||
throw new BadRequestException("请使用手持并且与电气初始化");
|
||||
}
|
||||
}
|
||||
LambdaUpdateWrapper<PdmBiSlittingproductionplan> lam = new LambdaUpdateWrapper<>();
|
||||
lam.set(PdmBiSlittingproductionplan::getIs_paper_ok, "1")
|
||||
.eq(PdmBiSlittingproductionplan::getContainer_name, containerName);
|
||||
slittingproductionplanService.update(lam);
|
||||
}
|
||||
|
||||
public List<String> getRedisListValue(String key) {
|
||||
List<String> stepTipLogs = (List<String>) redisUtils.get(key);
|
||||
if (CollectionUtil.isEmpty(stepTipLogs)) {
|
||||
|
||||
@@ -12,10 +12,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -529,4 +526,32 @@ public class SlitterTaskUtil {
|
||||
}
|
||||
log.info("分切下卷计划位置校验通过!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断管芯行家对接位是否有所需的管芯、并且数量是符合的。
|
||||
* @param tubeCodes
|
||||
* @param needTubes
|
||||
* @param papers
|
||||
* @return
|
||||
*/
|
||||
public static boolean containsAllTubes(List<String> tubeCodes, List<String> needTubes, List<MdPbPapervehicle> papers) {
|
||||
Set<String> tubeSet = new HashSet<>(tubeCodes);
|
||||
for (String tube : needTubes) {
|
||||
if (!tubeSet.contains(tube)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
for (String needTube : needTubes) {
|
||||
for (MdPbPapervehicle paper : papers) {
|
||||
if (needTube.equals(paper.getMaterial_code())) {
|
||||
num += paper.getQty().intValue();
|
||||
}
|
||||
}
|
||||
if (num == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user