|  |  | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.zy.asrs.entity.BasCrnp; | 
 |  |  | import com.zy.asrs.entity.LocDetl; | 
 |  |  | import com.zy.asrs.entity.LocMast; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import com.zy.asrs.service.*; | 
 |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public synchronized ReturnT<String> start() { | 
 |  |  |         try { | 
 |  |  |             for (int crnNo = 1; crnNo < 3; crnNo++){ | 
 |  |  |             for (int crnNo = 1; crnNo < 3; crnNo++) { | 
 |  |  |                 List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() | 
 |  |  |                         .eq("crn_no",crnNo) | 
 |  |  |                         .eq("crn_no", crnNo) | 
 |  |  |                         .last(" and wrk_sts in (2,3,4,11,12)") | 
 |  |  |                 ); | 
 |  |  |                 if (wrkMasts.size() > 0) continue; | 
 |  |  |  | 
 |  |  |                 //暂停移库 | 
 |  |  |                 BasCrnp crnp = basCrnpService.selectById(crnNo); | 
 |  |  |                 if(!Cools.isEmpty(crnp) && !Cools.isEmpty(crnp.getTankQty()) && crnp.getTankQty()==0){ | 
 |  |  |                 if (!Cools.isEmpty(crnp) && !Cools.isEmpty(crnp.getTankQty()) && crnp.getTankQty() == 0) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 List<LocMast> locMasts = locMastService.queryShallowLocFMast(crnNo); | 
 |  |  |                 if (null == locMasts) continue; | 
 |  |  |  | 
 |  |  |                 for (LocMast sourceLoc : locMasts){ | 
 |  |  |                 for (LocMast sourceLoc : locMasts) { | 
 |  |  |                     String deep = Utils.getDeepLoc(slaveProperties, sourceLoc.getLocNo()); | 
 |  |  |                     LocMast destLoc = locMastService.selectById(deep); | 
 |  |  |  | 
 |  |  |                     if(!Cools.isEmpty(sourceLoc) && !Cools.isEmpty(destLoc)) { | 
 |  |  |                     if (!Cools.isEmpty(sourceLoc) && !Cools.isEmpty(destLoc)) { | 
 |  |  |                         //查找源库位是否有转移任务,如果有,不生成库位移转 | 
 |  |  |                         WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() | 
 |  |  |                                 .eq("source_loc_no", sourceLoc.getLocNo())); | 
 |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 将深库位转为对应浅库位 | 
 |  |  |      * | 
 |  |  |      * @param deep | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     private String convertShallow(String deep){ | 
 |  |  |     private String convertShallow(String deep) { | 
 |  |  |         String shallLoc = ""; | 
 |  |  |         Integer mastInt = Integer.parseInt(deep.substring(0, 2)); | 
 |  |  |         if (mastInt % 2 == 0){ | 
 |  |  |         if (mastInt % 2 == 0) { | 
 |  |  |             mastInt -= 1; | 
 |  |  |         }else if (mastInt % 2 == 1){ | 
 |  |  |         } else if (mastInt % 2 == 1) { | 
 |  |  |             mastInt += 1; | 
 |  |  |         } | 
 |  |  |         if (mastInt <10){ | 
 |  |  |             shallLoc = "0" + mastInt+ deep.substring(2,7); | 
 |  |  |         }else { | 
 |  |  |             shallLoc = mastInt+ deep.substring(2,7); | 
 |  |  |         if (mastInt < 10) { | 
 |  |  |             shallLoc = "0" + mastInt + deep.substring(2, 7); | 
 |  |  |         } else { | 
 |  |  |             shallLoc = mastInt + deep.substring(2, 7); | 
 |  |  |         } | 
 |  |  |         return shallLoc; | 
 |  |  |     } |