Merge branch 'master' of git://10.153.19.25/YiWuProject
| | |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | @Data |
| | | public class DamageRequest { |
| | | |
| | | @ApiModelProperty("流程卡号") |
| | | private String flowCardId; |
| | | @ApiModelProperty("订单序号") |
| | | private Integer glassType; |
| | | @ApiModelProperty("层号") |
| | | private Integer layer; |
| | | |
| | | @ApiModelProperty("玻璃列表") |
| | | private List<String> glassIdList; |
| | | |
| | | @ApiModelProperty("玻璃ID") |
| | | @NotBlank(message = "玻璃ID不能为空") |
| | | private String glassId; |
| | |
| | | List<EdgSlotRemainVO> querySlotRemainWidth(int cellLength, int glassGap); |
| | | |
| | | List<PieChartVO> queryPieChart(); |
| | | |
| | | Boolean identControlsByPatternSequence(DamageRequest request); |
| | | } |
| | |
| | | public List<PieChartVO> queryPieChart() { |
| | | return this.baseMapper.queryPieChart(); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean identControlsByPatternSequence(DamageRequest request) { |
| | | for (String glassId : request.getGlassIdList()) { |
| | | //掰片报破损 |
| | | damageService.autoSubmitReport(glassId, request.getLine(), request.getWorkingProcedure(), request.getRemark(), request.getState()); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.damage.entity.request.DamageRequest; |
| | | import com.mes.edgstoragecage.entity.vo.CutDrawingVO; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import com.mes.utils.Result; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | return Result.build(200, "成功", edgStorageCageDetailsService.identControls(request)); |
| | | } |
| | | |
| | | @ApiOperation("识别操作一键执行: 破损/拿走 参数(ID,功能[9:拿走,8:破损])") |
| | | @PostMapping("/identControlsByPatternSequence") |
| | | public Result<Boolean> identControlsByPatternSequence(@RequestBody DamageRequest request) { |
| | | return Result.build(200, "成功", edgStorageCageDetailsService.identControlsByPatternSequence(request)); |
| | | } |
| | | |
| | | @ApiOperation("磨边任务 参数()") |
| | | @PostMapping("/selectEdgTask") |
| | | public Result selectEdgTask(@RequestBody Map<String, String> arguments) { |
| | |
| | | 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 { |
| | |
| | | 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; |
| | |
| | | // return Result.success(lackDetailsList); |
| | | // } |
| | | |
| | | @ApiOperation("中空缺片爆破笼报破损") |
| | | @PostMapping("/hollowBigStorageGlassDamage") |
| | | public Result<Boolean> hollowBigStorageGlassDamage(@RequestBody DamageRequest request) { |
| | | return Result.build(200, "报破损成功", hollowGlassRelationInfoService.hollowBigStorageGlassDamage(request)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | private int layer; |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private int glassType; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | |
| | | |
| | | Boolean dispatchHollowSwitch(Boolean flag); |
| | | |
| | | Boolean priorityHollowSwitch(Boolean flag); |
| | | |
| | | List<String> hollowTaskList(int cell); |
| | | |
| | | List<HollowGlassQueueInfo> appointHollowTaskDetails(String flowCardId, int cell); |
| | |
| | | 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; |
| | |
| | | */ |
| | | Integer getGlassGapByThickness(Double thickness); |
| | | |
| | | Boolean hollowBigStorageGlassDamage(DamageRequest request); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @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>() |
| | |
| | | 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; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigInteger; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; |
| | | @Resource |
| | | SysConfigService sysConfigService; |
| | | @Resource |
| | | DamageService damageService; |
| | | // @Value("${mes.slotWidth}") |
| | | // private Integer slotWidth; |
| | | // @Value("${mes.glassGap}") |
| | |
| | | |
| | | @Override |
| | | public List<HollowAllFlowCardVO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) { |
| | | Date startDate = new Date(); |
| | | log.info("开始查询中空流程卡任务信息,开始时间{}", startDate); |
| | | List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId()) |
| | |
| | | log.info("笼内无玻璃"); |
| | | return new ArrayList<>(); |
| | | } |
| | | Date middleDate = new Date(); |
| | | log.info("中空理片笼详情数据已查询完毕,耗时:{}ms", middleDate.getTime() - startDate.getTime()); |
| | | Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId)); |
| | | List<HollowAllFlowCardVO> resultList = new ArrayList<>(); |
| | | AtomicInteger pairTotalCount = new AtomicInteger(); |
| | |
| | | resultList.add(hollowAllFlowCardVO); |
| | | } |
| | | }); |
| | | Date endDate = new Date(); |
| | | log.info("客户信息数据已查询完毕,耗时:{}ms,总计耗时:{}ms", endDate.getTime() - middleDate.getTime(), endDate.getTime() - startDate.getTime()); |
| | | if (CollectionUtil.isEmpty(resultList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | 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+)$"); |
| | | |
| | |
| | | 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); |
| | | |
| | | /** |
| | | * 直通格子 |
| | | */ |
| | |
| | | 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 |
| | |
| | | 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 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) |
| | | .orderByAsc(HollowGlassOutRelationInfo::getUpdateTime).last("limit 1") |
| | | ); |
| | | } |
| | | } 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) { |
| | |
| | | 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 { |
| | |
| | | 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())); |
| | | } |
| | | } |
| | |
| | | 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(); |
| | |
| | | (#{item.glassId}, #{item.targetSlot}) |
| | | </foreach> |
| | | ) |
| | | and state !=101 |
| | | and state not in (8, 9, 101) |
| | | </where> |
| | | </update> |
| | | <update id="updateDeviceIdBySlot"> |
| | |
| | | <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"/> |
| | | <result column="thickness" property="thickness"/> |
| | | <result column="lack_cout" property="lackCount"/> |
| | | <result column="lack_count" property="lackCount"/> |
| | | <result column="damage_count" property="damageCount"/> |
| | | </resultMap> |
| | | |
| | | <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMap"> |
| | |
| | | with relation_length as ( |
| | | select flow_card_id, |
| | | layer, |
| | | order_sort, |
| | | tempering_layout_id, |
| | | tempering_feed_sequence, |
| | | GREATEST(width, height) as first_length, |
| | |
| | | where flow_card_id = #{flowCardId} |
| | | 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 |
| | | ), |
| | | lack_count_temp as ( |
| | | select flow_card_id, |
| | | layer, |
| | | order_sort, |
| | | first_length, |
| | | films_id, |
| | | second_Length, |
| | | thickness, |
| | | count(*) as lack_count |
| | | 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 |
| | | ), |
| | | damage_count_temp as ( |
| | | select process_id as flow_card_id, |
| | | technology_number as layer, |
| | | order_number as order_sort, |
| | | count(1) as damage_count |
| | | from damage |
| | | where process_id = #{flowCardId} |
| | | group by process_id, technology_number, order_number |
| | | ), |
| | | result_count as ( |
| | | select t.*, IFNULL(t1.damage_count, 0) damage_count |
| | | from lack_count_temp t |
| | | left join damage_count_temp t1 on t.flow_card_id = t1.flow_card_id and t.layer = t1.layer and |
| | | t.order_sort = t1.order_sort |
| | | ) |
| | | select * |
| | | from result_count |
| | | </select> |
| | | <select id="queryLayerByFlowCardId" resultType="java.lang.Integer"> |
| | | select count(distinct layer) |