hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/entity/request/DamageRequest.java
@@ -16,6 +16,13 @@ @Data public class DamageRequest { @ApiModelProperty("流程卡号") private String flowCardId; @ApiModelProperty("订单序号") private Integer glassType; @ApiModelProperty("层号") private Integer layer; @ApiModelProperty("玻璃列表") private List<String> glassIdList; hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
@@ -97,6 +97,12 @@ return Result.build(200, "修改成功", hollowGlassOutRelationInfoService.dispatchHollowSwitch(flag)); } @ApiOperation("中空优先级开关") @PostMapping("/priorityHollowSwitch") public Result<Boolean> priorityHollowSwitch(Boolean flag) { return Result.build(200, "修改成功", hollowGlassOutRelationInfoService.priorityHollowSwitch(flag)); } @ApiOperation("手动生成李赛克文件") @PostMapping("/generateHollowLisecFile") public Result<String> generateHollowLisecFile(String flowCardId, int cell, int isForce) throws IOException { hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
@@ -1,6 +1,7 @@ package com.mes.hollow.controller; import com.mes.damage.entity.request.DamageRequest; import com.mes.hollow.entity.dto.LackDetailsDTO; import com.mes.hollow.entity.vo.HollowAllFlowCardVO; import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; @@ -52,5 +53,11 @@ // return Result.success(lackDetailsList); // } @ApiOperation("中空缺片爆破笼报破损") @PostMapping("/hollowBigStorageGlassDamage") public Result<Boolean> hollowBigStorageGlassDamage(@RequestBody DamageRequest request) { return Result.build(200, "报破损成功", hollowGlassRelationInfoService.hollowBigStorageGlassDamage(request)); } } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/dto/LackDetailsDTO.java
@@ -19,6 +19,10 @@ */ private int layer; /** * 流程卡 */ private int glassType; /** * 膜系 */ private String filmsId; hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java
@@ -25,6 +25,8 @@ Boolean dispatchHollowSwitch(Boolean flag); Boolean priorityHollowSwitch(Boolean flag); List<String> hollowTaskList(int cell); List<HollowGlassQueueInfo> appointHollowTaskDetails(String flowCardId, int cell); hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
@@ -1,6 +1,7 @@ package com.mes.hollow.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mes.damage.entity.request.DamageRequest; import com.mes.hollow.entity.HollowGlassRelationInfo; import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; import com.mes.hollow.entity.dto.HollowBigStorageDTO; @@ -48,5 +49,6 @@ */ Integer getGlassGapByThickness(Double thickness); Boolean hollowBigStorageGlassDamage(DamageRequest request); } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -97,6 +97,12 @@ } @Override public Boolean priorityHollowSwitch(Boolean flag) { redisUtil.setCacheObject("priorityHollowSwitch", flag); return redisUtil.getCacheObject("priorityHollowSwitch"); } @Override public List<String> hollowTaskList(int cell) { //查询任务表中本条线所有未完成的任务信息 List<HollowGlassOutRelationInfo> list = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mes.common.config.Const; import com.mes.common.config.ConstSysConfig; import com.mes.damage.entity.request.DamageRequest; import com.mes.damage.service.DamageService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; import com.mes.hollow.entity.HollowBigStorageCage; @@ -59,6 +61,8 @@ HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; @Resource SysConfigService sysConfigService; @Resource DamageService damageService; // @Value("${mes.slotWidth}") // private Integer slotWidth; // @Value("${mes.glassGap}") @@ -419,6 +423,19 @@ return sysConfigService.queryConfigValue(sysKey); } @Override public Boolean hollowBigStorageGlassDamage(DamageRequest request) { List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>() .eq(GlassInfo::getFlowCardId, request.getFlowCardId()) .eq(GlassInfo::getLayer, request.getLayer()) .eq(GlassInfo::getGlassType, request.getGlassType())); for (GlassInfo glassInfo : glassInfos) { //掰片报破损 damageService.autoSubmitReport(glassInfo.getGlassId(), request.getLine(), request.getWorkingProcedure(), request.getRemark(), request.getState()); } return Boolean.TRUE; } private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) { Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$"); hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -104,6 +104,9 @@ private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task"; private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task"; private static final List<Integer> ONE_LINE_FIRST = Arrays.asList(930, 931, 932); private static final List<Integer> TWO_LINE_FIRST = Arrays.asList(931, 930, 932); /** * 直通格子 */ @@ -375,14 +378,14 @@ return; } //获取所有空闲的线路信息 List<Integer> freeLineList = new ArrayList<>(); HashMap<Integer, Boolean> map = new HashMap<>(); //获取空闲且领取任务的数据信息,没有任务直接走玻璃调度 try { if (CMJ1ModbusTcp.checkConnected()) { Boolean oneState = CMJ1ModbusTcp.readUInt16(42027 - 40001) != 0; if (oneState) { freeLineList.add(930); } map.put(930, oneState); } else { map.put(930, Boolean.FALSE); } } catch (Exception e) { //nothing @@ -391,34 +394,47 @@ try { S7DataZKExtra s7DataZKExtra = s7SerializerZKQ2.read(S7DataZKExtra.class); log.info("中空额外读取{}", s7DataZKExtra); Boolean twoState = s7DataZKExtra.getIsFree(); Boolean threeState = s7DataZKExtra.getIsFree03(); if (twoState) { freeLineList.add(931); } if (threeState) { freeLineList.add(932); } map.put(931, s7DataZKExtra.getIsFree()); map.put(932, s7DataZKExtra.getIsFree03()); } catch (Exception e) { //nothing log.info("二/三线线空闲状态获取异常"); } HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null; if (CollectionUtil.isNotEmpty(freeLineList)) { hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() .in(HollowGlassOutRelationInfo::getCell, freeLineList) .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) .orderByAsc(HollowGlassOutRelationInfo::getUpdateTime).last("limit 1") ); List<Integer> resultList = new ArrayList<>(); if (redisUtil.getCacheObject("priorityHollowSwitch")) { resultList = TWO_LINE_FIRST; } else { resultList = ONE_LINE_FIRST; } if (hollowGlassOutRelationInfo == null) { hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) .orderByAsc(HollowGlassOutRelationInfo::getUpdateTime).last("limit 1") ); HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null; int cell = -1; for (Integer i : resultList) { if (null == hollowGlassOutRelationInfo) { Boolean entity = map.get(i); cell = i; if (null != entity && entity) { hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() .eq(HollowGlassOutRelationInfo::getCell, cell) .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) ); } } else { break; } } for (Integer i : resultList) { if (null == hollowGlassOutRelationInfo) { cell = i; hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() .eq(HollowGlassOutRelationInfo::getCell, cell) .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) ); } else { break; } } if (null != hollowGlassOutRelationInfo) { @@ -853,7 +869,7 @@ List<String> glassList = noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() .set(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) .notIn(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE) .in(HollowBigStorageCageDetails::getGlassId, glassList)); } else { @@ -862,7 +878,7 @@ hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() .set(HollowBigStorageCageDetails::getSlot, item.getStartSlot()) .set(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) .notIn(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE) .eq(HollowBigStorageCageDetails::getGlassId, item.getGlassId())); } } @@ -1049,7 +1065,7 @@ hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() .set(HollowBigStorageCageDetails::getState, state) .set(Const.BIG_STORAGE_AFTER_DISPATCH.equals(taskType), HollowBigStorageCageDetails::getSlot, targetSlot) .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) .notIn(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE) .in(HollowBigStorageCageDetails::getGlassId, glassIds)); try { s7DataZKDLPTwo = new S7DataZKDLPTwo(); hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -36,7 +36,7 @@ (#{item.glassId}, #{item.targetSlot}) </foreach> ) and state !=101 and state not in (8, 9, 101) </where> </update> <update id="updateDeviceIdBySlot"> hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -13,6 +13,7 @@ <resultMap id="lackBaseMap" type="com.mes.hollow.entity.dto.LackDetailsDTO"> <result column="flow_card_id" property="flowCardId"/> <result column="layer" property="layer"/> <result column="order_sort" property="glassType"/> <result column="films_id" property="filmsId"/> <result column="first_length" property="width"/> <result column="second_Length" property="height"/> @@ -107,6 +108,7 @@ with relation_length as ( select flow_card_id, layer, order_sort, tempering_layout_id, tempering_feed_sequence, GREATEST(width, height) as first_length, @@ -120,9 +122,16 @@ and tempering_layout_id is null and tempering_feed_sequence is null ) select flow_card_id, layer, first_length, films_id, second_Length, thickness, count(*) as lack_cout select flow_card_id, layer, order_sort, first_length, films_id, second_Length, thickness, count(*) as lack_cout from relation_length group by flow_card_id, layer, films_id, first_length, second_Length, thickness group by flow_card_id, layer, order_sort, films_id, first_length, second_Length, thickness </select> <select id="queryLayerByFlowCardId" resultType="java.lang.Integer"> select count(distinct layer)