| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.Collection; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import java.util.Collections; |
| | | |
| | | @Service |
| | | public class North_Glass_Buffer1Service { |
| | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | |
| | | //获取玻璃是否在笼子,是否在出片队列 |
| | | class north_glass_buffer1Comparator implements Comparator<north_glass_buffer1> { |
| | | @Override |
| | | public int compare(north_glass_buffer1 n1, north_glass_buffer1 n2) {//对查询到的铝框对应的玻璃数据进行排序,将离出片位置近的,靠近笼子出片侧的玻璃排在前面 |
| | | if (n1.getstorageCage() != null) { |
| | | if (n2.getstorageCage() != null) { |
| | | int cageComparison = n2.getstorageCage().getCage().compareTo(n1.getstorageCage().getCage()); |
| | | if (cageComparison != 0) { |
| | | return cageComparison; |
| | | } else { |
| | | int cellComparison = n2.getstorageCage().getCell().compareTo(n1.getstorageCage().getCell()); |
| | | if (cellComparison != 0) { |
| | | return cellComparison; |
| | | } else { |
| | | return n2.getstorageCage().getTier().compareTo(n1.getstorageCage().getTier()); |
| | | } |
| | | } |
| | | } else { |
| | | return -1; |
| | | } |
| | | |
| | | } else { |
| | | return 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | // 获取玻璃是否在笼子,是否在出片队列 |
| | | public List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode) throws SQLException { |
| | | List<north_glass_buffer1> listAluminumFrame = jdbcConnections |
| | | .SelectGlassByGlassIdOrderIdFrameIdss(FrameBarcode); |
| | |
| | | north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode())); |
| | | north_glass_buffer1.setOut_slice(homeMapper.SelectQueueByglassid(north_glass_buffer1.getbarcode())); |
| | | } |
| | | // 对嵌套类的其中一列进行排序 |
| | | Collections.sort(listAluminumFrame, new north_glass_buffer1Comparator()); |
| | | return listAluminumFrame; |
| | | } |
| | | |
| | | //根据铝框id添加玻璃到出片队列 |
| | | public void AddOutSliceS(String FrameBarcode) throws SQLException{ |
| | | List<north_glass_buffer1> north_glass_buffer1s=SelectAluminumFrameInfoById(FrameBarcode); |
| | | // 根据铝框id添加玻璃到出片队列 |
| | | public void AddOutSliceS(String FrameBarcode) throws SQLException { |
| | | List<north_glass_buffer1> north_glass_buffer1s = SelectAluminumFrameInfoById(FrameBarcode); |
| | | String flip = jdbcConnections.SelectFlipByFrameBarcode(FrameBarcode); |
| | | String position =jdbcConnections.SelectPositionByFrameBarcode(FrameBarcode); |
| | | int sequence=homeMapper.SelectMaxSquence(); |
| | | |
| | | String position = jdbcConnections.SelectPositionByFrameBarcode(FrameBarcode); |
| | | int sequence = homeMapper.SelectMaxSquence(); |
| | | for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) { |
| | | Short state=0; |
| | | if(north_glass_buffer1.getOut_slice()==null){ |
| | | if(north_glass_buffer1.getstorageCage()==null){ |
| | | state=3; |
| | | Short state = 0; |
| | | if (north_glass_buffer1.getOut_slice() == null) { |
| | | if (north_glass_buffer1.getstorageCage() == null) { |
| | | state = 3; |
| | | } |
| | | homeMapper.AddOutSliceS(north_glass_buffer1.getbarcode(), flip, FrameBarcode, north_glass_buffer1.getglasslengthmm().toString(), north_glass_buffer1.getglassheightmm().toString(), sequence, position, state); |
| | | sequence+=1; |
| | | homeMapper.AddOutSliceS(north_glass_buffer1.getbarcode(), flip, FrameBarcode, |
| | | north_glass_buffer1.getglasslengthmm().toString(), |
| | | north_glass_buffer1.getglassheightmm().toString(), sequence, position, state, |
| | | north_glass_buffer1.getordernumber(), north_glass_buffer1.getlistnumber(), |
| | | north_glass_buffer1.getboxnumber(), north_glass_buffer1.getglasslength().toString(), |
| | | north_glass_buffer1.getglassheight().toString()); |
| | | sequence += 1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |