| | |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageOutTaskMapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.common.config.ConstSysConfig; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.job.PlcStorageCageTask; |
| | | import com.mes.sysconfig.entity.SysConfig; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | |
| | | @Resource |
| | | private PlcStorageCageTask plcStorageCageTask; |
| | | private SysConfigService sysConfigService; |
| | | |
| | | |
| | | @Resource |
| | | private DamageService damageService; |
| | |
| | | |
| | | @Resource |
| | | BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService; |
| | | |
| | | @Value("${mes.minCount}") |
| | | private int minCount; |
| | | |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.sequence.order}") |
| | | private boolean sequenceOrder; |
| | | // |
| | | // @Value("${mes.minCount}") |
| | | // private int minCount; |
| | | // |
| | | // @Value("${mes.slotWidth}") |
| | | // private Integer slotWidth; |
| | | // |
| | | // @Value("${mes.glassGap}") |
| | | // private Integer glassGap; |
| | | // |
| | | // @Value("${mes.sequence.order}") |
| | | // private boolean sequenceOrder; |
| | | |
| | | |
| | | @Override |
| | |
| | | for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList |
| | | ) { |
| | | if (bigStorageCageDetails.getBigStorageCageFeedTask().getTaskState() == 0) { |
| | | carWidth = carWidth - bigStorageCageDetails.getWidth() - glassGap; |
| | | carWidth = carWidth - bigStorageCageDetails.getWidth() - 250; |
| | | } |
| | | } |
| | | return carWidth; |
| | |
| | | if (glassInfo != null) { |
| | | BeanUtils.copyProperties(glassInfo, bigStorageCageDetails); |
| | | bigStorageCageDetails.setState(1); |
| | | bigStorageCageDetails.setGap(glassGap); |
| | | bigStorageCageDetails.setGap(250); |
| | | bigStorageCageDetailsList = new ArrayList<>(); |
| | | bigStorageCageDetailsList.add(bigStorageCageDetails); |
| | | } |
| | |
| | | @Override |
| | | public BigStorageDTO queryTargetSlotByTempering(GlassInfo glassInfo) { |
| | | BigStorageDTO bigStorageDTO = null; |
| | | int slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH); |
| | | MPJLambdaWrapper<BigStorageCage> wrapper = new MPJLambdaWrapper<>(BigStorageCage.class) |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot) |
| | |
| | | |
| | | @Override |
| | | public List<TemperingLayoutDTO> queryTemperingOccupySlot() { |
| | | return baseMapper.queryTemperingOccupySlot(minCount); |
| | | return baseMapper.queryTemperingOccupySlot(10); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public boolean temperingGlass(String temperingLayoutId, String engineerId, String temperingFeedSequence) { |
| | | LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | SysConfig sysConfig = sysConfigService.queryConfigById(ConstSysConfig.CACHE_SEQUENCE_ORDER_TRUE); |
| | | boolean sequenceOrder = Boolean.parseBoolean(sysConfig.getConfigValue()); |
| | | temperingGlassInfoLambdaQueryWrapper |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW); |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); |
| | | |
| | | int dispatchCount = bigStorageCageHistoryTaskService.count(new LambdaQueryWrapper<BigStorageCageHistoryTask>() |
| | | .eq(BigStorageCageHistoryTask::getTaskState, Const.GLASS_STATE_NEW) |
| | | .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_DISPATCH)); |
| | | |
| | | if (temperingGlassInfoList.size() == 0) { |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) |
| | | MPJLambdaWrapper<GlassInfo> wrapper = JoinWrappers.lambda(GlassInfo.class) |
| | | .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + |
| | | ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + |
| | | "t.angle,t1.slot,t.engineer_id") |
| | | .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) |
| | | .eq(GlassInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(GlassInfo::getEngineerId, engineerId) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); |
| | | |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence); |
| | | if (dispatchCount > 0) { |
| | | wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL); |
| | | } else { |
| | | wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN); |
| | | } |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, wrapper); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { |
| | | if ("0".equals(temperingFeedSequence)) { |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { |
| | | plcStorageCageTask.computeOutMoreGlassInfo(temperingGlassInfos, Boolean.FALSE, ""); |
| | | // plcStorageCageTask.computeOutMoreGlassInfo(temperingGlassInfos, Boolean.FALSE, ""); |
| | | } |
| | | } else { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW); |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); |
| | | |
| | | int dispatchCount = bigStorageCageHistoryTaskService.count(new LambdaQueryWrapper<BigStorageCageHistoryTask>() |
| | | .eq(BigStorageCageHistoryTask::getTaskState, Const.GLASS_STATE_NEW) |
| | | .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_DISPATCH)); |
| | | |
| | | if (temperingGlassInfoList.size() == 0) { |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) |
| | | MPJLambdaWrapper<GlassInfo> wrapper = JoinWrappers.lambda(GlassInfo.class) |
| | | .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + |
| | | ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + |
| | | "t.angle,t1.slot,t.engineer_id") |
| | | .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) |
| | | .eq(GlassInfo::getEngineerId, engineerId) |
| | | .ne(GlassInfo::getTemperingLayoutId, 0) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .orderByAsc(BigStorageCageDetails::getTemperingLayoutId) |
| | | .orderByAsc(BigStorageCageDetails::getTemperingFeedSequence) |
| | | ); |
| | | .orderByAsc(BigStorageCageDetails::getTemperingFeedSequence); |
| | | if (dispatchCount > 0) { |
| | | wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL); |
| | | } else { |
| | | wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN); |
| | | } |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, wrapper); |
| | | |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { |
| | | //避免大量数据插入导致sqlserver数据库异常,分批次每调存储依次 |
| | | List<List<TemperingGlassInfo>> temperingGlassInfoLists = Lists.partition(temperingGlassInfos, 50); |