opt: 备货区优化、拉取子卷优先能释放架子的点位
This commit is contained in:
@@ -155,4 +155,13 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
* @return
|
||||
*/
|
||||
BstIvtCutpointivt getPointByTrussOrAgvCode(String endPoint, boolean flag);
|
||||
|
||||
/**
|
||||
* 获取可以拔轴的卷
|
||||
* @param qzzSize 尺寸
|
||||
* @param generation 代数
|
||||
* @param pointLocation 点位半区(0下,1上)
|
||||
* @return
|
||||
*/
|
||||
List<CutpointAirShhaftDto> getCanPullPoints(String qzzSize, String generation, String pointLocation);
|
||||
}
|
||||
|
||||
@@ -35,4 +35,6 @@ public interface BstIvtCutpointivtMapper extends BaseMapper<BstIvtCutpointivt> {
|
||||
|
||||
List<String> getCanUseMinPointByShelf(String type, String area);
|
||||
List<String> getCanUseMinPointByShelfSpecial(String type, String area);
|
||||
|
||||
List<CutpointAirShhaftDto> getCanPullPoints(String size, String generation, String area);
|
||||
}
|
||||
|
||||
@@ -211,30 +211,42 @@
|
||||
</select>
|
||||
<select id="getAreaNotTaskPointByTcQzzPoint"
|
||||
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dto.CutpointAirShhaftDto">
|
||||
SELECT bic.ivt_id,bic.point_code,bic.qzz_no1 as qzz_no,bic.truss_point_code1 as qzz_point, p.qzz_generation, p.qzz_size
|
||||
SELECT bic.ivt_id,
|
||||
bic.point_code,
|
||||
bic.qzz_no1 as qzz_no,
|
||||
bic.truss_point_code1 as qzz_point,
|
||||
p.qzz_generation,
|
||||
p.qzz_size
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON ((p.qzzno = bic.qzz_no1 AND IFNULL(bic.qzz_no1,'') != '')
|
||||
OR (p.qzzno = bic.qzz_no2 AND IFNULL(bic.qzz_no2,'') != ''))
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON ((p.qzzno = bic.qzz_no1 AND IFNULL(bic.qzz_no1, '') != '')
|
||||
OR (p.qzzno = bic.qzz_no2 AND IFNULL(bic.qzz_no2, '') != ''))
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '3'
|
||||
AND qzz_no1 !=''
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '3'
|
||||
AND qzz_no1 !=''
|
||||
AND bic.point_location = #{area}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071' AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
AND t.is_delete = '0'
|
||||
AND (t.point_code1 = bic.truss_point_code1 oR t.point_code2 = bic.truss_point_code1))
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071'
|
||||
AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
AND t.is_delete = '0'
|
||||
AND (t.point_code1 = bic.truss_point_code1
|
||||
oR t.point_code2 = bic.truss_point_code1))
|
||||
UNION all
|
||||
SELECT bic.ivt_id,bic.point_code,bic.qzz_no2 as qzz_no,bic.truss_point_code2 as qzz_point, p.qzz_generation, p.qzz_size
|
||||
SELECT bic.ivt_id,
|
||||
bic.point_code,
|
||||
bic.qzz_no2 as qzz_no,
|
||||
bic.truss_point_code2 as qzz_point,
|
||||
p.qzz_generation,
|
||||
p.qzz_size
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON ((p.qzzno = bic.qzz_no1 AND IFNULL(bic.qzz_no1,'') != '')
|
||||
OR (p.qzzno = bic.qzz_no2 AND IFNULL(bic.qzz_no2,'') != ''))
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON ((p.qzzno = bic.qzz_no1 AND IFNULL(bic.qzz_no1, '') != '')
|
||||
OR (p.qzzno = bic.qzz_no2 AND IFNULL(bic.qzz_no2, '') != ''))
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_location = #{area}
|
||||
AND bic.point_status = '3'
|
||||
AND qzz_no2 !=''
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_location = #{area}
|
||||
AND bic.point_status = '3'
|
||||
AND qzz_no2 !=''
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071' AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
@@ -313,4 +325,54 @@
|
||||
))) AS combined
|
||||
ORDER BY point_status DESC, truss_point_code;
|
||||
</select>
|
||||
<select id="getCanPullPoints"
|
||||
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dto.CutpointAirShhaftDto">
|
||||
SELECT bic.ivt_id,
|
||||
bic.point_code,
|
||||
bic.qzz_no1 as qzz_no,
|
||||
bic.truss_point_code1 as qzz_point,
|
||||
p.qzz_generation,
|
||||
p.qzz_size
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON (p.qzzno = bic.qzz_no1 AND IFNULL(bic.qzz_no1, '') != '')
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '3'
|
||||
AND p.qzz_size = #{size}
|
||||
<if test="size == '3'">
|
||||
AND p.qzz_generation = #{generation}
|
||||
</if>
|
||||
AND IFNULL(bic.qzz_no1, '') <![CDATA[ <> ]]> ''
|
||||
AND bic.point_location = #{area}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071'
|
||||
AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
AND t.is_delete = '0'
|
||||
AND (t.point_code1 = bic.truss_point_code1
|
||||
oR t.point_code2 = bic.truss_point_code1))
|
||||
UNION all
|
||||
SELECT bic.ivt_id,
|
||||
bic.point_code,
|
||||
bic.qzz_no2 as qzz_no,
|
||||
bic.truss_point_code2 as qzz_point,
|
||||
p.qzz_generation,
|
||||
p.qzz_size
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON (p.qzzno = bic.qzz_no2 AND IFNULL(bic.qzz_no2, '') != '')
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_location = #{area}
|
||||
AND bic.point_status = '3'
|
||||
AND p.qzz_size = #{size}
|
||||
<if test="size == '3'">
|
||||
AND p.qzz_generation = #{generation}
|
||||
</if>
|
||||
AND IFNULL(bic.qzz_no2, '') <![CDATA[ <> ]]> ''
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071' AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
AND t.is_delete = '0'
|
||||
AND (t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2));
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -190,4 +190,9 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code2, point));
|
||||
return bstIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CutpointAirShhaftDto> getCanPullPoints(String qzzSize, String generation, String pointLocation) {
|
||||
return bstIvtCutpointivtMapper.getCanPullPoints(qzzSize, generation, pointLocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.nl.b_lms.bst.ivt.papervehicle.service.IMdPbPapervehicleService;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.IBstIvtStockingivtService;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
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.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
|
||||
@@ -29,7 +31,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -47,6 +51,8 @@ public class StockAreaCallTubeTask extends AbstractAcsTask {
|
||||
@Autowired
|
||||
private IMdPbPapervehicleService mdPbPapervehicleService;
|
||||
@Autowired
|
||||
private IPdmBiSlittingproductionplanService slittingproductionplanService;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
@@ -101,7 +107,31 @@ public class StockAreaCallTubeTask extends AbstractAcsTask {
|
||||
startPointObj.setIvt_status("0");
|
||||
TaskUtils.updateOptMessageByBStockingPoint(startPointObj);
|
||||
stockingivtService.update(startPointObj);
|
||||
|
||||
JSONObject object = JSONObject.parseObject(task.getRequest_param());
|
||||
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(object.getString("to_material"))) {
|
||||
String toMaterial = object.getString("to_material");
|
||||
List<String> tubes = Arrays.stream(toMaterial.split(",")).collect(Collectors.toList());
|
||||
// 将95的计划恢复
|
||||
// 批量设置
|
||||
List<PdmBiSlittingproductionplan> list = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "01")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_child_tz_ok, "0")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, "95")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_call, "1")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
||||
.and(la2 -> la2.in(PdmBiSlittingproductionplan::getPaper_tube_material, tubes)
|
||||
.or()
|
||||
.in(PdmBiSlittingproductionplan::getFRP_material, tubes))
|
||||
);
|
||||
if (list.size() > 0) {
|
||||
for (PdmBiSlittingproductionplan p : list) {
|
||||
p.setIs_paper_ok("1");
|
||||
p.setUpdate_optname("任务完成");
|
||||
p.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
slittingproductionplanService.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
|
||||
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 com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||
@@ -304,65 +305,29 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
|
||||
String qzz_generation = needPlan.getQzz_generation();
|
||||
// 从套轴对接位获取相同气涨轴大小
|
||||
// update: 不需要(同标箔或者锂电分开)
|
||||
List<BstIvtCutpointivt> qzzPoint = bcutpointivtService.getPointByTypeAndShaftSize("1", qzzSize, specification);
|
||||
List<CutpointAirShhaftDto> notTaskPoints = bcutpointivtService.getCanPullPoints(qzzSize, specification, empty.getPoint_location());
|
||||
List<CutpointAirShhaftDto> qzzPoint = sortByPointEmpty(notTaskPoints);
|
||||
log.info("查找到满足到对应尺寸的点位-{}", qzzPoint);
|
||||
if (qzzPoint.size() == 0) {
|
||||
stepErrorInfo.add("没有可拔轴的点位。");
|
||||
//若套轴暂存位没有相同规格的气胀轴,直接去气胀轴库找即可
|
||||
// 调用ACS滚条气涨轴下来
|
||||
if (!toAcsOutShaft(qzzSize,location, empty)) {
|
||||
if (!toAcsOutShaft(needPlans, plans, qzzSize,location, empty)) {
|
||||
log.error("呼叫出轴失败-穿拔轴{}不进行套轴,跳过!", empty.getPoint_code());
|
||||
stepErrorInfo.add("呼叫出轴失败-穿拔轴" + empty.getPoint_code() + "不进行套轴,跳过!");
|
||||
return;
|
||||
}
|
||||
// 保存所需要的分切计划数据到点位上(套轴对接位)更新分切计划
|
||||
saveCutPlanMessage(empty, needPlans, qzzSize);
|
||||
toCallAgvMovePaperTube(needPlans, location, empty, plans);
|
||||
// toCallAgvMovePaperTube(needPlans, location, empty, plans);
|
||||
return;
|
||||
}
|
||||
// 查找一条没任务的点位
|
||||
BstIvtCutpointivt startPoint = qzzPoint.get(0);
|
||||
// 当前纸管的规格信息
|
||||
String oldQzzNo = ObjectUtil.isNotEmpty(startPoint.getQzz_no1())
|
||||
? startPoint.getQzz_no1() : startPoint.getQzz_no2();
|
||||
if (oldQzzNo == null) {
|
||||
log.error("当前气胀轴的编码为空!");
|
||||
stepErrorInfo.add(startPoint.getPoint_code() + "的气胀轴编码为空,请检查...");
|
||||
return;
|
||||
}
|
||||
String startPointCode = ObjectUtil.isNotEmpty(startPoint.getQzz_no1())
|
||||
? startPoint.getTruss_point_code1() : startPoint.getTruss_point_code2();
|
||||
if (startPointCode == null) {
|
||||
log.error("当前点位的编码为空!");
|
||||
stepErrorInfo.add(startPoint.getPoint_code() + "的点位编码为空,检查A或B点位的信息是否正常");
|
||||
return;
|
||||
}
|
||||
// 如果A6寸 B3寸,则需要过滤到精确点位
|
||||
if (ObjectUtil.isNotEmpty(startPoint.getQzz_no1()) && ObjectUtil.isNotEmpty(startPoint.getQzz_no2())) {
|
||||
// 获取需要的数据
|
||||
List<PdmBiSlittingproductionplan> aPlans = slittingproductionplanService.getByQzzNoByStatus(startPoint.getQzz_no1(), null);
|
||||
List<PdmBiSlittingproductionplan> bPlans = slittingproductionplanService.getByQzzNoByStatus(startPoint.getQzz_no2(), null);
|
||||
log.info("筛选得到的计划值:{},{}", aPlans, bPlans);
|
||||
if (aPlans.size() > 0) {
|
||||
PdmBiSlittingproductionplan aPlan = aPlans.get(0);
|
||||
if (needPlan.getQzz_size().equals(aPlan.getQzz_size())) {
|
||||
oldQzzNo = aPlan.getQzzno();
|
||||
startPointCode = startPoint.getTruss_point_code1();
|
||||
} else {
|
||||
if (bPlans.size() > 0) {
|
||||
PdmBiSlittingproductionplan bPlan = bPlans.get(0);
|
||||
if (needPlan.getQzz_size().equals(bPlan.getQzz_size())) {
|
||||
oldQzzNo = bPlan.getQzzno();
|
||||
startPointCode = startPoint.getTruss_point_code2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CutpointAirShhaftDto startPoint = qzzPoint.get(0);
|
||||
String oldQzzNo = startPoint.getQzz_no();
|
||||
// 创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", startPointCode);
|
||||
param.put("point_code1", startPoint.getQzz_point());
|
||||
param.put("point_code2", empty.getPoint_code());
|
||||
param.put("vehicle_code", oldQzzNo);
|
||||
// 气胀轴号
|
||||
@@ -373,22 +338,34 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
param.put("task_type", SlitterEnum.TASK_TYPE.code("穿拔轴缓存<>穿拔轴位"));
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
param.put("qzz_size", needPlan.getQzz_size());
|
||||
// 所需的纸管规格
|
||||
SlitterTaskUtil.putNeedPaperSpec(param, needPlans);
|
||||
// 设置是否套轴:1:正常套轴,2:待定(到后面还会申请套轴)
|
||||
setIsSleeveShaft(param);
|
||||
// 最多两条
|
||||
List<PdmBiSlittingproductionplan> oldPlans = slittingproductionplanService.getByQzzNo(oldQzzNo);
|
||||
if (oldPlans.size() == 0) {
|
||||
log.warn("当前气胀轴编码{},找不到对应的计划", oldQzzNo);
|
||||
// 把点位禁用
|
||||
startPoint.setIs_used("0");
|
||||
startPoint.setRemark("气胀轴" + oldQzzNo + "的计划不存在,无效点位自动禁用。");
|
||||
startPoint.setUpdate_time(DateUtil.now());
|
||||
bcutpointivtService.updateById(startPoint);
|
||||
bcutpointivtService.update(new LambdaUpdateWrapper<BstIvtCutpointivt>()
|
||||
.set(BstIvtCutpointivt::getIs_used, "0")
|
||||
.set(BstIvtCutpointivt::getRemark, "气胀轴" + oldQzzNo + "的计划不存在,无效点位自动禁用。")
|
||||
.set(BstIvtCutpointivt::getUpdate_time, DateUtil.now())
|
||||
.eq(BstIvtCutpointivt::getIvt_id, startPoint.getIvt_id()));
|
||||
stepErrorInfo.add("当前气胀轴编码{" + oldQzzNo + "},找不到对应的计划, 点位" + startPoint.getPoint_code() + "已被系统禁用。");
|
||||
return;
|
||||
}
|
||||
// 0.1和0.2有先后顺序
|
||||
// 0.1 所需的纸管规格
|
||||
SlitterTaskUtil.putNeedPaperSpec(param, needPlans);
|
||||
// 0.2 设置是否套轴:1:正常套轴,2:待定(到后面还会申请套轴)
|
||||
setIsSleeveShaft(param);
|
||||
Integer movePaperTube = toCallAgvMovePaperTube(needPlans, location, empty, plans);
|
||||
if (movePaperTube == 2) {
|
||||
stepErrorInfo.add("桁架下的3个位置均有任务...先只做拔轴任务...");
|
||||
makePullShaft(empty, specification);
|
||||
return;
|
||||
}
|
||||
if (movePaperTube == 1) {
|
||||
skipTheSameTubePlans(needPlans);
|
||||
return;
|
||||
}
|
||||
// 保存所需要的分切计划数据到点位上(套轴对接位)更新分切计划
|
||||
saveCutPlanMessage(empty, needPlans, qzzSize);
|
||||
SlitterTaskUtil.putCurrentPaperSpec(param, oldPlans);
|
||||
@@ -397,7 +374,6 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
// 拔管数量
|
||||
param.put("pullCount", oldPlans.size());
|
||||
param.put("containers", oldPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
||||
toCallAgvMovePaperTube(needPlans, location, empty, plans);
|
||||
trussCallAirShaftTask.createTask(param);
|
||||
// 将分切计划is_paper_ok 1(纸管已经准备好) -> 2(已经套轴)
|
||||
needPlans.forEach(p -> {
|
||||
@@ -449,6 +425,9 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
* @return
|
||||
*/
|
||||
public boolean havaEmptyShaft(SlitterPlanDistinctDto planD, BstIvtShafttubeivt empty) {
|
||||
if (true) {
|
||||
return true;
|
||||
}
|
||||
String qzzSize = planD.getQzz_size();
|
||||
String qzzGeneration = planD.getQzz_generation();
|
||||
String location = empty.getPoint_location();
|
||||
@@ -524,6 +503,41 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳过跟当前套轴计划一样的管芯的分切计划
|
||||
* @param needPlans 当前能套轴的计划
|
||||
*/
|
||||
public void skipTheSameTubePlans(List<PdmBiSlittingproductionplan> needPlans) {
|
||||
stepErrorInfo.add("批量将AGV搬运的管芯设置95状态...");
|
||||
List<String> tubes = needPlans.stream().map(plan -> {
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
return plan.getPaper_tube_material();
|
||||
} else {
|
||||
return plan.getFRP_material();
|
||||
}
|
||||
}).distinct().collect(Collectors.toList());
|
||||
// 批量设置
|
||||
List<PdmBiSlittingproductionplan> list = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "01")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_child_tz_ok, "0")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, "1")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_call, "1")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
||||
.and(la2 -> la2.in(PdmBiSlittingproductionplan::getPaper_tube_material, tubes)
|
||||
.or()
|
||||
.in(PdmBiSlittingproductionplan::getFRP_material, tubes))
|
||||
);
|
||||
if (list.size() > 0) {
|
||||
for (PdmBiSlittingproductionplan p : list) {
|
||||
p.setIs_paper_ok("95");
|
||||
p.setUpdate_optname("定时任务");
|
||||
p.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
slittingproductionplanService.updateBatchById(list);
|
||||
}
|
||||
stepErrorInfo.add("批量将AGV搬运的管芯设置95状态完毕,本次不套轴...");
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>呼叫AGV更换纸管</h2>
|
||||
* <p>默认双管芯尺寸一致
|
||||
@@ -531,8 +545,9 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
* @param location 位置
|
||||
* @param empty 穿拔轴点位
|
||||
* @param plans 总计划
|
||||
* @return 0: false, 1: true, 2: 只作拔轴
|
||||
*/
|
||||
public Boolean toCallAgvMovePaperTube(List<PdmBiSlittingproductionplan> needPlans, String location, BstIvtShafttubeivt empty, List<SlitterPlanDistinctDto> plans) {
|
||||
public Integer toCallAgvMovePaperTube(List<PdmBiSlittingproductionplan> needPlans, String location, BstIvtShafttubeivt empty, List<SlitterPlanDistinctDto> plans) {
|
||||
// 1 前置参数获取
|
||||
// 最多两根
|
||||
List<String> tubes = needPlans.stream().map(plan -> {
|
||||
@@ -569,7 +584,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
int sum = useList.stream().mapToInt(BstIvtStockingivt::getQty).sum();
|
||||
// 说明三个位置中有包含此纸管的数据。
|
||||
if (sum >= tubes.size() + otherDeviceTubeSize) {
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
// 如果不够,就计算还缺多少个
|
||||
int needTemp = tubes.size() + otherDeviceTubeSize - sum;
|
||||
@@ -597,7 +612,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
if (sumQty >= needQuantity ) {
|
||||
stepErrorInfo.add("AGV正在搬运管芯...");
|
||||
log.info("AGV正在搬运管芯...");
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
// 如果不够,就计算还缺多少个
|
||||
int needTemp = needQuantity - sumQty;
|
||||
@@ -639,7 +654,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
"点位[" + empty.getPoint_name() + "]无法从备货区找到纸管信息",
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
stepErrorInfo.add("备货区找不到[" + tubes.get(0) + "]的纸管信息");
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
// 3 找到就创建AGV搬运任务
|
||||
// 筛选3个位置中数量最少的搬走, 如果是空位,直接搬运过来
|
||||
@@ -664,7 +679,11 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
// 3.1 空位就直接创建搬过来的任务
|
||||
// 如果有空位,第一个肯定是空位,所以获取第一个元素判断状态即可canMovePointList
|
||||
BhTubeMovePointDto needMovePoint = canMovePointList.size() > 0 ? canMovePointList.get(0) : null;
|
||||
if (ObjectUtil.isEmpty(needMovePoint) || "0".equals(needMovePoint.getIvt_status())) {
|
||||
if (needMovePoint == null) {
|
||||
// 如果三个位置都被占用,只做拔轴
|
||||
return 2;
|
||||
}
|
||||
if ("0".equals(needMovePoint.getIvt_status())) {
|
||||
// 直接搬过来即可
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", needPoint.getPoint_code());
|
||||
@@ -680,7 +699,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
doSavePaperInfos(paperList, param);
|
||||
stockAreaCallTubeTask.createTask(param);
|
||||
stepErrorInfo.add("备货区正在搬运管芯过来,托盘号:[" + needPoint.getVehicle_code() + "]。");
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
// 3.2 判断是否有单独拉出去的任务,有的话直接拉过来。
|
||||
List<BstIvtStockingivt> stockingivts = stockingivtService.getMoveTaskPoints();
|
||||
@@ -701,7 +720,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
doSavePaperInfos(paperList, param);
|
||||
stockAreaCallTubeTask.createTask(param);
|
||||
stepErrorInfo.add("备货区正在搬运管芯过来,托盘号:[" + needPoint.getVehicle_code() + "]。");
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
// 3.3 排序,获取最后的起点,需要根据下一趟需要套轴的管芯规格来进行过滤
|
||||
if (plans.size() > 0) {
|
||||
@@ -742,11 +761,8 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
// 3.4 查找一个没有任务的空位(创建交换任务)
|
||||
List<BstIvtStockingivt> list = stockingivtService.getEmptyPointNotTask(location, "0");
|
||||
if (list.size() == 0) {
|
||||
noticeService.createNotice("备货区找不到空位置搬运",
|
||||
"点位[" + empty.getPoint_name() + "]无法从备货区找到空位",
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
stepErrorInfo.add("备货区找不到空位置搬运。");
|
||||
return false;
|
||||
stepErrorInfo.add("备货区找不到空位置搬运, 请检查备货区点位情况!");
|
||||
throw new RuntimeException("备货区找不到空位置搬运, 请检查备货区点位情况!");
|
||||
}
|
||||
BstIvtStockingivt endPoint = list.get(0);
|
||||
// 创建任务 -> HINT: 在此任务完成之后会调用搬回来的任务,因此任务中要记录需要搬运的点位放在任务请求参数中。
|
||||
@@ -763,7 +779,7 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
stockAreaSendVehicleTask.createTask(param);
|
||||
stepErrorInfo.add("备货区交换托盘中...请等待。");
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -774,7 +790,12 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
* @param location 位置:上半部分还是下半部分
|
||||
* @param empty 套拔轴点位
|
||||
*/
|
||||
private Boolean toAcsOutShaft(String qzzSize, String location, BstIvtShafttubeivt empty) {
|
||||
private Boolean toAcsOutShaft(List<PdmBiSlittingproductionplan> needPlans, List<SlitterPlanDistinctDto> plans, String qzzSize, String location, BstIvtShafttubeivt empty) {
|
||||
Integer movePaperTube = toCallAgvMovePaperTube(needPlans, location, empty, plans);
|
||||
if (movePaperTube != 0) {
|
||||
skipTheSameTubePlans(needPlans);
|
||||
return false;
|
||||
}
|
||||
// 需要区分上下
|
||||
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), location);
|
||||
if (shafttubeivts.size() == 0) {
|
||||
@@ -913,14 +934,15 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
//查询套轴缓存位哦:point_type=1
|
||||
List<CutpointAirShhaftDto> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByTcQzzPoint(empty.getPoint_location());
|
||||
//所有TC暂存位有卷的:Truss_point_code1,Truss_point_code2有任务的
|
||||
//根据point_code排序
|
||||
if (notTaskPoints.size() == 0) {
|
||||
stepErrorInfo.add("只进行拔轴,没有可以拔轴的点位。");
|
||||
return;
|
||||
}
|
||||
// 根据point_code排序 保证一个架子的先清空
|
||||
List<CutpointAirShhaftDto> notTaskPointsSort = sortByPointEmpty(notTaskPoints);
|
||||
// 筛选一个满足的位置:3寸:看代数4/5;6寸直接
|
||||
//判断气胀轴代
|
||||
CutpointAirShhaftDto cutpointivt = notTaskPoints.stream()
|
||||
CutpointAirShhaftDto cutpointivt = notTaskPointsSort.stream()
|
||||
.sorted(Comparator.comparingLong(CutpointAirShhaftDto::getIvt_id))
|
||||
.filter(cut -> "6".equals(cut.getQzz_size()) ||
|
||||
("3".equals(cut.getQzz_size()) && specification.equals(cut.getQzz_generation())))
|
||||
@@ -971,6 +993,20 @@ public class AutoCallAirShaftTask extends Prun {
|
||||
stepErrorInfo.add("只做拔轴,拔轴任务已经创建...");
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* @param notTaskPoints
|
||||
* @return
|
||||
*/
|
||||
private List<CutpointAirShhaftDto> sortByPointEmpty(List<CutpointAirShhaftDto> notTaskPoints) {
|
||||
Map<String, Long> countMap = notTaskPoints.stream()
|
||||
.collect(Collectors.groupingBy(CutpointAirShhaftDto::getPoint_code, Collectors.counting()));
|
||||
return notTaskPoints.stream()
|
||||
.sorted(Comparator.comparing((CutpointAirShhaftDto dto) -> countMap.get(dto.getPoint_code()))
|
||||
.thenComparing(CutpointAirShhaftDto::getPoint_code))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否有同设备的任务
|
||||
*
|
||||
|
||||
@@ -2604,56 +2604,57 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("message", "创建AGV任务成功!");
|
||||
// param: point_code
|
||||
String pointCode = param.getString("point_code");
|
||||
//缓存A气胀轴规格 3-4 三寸四代
|
||||
String size1 = param.getString("size1");
|
||||
//缓存B气胀轴规格
|
||||
String size2 = param.getString("size2");
|
||||
RLock lock = redissonClient.getLock("doAcsFinishLoadShaft");
|
||||
boolean tryLock;
|
||||
try {
|
||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new BadRequestException("获取锁异常");
|
||||
}
|
||||
try {
|
||||
if (tryLock) {
|
||||
//缓存A气胀轴规格 3-4 三寸四代
|
||||
String size1 = param.getString("size1");
|
||||
//缓存B气胀轴规格
|
||||
String size2 = param.getString("size2");
|
||||
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
// 校验是否存在行架任务
|
||||
Boolean haveTaskByZcPoint = taskService.checkHaveTaskByZcPoint(point);
|
||||
if (haveTaskByZcPoint) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的行架任务!");
|
||||
}
|
||||
// 校验是否存在agv任务
|
||||
List<SchBaseTask> taskList = taskService.checkHaveTask(pointCode);
|
||||
if (taskList.size() > 0) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的agv任务!");
|
||||
}
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
// 校验是否存在行架任务
|
||||
Boolean haveTaskByZcPoint = taskService.checkHaveTaskByZcPoint(point);
|
||||
if (haveTaskByZcPoint) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的行架任务!");
|
||||
}
|
||||
// 校验是否存在agv任务
|
||||
List<SchBaseTask> taskList = taskService.checkHaveTask(pointCode);
|
||||
if (taskList.size() > 0) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的agv任务!");
|
||||
}
|
||||
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "未检测有气胀轴,请先设置点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "2")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测空气胀轴,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "3")) {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测子卷,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(point.getQzz_no1()) || ObjectUtil.isNotEmpty(point.getQzz_no2())) {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + " 的气胀轴编码不为空,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (Objects.equals(point.getPoint_status(), "4") && ObjectUtil.isEmpty(point.getQzz_no1()) && ObjectUtil.isEmpty(point.getQzz_no2())) {
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "未检测有气胀轴,请先设置点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "2")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测空气胀轴,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "3")) {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测子卷,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(point.getQzz_no1()) || ObjectUtil.isNotEmpty(point.getQzz_no2())) {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + " 的气胀轴编码不为空,请先清空点位信息再触发!!");
|
||||
}
|
||||
if (Objects.equals(point.getPoint_status(), "4") && ObjectUtil.isEmpty(point.getQzz_no1()) && ObjectUtil.isEmpty(point.getQzz_no2())) {
|
||||
|
||||
JSONObject taskParam = new JSONObject();
|
||||
JSONObject taskParam = new JSONObject();
|
||||
|
||||
// 获取内包间缓存位
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getNBJCanUsePoint("1", "1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() <= 1) {
|
||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
||||
}
|
||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||
|
||||
// 获取内包间缓存位
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getNBJCanUsePoint("1", "1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() <= 1) {
|
||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
||||
}
|
||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||
RLock lock = redissonClient.getLock(endPoint.getPoint_code());
|
||||
boolean tryLock;
|
||||
try {
|
||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new BadRequestException("获取锁异常");
|
||||
}
|
||||
try {
|
||||
if (tryLock) {
|
||||
taskParam.put("point_code1", point.getPoint_code());
|
||||
taskParam.put("point_code2", endPoint.getPoint_code());
|
||||
if (ObjectUtil.isNotEmpty(size1)) {
|
||||
@@ -2668,13 +2669,14 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new BadRequestException("点位:" + pointCode + "点位状态不对,请先设置点位信息再触发!!");
|
||||
}
|
||||
} finally {
|
||||
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||
lock.unlock();
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "点位状态不对,请先设置点位信息再触发!!");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user