feat: 分切业务
This commit is contained in:
@@ -46,17 +46,18 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
/**
|
||||
* 获取类型状态,没任务的点位
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位
|
||||
* @param pointStatus 点位状态:1空位2有气涨轴3有子卷
|
||||
* @param pointStatus 点位状态:1空位、2有气涨轴、3有子卷
|
||||
* @param area 区域(0上1下)
|
||||
* @param sort 0:不排序,1:正序, 2:倒序
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String sort);
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
|
||||
|
||||
/**
|
||||
* 获取同尺寸的气涨轴
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位
|
||||
* @param size 气涨轴尺寸
|
||||
* @param area 区域
|
||||
* @param area 区域(0上1下)
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String area);
|
||||
@@ -76,4 +77,11 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
*/
|
||||
BstIvtCutpointivt getPintByAgvCode(String point, boolean flag);
|
||||
|
||||
/**
|
||||
* 获取类型1状态3,没任务的点位
|
||||
* @param location 区域:0上1下
|
||||
* @param area:区域:B1 B2 B3 B4
|
||||
* @return
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location, String area);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ import java.util.List;
|
||||
**/
|
||||
public interface BstIvtCutpointivtMapper extends BaseMapper<BstIvtCutpointivt> {
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String sort);
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
|
||||
|
||||
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String area);
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location, String area);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
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'
|
||||
@@ -40,4 +41,22 @@
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (t.point_code1 = bc.truss_point_code1 OR t.point_code1 = bc.truss_point_code2))
|
||||
</select>
|
||||
<select id="getAreaNotTaskPointByLocationAreaAndStatus"
|
||||
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
|
||||
SELECT DISTINCT bic.*
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON p.qzzno = bic.qzz_no1 OR p.qzzno = bic.qzz_no2
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '3'
|
||||
AND bic.point_location = #{location}
|
||||
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)
|
||||
)
|
||||
AND LEFT(p.resource_name,2) = #{area}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -89,8 +89,8 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String sort) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatus(type, pointStatus, sort);
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatus(type, pointStatus, area, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,4 +113,9 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
|
||||
lam.eq(flag, BstIvtCutpointivt::getIs_used, "1").eq(BstIvtCutpointivt::getPoint_code, point);
|
||||
return bstIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location, String area) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByLocationAreaAndStatus(location, area);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TrussCallAirShaftTask extends AbstractAcsTask {
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(task.getPriority())
|
||||
.remark(task.getRemark())
|
||||
.params2(task.getRequest_param())
|
||||
.interaction_json(task.getRequest_param())
|
||||
.product_area(task.getProduct_area())
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
|
||||
@@ -79,11 +79,16 @@ public class TrussCallShaftCacheTask extends AbstractAcsTask {
|
||||
// 更改任务状态为完成
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
String startPoint = task.getPoint_code1();
|
||||
String endPoint = task.getPoint_code2();
|
||||
BstIvtShafttubeivt startPointObj = shafttubeivtService.getByPointCode(startPoint, false);
|
||||
BstIvtShafttubeivt endPointObj = shafttubeivtService.getByPointCode(endPoint, false);
|
||||
// 起点清空
|
||||
startPointObj.setHave_qzz("0");
|
||||
TaskUtils.updateOptMessageByBShaftPoint(startPointObj);
|
||||
shafttubeivtService.updateById(startPointObj);
|
||||
endPointObj.setHave_qzz("1");
|
||||
TaskUtils.updateOptMessageByBShaftPoint(endPointObj);
|
||||
shafttubeivtService.updateById(endPointObj);
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TrussSendShaftCacheTask extends AbstractAcsTask {
|
||||
class TrussSendShaftCacheTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = TrussSendShaftCacheTask.class.getName();
|
||||
@Autowired
|
||||
private IschBaseTaskService taskService;
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.nl.b_lms.bst.ivt.shafttubeivt.service.IBstIvtShafttubeivtService;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
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.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussCallAirShaftTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussCallShaftCacheTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
@@ -23,7 +22,6 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -45,8 +43,6 @@ public class AutoCallAirShaftTask {
|
||||
@Autowired
|
||||
private IPdmBiSlittingproductionplanService slittingproductionplanService;
|
||||
@Autowired
|
||||
private IschBaseTaskService taskService;
|
||||
@Autowired
|
||||
private TrussCallAirShaftTask trussCallAirShaftTask;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
@@ -55,23 +51,21 @@ public class AutoCallAirShaftTask {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
// 1、获取空的插拔轴位(无任务) todo:(目前都是上区域,下区域未考虑)
|
||||
// 1、获取空的插拔轴位(无任务)
|
||||
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2","0","0");
|
||||
emptyPoints.forEach(empty -> {
|
||||
// 标箔:1,锂电:2
|
||||
String specification = empty.getQzz_generation();
|
||||
String location;
|
||||
String location = empty.getPoint_location();
|
||||
String area;
|
||||
if ("1".equals(specification)) {
|
||||
location = "0";
|
||||
if ("0".equals(empty.getPoint_location())) {
|
||||
if (SlitterConstant.SLITTER_STANDARD_FOIL.equals(specification)) {
|
||||
if (SlitterConstant.SLITTER_AREA_UP.equals(location)) {
|
||||
area = "B2";
|
||||
} else {
|
||||
area = "B4";
|
||||
}
|
||||
} else {
|
||||
location = "1";
|
||||
if ("0".equals(empty.getPoint_location())) {
|
||||
if (SlitterConstant.SLITTER_AREA_UP.equals(location)) {
|
||||
area = "B1";
|
||||
} else {
|
||||
area = "B3";
|
||||
@@ -81,15 +75,15 @@ public class AutoCallAirShaftTask {
|
||||
List<SlitterPlanDistinctDto> plans = slittingproductionplanService.getAllCutPlan(area);
|
||||
if (plans.size() == 0) {
|
||||
// 如果不需要套轴,就只做拔轴
|
||||
makePullShaft(empty);
|
||||
makePullShaft(empty, area);
|
||||
return;
|
||||
}
|
||||
// 查看套轴对接位是否满了
|
||||
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", "0");
|
||||
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", location, "0");
|
||||
// 如果满了就只做拔轴
|
||||
if (emptyShaftPoint.size() == 0) {
|
||||
// 如果不需要套轴,就只做拔轴
|
||||
makePullShaft(empty);
|
||||
makePullShaft(empty, area);
|
||||
return;
|
||||
}
|
||||
// 获取一个分切计划的Dto。一根轴可能有两个分切计划
|
||||
@@ -104,7 +98,7 @@ public class AutoCallAirShaftTask {
|
||||
// 获取其中一条
|
||||
PdmBiSlittingproductionplan needPlan = needPlans.get(0);
|
||||
String qzzSize = needPlan.getQzz_size();
|
||||
// 从套轴对接位获取相同气涨轴大小
|
||||
// 从套轴对接位获取相同气涨轴大小 (同标箔或者锂电分开)
|
||||
List<BstIvtCutpointivt> qzzPoint = bcutpointivtService.getPointByTypeAndShaftSize("1", qzzSize, area);
|
||||
if (qzzPoint.size() == 0) {
|
||||
// 调用ACS滚条气涨轴下来
|
||||
@@ -133,16 +127,25 @@ public class AutoCallAirShaftTask {
|
||||
param.put("qzz_no", ObjectUtil.isNotEmpty(startPoint.getQzz_no1())
|
||||
? startPoint.getQzz_no1() : startPoint.getQzz_no2());
|
||||
param.put("needPlan", planDto);
|
||||
param.put("is_pulling", "1");
|
||||
param.put("is_bushing", "1");
|
||||
param.put("task_type", "6");
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
param.put("qzz_size", needPlan.getQzz_size());
|
||||
// 设置子卷号
|
||||
// 纸管规格、是否拔轴
|
||||
for (PdmBiSlittingproductionplan plan : needPlans) {
|
||||
if ("1".equals(plan.getLeft_or_right())) {
|
||||
param.put("left", plan.getContainer_name());
|
||||
if ("1".equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("left", plan.getPaper_tube_model());
|
||||
} else {
|
||||
param.put("left", plan.getFRP_model());
|
||||
}
|
||||
} else {
|
||||
param.put("right", plan.getContainer_name());
|
||||
if ("1".equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("right", plan.getPaper_tube_model());
|
||||
} else {
|
||||
param.put("right", plan.getFRP_model());
|
||||
}
|
||||
}
|
||||
}
|
||||
trussCallAirShaftTask.createTask(param);
|
||||
@@ -169,7 +172,7 @@ public class AutoCallAirShaftTask {
|
||||
throw new BadRequestException("气胀轴库找不到[" + qzzSize + "]规格的气涨轴");
|
||||
}
|
||||
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0);
|
||||
// todo: 访问acs判断是否有无气涨轴
|
||||
// todo: 访问acs判断有无气涨轴
|
||||
boolean flag = true;
|
||||
if (!flag) {
|
||||
// 气涨轴库没有对应的气涨轴,就到气涨轴暂存区获取
|
||||
@@ -256,11 +259,12 @@ public class AutoCallAirShaftTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* 不需要套轴,就只做拔轴
|
||||
* 不需要套轴,就只做拔轴(区分标箔、锂电)
|
||||
* @param empty 空的插拔轴点位
|
||||
* @param area 区域
|
||||
*/
|
||||
private void makePullShaft(BstIvtShafttubeivt empty) {
|
||||
List<BstIvtCutpointivt> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "3", "0");
|
||||
private void makePullShaft(BstIvtShafttubeivt empty, String area) {
|
||||
List<BstIvtCutpointivt> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByLocationAreaAndStatus(empty.getPoint_location(), area);
|
||||
if (notTaskPoints.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
// 获取套轴对接位有气涨轴没任务的点位
|
||||
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0");
|
||||
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0", "0");
|
||||
for (BstIvtCutpointivt cutPoint : cutPoints) {
|
||||
// 获取分切计划
|
||||
List<String> collect = Stream.of(cutPoint.getQzz_no1(), cutPoint.getQzz_no2())
|
||||
@@ -63,6 +63,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
}
|
||||
// 获取任意一条
|
||||
PdmBiSlittingproductionplan demoPlan = plans.get(0);
|
||||
// 区域(B1, B2, B3, B4)
|
||||
String area = demoPlan.getResource_name().substring(0, 2);
|
||||
StIvtCutpointivt deviceCut = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>()
|
||||
.eq(StIvtCutpointivt::getExt_code, demoPlan.getResource_name()));
|
||||
@@ -81,7 +82,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
}
|
||||
// 如果两个气涨轴编码则表示一组满了
|
||||
// 查找分切对接没任务的空位
|
||||
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyCutPointNotTask(deviceCut.getSort_seq());
|
||||
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyCutPointNotTask(area, deviceCut.getSort_seq());
|
||||
if (emptyPoint.size() == 0) {
|
||||
log.warn("找不到对应的位置!");
|
||||
return;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AutoSlitterDownAgvTask {
|
||||
cutPointIvts.forEach(cut -> {
|
||||
// cut是起点
|
||||
// 1、先去对应的套轴对接位,没有气涨轴(空位),没有任务的点位
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("1", "1", "2");
|
||||
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());
|
||||
@@ -79,7 +79,7 @@ public class AutoSlitterDownAgvTask {
|
||||
}
|
||||
} else if (areaEmptyNotTaskPoint.size() == 0 && "3".equals(cut.getPoint_type())) {
|
||||
// 2、没有位置,就去分切缓存位
|
||||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("3", "1", "0");
|
||||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("3", "1", "0","0");
|
||||
}
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
log.warn(cut.getProduct_area() + "该区域暂无位置存放满轴");
|
||||
|
||||
@@ -11,5 +11,29 @@ public interface SlitterConstant {
|
||||
* 任务区域:暂定Test
|
||||
*/
|
||||
String SLITTER_TASK_AREA = "B2";
|
||||
/**
|
||||
* 是/可能/使用...
|
||||
*/
|
||||
String SLITTER_YES = "1";
|
||||
/**
|
||||
* 否/不可能/不用...
|
||||
*/
|
||||
String SLITTER_NO = "0";
|
||||
/**
|
||||
* 标箔:1
|
||||
*/
|
||||
String SLITTER_STANDARD_FOIL = "1";
|
||||
/**
|
||||
* 锂电:2
|
||||
*/
|
||||
String SLITTER_LITHIUM_BATTERY = "2";
|
||||
/**
|
||||
* 区域:上
|
||||
*/
|
||||
String SLITTER_AREA_UP = "0";
|
||||
/**
|
||||
* 区域:下
|
||||
*/
|
||||
String SLITTER_AREA_DOWN = "1";
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public class SlitterController {
|
||||
return new ResponseEntity<>(slitterService.acsFinishLoadShaft(entity), HttpStatus.OK);
|
||||
} else if ("3".equals(entity.getString("type"))) {
|
||||
return new ResponseEntity<>(slitterService.acsFinishShaftPluckTube(entity), HttpStatus.OK);
|
||||
} else if ("5".equals(entity.getString("type"))) {
|
||||
return new ResponseEntity<>(slitterService.acsSendShaftToCache(entity), HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(slitterService.acsRequestShaftLoadTube(entity), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -35,10 +35,11 @@ public interface SlitterMapper {
|
||||
|
||||
/**
|
||||
* 获取分切机下料位没任务的点位
|
||||
* @param sortSeq
|
||||
* @param area 区域
|
||||
* @param sortSeq 设备序号
|
||||
* @return
|
||||
*/
|
||||
List<BstIvtCutpointivt> getEmptyCutPointNotTask(BigDecimal sortSeq);
|
||||
List<BstIvtCutpointivt> getEmptyCutPointNotTask(String area, BigDecimal sortSeq);
|
||||
|
||||
/**
|
||||
* 获取分切机下一组分切计划对应的点位
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
FROM
|
||||
`bst_ivt_cutpointivt` bcp
|
||||
WHERE bcp.point_type = '3' AND bcp.point_status = '1' AND bcp.is_used = '1'
|
||||
AND bcp.product_area = #{area}
|
||||
AND 0 = (
|
||||
SELECT COUNT(*) FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07' AND (t.point_code2 = bcp.point_code OR t.point_code2 = bcp.truss_point_code1
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
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.bst.ivt.shafttubeivt.service.IBstIvtShafttubeivtService;
|
||||
@@ -20,6 +21,7 @@ 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.SendCopperFoilSubRollTrussTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.SlitterDownTrussTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussCallShaftCacheTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussSendAirShaftTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper;
|
||||
@@ -43,6 +45,7 @@ import java.util.stream.Stream;
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@@ -66,6 +69,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
private SendCopperFoilSubRollTrussTask sendCopperFoilSubRollTrussTask;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private TrussCallShaftCacheTask trussCallShaftCacheTask;
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@@ -79,10 +84,22 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (tryLock) {
|
||||
String size = param.getString("size");
|
||||
BstIvtShafttubeivt point = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
// 判断尺寸是否相同
|
||||
if (!size.equals(point.getQzz_size())) {
|
||||
log.error("设备:{}对应的气胀轴尺寸不批对,需要气胀轴尺寸:{},实际尺寸:{}", deviceCode, point.getQzz_size(), size);
|
||||
throw new BadRequestException("设备:{ " + deviceCode + " }对应的气胀轴尺寸不批对" +
|
||||
",需要气胀轴尺寸:{ " + point.getQzz_size() + " },实际尺寸:{ " + size + " }");
|
||||
}
|
||||
res.put("device_code", deviceCode);
|
||||
res.put("data", con);
|
||||
con.put("left", point.getTube_code1());
|
||||
con.put("left_size", ObjectUtil.isNotEmpty(point.getTube_name1())
|
||||
? point.getTube_name1().split("\\|")[2].charAt(0) : "");
|
||||
con.put("right", point.getTube_code2());
|
||||
con.put("right_size", ObjectUtil.isNotEmpty(point.getTube_name2())
|
||||
? point.getTube_name2().split("\\|")[2].charAt(0) : "");
|
||||
con.put("number", ObjectUtil.isNotEmpty(point.getTube_code1()) && ObjectUtil.isNotEmpty(point.getTube_code2())
|
||||
? "2" : "1");
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
@@ -107,16 +124,21 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (tryLock) {
|
||||
// 气涨轴编码
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
String direction = param.getString("direction");
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
PdmBiSlittingproductionplan plan;
|
||||
if ("1".equals(deviceCode.substring(deviceCode.length() - 1))) {
|
||||
if ("1".equals(direction)) {
|
||||
plan = plans.stream().filter(p -> "1".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
} else {
|
||||
plan = plans.stream().filter(p -> "2".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
}
|
||||
if (plan == null) {
|
||||
log.error("设备{}, 找不到气胀轴编码{}对应的分切计划!参数:{}",deviceCode, qzzNo, param);
|
||||
throw new BadRequestException("找不到气胀轴编码{ " + qzzNo + " }的分切计划!");
|
||||
}
|
||||
// 查找终点 todo: 如何确认是废箔还是成品
|
||||
// todo: 暂时写死去成品称重
|
||||
// BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
@@ -153,10 +175,12 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (tryLock) {
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
if (ObjectUtil.isEmpty(qzzNo)) {
|
||||
log.error("气涨轴编码不能为空!");
|
||||
throw new BadRequestException("气涨轴编码不能为空!");
|
||||
}
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
log.error("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
// 反馈 纸管尺寸
|
||||
@@ -165,7 +189,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
r.put("device_code", deviceCode);
|
||||
for (PdmBiSlittingproductionplan plan : plans) {
|
||||
String s = String.valueOf("1".equals(plan.getPaper_tube_or_FRP())
|
||||
? plan.getPaper_tube_model()
|
||||
? plan.getPaper_tube_model().split("\\|")[2].charAt(0)
|
||||
: plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
if ("1".equals(plan.getLeft_or_right())) {
|
||||
r.put("left_size", s);
|
||||
@@ -191,6 +215,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject acsFinishLoadShaft(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
// 穿拔轴位
|
||||
String deviceCode = param.getString("device_code");
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
@@ -207,6 +232,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
.eq(SchBaseTask::getPoint_code1, deviceCode)
|
||||
.lt(SchBaseTask::getTask_status, "07"));
|
||||
if (list.size() > 0) {
|
||||
log.error("点位[{}]存在未完成得任务!", deviceCode);
|
||||
throw new BadRequestException("点位[" + deviceCode + "]存在未完成得任务!");
|
||||
}
|
||||
BstIvtShafttubeivt startPoint = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
@@ -218,6 +244,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, collect)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
|
||||
if (plans.size() == 0) {
|
||||
log.error("找不到[{}]对应的分切计划!", collect);
|
||||
throw new BadRequestException("找不到[" + collect + "]对应的分切计划!");
|
||||
}
|
||||
// 当前套轴的分切计划
|
||||
@@ -234,8 +261,9 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(cutPoint)) {
|
||||
// 获取一个空位
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", "1");
|
||||
// 获取一个空位 (上下区域)
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus(
|
||||
"1", "1", startPoint.getPoint_location(), "1");
|
||||
if (emptyNotTaskPoint.size() == 0) {
|
||||
throw new BadRequestException("找不到可用套轴对接位!");
|
||||
}
|
||||
@@ -243,7 +271,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
}
|
||||
// 枷锁
|
||||
RLock lockPoint = redissonClient.getLock(cutPoint.getPoint_code());
|
||||
boolean tryLockPoint = lockPoint.tryLock(5, TimeUnit.SECONDS);
|
||||
boolean tryLockPoint = lockPoint.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLockPoint) {
|
||||
// 分切计划设置套轴完成
|
||||
@@ -294,7 +322,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String qzzSize = param.getString("qzz_size");
|
||||
String qzzSize = param.getString("size");
|
||||
// 判断是否有未完成的任务
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code1, deviceCode)
|
||||
@@ -319,6 +347,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
param.put("task_type", "6");
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
param.put("is_bushing", "0");
|
||||
trussCallShaftCacheTask.createTask(param);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
@@ -360,6 +389,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
// 获得设备
|
||||
StIvtCutpointivt device = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>()
|
||||
.eq(StIvtCutpointivt::getExt_code, demoPlan.getResource_name()));
|
||||
String area = demoPlan.getResource_name().substring(0, 2);
|
||||
// 获取当前分切机的下一组分切计划(最多四条分切计划)
|
||||
// hint: 获取到的分切可能是不同组的但具有一定时间顺序
|
||||
List<PdmBiSlittingproductionplan> timePlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
@@ -372,7 +402,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (timePlans.size() == 0) {
|
||||
// 如果没有下一组的分切计划,就只做下卷任务(判断下单/下双)
|
||||
// 获取分切对接位没任务的空位置
|
||||
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(device.getSort_seq());
|
||||
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(area, device.getSort_seq());
|
||||
if (emptyPoints.size() == 0) {
|
||||
throw new BadRequestException("分切机【" + device.getExt_code() + "】找不到对应的对接位!");
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ public class AcsTaskDto {
|
||||
* 扩展参数
|
||||
*/
|
||||
private String params;
|
||||
private String params2;
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user