| | |
| | | package com.mes.hollowqueue.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * (HollowGlassQueueInfo)表服务实现类 |
| | |
| | | |
| | | @Resource |
| | | HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService; |
| | | |
| | | @Resource |
| | | DamageService damageService; |
| | | |
| | | |
| | | @Override |
| | |
| | | .orderByAsc(HollowGlassQueueInfo::getHollowSequence) |
| | | .orderByAsc(HollowGlassQueueInfo::getLayer)); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowGlassQueueInfo> queryHollowGlassQueueInfoByLine(int cell) { |
| | | List<String> relationIds = this.listObjs( |
| | | new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .lt(HollowGlassQueueInfo::getState, 1) |
| | | .eq(HollowGlassQueueInfo::getCell, cell) |
| | | .select(HollowGlassQueueInfo::getRelationId) |
| | | .groupBy(HollowGlassQueueInfo::getRelationId), |
| | | Object::toString |
| | | ); |
| | | List<HollowGlassQueueInfo> resultList = this.list( |
| | | new QueryWrapper<HollowGlassQueueInfo>() |
| | | .in("relation_id", relationIds) |
| | | .eq("cell", cell) |
| | | .eq("is_pair", 1) |
| | | .select("width","height","flow_card_id","relation_id", "hollow_sequence", "cell", "MAX(state) as state", "MAX(layer) as layer") |
| | | .groupBy("relation_id", "hollow_sequence") |
| | | .orderByAsc("relation_id", "hollow_sequence") |
| | | ); |
| | | |
| | | // 修改内存中集合的第一条 state 为 0 或 -1 的对象的 state 为 -2 |
| | | for (HollowGlassQueueInfo item : resultList) { |
| | | if (item.getState() == 0 || item.getState() == -1) { |
| | | item.setState(-2); |
| | | break; // 只改第一条,改完就退出循环 |
| | | } |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public void confirmBorder(HollowGlassQueueInfo hollowGlassQueueInfo) { |
| | | |
| | | if (hollowGlassQueueInfo.getState() == 8) { |
| | | HollowGlassQueueInfo hollowGlassQueueInfoDamage = this.getOne( |
| | | new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getLayer, hollowGlassQueueInfo.getLayer()) |
| | | .eq(HollowGlassQueueInfo::getRelationId, hollowGlassQueueInfo.getRelationId()) |
| | | .eq(HollowGlassQueueInfo::getHollowSequence, hollowGlassQueueInfo.getHollowSequence()) |
| | | ); |
| | | hollowGlassQueueInfoDamage.setState(hollowGlassQueueInfo.getState()); |
| | | this.updateById(hollowGlassQueueInfoDamage); |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(hollowGlassQueueInfoDamage.getGlassId()); |
| | | damage.setLine(hollowGlassQueueInfoDamage.getCell()); |
| | | damage.setWorkingProcedure("中空"); |
| | | damage.setRemark("折铝框"); |
| | | damage.setStatus(1); |
| | | damage.setType(hollowGlassQueueInfoDamage.getState()); |
| | | damageService.insertDamage(damage); |
| | | } else { |
| | | this.update( |
| | | new LambdaUpdateWrapper<HollowGlassQueueInfo>() |
| | | .set(HollowGlassQueueInfo::getState, hollowGlassQueueInfo.getState()) |
| | | .eq(HollowGlassQueueInfo::getRelationId, hollowGlassQueueInfo.getRelationId()) |
| | | .eq(HollowGlassQueueInfo::getHollowSequence, hollowGlassQueueInfo.getHollowSequence()) |
| | | ); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |