Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
| | |
| | | <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="fetchxianga"> |
| | | {{$t('reportmanage.inquire')}}</el-button> |
| | | </div> |
| | | <el-table ref="table" style="margin-top: 20px;height: 700px;width: 1770px;" :data="tableDataa" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="deviceId" align="center" :label="$t('searchOrder.cagenumber')" min-width="100" /> |
| | | <el-table |
| | | ref="table" |
| | | style="margin-top: 20px; height: 700px; width: 1770px; overflow-y: auto;" |
| | | :data="tableDataa" |
| | | :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" |
| | | virtual-scroll |
| | | :virtual-scroll-item-size="50" |
| | | :virtual-scroll-offset="100" |
| | | :row-height="50" |
| | | :border="false" |
| | | :lazy="true" |
| | | :cell-style="{padding: '8px 0'}" |
| | | :show-header-overflow="false" |
| | | :show-overflow="false" |
| | | :stripe="false" |
| | | :selectable="false" |
| | | :tooltip-effect="null" |
| | | > |
| | | <el-table-column prop="deviceId" align="center" :label="$t('searchOrder.cagenumber')" min-width="100" /> |
| | | <el-table-column prop="engineerId" align="center" :label="$t('searchOrder.projectnumber')" min-width="100" /> |
| | | <el-table-column prop="layer" align="center" :label="$t('processCard.layer')" min-width="50" /> |
| | | <el-table-column prop="slot" align="center" :label="$t('searchOrder.gridnumber')" min-width="150" /> |
| | |
| | | <el-table ref="table" style="margin-top: 20px;height: 500px;" |
| | | :data="tableDatagh" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="engineerId" fixed align="center" :label="$t('searchOrder.projectnumber')" min-width="150"/> |
| | | <el-table-column prop="engineerName" fixed align="center" :label="$t('large.productname')" min-width="150"/> |
| | | <el-table-column prop="thickness" align="center" :label="$t('basicData.thickness')" min-width="150" /> |
| | | <el-table-column prop="filmsId" align="center" :label="$t('basicData.coatingtypes')" min-width="150" /> |
| | | <el-table-column prop="temperingLayoutId" align="center" :label="$t('searchOrder.layoutnumber')" min-width="120" /> |
| | |
| | | <el-table-column prop="workingProcedure" align="center" :label="$t('reportmanage.process')" min-width="80" /> |
| | | <el-table-column fixed="right" :label="$t('searchOrder.operate')" align="center"> |
| | | <template #default="scope"> |
| | | <el-button type="text" plain @click="handleBroke(scope.row)">{{ $t('order.dilapidation') }}</el-button> |
| | | <el-button type="text" plain :disabled="scope.row.glassId==null" @click="handleBroke(scope.row)">{{ $t('order.dilapidation') }}{{ }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <div style="float: right;margin-bottom: 5px;"> |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.damage.entity.Damage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @DS("northGlassMes") |
| | | public interface DamageMapper extends MPJBaseMapper<Damage> { |
| | | |
| | | List<Damage> queryUnTempByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | } |
| | |
| | | void deleteByGlassId(String glassId); |
| | | |
| | | Boolean sendToERP(ReportingWork reportingWork, List<ReportingWorkDetail> reportingWorkDetails, Boolean type); |
| | | |
| | | List<Damage> queryUnTempByFlowCardId(String flowCardId); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Damage> queryUnTempByFlowCardId(String flowCardId){ |
| | | return baseMapper.queryUnTempByFlowCardId(flowCardId); |
| | | } |
| | | } |
| | |
| | | package com.mes.order.mapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.order.entity.HollowGlassDetailsDTO; |
| | | import com.mes.order.entity.HollowOrderDTO; |
| | | import com.mes.order.entity.OrderDetailsDTO; |
| | | import com.mes.order.entity.Orders; |
| | | import com.mes.order.entity.*; |
| | | import com.mes.order.entity.dto.OrderDTO; |
| | | |
| | | import java.util.List; |
| | |
| | | List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(String flowCardId, int totalLayer, int layer); |
| | | |
| | | OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId); |
| | | |
| | | List<ProcessCardReport> queryLackByERP(String flowCardId); |
| | | } |
| | |
| | | List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(String flowCardId, int totalLayer, int layer); |
| | | |
| | | OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId); |
| | | |
| | | List<ProcessCardReport> queryLackByERP(String flowCardId); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "orderDetails", key = "#flowCardId",unless = "#result == null") |
| | | @Cacheable(value = "orderDetails", key = "#flowCardId", unless = "#result == null") |
| | | public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId) { |
| | | log.info("查询数据库一次:{}", flowCardId); |
| | | return baseMapper.queryProductNameByFlowCardId(flowCardId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProcessCardReport> queryLackByERP(String flowCardId) { |
| | | return baseMapper.queryLackByERP(flowCardId); |
| | | } |
| | | } |
| | |
| | | a.area, |
| | | a.quantity, |
| | | a.create_time, |
| | | round(ifnull(d.finishNum, 0) / a.quantity * 100) as 'percent', |
| | | ifnull(d.finishNum, 0) |
| | | round(ifnull(d.finishNum, 0) / a.quantity * 100) as 'percent', ifnull(d.finishNum, 0) |
| | | from sd.`order` as a |
| | | LEFT JOIN ( |
| | | SELECT sum(c.reporting_work_num) as 'finishNum',order_id |
| | |
| | | ) as d |
| | | on a.order_id = d.order_id |
| | | where a.warehousing != 2 and a.warehousing >= 0 |
| | | ORDER BY a.order_id desc |
| | | ORDER BY a.order_id desc |
| | | </select> |
| | | <select id="queryOrderByFlowCardId" resultType="com.mes.order.entity.HollowOrderDTO"> |
| | | select t1.* |
| | | from pp.flow_card t |
| | | inner join sd.order t1 on t.order_id = t1.order_id |
| | | where t.process_id = #{flowCardId} |
| | | limit 1 |
| | | where t.process_id = #{flowCardId} limit 1 |
| | | </select> |
| | | <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMapHollowDetail"> |
| | | <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMapHollowDetail"> |
| | | with temp_flow as (SELECT t.process_id, |
| | | t.order_id, |
| | | t.order_number, |
| | |
| | | select min(order_id) as order_id, min(order_number) as order_number |
| | | from pp.flow_card |
| | | where process_id = #{flowCardId} |
| | | ) |
| | | limit 1 |
| | | ) limit 1 |
| | | </select> |
| | | <select id="queryLackByERP" resultType="com.mes.order.entity.ProcessCardReport"> |
| | | select a.*, |
| | | (b.quantity - b.termination_quantity) as 'quantity', |
| | | (b.quantity - b.termination_quantity - reporting_work_num) as 'lack_quantity' |
| | | from order_process_detail as a |
| | | inner join pp.flow_card as b |
| | | on a.order_id = b.order_id |
| | | and a.process_id = b.process_id |
| | | and a.order_number = b.order_number |
| | | and a.technology_number = b.technology_number |
| | | where termination_status = 0 |
| | | and a.process_id = #{flowCardId} |
| | | and a.process = "中空" |
| | | and (b.quantity - b.termination_quantity) > reporting_work_num |
| | | </select> |
| | | </mapper> |
| | |
| | | private static final String ALARM_TYPE1 = "一线卧式理片笼"; |
| | | private static final String ALARM_TYPE2 = "二线卧式理片笼"; |
| | | private static final String ALARM_CODE_NOGLASS = "noGlass"; |
| | | private static final String ALARM_CODE_ID = "idSame"; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void startOneOpcTask() throws Exception { |
| | |
| | | } |
| | | if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) { |
| | | log.info("玻璃id与上次相同,禁止进片"); |
| | | ProductAlarmInfo alarmInfo = new ProductAlarmInfo(); |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | | if (deviceId == 1) { |
| | | alarmInfo.setAlarmType(ALARM_TYPE1); |
| | | } else { |
| | | alarmInfo.setAlarmType(ALARM_TYPE2); |
| | | } |
| | | alarmInfo.setAlarmCode(ALARM_CODE_ID); |
| | | alarmInfo.setAlarmMessage(task.getGlassIdIn()); |
| | | productAlarmInfoService.save(alarmInfo); |
| | | Date endDate = new Date(); |
| | | log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime()); |
| | | return Boolean.FALSE; |
| | |
| | | |
| | | private boolean outTask(S7DataWL task, int deviceId, int cellFlag) { |
| | | Date startDate = new Date(); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdOut())); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn())); |
| | | if (null == glassInfo && StringUtils.isNotBlank(task.getGlassIdIn())) { |
| | | log.info("进片玻璃信息不存在,玻璃id:{}", task.getGlassIdIn()); |
| | | log.info("直通玻璃信息不存在,玻璃id:{}", task.getGlassIdIn()); |
| | | ProductAlarmInfo alarmInfo = new ProductAlarmInfo(); |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | |
| | | */ |
| | | private String engineerId; |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String engineerName; |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | |
| | | |
| | | <resultMap id="temperingGlassCount" type="com.mes.bigstorage.entity.dto.TemperingGlassCountDTO"> |
| | | <result column="engineer_id" property="engineerId"/> |
| | | <result column="engineer_name" property="engineerName"/> |
| | | <result column="tempering_layout_id" property="temperingLayoutId"/> |
| | | <result column="films_id" property="filmsId"/> |
| | | <result column="thickness" property="thickness"/> |
| | |
| | | |
| | | <select id="selectTemperingGlassCount" resultMap="temperingGlassCount"> |
| | | with glass_info_temp as ( |
| | | select engineer_id, tempering_layout_id, count(*) as total_count |
| | | from glass_info |
| | | group by engineer_id, tempering_layout_id |
| | | select t.engineer_id,t1.engineer_name, t.tempering_layout_id, count(*) as total_count |
| | | from glass_info t inner join engineering t1 on t.engineer_id=t1.engineer_id |
| | | group by t.engineer_id, t.tempering_layout_id |
| | | ), |
| | | big_details_temp as ( |
| | | select engineer_id, tempering_layout_id, count(*) as real_count, films_id, thickness |
| | |
| | | ), |
| | | result as ( |
| | | select t.engineer_id, |
| | | t1.engineer_name, |
| | | t.tempering_layout_id, |
| | | t.films_id, |
| | | t.thickness, |
| | |
| | | // return Result.success(lackDetailsList); |
| | | // } |
| | | @ApiOperation("查询指定流程卡的缺片详情") |
| | | @PostMapping("/queryLackByFlowCard") |
| | | @PostMapping("/queryLackByFlowCardByERP") |
| | | public Result<Map<Integer,List<LackDetailsDTO>>> queryLackByFlowCard(String flowCardId) { |
| | | Map<Integer,List<LackDetailsDTO>> lackDetailsMap = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId); |
| | | return Result.success(lackDetailsMap); |
| | | } |
| | | |
| | | @ApiOperation("查询指定流程卡的缺片详情") |
| | | @PostMapping("/queryLackByFlowCard") |
| | | public Result<Map<Integer,List<LackDetailsDTO>>> queryLackByFlowCardByERP(String flowCardId) { |
| | | Map<Integer,List<LackDetailsDTO>> lackDetailsMap = hollowGlassRelationInfoService.queryLackByFlowCardByERP(flowCardId); |
| | | return Result.success(lackDetailsMap); |
| | | } |
| | | |
| | | @ApiOperation("中空缺片爆破笼报破损") |
| | | @PostMapping("/hollowBigStorageGlassDamage") |
| | | public Result<Boolean> hollowBigStorageGlassDamage(@RequestBody DamageRequest request) { |
| | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private int layer; |
| | | private Integer layer; |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private int glassType; |
| | | private Integer glassType; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import com.mes.order.entity.ProcessCardReport; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | |
| | |
| | | List<LackDetailsDTO> queryLackByFlowCard(@Param("flowCardId") String flowCardId); |
| | | |
| | | List<LackDetailsDTO> queryLackGlassByFlowCard(@Param("flowCardId") String flowCardId, @Param("orderSort") Integer orderSort, @Param("layer") Integer layer); |
| | | |
| | | List<LackDetailsDTO> queryLackByFlowCardByERP(@Param("flowCardIdList") List<ProcessCardReport> flowCardIdList); |
| | | } |
| | | |
| | |
| | | |
| | | Map<Integer,List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId); |
| | | |
| | | Map<Integer,List<LackDetailsDTO>> queryLackByFlowCardByERP(String flowCardId); |
| | | |
| | | |
| | | /** |
| | | * 按照厚度获取玻璃间隙 |
| | |
| | | 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.Damage; |
| | | import com.mes.damage.entity.request.DamageRequest; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | |
| | | import com.mes.hollow.service.HollowGlassRelationInfoService; |
| | | import com.mes.order.entity.HollowGlassDetailsDTO; |
| | | import com.mes.order.entity.OrderDetailsDTO; |
| | | import com.mes.order.entity.ProcessCardReport; |
| | | import com.mes.order.service.OrdersService; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCardByERP(String flowCardId) { |
| | | List<ProcessCardReport> processCardReports = ordersService.queryLackByERP(flowCardId); |
| | | if (CollectionUtil.isEmpty(processCardReports)) { |
| | | return null; |
| | | } |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetails = hollowBigStorageCageDetailsService.list( |
| | | new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId) |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL) |
| | | ); |
| | | // 1. 统计每个 (glassType, layer) 组合的出现次数 |
| | | Map<String, Long> typeLayerCountMap = hollowBigStorageCageDetails.stream() |
| | | .map(detail -> detail.getGlassType() + "_" + detail.getLayer()) |
| | | .collect(Collectors.groupingBy( |
| | | key -> key, // 以复合键为分组依据 |
| | | Collectors.counting() // 统计每个键的出现次数 |
| | | )); |
| | | // 2. 遍历并按次数减 quantity(避免负数) |
| | | processCardReports.forEach(report -> { |
| | | String reportPair = report.getOrderNumber() + "_" + report.getTechnologyNumber(); |
| | | Long count = typeLayerCountMap.getOrDefault(reportPair, 0L); |
| | | if (count > 0) { |
| | | int newQuantity = Math.max(0, report.getLackQuantity() - count.intValue()); |
| | | report.setLackQuantity(newQuantity); |
| | | } |
| | | }); |
| | | List<LackDetailsDTO> detailsDTOS = baseMapper.queryLackByFlowCardByERP(processCardReports); |
| | | List<Damage> damages = damageService.queryUnTempByFlowCardId(flowCardId); |
| | | // 1. 按(orderNumber+layer)分组,同时缓存DTO的其他字段作为模板 |
| | | Map<String, List<Damage>> damageMap = new HashMap<>(); |
| | | Map<String, LackDetailsDTO> dtoTemplateMap = new HashMap<>(); // 存储分组对应的DTO模板 |
| | | |
| | | // 1.1 初始化damage分组和DTO模板 |
| | | damages.forEach(damage -> { |
| | | if (damage.getOrderNumber() == null || damage.getTechnologyNumber() == null) { |
| | | return; |
| | | } |
| | | String key = damage.getOrderNumber() + "_" + damage.getTechnologyNumber(); |
| | | damageMap.computeIfAbsent(key, k -> new ArrayList<>()).add(damage); |
| | | }); |
| | | |
| | | detailsDTOS.forEach(dto -> { |
| | | if (dto.getGlassType() == null || dto.getLayer() == null) { |
| | | return; |
| | | } |
| | | String key = dto.getGlassType() + "_" + dto.getLayer(); |
| | | // 缓存第一个DTO作为模板(包含其他字段值) |
| | | dtoTemplateMap.putIfAbsent(key, dto); |
| | | }); |
| | | |
| | | // 2. 匹配并更新原始DTO |
| | | detailsDTOS.forEach(dto -> { |
| | | if (dto.getGlassType() == null || dto.getLayer() == null) { |
| | | return; |
| | | } |
| | | String key = dto.getGlassType() + "_" + dto.getLayer(); |
| | | List<Damage> damagess = damageMap.get(key); |
| | | if (damagess != null && !damagess.isEmpty()) { |
| | | Damage damage = damagess.remove(0); |
| | | dto.setGlassId(damage.getGlassId()); |
| | | dto.setWorkingProcedure(damage.getWorkingProcedure()); |
| | | } |
| | | }); |
| | | |
| | | // 3. 处理剩余damage:复用同组DTO模板的其他字段 |
| | | damageMap.values().forEach(damagess -> damagess.forEach(damage -> { |
| | | String key = damage.getOrderNumber() + "_" + damage.getTechnologyNumber(); |
| | | LackDetailsDTO template = dtoTemplateMap.get(key); // 获取同组模板 |
| | | if (template == null) return; // 无模板则跳过(理论上不会出现) |
| | | |
| | | LackDetailsDTO newDto = new LackDetailsDTO(); |
| | | // 1. 复制模板中的其他字段(除了glassId和workproduce) |
| | | BeanUtils.copyProperties(template, newDto); // 用Spring的工具类复制属性 |
| | | // 2. 覆盖glassId和workproduce为当前damage的值 |
| | | newDto.setGlassId(damage.getGlassId()); |
| | | newDto.setWorkingProcedure("未知"); |
| | | detailsDTOS.add(newDto); |
| | | })); |
| | | return detailsDTOS.stream().collect(Collectors.groupingBy(item -> item.getLayer())); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getGlassGapByThickness(Double thickness) { |
| | | int sysKey = 0; |
| | | if (thickness >= 12) { |
| | |
| | | package com.mes.job; |
| | | |
| | | import com.github.xingshuangs.iot.common.buff.ByteReadBuff; |
| | | import com.github.xingshuangs.iot.common.buff.EByteBuffFormat; |
| | | import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp; |
| | | import com.github.xingshuangs.iot.utils.ByteUtil; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.hollow.entity.vo.HollowGlassFormulaVO; |
| | | import com.mes.hollow.service.HollowFormulaDetailsService; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author SNG-015 |
| | |
| | | } |
| | | |
| | | HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null; |
| | | |
| | | //直通台有玻璃时将中空出片队列中对应玻璃id的格子号替换未直通台 |
| | | HollowBigStorageCageDetails details = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1")); |
| | | if (details != null) { |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService.getOne( |
| | | new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getFlowCardId, details.getFlowCardId()) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | .orderByAsc(HollowGlassOutRelationInfo::getId) |
| | | .last("limit 1") |
| | | ); |
| | | } |
| | | int cell = -1; |
| | | for (Integer i : resultList) { |
| | | if (null == hollowGlassOutRelationInfo) { |
| | |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | .eq(HollowGlassQueueInfo::getRelationId, hollowGlassOutRelationInfo.getId()) |
| | | .orderByAsc(HollowGlassQueueInfo::getHollowSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) { |
| | | //按照任务信息过滤筛选需要出片及调度的玻璃队列 |
| | | List<HollowGlassQueueInfo> resultQueue = computeOutHollowQueue(unFinishHollowQueueList, hollowGlassOutRelationInfo); |
| | | log.info("中空出片任务计算后的出片队列为:{}", resultQueue); |
| | | if (CollectionUtil.isNotEmpty(resultQueue)) { |
| | | //直通台有玻璃时将中空出片队列中对应玻璃id的格子号替换未直通台 |
| | | HollowBigStorageCageDetails details = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1")); |
| | | log.info("中空大理片直通台玻璃信息{}", details); |
| | | if (details != null) { |
| | | unFinishHollowQueueList.stream().forEach(e -> { |
| | | resultQueue.stream().forEach(e -> { |
| | | if (e.getGlassId().equals(details.getGlassId())) { |
| | | e.setSlot(THROUGH_SLOT); |
| | | e.setDeviceId(0); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | List<HollowGlassQueueInfo> infoList = unFinishHollowQueueList.stream().filter(e -> !(e.getSlot() >= 500 && e.getSlot() < 900 && e.getIsPair() != 1)).collect(Collectors.toList()); |
| | | log.info("有正在出片的中空任务"); |
| | | Integer isPair = infoList.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(infoList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce()); |
| | | log.info("有正在出片的中空任务:{}", hollowGlassOutRelationInfo); |
| | | Integer isPair = resultQueue.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(resultQueue, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce()); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishInBigStorageTask() throws Exception { |
| | |
| | | log.info("出片任务-无动作执行完成"); |
| | | } |
| | | |
| | | private List<HollowGlassQueueInfo> computeOutHollowQueue(List<HollowGlassQueueInfo> queueInfoList, HollowGlassOutRelationInfo hollowGlassOutRelationInfo) { |
| | | if (CollectionUtil.isNotEmpty(queueInfoList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | //任务为强制,只直接返回原有的队列 |
| | | if (hollowGlassOutRelationInfo.getIsForce() == 1) { |
| | | return queueInfoList; |
| | | } |
| | | log.info("领取任务:{}的队列:{}", hollowGlassOutRelationInfo, queueInfoList); |
| | | // 按格子号分组 |
| | | Map<Integer, List<HollowGlassQueueInfo>> gridGroups = queueInfoList.stream() |
| | | .collect(Collectors.groupingBy(HollowGlassQueueInfo::getSlot)); |
| | | List<HollowGlassQueueInfo> resultQueue = new ArrayList<>(); |
| | | |
| | | for (List<HollowGlassQueueInfo> items : gridGroups.values()) { |
| | | // 情况1:格子内只有一个数据且未配对 - 过滤掉 |
| | | if (items.size() == 1 && 0 == items.get(0).getSlot()) { |
| | | continue; |
| | | } |
| | | |
| | | // 情况2:格子内全部为未配对的数据 - 过滤掉 |
| | | boolean allUnpaired = items.stream().noneMatch(e -> e.getIsPair() == 1); |
| | | if (allUnpaired) { |
| | | continue; |
| | | } |
| | | // 否则保留这个格子内的所有数据 |
| | | resultQueue.addAll(items); |
| | | } |
| | | return resultQueue; |
| | | } |
| | | |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, |
| | | int targetSlot, int isPair, int totalLayer, int isForce) throws Exception { |
| | |
| | | detail_temp AS ( |
| | | SELECT t.* |
| | | FROM glass_temp t |
| | | WHERE NOT EXISTS ( |
| | | WHERE NOT EXISTS( |
| | | SELECT 1 |
| | | FROM hollow_big_storage_cage_details t1 |
| | | WHERE t1.glass_id = t.glass_id |
| | | AND t1.state NOT IN (8,9) |
| | | AND t1.state NOT IN (8, 9) |
| | | ) |
| | | ), |
| | | damage_latest AS ( |
| | | SELECT |
| | | dr.glass_id, |
| | | dr.type, |
| | | dr.status |
| | | SELECT dr.glass_id, |
| | | dr.type, |
| | | dr.status |
| | | FROM ( |
| | | SELECT |
| | | t1.glass_id, |
| | | t1.type, |
| | | t1.status, |
| | | ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | SELECT t1.glass_id, |
| | | t1.type, |
| | | t1.status, |
| | | ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |
| | | INNER JOIN damage t1 ON t.flow_card_id = t1.process_id |
| | | ) dr |
| | | WHERE dr.rn = 1 |
| | | ), |
| | | result_temp AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.glass_type, |
| | | t.thickness, |
| | | t.filmsId, |
| | | t.width, |
| | | t.height, |
| | | COUNT(DISTINCT t.glass_id) as lack_count, |
| | | COUNT(DISTINCT CASE WHEN t1.type IN (8,9) AND t1.status = 1 THEN t.glass_id END) as damage_count |
| | | SELECT t.flow_card_id, |
| | | t.layer, |
| | | t.glass_type, |
| | | t.thickness, |
| | | t.filmsId, |
| | | t.width, |
| | | t.height, |
| | | COUNT(DISTINCT t.glass_id) as lack_count, |
| | | COUNT(DISTINCT |
| | | CASE WHEN t1.type IN (8, 9) AND t1.status = 1 THEN t.glass_id END) as damage_count |
| | | FROM detail_temp t |
| | | LEFT JOIN damage_latest t1 ON t.glass_id = t1.glass_id |
| | | GROUP BY |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.glass_type, |
| | | t.thickness, |
| | | t.filmsId, |
| | | t.width, |
| | | t.height |
| | | GROUP BY t.flow_card_id, |
| | | t.layer, |
| | | t.glass_type, |
| | | t.thickness, |
| | | t.filmsId, |
| | | t.width, |
| | | t.height |
| | | ) |
| | | SELECT * |
| | | FROM result_temp |
| | |
| | | , detail_temp as ( |
| | | select t.* |
| | | from glass_temp t |
| | | left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8,9) |
| | | left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8, 9) |
| | | where t1.glass_id is null |
| | | ) |
| | | , damage_ranked AS ( |
| | |
| | | select * |
| | | from damage_latest |
| | | </select> |
| | | <select id="queryLackByFlowCardByERP" resultType="com.mes.hollow.entity.dto.LackDetailsDTO"> |
| | | WITH RECURSIVE nums(n) AS ( |
| | | SELECT 1 |
| | | UNION ALL |
| | | SELECT n + 1 FROM nums WHERE n < (SELECT MAX(quantity) FROM ( |
| | | <foreach collection="flowCardIdList" item="item" separator="UNION ALL"> |
| | | SELECT #{item.lackQuantity} AS quantity |
| | | </foreach> |
| | | ) t) |
| | | ) |
| | | <foreach collection="flowCardIdList" item="item" separator="UNION ALL"> |
| | | SELECT t1.* |
| | | FROM ( |
| | | SELECT |
| | | g.flow_card_id AS flowCardId, |
| | | g.layer AS layer, |
| | | g.glass_type AS glassType, |
| | | g.filmsid AS filmsId, |
| | | g.width AS width, |
| | | g.height AS height, |
| | | g.thickness AS thickness |
| | | FROM glass_info g |
| | | WHERE g.flow_card_id = #{item.processId} |
| | | AND g.layer = #{item.technologyNumber} |
| | | AND g.glass_type = #{item.orderNumber} |
| | | LIMIT 1 |
| | | ) t1 |
| | | CROSS JOIN nums |
| | | WHERE nums.n <= #{item.lackQuantity} |
| | | </foreach> |
| | | </select> |
| | | |
| | | |
| | | <update id="clearDirtyFlowCardData"> |