|  |  | 
 |  |  |         if (mat.getColor().equals("报废")){ | 
 |  |  |             throw new CoolException("该物料已报废,请勿绑定"); | 
 |  |  |         } | 
 |  |  |         HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit()); | 
 |  |  |         if (halfBarcode == null){ | 
 |  |  |             HalfBarcode hb = new HalfBarcode(); | 
 |  |  |             hb.setZpallet(mat.getUnit()); | 
 |  |  |             hb.setSpecs(mat.getUnit().substring(0,1)); | 
 |  |  |             hb.setAnfme(1); | 
 |  |  |             if (Integer.parseInt(mat.getUnit().substring(0,1))==6){ | 
 |  |  |                 hb.setPrice(24-1); | 
 |  |  |             }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){ | 
 |  |  |                 hb.setPrice(24-1); | 
 |  |  |             }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){ | 
 |  |  |                 hb.setPrice(24-1); | 
 |  |  |             } | 
 |  |  |             if (!halfBarcodeService.insert(hb)){ | 
 |  |  |                 throw new CoolException("更新半托信息失败"); | 
 |  |  |             } | 
 |  |  |         }else { | 
 |  |  |             if (Integer.parseInt(mat.getUnit().substring(0,1))==6){ | 
 |  |  |                 halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); | 
 |  |  |                 halfBarcode.setPrice(halfBarcode.getPrice()-1); | 
 |  |  |             }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){ | 
 |  |  |                 halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); | 
 |  |  |                 halfBarcode.setPrice(halfBarcode.getPrice()-1); | 
 |  |  |             }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){ | 
 |  |  |                 halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); | 
 |  |  |                 halfBarcode.setPrice(halfBarcode.getPrice()-1); | 
 |  |  |             } | 
 |  |  |             if (!halfBarcodeService.half(halfBarcode)){ | 
 |  |  |                 throw new CoolException("更新半托信息失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         MatBarcode mb=new MatBarcode(); | 
 |  |  |         mb.setZpallet(mat.getUnit()); | 
 |  |  |         mb.setMatnr(mat.getMatnr()); |