|  |  | 
 |  |  |                 if (!agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no", locMast.getLocNo()))) { | 
 |  |  |                     throw new CoolException("服务器错误,请联系管理员"); | 
 |  |  |                 } | 
 |  |  |                 if (locMast.getLocSts().equals("O")) { | 
 |  |  |                     locMast.setBarcode(""); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         locMast.setModiUser(getUserId()); | 
 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //入库取消 | 
 |  |  |         if(wrkMast.getIoType() == 1 || wrkMast.getIoType() == 10){ | 
 |  |  |         if(wrkMast.getIoType() == 1 || wrkMast.getIoType() == 10 || wrkMast.getIoType() == 58){ | 
 |  |  |             //源站点 | 
 |  |  |             String devNo = wrkMast.getSourceLocNo(); | 
 |  |  |             //目标库位 | 
 
 |  |  | 
 |  |  |             agvWrkMast.setWrkNo(-agvWrkMast.getWrkNo()); | 
 |  |  |         } | 
 |  |  |         agvTaskCreateParam.setTaskCode(agvWrkMast.getWrkNo().toString()); | 
 |  |  |         if (agvWrkMast.getIoType() == 108 || agvWrkMast.getIoType() == 109 || agvWrkMast.getIoType() == 12) { | 
 |  |  |         if (agvWrkMast.getIoType() == 108 || (agvWrkMast.getIoType() == 109 && agvWrkMast.getWrkSts() == 201) || agvWrkMast.getIoType() == 12) { | 
 |  |  |             agvTaskCreateParam.setTaskTyp("F06"); | 
 |  |  |         } else  { | 
 |  |  |             agvTaskCreateParam.setTaskTyp("F01"); | 
 
 |  |  | 
 |  |  |                         .or().eq("io_type", 11) | 
 |  |  |                         .or().eq("io_type", 110) | 
 |  |  |                         .or().eq("io_type", 107) | 
 |  |  |                         .or().eq("io_type", 109) | 
 |  |  |                         .or().eq("io_type", 108)).getRecords(); | 
 |  |  |  | 
 |  |  |         if(!Cools.isEmpty(agvWrkMastList)){ | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 空板自动回库 | 
 |  |  |     // 空板自动回库  库位-接驳点 | 
 |  |  |     @Scheduled(cron = "0/2 * * * * ? ") | 
 |  |  |     private void autoEmptyBack(){ | 
 |  |  |         // 查询 不为1楼的空货架 | 
 |  |  | 
 |  |  |         for (AgvLocMast agvLocMast : agvLocMasts) { | 
 |  |  |             ReturnT<String> returnT = autoMoveHandler.autoEmptyBack(agvLocMast); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |     // 空板自动回库  接驳点 - 1楼库位 | 
 |  |  |     @Scheduled(cron = "0/2 * * * * ? ") | 
 |  |  |     private void autoEmptyBack3(){ | 
 |  |  |         // 工作档为201 且 入出库类型为109 | 
 |  |  |         List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>() | 
 |  |  |                 .eq("wrk_sts", 201) | 
 |  |  |                 .eq("loc_no","") | 
 |  |  |                 .or().eq("io_type",109) | 
 |  |  |                 .or().eq("io_type",112)); | 
 |  |  |         if (agvWrkMastList.isEmpty()) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         for (AgvWrkMast agvWrkMast : agvWrkMastList) { | 
 |  |  |             ReturnT<String> returnT = autoMoveHandler.autoEmptyBack3(agvWrkMast); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 空板自动回库 | 
 |  |  |     //@Scheduled(cron = "0/2 * * * * ? ") | 
 |  |  |     private void autoEmptyBack2(){ | 
 |  |  |         // 查询 不为1楼的空货架 | 
 |  |  |         List<AgvLocMast> agvLocMasts = agvLocMastService.selectList( | 
 |  |  |                 new EntityWrapper<AgvLocMast>() | 
 |  |  |                         .ne("floor", 1) | 
 |  |  |                         .eq("loc_sts","D") | 
 |  |  |                         .eq("loc_type1",3)); | 
 |  |  |         if (agvLocMasts.isEmpty()) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         for (AgvLocMast agvLocMast : agvLocMasts) { | 
 |  |  |             ReturnT<String> returnT = autoMoveHandler.autoEmptyBack2(agvLocMast); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  | 
 |  |  |         // 空板入库 设置库位状态为D.空桶/空栈板 | 
 |  |  |         String locSts = agvWrkMast.getIoType() == 10 ? "D" : "F"; | 
 |  |  |         if (agvWrkMast.getIoType() == 10 || agvWrkMast.getIoType() == 109) { | 
 |  |  |             agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); | 
 |  |  |             if (agvWrkMast.getIoType() == 109 && agvWrkMast.getLocNo().substring(0,2).equals("DB")) { | 
 |  |  |                 agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getLocNo(),"R",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); | 
 |  |  |             } else { | 
 |  |  |                 agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"F",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); | 
 |  |  |         } | 
 |  |  | 
 |  |  |             agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",agvWrkMast.getWhsType().shortValue(),"",(short)0); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if(agvWrkMast.getIoType() == 109 || agvWrkMast.getIoType() == 58){ | 
 |  |  |         if(agvWrkMast.getIoType() == 109){ | 
 |  |  |             //修改源库位状态为O | 
 |  |  |             agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",agvWrkMast.getWhsType().shortValue(),"",(short)0); | 
 |  |  |             // 新建工作档 | 
 |  |  |             Date now = new Date(); | 
 |  |  |             createWrkMast(109, 201L, agvWrkMast.getLocNo(), "", agvWrkMast.getBarcode(), now, 9527L, agvWrkMast.getWhsType(), 0); | 
 |  |  |         } | 
 |  |  |         if (agvWrkMast.getIoType() == 58) { | 
 |  |  |             agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getSourceLocNo(),"O","",agvWrkMast.getWhsType().shortValue()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //删除AGV工作档 | 
 |  |  | 
 |  |  |             return num <= maxWrokNum; | 
 |  |  |         }).collect(Collectors.toList()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /* | 
 |  |  |   生成工作档 | 
 |  |  |    */ | 
 |  |  |     private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode, Date now, Long userId, int containerType, int floor){ | 
 |  |  |         AgvWrkMast wrkMast = new AgvWrkMast(); | 
 |  |  |         //工作状态 | 
 |  |  |         wrkMast.setWrkSts(wrkSts); | 
 |  |  |         //入出库类型 | 
 |  |  |         wrkMast.setIoType(ioType); | 
 |  |  |         wrkMast.setIoTime(now); | 
 |  |  |         //优先级 | 
 |  |  |         wrkMast.setIoPri(300.0); | 
 |  |  |         //源站点 | 
 |  |  |         wrkMast.setSourceLocNo(sourceLocNo); | 
 |  |  |         //目标站点 | 
 |  |  |         wrkMast.setLocNo(locNo); | 
 |  |  |         //容器编码 | 
 |  |  |         wrkMast.setBarcode(barcode); | 
 |  |  |         //容器类型 | 
 |  |  |         wrkMast.setWhsType(containerType); | 
 |  |  |         // 目标楼层 | 
 |  |  |         wrkMast.setCrnNo(floor); | 
 |  |  |  | 
 |  |  |         wrkMast.setAppeUser(userId); | 
 |  |  |         wrkMast.setAppeTime(now); | 
 |  |  |         wrkMast.setModiUser(userId); | 
 |  |  |         wrkMast.setModiTime(now); | 
 |  |  |  | 
 |  |  |         if (!agvWrkMastService.insertByIncrease(wrkMast)) { | 
 |  |  |             throw new CoolException("保存工作档失败"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         wrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", locNo).eq("source_loc_no",sourceLocNo).eq("barcode",barcode).orderBy("modi_time",false)); | 
 |  |  |  | 
 |  |  |         return wrkMast; | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |         if(!Cools.isEmpty(agvWrkMast)){ | 
 |  |  |             throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); | 
 |  |  |         } | 
 |  |  |         //检索空闲接驳位,选择合适的接驳位 | 
 |  |  |         AgvBasDevp devpNo = agvCommonService.getDevpNo(3, agvLocMast.getFloor()); | 
 |  |  |         //生成工作档 | 
 |  |  |         AgvWrkMast mast = new AgvWrkMast(); | 
 |  |  |         //工作状态 | 
 |  |  |         mast.setWrkSts(21L); | 
 |  |  |         //入出库类型 | 
 |  |  |         mast.setIoType(109); | 
 |  |  |         mast.setIoTime(now); | 
 |  |  |         //优先级 | 
 |  |  |         mast.setIoPri(300.0); | 
 |  |  |         //源站点 | 
 |  |  |         mast.setSourceLocNo(agvLocMast.getLocNo()); | 
 |  |  |         //目标站点 | 
 |  |  |         mast.setLocNo(devpNo.getDevNo()); | 
 |  |  |         //容器编码 | 
 |  |  |         mast.setBarcode(agvLocMast.getBarcode()); | 
 |  |  |         //容器类型 | 
 |  |  |         mast.setWhsType(30); | 
 |  |  |  | 
 |  |  |         mast.setAppeUser(9527L); | 
 |  |  |         mast.setAppeTime(now); | 
 |  |  |         mast.setModiUser(9527L); | 
 |  |  |         mast.setModiTime(now); | 
 |  |  |         if (!agvWrkMastService.insertByIncrease(mast)) { | 
 |  |  |             throw new CoolException("保存工作档失败"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //更新目标库位状态 | 
 |  |  |         updateAgvLocMast(agvLocMast,"R"); | 
 |  |  |         updateAgvBasDevp(devpNo,"S",agvLocMast.getLocType2(),agvLocMast.getBarcode()); | 
 |  |  |         return SUCCESS; | 
 |  |  |     } | 
 |  |  |     public ReturnT<String> autoEmptyBack3(AgvWrkMast agvWrkMast) { | 
 |  |  |         Date now = new Date(); | 
 |  |  |         //检索空闲接驳位,选择合适的接驳位 | 
 |  |  |         AgvLocMast locMast = agvCommonService.getLocNo(3, 1); | 
 |  |  |         //目标站点 | 
 |  |  |         agvWrkMast.setLocNo(locMast.getLocNo()); | 
 |  |  |         agvWrkMast.setModiUser(9527L); | 
 |  |  |         agvWrkMast.setModiTime(now); | 
 |  |  |         if (!agvWrkMastService.updateById(agvWrkMast)) { | 
 |  |  |             throw new CoolException("保存工作档失败"); | 
 |  |  |         } | 
 |  |  |         //更新目标库位状态 | 
 |  |  |         updateAgvLocMast(locMast,"S"); | 
 |  |  |         return SUCCESS; | 
 |  |  |     } | 
 |  |  |     public ReturnT<String> autoEmptyBack2(AgvLocMast agvLocMast) { | 
 |  |  |         Date now = new Date(); | 
 |  |  |         //查询工作档 | 
 |  |  |         AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); | 
 |  |  |         if(!Cools.isEmpty(agvWrkMast)){ | 
 |  |  |             throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); | 
 |  |  |         } | 
 |  |  |         //检索库位,选择合适的库位 | 
 |  |  |         AgvLocMast LocMast = agvCommonService.getLocNo(3,1); | 
 |  |  |         //生成工作档 | 
 
 |  |  | 
 |  |  |     enabled: false | 
 |  |  |   datasource: | 
 |  |  |     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 
 |  |  |     url: jdbc:sqlserver://localhost:1433;databasename=phyzasrs | 
 |  |  | #    url: jdbc:sqlserver://192.168.4.15:1433;databasename=tzskasrs | 
 |  |  | #    url: jdbc:sqlserver://127.0.0.1:1433;databasename=phyzasrs | 
 |  |  |     url: jdbc:sqlserver://192.168.4.176:1433;databasename=phyzasrs | 
 |  |  |     #url: jdbc:sqlserver://10.10.10.40:1433;databasename=tzskasrs | 
 |  |  |     username: sa | 
 |  |  |     password: sa@123 |