| | |
| | | return agvBasDevpService.selectById(devNo); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | workService.createWaitPainWrkMastStart(agvBasDevpList, getUserId()); |
| | | workService.createWaitPainWrkMastStart(agvBasDevpList, getUserId(),false); |
| | | |
| | | return R.ok("生成工作档成功"); |
| | | } |
| | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.EnumSet; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 上报事件类型(eventType): |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/conveyor/loadContainerFinish ") |
| | | @AppAuth(memo = "取容器完成通知") |
| | | public R loadContainerFinish(@RequestBody Map<String,Object> params){ |
| | | |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | | enum AgvTask{ |
| | |
| | | |
| | | List<AgvBasDevp> agvBasDevpList = JSONArray.parseArray(param, AgvBasDevp.class); |
| | | |
| | | workService.createWaitPainWrkMastStart(agvBasDevpList, getUserId()); |
| | | workService.createWaitPainWrkMastStart(agvBasDevpList, getUserId(),false); |
| | | //return R.ok("任务号:" + startupDto.getWorkNo() + ";目标库位:" + startupDto.getLocNo()); |
| | | return R.ok("生成入库工作档成功"); |
| | | } |
| | |
| | | } |
| | | int startWrkCode = agvWrkMastService.startWrk(agvWrkMastList,"putaway"); |
| | | |
| | | int code = agvWrkMastService.containerMove(agvWrkMastList); |
| | | int code = agvWrkMastService.containerMoveIn(agvWrkMastList); |
| | | |
| | | if(code == 0){ |
| | | agvWrkMastList.forEach(agvWrkMast -> { |
| | |
| | | /* |
| | | 平库移库 |
| | | */ |
| | | @RequestMapping("/node/move/start") |
| | | public R nodeMoveStart(@RequestParam String sourceLocNo, @RequestParam String targetLocNo){ |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /* |
| | | |
| | | 平库库区拣料信息 |
| | | */ |
| | | @RequestMapping("/node/order/pakout") |
| | | public R nodeOrderPakout(@RequestParam String locType){ |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | "source_loc_no," + |
| | | "loc_no," + |
| | | "barcode," + |
| | | "mk," + |
| | | "appe_user," + |
| | | "appe_time," + |
| | | "modi_user," + |
| | | "modi_time) " + |
| | | "VALUES(#{wrkSts},#{ioType},#{ioTime},#{ioPri},#{sourceLocNo},#{locNo},#{barcode},#{appeUser},#{appeTime},#{modiUser},#{modiTime})") |
| | | "VALUES(#{wrkSts},#{ioType},#{ioTime},#{ioPri},#{sourceLocNo},#{locNo},#{barcode},#{mk},#{appeUser},#{appeTime},#{modiUser},#{modiTime})") |
| | | public int insertByIncrease(AgvWrkMast agvWrkMast); |
| | | |
| | | } |
| | |
| | | /* |
| | | 通知档手动生成任务 |
| | | */ |
| | | StartupDto createWaitPainWrkMastStart(List<AgvBasDevp> agvBasDevpList, Long userId); |
| | | StartupDto createWaitPainWrkMastStart(List<AgvBasDevp> agvBasDevpList, Long userId, boolean isConveyor); |
| | | |
| | | /* |
| | | 生成出库任务 |
| | |
| | | |
| | | public int startWrk(List<AgvWrkMast> agvWrkMastList, String taskType) throws IOException; |
| | | |
| | | public int containerMove(List<AgvWrkMast> agvWrkMastList) throws IOException; |
| | | public int containerMoveIn(List<AgvWrkMast> agvWrkMastList) throws IOException; |
| | | |
| | | public int containerMoveOut(List<AgvWrkMast> agvWrkMastList) throws IOException; |
| | | |
| | | public boolean insertByIncrease(AgvWrkMast agvWrkMast); |
| | | |
| | | public boolean deleteByWrkNo(int wrkNo); |
| | | |
| | | public int containerArrived(AgvWrkMast agvWrkMast); |
| | | } |
| | |
| | | 入库 |
| | | */ |
| | | @Transactional |
| | | public StartupDto createWaitPainWrkMastStart(List<AgvBasDevp> agvBasDevpList, Long userId) { |
| | | public StartupDto createWaitPainWrkMastStart(List<AgvBasDevp> agvBasDevpList, Long userId, boolean isConveyor) { |
| | | |
| | | Date now = new Date(); |
| | | |
| | |
| | | AgvLocMast agvLocMast = agvCommonService.getLocNo(agvWaitPakinList, agvBasDevp.getFloor()); |
| | | //生成工作档 |
| | | //AgvWrkMast wrkMast = createWrkMast(agvBasDevp, agvLocMast, now, userId); |
| | | AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),agvBasDevp.getBarcode(),now,userId); |
| | | AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),agvBasDevp.getBarcode(),now,userId, isConveyor); |
| | | //标记是否为输送线入库 |
| | | wrkMast.setMk(isConveyor ? "Y" : "N"); |
| | | //生成工作档明细 |
| | | //createWrkDetlReWrite(agvWaitPakinList,wrkMast,userId); |
| | | agvWaitPakinList.forEach(wp -> { |
| | |
| | | //判断是否全板出库 |
| | | int ioType = isPakOut(sourceLocNo,anfme) ? 101 : 103; |
| | | //生成工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(ioType,wrkSts,sourceLocNo,targetLocNo,barcode,now,userId); |
| | | AgvWrkMast wrkMast = createWrkMast(ioType,wrkSts,sourceLocNo,targetLocNo,barcode,now,userId,false); |
| | | //生成工作档明细 |
| | | createWrkDetlReWrite(mantr,wrkMast.getWrkNo(),orderNo,batch,anfme,barcode,now,userId,csocode,isoseq); |
| | | //修改订单信息 |
| | |
| | | Date now = new Date(); |
| | | |
| | | //生成工作党 |
| | | AgvWrkMast wrkMast = createWrkMast(107, 21L, locDetl.getLocNo(), agvBasDevp.getDevNo(), agvLocDetl.getSuppCode(), now, userId); |
| | | AgvWrkMast wrkMast = createWrkMast(107, 21L, locDetl.getLocNo(), agvBasDevp.getDevNo(), agvLocDetl.getSuppCode(), now, userId,false); |
| | | //生成工作明细档 |
| | | createWrkDetlReWrite(locDetl.getMatnr(),wrkMast.getWrkNo(),null,locDetl.getBatch(),locDetl.getCount(),wrkMast.getBarcode(),now,userId,agvLocDetl.getThreeCode(),agvLocDetl.getDeadTime()); |
| | | //修改库位信息 |
| | |
| | | |
| | | Date now = new Date(); |
| | | //生成移库工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId); |
| | | AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId,false); |
| | | //生成工作党明细 |
| | | createWrkDetlReWrite(sourceLocDetl.getMatnr(),wrkMast.getWrkNo(),null,sourceLocDetl.getBatch(),sourceLocDetl.getAnfme(),sourceLocDetl.getZpallet(),now,userId,sourceLocDetl.getThreeCode(),sourceLocDetl.getDeadTime()); |
| | | //修改目标库位状态 |
| | |
| | | // 检索库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(null, agvBasDevp.getFloor()); |
| | | // 生成工作档 10.空板入库 |
| | | createWrkMast(10,201L,agvBasDevp.getDevNo(),locMast.getLocNo(),null,now,userId); |
| | | createWrkMast(10,201L,agvBasDevp.getDevNo(),locMast.getLocNo(),null,now,userId,false); |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R"); |
| | | //更新目标库位状态 |
| | |
| | | .eq("station_code", param.getStationCode()) |
| | | .eq("loc_sts", "O")); |
| | | //生成工作档 |
| | | createWrkMast(110,21L,locNo,agvBasDevp.getDevNo(),null,now,userId); |
| | | createWrkMast(110,21L,locNo,agvBasDevp.getDevNo(),null,now,userId,false); |
| | | //修改源库位状态 |
| | | updateAgvLocMast(agvLocMast,"R"); |
| | | //修改目标工作位状态 |
| | |
| | | /* |
| | | 生成工作档 |
| | | */ |
| | | private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode, Date now, Long userId){ |
| | | private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode, Date now, Long userId, boolean isConveyor){ |
| | | AgvWrkMast wrkMast = new AgvWrkMast(); |
| | | //生成工作号 |
| | | // int workNo = agvCommonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | |
| | | wrkMast.setLocNo(locNo); |
| | | //容器编码 |
| | | wrkMast.setBarcode(barcode); |
| | | //标记是否为输送线入库 |
| | | wrkMast.setMk(isConveyor ? "Y" : "N"); |
| | | // 满板:Y |
| | | //wrkMast.setFullPlt("Y"); |
| | | // 拣料 |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.AgvWrkMast; |
| | | import com.zy.asrs.entity.param.AgvTaskCreateParam; |
| | |
| | | @Value("${agv.containerMoveOutPath}") |
| | | private String containerMoveOutPath; |
| | | |
| | | @Value("${agv.containerArrivedPath}") |
| | | private String containerArrivedPath; |
| | | |
| | | @Autowired |
| | | AgvWrkMastMapper agvWrkMastMapper; |
| | | @Autowired |
| | |
| | | AgvTaskCreateParam agvTaskCreateParam = new AgvTaskCreateParam(); |
| | | agvTaskCreateParam.setTaskType(taskType); |
| | | |
| | | // //调用容器入场时所需要参数 |
| | | // Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>(); |
| | | // List<Map<String,String>> positionCodeMapList = new ArrayList<>(); |
| | | // containerMoveParam.put("containerMoveIns",positionCodeMapList); |
| | | |
| | | getRequestParam(agvTaskCreateParam,agvWrkMastList); |
| | | |
| | | return doHttpRequest(agvTaskCreateParam,"搬运任务下发",url, taskCreatePath,null,"127.0.0.1"); |
| | |
| | | } |
| | | |
| | | //容器入场 |
| | | public int containerMove(List<AgvWrkMast> agvWrkMastList) throws IOException { |
| | | public int containerMoveIn(List<AgvWrkMast> agvWrkMastList) throws IOException { |
| | | //调用容器入场时所需要参数 |
| | | Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>(); |
| | | List<Map<String,String>> positionCodeMapList = new ArrayList<>(); |
| | | containerMoveParam.put("containerMoveIns",positionCodeMapList); |
| | | |
| | | getContainerMoveParam(agvWrkMastList,positionCodeMapList); |
| | | |
| | | if(Cools.isEmpty(positionCodeMapList)){ |
| | | return 0; |
| | | } |
| | | return doHttpRequest(containerMoveParam,"容器入场任务下发",url, containerMoveInPath,null,"127.0.0.1"); |
| | | |
| | | } |
| | |
| | | return this.delete(new EntityWrapper<AgvWrkMast>().eq("wrk_no", wrkNo)); |
| | | } |
| | | |
| | | //容器到达通知 |
| | | public int containerArrived(AgvWrkMast agvWrkMast) { |
| | | |
| | | Map<String,String> containerArrivedParam = new HashMap<>(); |
| | | containerArrivedParam.put("slotCode",agvWrkMast.getSourceLocNo()); |
| | | containerArrivedParam.put("containerCode",agvWrkMast.getBarcode()); |
| | | |
| | | return doHttpRequest(containerArrivedParam,"容器达到通知",url, containerArrivedPath,null,"127.0.0.1"); |
| | | } |
| | | |
| | | private void getContainerMoveParam(List<AgvWrkMast> agvWrkMastList,List<Map<String,String>> positionCodeMapList){ |
| | | //往容器入场参数中放入源站点位置 |
| | | for(AgvWrkMast agvWrkMast : agvWrkMastList){ |
| | | //判断是否为输送线入库,是则不需要容器进场请求 |
| | | if("Y".equals(agvWrkMast.getMk())){ |
| | | continue; |
| | | } |
| | | Map<String,String> positionCodeMap = new HashMap<>(); |
| | | positionCodeMap.put("positionCode",agvWrkMast.getSourceLocNo()); |
| | | positionCodeMapList.add(positionCodeMap); |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | @Service("locDetlService") |
| | | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService { |
| | |
| | | wapperSetCondition(wrapper,"batch",batch); |
| | | wapperSetCondition(wrapper,"three_code",csocode); |
| | | wapperSetCondition(wrapper,"dead_time",isoseq); |
| | | // if(Cools.isEmpty(batch)){ |
| | | // wrapper.isNull("batch"); |
| | | // }else { |
| | | // wrapper.eq("batch",batch); |
| | | // } |
| | | |
| | | List<LocDetl> locDetlList = this.selectList(wrapper); |
| | | for (LocDetl locDetl : locDetlList) { |
| | | //判断当前库位货物是否F在库 |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | | continue; |
| | | } |
| | | |
| | | Set<LocDetl> resort = resort(locDetlList); |
| | | |
| | | for (LocDetl locDetl : resort) { |
| | | |
| | | if (issued > 0) { |
| | | double anfme = locDetl.getAnfme(); |
| | | int ioType = anfme > issued ? 103 : 101; |
| | | anfme = anfme > issued ? issued : anfme; |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderNo, anfme); |
| | | //List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); |
| | | |
| | | List<Integer> outSite = basDevpService.getAvailableOutSite(101); |
| | | |
| | | locDto.setStaNos(outSite); |
| | |
| | | wapperSetCondition(wrapper,"batch",batch); |
| | | wapperSetCondition(wrapper,"three_code",csocode); |
| | | wapperSetCondition(wrapper,"dead_time",isoseq); |
| | | // if(Cools.isEmpty(batch)){ |
| | | // wrapper.isNull("batch"); |
| | | // }else { |
| | | // wrapper.eq("batch",batch); |
| | | // } |
| | | |
| | | List<LocDetl> locDetlList = this.selectList(wrapper); |
| | | for (LocDetl locDetl : locDetlList) { |
| | | Set<LocDetl> resort = resort(locDetlList); |
| | | for (LocDetl locDetl : resort) { |
| | | //判断当前库位货物是否F在库 |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | |
| | | wrapper.eq(column,condition); |
| | | } |
| | | } |
| | | |
| | | //根据深浅库位进行重新排序 |
| | | private Set<LocDetl> resort(List<LocDetl> locDetls){ |
| | | Set<LocDetl> locDetlsResort = new LinkedHashSet<>(); |
| | | |
| | | for(LocDetl locDetl : locDetls){ |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | | continue; |
| | | } |
| | | |
| | | List<String> groupOuterLoc = Utils.getGroupOuterLoc(locDetl.getLocNo()); |
| | | |
| | | if(Cools.isEmpty(groupOuterLoc)){ |
| | | locDetlsResort.add(locDetl); |
| | | }else { |
| | | groupOuterLoc.add(locDetl.getLocNo()); |
| | | //如果是深库位,则先找外侧的库位 |
| | | for (String locNo : groupOuterLoc){ |
| | | LocMast locMastOuter = locMastService.selectById(locNo); |
| | | //外侧如果是拣料,则内测不允许出 |
| | | if("P".equals(locMastOuter.getLocSts()) || "Q".equals(locMastOuter.getLocSts()) || "S".equals(locMastOuter.getLocSts())){ |
| | | break; |
| | | } |
| | | |
| | | if(!"F".equals(locMastOuter.getLocSts())){ |
| | | continue; |
| | | } |
| | | locDetlsResort.addAll(this.selectByLocNo(locNo)); |
| | | |
| | | } |
| | | } |
| | | } |
| | | return locDetlsResort; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | LocDetl locDetl2 = new LocDetl(); |
| | | locDetl2.setLocNo("aaa1"); |
| | | LocDetl locDetl3 = new LocDetl(); |
| | | locDetl3.setLocNo("aaa2"); |
| | | locDetls.add(locDetl2); |
| | | locDetls.add(locDetl3); |
| | | System.out.println(locDetls.size()); |
| | | |
| | | Set<LocDetl> set = new LinkedHashSet<>(); |
| | | LocDetl locDetl = new LocDetl(); |
| | | LocDetl locDetl1 = new LocDetl(); |
| | | locDetl.setLocNo("aaa"); |
| | | locDetl1.setLocNo("aaa"); |
| | | |
| | | set.add(locDetl); |
| | | set.add(locDetl1); |
| | | set.addAll(locDetls); |
| | | |
| | | System.out.println(set); |
| | | System.out.println(set.size()); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.AgvLocDetl; |
| | | import com.zy.asrs.entity.AgvWaitPakin; |
| | | import com.zy.asrs.entity.AgvWrkDetl; |
| | |
| | | @Transactional |
| | | public ReturnT<String> startPutWayWrk(List<AgvWrkMast> agvWrkMastList) throws IOException { |
| | | |
| | | int startWwrkCode = agvWrkMastService.startWrk(agvWrkMastList,"putaway"); |
| | | //下发任务 |
| | | int startWrkCode = agvWrkMastService.startWrk(agvWrkMastList,"putaway"); |
| | | if(startWrkCode != 0){ |
| | | throw new CoolException("任务下发失败"); |
| | | } |
| | | |
| | | int code = agvWrkMastService.containerMove(agvWrkMastList); |
| | | //下发容器入场指令 (缓存货架) |
| | | int code = agvWrkMastService.containerMoveIn(agvWrkMastList); |
| | | |
| | | if(code == 0){ |
| | | agvWrkMastList.forEach(agvWrkMast -> { |
| | | for(AgvWrkMast agvWrkMast : agvWrkMastList){ |
| | | //下发容器达到通知 (输送线) |
| | | if("Y".equals(agvWrkMast.getMk())){ |
| | | int containerArrivedCode = agvWrkMastService.containerArrived(agvWrkMast); |
| | | if(containerArrivedCode != 0){ |
| | | log.error("容器到达指令下发失败"); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | //202.RCS取货中 |
| | | agvWrkMast.setWrkSts(202L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | |
| | | //修改AGV入库通知档状态入出状态为Y |
| | | agvWaitPakinService.updateIoStatus(agvWrkMast.getWrkNo(),"Y"); |
| | | } |
| | | |
| | | }); |
| | | //agvWrkMastService.updateBatchById(agvWrkMastList); |
| | | } |
| | | |
| | | return SUCCESS; |
| | | } |
| | |
| | | AgvBasDevp agvBasDevp = agvBasDevpService.getByDevNo(param.getDevNo()); |
| | | |
| | | if(Cools.isEmpty(agvBasDevp) || !"O".equals(agvBasDevp.getLocSts())){ |
| | | //去找agv工作档任务 |
| | | throw new CoolException("当前站点不存在或者站点不为空"); |
| | | } |
| | | //绑定站点 |
| | |
| | | |
| | | //生成工作档 |
| | | List<AgvBasDevp> agvBasDevpList = agvBasDevpService.selectList(new EntityWrapper<AgvBasDevp>().eq("dev_no", param.getDevNo())); |
| | | agvWorkService.createWaitPainWrkMastStart(agvBasDevpList, null); |
| | | agvWorkService.createWaitPainWrkMastStart(agvBasDevpList, null, true); |
| | | |
| | | |
| | | return R.ok(); |
| | |
| | | enabled: false |
| | | datasource: |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | #url: jdbc:sqlserver://localhost:1433;databasename=tzskasrs |
| | | url: jdbc:sqlserver://localhost:1433;databasename=tzskasrs |
| | | #url: jdbc:sqlserver://192.168.4.15:1433;databasename=tzskasrs |
| | | url: jdbc:sqlserver://10.10.10.40:1433;databasename=tzskasrs |
| | | #url: jdbc:sqlserver://10.10.10.40:1433;databasename=tzskasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
| | |
| | | taskCreatePath: /task/create |
| | | containerMoveInPath: /expand/api/moveIn/container |
| | | containerMoveOutPath: /expand/api/moveOut/container |
| | | containerArrivedPath: /conveyor/containerArrived |
| | | |
| | | u8: |
| | | url: http://192.168.1.55:8010 |