| | |
| | | import com.kangaroohy.milo.runner.subscription.SubscriptionCallback; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private int glassGap; |
| | | @Value("${mes.threshold}") |
| | | private int threshold; |
| | | @Value("${mes.cellLength}") |
| | | private int cellLength; |
| | | // @Value("${mes.glassGap}") |
| | | // private int glassGap; |
| | | // @Value("${mes.threshold}") |
| | | // private int threshold; |
| | | // @Value("${mes.cellLength}") |
| | | // private int cellLength; |
| | | |
| | | private Date startDate; |
| | | |
| | |
| | | } |
| | | |
| | | private boolean updateCellRemainWidth(int slot, int device) { |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot, slot) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | int remainWidth = cellLength; |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | int widthTotal = (int) list.stream().map(e -> Math.max(e.getWidth(), e.getHeight()) + glassGap).mapToDouble(Double::intValue).sum(); |
| | | remainWidth = cellLength - widthTotal >= 0 ? cellLength - widthTotal : 0; |
| | | } |
| | | edgStorageCageService.update(new LambdaUpdateWrapper<EdgStorageCage>(). |
| | | set(EdgStorageCage::getRemainWidth, remainWidth).eq(EdgStorageCage::getSlot, slot).eq(EdgStorageCage::getDeviceId, device)); |
| | | // List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot, slot) |
| | | // .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | // int remainWidth = cellLength; |
| | | // if (CollectionUtil.isNotEmpty(list)) { |
| | | // int widthTotal = (int) list.stream().map(e -> Math.max(e.getWidth(), e.getHeight()) + glassGap).mapToDouble(Double::intValue).sum(); |
| | | // remainWidth = cellLength - widthTotal >= 0 ? cellLength - widthTotal : 0; |
| | | // } |
| | | // edgStorageCageService.update(new LambdaUpdateWrapper<EdgStorageCage>(). |
| | | // set(EdgStorageCage::getRemainWidth, remainWidth).eq(EdgStorageCage::getSlot, slot).eq(EdgStorageCage::getDeviceId, device)); |
| | | return Boolean.TRUE; |
| | | } |
| | | } |