| | |
| | | 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.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | |
| | | |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | |
| | | @Resource |
| | | private PlcStorageCageTask plcStorageCageTask; |
| | | |
| | | @Resource |
| | | private DamageService damageService; |
| | |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW, Const.GLASS_STATE_IN_ALL) |
| | | .eq(BigStorageCageDetails::getEngineerId,glassInfo.getEngineerId()) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight())) |
| | |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | // .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = "+glassInfo.getEngineerId()+" and tempering_layout_id = " + glassInfo.getTemperingLayoutId()) |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + glassInfo.getEngineerId() + "' and tempering_layout_id = " + glassInfo.getTemperingLayoutId()) |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("根据版图id找到笼子内的目标格子:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | .notInSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where state in (100,102,103)") |
| | | .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .orderByAsc(BigStorageCage::getDeviceId) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select t.device_id from big_storage_cage t left join big_storage_cage_details t1 on t.slot = t1.slot " + |
| | | " where state in (0,100,102,103,104) and t.max_thickness >= " + glassInfo.getThickness() + " and t.enable_state = 1 " + |
| | | " group by t.device_id " + |
| | | " order by count(DISTINCT t1.tempering_layout_id), count(distinct t1.slot)") |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("版图id首次进笼且不是所有笼子都有版图id,版图版图id:{},格子:{},玻璃id:{}", glassInfo.getTemperingLayoutId() , bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | log.info("按照存笼玻璃格子数占用最少方式获取信息格子为:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .orderByAsc(BigStorageCage::getDeviceId) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select t.device_id from big_storage_cage t left join big_storage_cage_details t1 on t.slot = t1.slot " + |
| | | " where state in (0,100,102,103,104) and t.max_thickness >= " + glassInfo.getThickness() + " and t.enable_state = 1 " + |
| | | " group by t.device_id " + |
| | | " order by count(DISTINCT t1.tempering_layout_id), count(distinct t.slot) - count(distinct t1.slot) desc") |
| | | .last("limit 1")); |
| | | Assert.isTrue(null != bigStorageCage, "没有空余的笼子存放玻璃"); |
| | | log.info("版图id首次进笼且是所有笼子都有版图id,版图版图id:{},格子:{},玻璃id:{}", glassInfo.getTemperingLayoutId() , bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | log.info("按照存笼玻璃格子数剩余最多得方式获取信息版图id:{},格子:{},玻璃id:{}", glassInfo.getTemperingLayoutId(), bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | |
| | | QueryWrapper<BigStorageCageDetails> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("engineer_id,tempering_layout_id,count(*) as count") |
| | | .in("state", Const.GLASS_STATE_IN, Const.GLASS_STATE_ARTIFICIAL) |
| | | .groupBy("engineer_id,tempering_layout_id"); |
| | | .groupBy("engineer_id,tempering_layout_id") |
| | | .orderByAsc("engineer_id") |
| | | .orderByAsc("tempering_layout_id"); |
| | | List<Map<String, Object>> TemperingGlass = baseMapper.selectMaps(wrapper); |
| | | return TemperingGlass; |
| | | } |