| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | ConfigService configService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | |
| | | /** |
| | | * 自动出空板 |
| | | */ |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute() { |
| | | Config config = configService.selectConfigByCode("AutoEmpty"); |
| | | if(config.getStatus()==0){ |
| | | if (config.getStatus() == 0) { |
| | | return; |
| | | } |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 110)); |
| | | if (count > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 110).eq("wrk_sts", 7)); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | return; |
| | | } |
| | | WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 1).eq("wrk_sts", 2).eq("full_plt", "N")); |
| | | if (Cools.isEmpty(wrkMast1)) { |
| | | return; |
| | | } |
| | | wrkMast1.setFullPlt("Y"); |
| | | wrkMastService.updateById(wrkMast1); |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMastService.updateById(wrkMast); |
| | | } else { |
| | | List<LocMast> locMastss =locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").orderBy("bay1")); |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 100)); |
| | | if (Cools.isEmpty(basDevp.getLoading())||basDevp.getLoading().equals("N")) { |
| | | List<LocMast> locMastss = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").orderBy("bay1")); |
| | | if (Cools.isEmpty(locMastss)) { |
| | | return; |
| | | } |
| | |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(locMasta.getLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locMasta.getLocNo()+"库位不存在"); |
| | | throw new CoolException(locMasta.getLocNo() + "库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("D")){ |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | if (!locMast.getLocSts().equals("D")) { |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:" + locMast.getLocNo() + " 、当前状态:" + locMast.getLocSts() + "-" + locMast.getLocSts$()); |
| | | } |
| | | boolean res1 = true; |
| | | |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", locMast.getLev1()) |
| | | .orderBy("bay1",res1)); |
| | | .orderBy("bay1", res1)); |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (locMast1.getLocNo().equals(locMast.getLocNo())) { |
| | | break; |
| | | } |
| | | if (locMast1.getLocSts().equals("D") || locMast1.getLocSts().equals("F")) { |
| | | throw new CoolException(locMasta.getLocNo()+"库位堵塞,禁止出库"); |
| | | throw new CoolException(locMasta.getLocNo() + "库位堵塞,禁止出库"); |
| | | }else if(!locMast1.getLocSts().equals("O")){ |
| | | return; |
| | | } |
| | | } |
| | | // 获取源站 |
| | |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(0L); // 工作状态:0.待发送 |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setIoPri(13D); //优先级排序 15.出库>14.入库>13.空板出库>12.空板入库>11.移库 |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(100); // 目标站 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 更新库位状态 D.空板 -> R.出库预约 |
| | | if (locMast.getLocSts().equals("D")){ |
| | | if (locMast.getLocSts().equals("D")) { |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiUser(9998L); |
| | | locMast.setModiTime(now); |
| | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |