feat: 优化、新增B1车间分切

This commit is contained in:
2024-07-08 09:30:13 +08:00
parent ac229c4823
commit 37471bec9a
23 changed files with 399 additions and 54 deletions

View File

@@ -53,6 +53,15 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
* @return /
*/
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
/**
* 获取类型状态,没任务的点位,不校验取货完成的任务
* @param type 点位类型1套轴对接位2分切缓存位3分切对接位4套轴异常位
* @param pointStatus 点位状态1空位、2有气涨轴、3有子卷
* @param area 区域0上1下
* @param sort 0:不排序1:正序, 2:倒序
* @return /
*/
List<BstIvtCutpointivt> getAreaNotTaskPointByStatusNotCheckPickUpCompleted(String type, String pointStatus, String area, String sort);
/**
* 获取同尺寸的气涨轴
@@ -114,4 +123,12 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
* @return /
*/
List<BstIvtCutpointivt> getReallyQzzSameDevice(String resourceName);
/**
* 根据区域、类型校验
* @param area 区域
* @param types 类型
* @return /
*/
List<BstIvtCutpointivt> getPintByAgvCodesByPointTypeAndArea(String area, List<String> types);
}

View File

@@ -23,4 +23,6 @@ public interface BstIvtCutpointivtMapper extends BaseMapper<BstIvtCutpointivt> {
List<BstIvtCutpointivt> getCachePointSame(SlitterPlanDistinctDto dto);
List<BstIvtCutpointivt> getReallyQzzSameDevice(String resourceName);
List<BstIvtCutpointivt> getAreaNotTaskPointByStatusNotCheckPickUpCompleted(String type, String pointStatus, String area, String sort);
}

View File

@@ -108,4 +108,26 @@
AND p.resource_name = #{resource_name}
</select>
<select id="getAreaNotTaskPointByStatusNotCheckPickUpCompleted"
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
SELECT bic.*
FROM bst_ivt_cutpointivt bic
WHERE bic.point_type = #{type}
AND bic.is_used = '1'
AND bic.point_status = #{pointStatus}
AND bic.point_location = #{area}
AND 0 = (SELECT COUNT(*)
FROM sch_base_task t
WHERE t.task_status <![CDATA[ < ]]> '07'
AND (t.point_code1 = bic.point_code OR t.point_code2 = bic.point_code
OR t.point_code1 = bic.truss_point_code1 oR t.point_code2 = bic.truss_point_code1
OR t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2)
)
<if test="sort == '1'">
ORDER BY bic.sort_seq ASC
</if>
<if test="sort == '2'">
ORDER BY bic.sort_seq DESC
</if>
</select>
</mapper>

View File

@@ -95,6 +95,11 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatus(type, pointStatus, area, sort);
}
@Override
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatusNotCheckPickUpCompleted(String type, String pointStatus, String area, String sort) {
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatusNotCheckPickUpCompleted(type, pointStatus, area, sort);
}
@Override
public List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String generation) {
return bstIvtCutpointivtMapper.getPointByTypeAndShaftSize(type, size, generation);
@@ -141,4 +146,11 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
public List<BstIvtCutpointivt> getReallyQzzSameDevice(String resourceName) {
return bstIvtCutpointivtMapper.getReallyQzzSameDevice(resourceName);
}
@Override
public List<BstIvtCutpointivt> getPintByAgvCodesByPointTypeAndArea(String area, List<String> types) {
return bstIvtCutpointivtMapper.selectList(new LambdaQueryWrapper<BstIvtCutpointivt>()
.eq(BstIvtCutpointivt::getProduct_area, area)
.in(BstIvtCutpointivt::getPoint_type, types));
}
}

View File

@@ -29,8 +29,8 @@ public class SlitterPdaController {
@PostMapping("/slitterDevices")
@Log("获取分切设备")
@SaIgnore
public ResponseEntity<Object> slitterDevices() {
return new ResponseEntity<>(slitterDevices.slitterDevices(), HttpStatus.OK);
public ResponseEntity<Object> slitterDevices(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.slitterDevices(param), HttpStatus.OK);
}
@PostMapping("/downRolls")
@@ -76,8 +76,8 @@ public class SlitterPdaController {
@PostMapping("/getCutCacheAgvPoints")
@Log("获取分切暂存位AGV点位下拉框数据")
@SaIgnore
public ResponseEntity<Object> getCutCacheAgvPoints() {
return new ResponseEntity<>(slitterDevices.getCutCacheAgvPoints(), HttpStatus.OK);
public ResponseEntity<Object> getCutCacheAgvPoints(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.getCutCacheAgvPoints(param), HttpStatus.OK);
}
@PostMapping("/toCleanCutCacheInventory")
@@ -86,4 +86,11 @@ public class SlitterPdaController {
public ResponseEntity<Object> toCleanCutCacheInventory(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.toCleanCutCacheInventory(param), HttpStatus.OK);
}
@PostMapping("/toSubvolumeBinding")
@Log("子卷绑定")
@SaIgnore
public ResponseEntity<Object> toSubvolumeBinding(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.toSubvolumeBinding(param), HttpStatus.OK);
}
}

View File

@@ -84,4 +84,11 @@ public interface IPdmBiSlittingproductionplanService extends IService<PdmBiSlitt
* @param whereJson /
*/
void setDirection(JSONObject whereJson);
/**
* 通过子卷号获取所有分切计划
* @param collect /
* @return /
*/
List<PdmBiSlittingproductionplan> getByContainerNames(List<String> collect);
}

View File

@@ -6,7 +6,7 @@
resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
SELECT
p.resource_name,
p.parent_container_name,
IF(p.order_type = 1,p.parent_container_name,p.container_name) AS parent_container_name,
p.split_group,
p.up_or_down,
p.qzz_size,

View File

@@ -141,5 +141,12 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
}
}
@Override
public List<PdmBiSlittingproductionplan> getByContainerNames(List<String> collect) {
LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new QueryWrapper<PdmBiSlittingproductionplan>().lambda();
lam.in(PdmBiSlittingproductionplan::getContainer_name, collect);
return pdmBiSlittingproductionplanMapper.selectList(lam);
}
}

View File

@@ -82,6 +82,14 @@ public interface IstIvtCutpointivtService extends IService<StIvtCutpointivt> {
* @return /
*/
List<StIvtCutpointivt> getListByStartsWith(String prefix, boolean flag);
/**
* 根据区域获取设备数据
* @param area 区域
* @param flag 是否判断启用
* @return /
*/
List<StIvtCutpointivt> getListByStartsArea(String area, boolean flag);
}

View File

@@ -117,6 +117,14 @@ public class StIvtCutpointivtServiceImpl extends ServiceImpl<StIvtCutpointivtMap
return stIvtCutpointivtMapper.selectList(lam);
}
@Override
public List<StIvtCutpointivt> getListByStartsArea(String area, boolean flag) {
LambdaQueryWrapper<StIvtCutpointivt> lam = new QueryWrapper<StIvtCutpointivt>().lambda();
lam.eq(StIvtCutpointivt::getProduct_area, area)
.eq(flag, StIvtCutpointivt::getIs_used, "1");
return stIvtCutpointivtMapper.selectList(lam);
}
/**
* 获取实体基础信息
*

View File

@@ -29,6 +29,8 @@ import org.nl.common.enums.NoticeTypeEnum;
import org.nl.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.dao.Param;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -76,6 +78,8 @@ public class AutoCallAirShaftTask {
private IMdPbPapervehicleService mdPbPapervehicleService;
@Autowired
private IschBaseTaskService taskService;
@Autowired
private ISysParamService paramService;
/**
* hint: 目前只是考虑了上区域
@@ -96,10 +100,12 @@ public class AutoCallAirShaftTask {
// 标箔1锂电2 改大小4代5代
String specification = empty.getQzz_generation();
String location = empty.getPoint_location();
// 2、获取分切计划数据 校验代数
// 判断配置参数是否只做拔轴
// 2、获取分切计划数据 校验代数 todo 顺序可能需要考虑
List<SlitterPlanDistinctDto> planAll = slittingproductionplanService.getAllCutPlan();
List<SlitterPlanDistinctDto> plans = planAll.stream()
.filter(p -> p.getResource_name().startsWith("B6") &&
.filter(p -> (p.getResource_name().startsWith("B5") ||
p.getResource_name().startsWith("B6")) &&
(checkComputationPoint(p) && checkHasTask(p))).collect(Collectors.toList());
if (plans.size() == 0) {
// 如果不需要套轴,就只做拔轴
@@ -107,9 +113,10 @@ public class AutoCallAirShaftTask {
return;
}
// 查看套轴对接位是否满了
// todo: 这里需要注意不要去校验071的任务不然提前释放货位没意义。
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1",
"1", location, "0");
// 如果满了就只做拔轴
// 如果满了就只做拔轴 预留一个货位,防止套轴直接站满
if (emptyShaftPoint.size() == 0) {
// 校验是否存在半个位置,且有分切计划
// 获取只有一个位置的点位
@@ -188,8 +195,6 @@ public class AutoCallAirShaftTask {
param.put("needPlan", planDto);
// 是否拔轴
param.put("is_pulling", SlitterConstant.SLITTER_YES);
// 是否套轴
param.put("is_bushing", SlitterConstant.SLITTER_YES);
param.put("task_type", SlitterEnum.TASK_TYPE.code("穿拔轴缓存<>穿拔轴位"));
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
param.put("qzz_size", needPlan.getQzz_size());
@@ -203,6 +208,8 @@ public class AutoCallAirShaftTask {
}
// 保存所需要的分切计划数据到点位上(套轴对接位)更新分切计划
saveCutPlanMessage(empty, needPlans, qzzSize);
// 设置是否套轴1正常套轴2待定到后面还会申请套轴
setIsSleeveShaft(param);
// 最多两条
List<PdmBiSlittingproductionplan> oldPlans = slittingproductionplanService.getByQzzNo(oldQzzNo);
SlitterTaskUtil.putCurrentPaperSpec(param, oldPlans);
@@ -221,6 +228,26 @@ public class AutoCallAirShaftTask {
});
}
/**
* 设置是否套轴
* @param param 任务map
*/
public void setIsSleeveShaft(JSONObject param) {
// 判断是否有纸管,没有纸管是否要直接送轴还是人工判断
List<String> tubes = Stream.of(param.getString("left"), param.getString("right"))
.filter(ObjectUtil::isNotEmpty)
.collect(Collectors.toList());
// 判断是否存在纸管
List<MdPbPapervehicle> list = mdPbPapervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>()
.in(MdPbPapervehicle::getMaterial_code, tubes)
.gt(MdPbPapervehicle::getQty, 0));
if (list.size() == 0) {
param.put("is_bushing", "2");
} else {
param.put("is_bushing", SlitterConstant.SLITTER_YES);
}
}
/**
* 呼叫AGV更换纸管
*

View File

@@ -54,6 +54,8 @@ public class AutoSendAirShaftAgvTask {
@SneakyThrows
public void run() {
// 获取套轴对接位有气涨轴没任务的点位
// 目前满足B1,B2
// todo: 可以把区域校验去掉就能够包括B1,B2,B3,B4
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0", "0");
for (BstIvtCutpointivt cutPoint : cutPoints) {
// 获取分切计划
@@ -103,10 +105,12 @@ public class AutoSendAirShaftAgvTask {
}
// 如果两个气涨轴编码则表示一组满了
// 查找分切对接没任务的空位
// hint: B1、B2、B3、B4分切区分两个桁架位置 (B1,B3: 1-6为上。B2B4是1-5为上区域)
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyCutPointNotTask(area,
deviceCut.getSort_seq(),
SlitterTaskUtil.getPointLocationInCutDevice(
SlitterTaskUtil.getNumberByResourceCode(demoPlan.getResource_name())));
SlitterTaskUtil.getNumberByResourceCode(demoPlan.getResource_name()),
area));
if (emptyPoint.size() == 0) {
log.warn("找不到对应的位置!");
return;

View File

@@ -8,10 +8,14 @@ import org.nl.b_lms.sch.tasks.slitter.SlitterDownAgvTask;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum;
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper;
import org.nl.modules.common.exception.BadRequestException;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @Author: lyd
@@ -33,6 +37,8 @@ public class AutoSlitterCacheDownAgvTask {
private SlitterDownAgvTask slitterDownAgvTask;
@Autowired
private SlitterMapper slitterMapper;
@Autowired
private RedissonClient redissonClient;
/**
* 业务:
* 分切下料满卷(分切计划是结束),通过气涨轴编码可定位。
@@ -40,10 +46,12 @@ public class AutoSlitterCacheDownAgvTask {
*/
public void run() {
// 获取分切对接位满轴数据 todo: 先不考虑区域,后期添加
// todo: 后面换 slitterService.getAreaFullVolumeByArea("B2", "B4"); 的数据
// bct.point_type IN ('2', '3') -> bct.point_type = '3'
List<BstIvtCutpointivt> cutPointIvts = slitterMapper.getAreaFullVolume();
cutPointIvts.forEach(cut -> {
// cut是起点
// todo: B2已经满足B4需要根据车间改动区域 (0 or 1)
// remove: 1、先去对应的套轴对接位没有气涨轴空位没有任务的点位
// update: 1、去分切缓存位在由手持下发到内包间
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("2", "1", "0","0");
@@ -53,7 +61,24 @@ public class AutoSlitterCacheDownAgvTask {
}
// 生成任务
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
toCreateTask(cut, endPoint);
RLock lock = redissonClient.getLock(endPoint.getPoint_code());
boolean tryLock;
try {
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
try {
if (tryLock) {
toCreateTask(cut, endPoint);
} else {
throw new BadRequestException("系统繁忙,稍后在试!");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
});
}

View File

@@ -0,0 +1,90 @@
package org.nl.b_lms.sch.tasks.slitter.auto;
import com.alibaba.fastjson.JSONObject;
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.sch.tasks.slitter.SlitterDownAgvTask;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum;
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
import org.nl.modules.common.exception.BadRequestException;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @Author: lyd
* @Description: 自动任务 分切机满卷下料(分切对接位:3)去拔轴 AGV任务
* 直接送到内包间穿拔轴位置
* B1、B3车间使用
* 不需要自动送
* @Date: 2024/7/5
* @see SlitterDownAgvTask#createTask(JSONObject)
*/
@Slf4j
@Component
@Deprecated
public class AutoSlitterNbjDownAgvTask {
@Autowired
private IBstIvtCutpointivtService cutpointivtService;
@Autowired
private SlitterDownAgvTask slitterDownAgvTask;
@Autowired
private SlitterService slitterService;
@Autowired
private RedissonClient redissonClient;
/**
* 业务:
* 分切下料满卷(分切计划是结束),通过气涨轴编码可定位。
* 先往套轴对接位送不够再送分切缓存位针对B1,B3车间
*/
public void run() {
// 获取B1B3满轴数据
List<BstIvtCutpointivt> cutPointIvts = slitterService.getAreaFullVolumeByArea("B1", "B3");
cutPointIvts.forEach(cut -> {
// cut是起点
// 1、先去对应的套轴对接位没有气涨轴空位没有任务的点位
// todo: 先考虑上区域 point_location
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("1", "1", "0", "2");
if (areaEmptyNotTaskPoint.size() > 0) {
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 RuntimeException(e);
}
try {
if (tryLock) {
toCreateTask(cut, endPoint);
} else {
throw new BadRequestException("系统繁忙,稍后在试!!");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
}
});
}
private void toCreateTask(BstIvtCutpointivt cut, BstIvtCutpointivt endPoint) {
JSONObject param = new JSONObject();
param.put("point_code1", cut.getPoint_code());
param.put("point_code2", endPoint.getPoint_code());
param.put("vehicle_code1", cut.getQzz_no1());
param.put("vehicle_code2", cut.getQzz_no2());
param.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV任务"));
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
slitterDownAgvTask.createTask(param);
}
}

View File

@@ -47,9 +47,9 @@ public class AutoUpShaftTrussTask {
* 并根据计划创建相应的搬运任务。
*/
public void run() {
// 获取符合条件的分切机点位信息 hint: (目前暂定B2区域)
// 获取符合条件的分切机点位信息 hint: (目前暂定B1,B2区域)
List<StIvtCutpointivt> devicePoint = cutpointivtService.list(new LambdaQueryWrapper<StIvtCutpointivt>()
.eq(StIvtCutpointivt::getProduct_area, "B2")
.in(StIvtCutpointivt::getProduct_area, "B2", "B1")
.and(l1 -> l1.eq(StIvtCutpointivt::getUp_qzzno, "").or().isNull(StIvtCutpointivt::getUp_qzzno))
.and(l2 -> l2.eq(StIvtCutpointivt::getDown_qzzno, "").or().isNull(StIvtCutpointivt::getDown_qzzno)));
@@ -100,10 +100,10 @@ public class AutoUpShaftTrussTask {
if (ObjectUtil.isNotEmpty(nextUpPlan) && ObjectUtil.isNotEmpty(nextDownPlan)) {
// 双轴任务参数构建
param.put("point_code1", newCutPoint.getTruss_point_code1());
param.put("point_code2", device.getUp_point_code());
param.put("point_code3", newCutPoint.getTruss_point_code2());
param.put("point_code4", device.getDown_point_code());
param.put("point_code1", newCutPoint.getTruss_point_code2());
param.put("point_code2", device.getDown_point_code());
param.put("point_code3", newCutPoint.getTruss_point_code1());
param.put("point_code4", device.getUp_point_code());
param.put("vehicle_code1", newCutPoint.getQzz_no1());
param.put("vehicle_code2", newCutPoint.getQzz_no2());
} else {

View File

@@ -3,7 +3,9 @@ package org.nl.b_lms.sch.tasks.slitter.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
import org.nl.common.utils.TaskUtils;
import org.nl.modules.logging.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -52,7 +55,7 @@ public class SlitterController {
@PostMapping("/test3")
@Log("1111")
public ResponseEntity<Object> create3(@RequestBody JSONObject entity){
List<String> collect = Stream.of("B1232401020303A1", "B1232401020303A2").collect(Collectors.toList());
List<String> collect = Stream.of("B1182312040201A1").collect(Collectors.toList());
entity.put("container", collect);
return new ResponseEntity<>(slitterService.mesSlittingMachineSendMaterial(entity), HttpStatus.CREATED);
}

View File

@@ -48,4 +48,6 @@ public interface SlitterMapper {
* @return
*/
List<BstIvtCutpointivt> getReadyShaftPoint(String extCode);
List<BstIvtCutpointivt> getAreaFullVolumeByArea(List<String> areas);
}

View File

@@ -69,4 +69,28 @@
AND p.resource_name = #{extCode}
ORDER BY bsp.update_time
</select>
<select id="getAreaFullVolumeByArea"
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
SELECT bct.*
FROM `bst_ivt_cutpointivt` bct
WHERE bct.point_type = '3'
AND bct.point_status = '3'
AND bct.is_used = '1'
AND bct.product_area IN
<foreach item="code" collection="areas" open="(" separator="," close=")">
#{code}
</foreach>
AND 0 = (SELECT COUNT(*)
FROM sch_base_task t
WHERE t.task_status <![CDATA[ < ]]> '07'
AND (
t.point_code1 = bct.point_code
OR t.point_code1 = bct.truss_point_code1
OR t.point_code1 = bct.truss_point_code1
OR t.point_code3 = bct.point_code
OR t.point_code3 = bct.truss_point_code1
OR t.point_code3 = bct.truss_point_code1
))
ORDER BY bct.point_type DESC
</select>
</mapper>

View File

@@ -2,6 +2,9 @@ package org.nl.b_lms.sch.tasks.slitter.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
import java.util.List;
/**
* @description 服务接口
@@ -96,7 +99,7 @@ public interface SlitterService {
* 获取设备信息
* @return
*/
JSONArray slitterDevices();
JSONArray slitterDevices(JSONObject param);
/**
* 下卷
@@ -146,7 +149,7 @@ public interface SlitterService {
* 获取分切暂存位AGV点位下拉框数据
* @return
*/
JSONArray getCutCacheAgvPoints();
JSONArray getCutCacheAgvPoints(JSONObject param);
/**
* 清理分切缓
@@ -161,4 +164,18 @@ public interface SlitterService {
* @return /
*/
JSONObject slitterSpliceOperation(JSONObject param);
/**
* 获取满卷AGV点位通过区域
* @param areas 区域
* @return /
*/
List<BstIvtCutpointivt> getAreaFullVolumeByArea(String ...areas);
/**
* 手持子卷绑定
* @param param 参数
* @return /
*/
JSONObject toSubvolumeBinding(JSONObject param);
}

View File

@@ -53,9 +53,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -331,7 +333,7 @@ public class SlitterServiceImpl implements SlitterService {
String qzzNo = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2)
+ demoPlan.getSplit_group()
+ TaskUtils.getDateTime("MMddHHmm") + "-"
+ TaskUtils.getDateTime("MMddHHmmss") + "-"
+ demoPlan.getUp_or_down();
plans.forEach(plan -> {
plan.setIs_child_tz_ok(SlitterConstant.SLITTER_YES);
@@ -476,22 +478,24 @@ public class SlitterServiceImpl implements SlitterService {
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
.orderByAsc(PdmBiSlittingproductionplan::getUpdate_time));
log.info("获取下一组分切计划:{}", timePlans);
// 寻找备好轴的对接点位
List<BstIvtCutpointivt> cutPointList = slitterMapper.getReadyShaftPoint(device.getExt_code());
// 任务参数
JSONObject taskParam = new JSONObject();
if (timePlans.size() == 0) {
if (timePlans.size() == 0 || cutPointList.size() == 0) {
// 如果没有下一组的分切计划,就只做下卷任务(判断下单/下双)
// 获取分切对接位没任务的空位置
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(area,
device.getSort_seq(),
getPointLocationInCutDevice(getNumberByResourceCode(demoPlan.getResource_name())));
getPointLocationInCutDevice(getNumberByResourceCode(demoPlan.getResource_name()), area));
if (emptyPoints.size() == 0) {
log.error("分切机【" + device.getExt_code() + "】找不到对应的对接位!");
throw new BadRequestException("分切机【" + device.getExt_code() + "】找不到对应的对接位!");
throw new BadRequestException("分切机【" + device.getExt_code() + "】找不到对应的对接位!😊");
}
// 枷锁
BstIvtCutpointivt emptyPoint = emptyPoints.get(0);
RLock lock = redissonClient.getLock(emptyPoint.getPoint_code());
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
// 创建任务
@@ -541,19 +545,20 @@ public class SlitterServiceImpl implements SlitterService {
PdmBiSlittingproductionplan nextUpPlan = nextPlans.stream().filter(p -> "1".equals(p.getUp_or_down())).findFirst().orElse(null);
PdmBiSlittingproductionplan nextDownPlan = nextPlans.stream().filter(p -> "2".equals(p.getUp_or_down())).findFirst().orElse(null);
// 找到该分切计划的点位
LambdaQueryWrapper<BstIvtCutpointivt> newCutLam = new QueryWrapper<BstIvtCutpointivt>().lambda();
newCutLam.eq(BstIvtCutpointivt::getPoint_type, "3").eq(BstIvtCutpointivt::getPoint_status, "2")
.eq(BstIvtCutpointivt::getIs_used, "1");
if (nextUpPlan != null) {
newCutLam.eq(BstIvtCutpointivt::getQzz_no1, nextUpPlan.getQzzno());
}
if (nextDownPlan != null) {
newCutLam.eq(BstIvtCutpointivt::getQzz_no2, nextDownPlan.getQzzno());
}
BstIvtCutpointivt newCutPoint = bcutpointivtService.getOne(newCutLam, false);
if (ObjectUtil.isEmpty(newCutPoint)) {
throw new BadRequestException("分切机【" + device.getExt_code() + "】的下一组分切计划未配送完毕!😊");
}
// LambdaQueryWrapper<BstIvtCutpointivt> newCutLam = new QueryWrapper<BstIvtCutpointivt>().lambda();
// newCutLam.eq(BstIvtCutpointivt::getPoint_type, "3").eq(BstIvtCutpointivt::getPoint_status, "2")
// .eq(BstIvtCutpointivt::getIs_used, "1");
// if (nextUpPlan != null) {
// newCutLam.eq(BstIvtCutpointivt::getQzz_no1, nextUpPlan.getQzzno());
// }
// if (nextDownPlan != null) {
// newCutLam.eq(BstIvtCutpointivt::getQzz_no2, nextDownPlan.getQzzno());
// }
// BstIvtCutpointivt newCutPoint = bcutpointivtService.getOne(newCutLam, false);
// if (ObjectUtil.isEmpty(newCutPoint)) {
// throw new BadRequestException("分切机【" + device.getExt_code() + "】的下一组分切计划未配送完毕!😊");
// }
BstIvtCutpointivt newCutPoint = cutPointList.get(0);
String binaryExpress = TaskUtils.binaryConvertExpress(currentUpPlan, currentDownPlan, nextUpPlan, nextDownPlan);
switch (binaryExpress) {
case "00":
@@ -729,7 +734,7 @@ public class SlitterServiceImpl implements SlitterService {
if (ObjectUtil.isEmpty(plan.getLevel())) {
throw new BadRequestException("子卷[" + plan.getContainer_name() + "]对应的级别不能为空");
}
plan.setLevel("4");
// plan.setLevel("4");
String point_type = "5".equals(plan.getLevel()) ? "5" : "4";
// 查找终点 确认是废箔还是成品: 根据分切计划的子卷等级来区分5为报废
BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
@@ -747,9 +752,9 @@ public class SlitterServiceImpl implements SlitterService {
}
@Override
public JSONArray slitterDevices() {
String prefix = "B6";
List<StIvtCutpointivt> list = cutpointivtService.getListByStartsWith(prefix, false);
public JSONArray slitterDevices(JSONObject param) {
String area = param.getString("area");
List<StIvtCutpointivt> list = cutpointivtService.getListByStartsArea(area, false);
JSONArray jsonArray = list.stream()
.map(item -> {
JSONObject jsonObject = new JSONObject();
@@ -1014,8 +1019,10 @@ public class SlitterServiceImpl implements SlitterService {
}
@Override
public JSONArray getCutCacheAgvPoints() {
List<BstIvtCutpointivt> list = bcutpointivtService.getPintByAgvCodesByPointType("2");
public JSONArray getCutCacheAgvPoints(JSONObject param) {
String area = param.getString("area");
List<String> types = Stream.of("2", "3").collect(Collectors.toList());
List<BstIvtCutpointivt> list = bcutpointivtService.getPintByAgvCodesByPointTypeAndArea(area, types);
JSONArray jsonArray = list.stream()
.map(item -> {
JSONObject jsonObject = new JSONObject();
@@ -1100,4 +1107,47 @@ public class SlitterServiceImpl implements SlitterService {
}
return null;
}
@Override
public List<BstIvtCutpointivt> getAreaFullVolumeByArea(String... areas) {
return slitterMapper.getAreaFullVolumeByArea(Arrays.asList(areas));
}
@Override
public JSONObject toSubvolumeBinding(JSONObject param) {
// param : container_name, point_code
String containerName = param.getString("container_name");
if (ObjectUtil.isEmpty(containerName)) {
throw new BadRequestException("子卷号不能为空!");
}
List<String> collect = Arrays.stream(containerName.split(",")).collect(Collectors.toList());
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByContainerNames(collect);
if (plans.size() == 0) {
throw new BadRequestException("子卷号:[" + containerName + "] 的分切计划没找到,检查是否推送或者子卷号是否正确!");
}
BstIvtCutpointivt pointCode = bcutpointivtService.getPintByTrussCode(param.getString("point_code"), false);
PdmBiSlittingproductionplan demoPlan = plans.get(0);
String resourceName = demoPlan.getResource_name();
// 创建新的气胀轴编码
String qzzNo = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2)
+ demoPlan.getSplit_group()
+ TaskUtils.getDateTime("MMddHHmmss") + "-"
+ demoPlan.getUp_or_down();
plans.forEach(p -> {
p.setQzzno(qzzNo);
TaskUtils.updateOptMessageBySlitterPlan(p);
if ("1".equals(p.getUp_or_down())) {
pointCode.setQzz_no1(qzzNo);
} else {
pointCode.setQzz_no2(qzzNo);
}
});
slittingproductionplanService.updateBatchById(plans);
bcutpointivtService.updateById(pointCode);
JSONObject res = new JSONObject();
res.put("status", HttpStatus.HTTP_OK);
res.put("message", "子卷绑定成功!");
return res;
}
}

View File

@@ -19,6 +19,11 @@ import java.util.List;
* @Date: 2024/4/12
*/
public class SlitterTaskUtil {
/** B1区域 */
public final static String B1_AREA_CODE = "B1";
/** B2区域 */
public final static String B2_AREA_CODE = "B2";
/**
* 组成纸管信息
* @param plan 对应的分切计划数组
@@ -172,12 +177,20 @@ public class SlitterTaskUtil {
/**
* 获取上下区域
* @param num /
* @param num 编码
* @param area 区域
* @return /
*/
public static String getPointLocationInCutDevice(int num) {
if (num >= 1 && num <= 5) {
return "0";
public static String getPointLocationInCutDevice(int num, String area) {
if (area.equals(B1_AREA_CODE)) {
if (num >= 1 && num <= 6) {
return "0";
}
}
if (area.equals(B2_AREA_CODE)) {
if (num >= 1 && num <= 5) {
return "0";
}
}
return "1";
}

View File

@@ -1010,7 +1010,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String qzzNO = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2)
+ plan_jo.getString("split_group")
+ TaskUtils.getDateTime("MMddHHmm") + "-"
+ TaskUtils.getDateTime("MMddHHmmss") + "-"
+ plan_jo.getString("up_or_down");
//赋值完成后,将气胀轴编号给绑定到分切机上
if (plan_jo.getString("up_or_down").equals("1")) {

View File

@@ -6,11 +6,11 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:lzhl_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:88lmsdb}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
# password: ${DB_PWD:NLABC&hl123}
password: ${DB_PWD:12356}
password: ${DB_PWD:NLABC&hl123}
# password: ${DB_PWD:12356}
# 初始连接数
initial-size: 5
# 最小连接数