| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.BigStorageDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.common.config.ConstSysConfig; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.tools.S7control; |
| | | import com.mes.tools.service.BigStorageBaseService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | @Resource |
| | | SysConfigService sysConfigService; |
| | | |
| | | @Value("${mes.carWidth}") |
| | | private Integer carWidth; |
| | | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | // @Value("${mes.slotWidth}") |
| | | // private Integer slotWidth; |
| | | // |
| | | // @Value("${mes.carWidth}") |
| | | // private Integer carWidth; |
| | | // |
| | | // @Value("${mes.outCarMaxSize}") |
| | | // private Integer outCarMaxSize; |
| | | // |
| | | // @Value("${mes.glassGap}") |
| | | // private Integer glassGap; |
| | | |
| | | |
| | | @Override |
| | | public void updateSlotRemainBySlots(List<Integer> slotList) { |
| | | //获取格子内所有的玻璃信息 |
| | | Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH); |
| | | int glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP); |
| | | List<BigStorageCageDetails> inSlotGlassList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .in(BigStorageCageDetails::getSlot, slotList).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | Map<Integer, Double> slotRemainMap = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void querySizeByEngineerTask() { |
| | | log.info("查询结果:{}", querySizeByEngineer("P24072402", 1, 10, 8)); |
| | | log.info("查询结果:{}", querySizeByEngineer("P24072402", 1, 5, 8)); |
| | |
| | | List<GlassInfo> infoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>() |
| | | .notInSql(GlassInfo::getGlassId, "select glass_id from damage where tempering_layout_id = " + temperingLayoutId + " and engineer_id = '" + engineerId + "'") |
| | | .eq(GlassInfo::getTemperingLayoutId, temperingLayoutId).eq(GlassInfo::getEngineerId, engineerId).orderByAsc(GlassInfo::getTemperingFeedSequence)); |
| | | int remainWidth = carWidth; |
| | | int remainWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_CAR_WIDTH); |
| | | int trainNumber = 1; |
| | | int serialNumber = 0; |
| | | int min = 0; |
| | | int temp = infoList.get(0).getTemperingFeedSequence(); |
| | | int slot = 0; |
| | | int resultTrainNumber = 0; |
| | | int outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE); |
| | | int carWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_CAR_WIDTH); |
| | | int glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP); |
| | | for (GlassInfo e : infoList) { |
| | | int maxLength = Math.max((int) e.getWidth(), (int) e.getHeight()); |
| | | if (serialNumber >= outCarMaxSize || maxLength > remainWidth || e.getTemperingFeedSequence() >= minLength) { |
| | |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | |
| | | int slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH); |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + engineerId + "' and tempering_layout_id = " + temperingLayoutId) |
| | | .last("limit 1")); |
| | |
| | | List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(thickness); |
| | | for (Integer item : deviceUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |