| | |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | |
| | | public class SpianService { |
| | | @Autowired |
| | | private SpianMapper spianMapper; |
| | | @Autowired |
| | | private HomeMapper homeMapper; |
| | | public static List<String> result=new ArrayList<String>(); |
| | | // @GetMapping("/all") |
| | | public Short selectAll(north_glass_buffer1 glasslist) { |
| | |
| | | int cages; |
| | | int cells; |
| | | double glasswidth = cageout.getGlassWidth(); |
| | | |
| | | |
| | | // 判断玻璃内外片 |
| | | if (tier == 2) { |
| | | int state = spianMapper.selectGlassState(cage, cell);// 获取格子数量 |
| | |
| | | spianMapper.UpdateCageOver(glassid.toString(), 0);// 更改笼子表出片状态 |
| | | spianMapper.UpdateCageadd(glassid.toString(), 1);// 更改笼子表进片状态 |
| | | String barcode = spianMapper.SelectBarcode(glassid.toString());// 获取该玻璃的铝框id |
| | | spianMapper.UpdateAddQueue(glassid.toString());// 把进片的玻璃更新到出片队列中 |
| | | // if (barcode != null) { |
| | | // int barcodeState = spianMapper.SelectOverState(barcode);// 获取该铝框的状态 |
| | | // if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据 |
| | | // spianMapper.DeleteQueue(barcode); |
| | | // } |
| | | // } |
| | | //spianMapper.UpdateAddQueue(glassid.toString());// 把进片的玻璃更新到出片队列中 |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public Short selectAlls(north_glass_buffer1 glasslist) { |
| | | try { |
| | | |
| | | int cage1 = 0; |
| | | int cells; |
| | | int ids; |
| | | int prcid; |
| | | int tiers; |
| | | int prctier; |
| | | double width; |
| | | double minwidth = 0; |
| | | double widths; |
| | | // north_glass_buffer1 glasslist = spianMapper.selectGlass(glassid); // 获取玻璃参数 |
| | | // 如果没有此id时 |
| | | if (glasslist == null) { |
| | | return (300); |
| | | } |
| | | //判断是否存在笼子里 |
| | | short result = homeMapper.SelectStorageByGlassId(glasslist.getbarcode()); |
| | | if (result > 0) { |
| | | return (500); |
| | | } |
| | | |
| | | |
| | | if(glasslist.getglasslengthmm()>glasslist.getglassheightmm()) { |
| | | widths= glasslist.getglasslengthmm(); |
| | | }else{ |
| | | widths= glasslist.getglassheightmm(); |
| | | } |
| | | // Map result=new HashMap(); |
| | | |
| | | |
| | | String orderids = glasslist.getordernumber(); |
| | | String FrameBarcode = glasslist.getFrameBarcode(); |
| | | String glassid = glasslist.getbarcode(); |
| | | |
| | | |
| | | // String orderid="A001"; |
| | | // 获取铝框相关度最高的笼子排序 |
| | | List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode, widths, 400); |
| | | // 判断铝框指定空格是否需要间隔空间 |
| | | |
| | | if (storageCage.size() == 0) { |
| | | storageCage = spianMapper.selectAll(orderids, FrameBarcode); |
| | | } |
| | | |
| | | if (storageCage == null) { |
| | | return (400); |
| | | } |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | // 保存订单优先顺序笼子号 |
| | | cage1 = storageCage2.getCage(); |
| | | // 判断该笼子号相邻最大的空格数 |
| | | StorageCage cages = spianMapper.selectCage(cage1); |
| | | |
| | | // 如果相邻笼子没有空格,或者有正在执行的出片任务时返回400 |
| | | if (cages == null) { |
| | | return (400); |
| | | } |
| | | StorageCage cages1; |
| | | // 判断是否是第二片需要加间隔物 |
| | | prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 传给prc的格子内玻璃数 |
| | | if (prctier > 0) { |
| | | cages1 = spianMapper.selectCage1(cage1, storageCage2.getCell(), widths + 400); |
| | | } else { |
| | | cages1 = spianMapper.selectCage1(cage1, storageCage2.getCell(), widths); |
| | | } |
| | | // 判断选中笼子是否有合适宽度空格 |
| | | // 有合适空格时进片 |
| | | if (cages1 != null && cages.getCell() >= 1 && storageCage2.getDisabled() == 0) { |
| | | |
| | | return (0); |
| | | |
| | | } |
| | | |
| | | } |
| | | return (400); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return (500); |
| | | // TODO: handle exception |
| | | } |
| | | |
| | | } |
| | | |
| | | } |