| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/process/out/pakout/auth") |
| | | @ManagerAuth(memo = "加工出库") |
| | | @Transactional |
| | | @Synchronized |
| | | public synchronized R processPakout(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | |
| | | //判断是否可以生成出库工作档 |
| | | boolean lack = true; |
| | | for (LocDto locDto : locDtos) { |
| | | //如果AGV出库站为空 和 四项库出库站为空 并且 有库存的情况下 则返回 |
| | | if (Cools.isEmpty(locDto.getStaNo()) && Cools.isEmpty(locDto.getAgvStaNo()) &&!locDto.isLack()) { |
| | | return R.error(locDto.getLocNo()+"库位请选择出库站"); |
| | | } |
| | | |
| | | AgvLocMast agvLocMast = agvLocMastService.selectById(locDto.getLocNo()); |
| | | List<String> staNoList = agvBasDevpService.selectCacheShelvesStationCodeByLocType(agvLocMast.getLocType1(),agvLocMast.getFloor()); |
| | | |
| | | if(!staNoList.contains(locDto.getAgvStaNo())){ |
| | | return R.error(locDto.getAgvStaNo()+"该站点已有出库任务,无法选择该站点出库"); |
| | | } |
| | | } |
| | | //如果所有库都没有库存,则返回 |
| | | for (LocDto locDto : locDtos) { |
| | | if (!locDto.isLack()) { |
| | | lack = false; |
| | | break; |
| | | } |
| | | } |
| | | if (lack) { |
| | | return R.error("库存不足"); |
| | | } |
| | | Thread.sleep(500L); |
| | | |
| | | // 订单预校验 ===>> 1.订单状态; 2.订单带出数量 |
| | | List<OrderDto> orderDtos = orderPreVerification(locDtos); |
| | | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | List<TaskDto> agvTaskDtos = new ArrayList<>(); |
| | | generateTaskDto(locDtos,taskDtos,agvTaskDtos); |
| | | |
| | | //生成AGV出库任务 |
| | | agvWorkService.stockOutWrkMast(agvTaskDtos, getUserId()); |
| | | |
| | | // 生成出库任务 |
| | | taskDtos.stream().map(TaskDto::getLocNo).distinct().collect(Collectors.toList()); |
| | | for (TaskDto taskDto : taskDtos) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | workService.stockOut(staNo, taskDto, getUserId()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | @TableField(exist = false) |
| | | private String locSts$; |
| | | |
| | | /** |
| | | * 工序状态 |
| | | */ |
| | | @ApiModelProperty(value= "工序状态 1:待加工,2:已加工,3:无需加工") |
| | | @TableField("process_sts") |
| | | private Integer processSts; |
| | | |
| | | |
| | | public String getProcessSts$(){ |
| | | if (null == this.processSts){ return null; } |
| | | switch (this.processSts){ |
| | | case 0: |
| | | return "其他"; |
| | | case 1: |
| | | return "待加工"; |
| | | case 2: |
| | | return "已加工"; |
| | | case 3: |
| | | return "无需加工"; |
| | | default: |
| | | return String.valueOf(this.processSts); |
| | | } |
| | | } |
| | | |
| | | public String getLocNo$(){ |
| | | LocMastService service = SpringUtils.getBean(LocMastService.class); |
| | | LocMast locMast = service.selectById(this.locNo); |
| | |
| | | wrkMast.setMk(isConveyor ? "Y" : "N"); |
| | | //生成工作档明细 |
| | | agvWaitPakinList.forEach(wp -> { |
| | | createWrkDetlReWrite(wp.getMatnr(),wrkMast.getWrkNo(),wp.getOrderNo(),wp.getBatch(),wp.getAnfme(),wp.getSuppCode(),now,userId,wp.getThreeCode(),wp.getDeadTime()); |
| | | createWrkDetlReWrite(wp.getMatnr(),wrkMast.getWrkNo(),wp.getOrderNo(),wp.getBatch(),wp.getAnfme(),wp.getSuppCode(),now,userId,wp.getThreeCode(),wp.getDeadTime(),wp.getProcessSts()); |
| | | }); |
| | | //更新源站点信息 |
| | | updateAgvBasDevp(agvBasDevp,"R"); |
| | |
| | | now, |
| | | userId, |
| | | locDto.getCsocode(), |
| | | locDto.getIsoseq()); |
| | | locDto.getIsoseq(), |
| | | locDto.getProcessSts()); |
| | | }else { |
| | | List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class); |
| | | orderDtoList.forEach(orderDto -> { |
| | |
| | | now, |
| | | userId, |
| | | locDto.getCsocode(), |
| | | locDto.getIsoseq()); |
| | | locDto.getIsoseq(), |
| | | locDto.getProcessSts()); |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | param.getLocDetls().forEach(locDetl -> { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(),locDetl.getCount(),locDetl.getMatnr(),locDetl.getBatch(),locDetl.getThreeCode(),locDetl.getDeadTime(),locDetl.getSuppCode()); |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(),locDetl.getCount(),locDetl.getMatnr(),locDetl.getBatch(),locDetl.getThreeCode(),locDetl.getDeadTime(),locDetl.getSuppCode(), locDetl.getProcessSts()); |
| | | TaskDto taskDto = new TaskDto(locDetl.getLocNo(),station,locDto); |
| | | if(TaskDto.has(taskDtos,taskDto)){ |
| | | TaskDto.find(taskDtos,taskDto).getLocDtos().add(locDto); |
| | |
| | | now, |
| | | userId, |
| | | locDto.getCsocode(), |
| | | locDto.getIsoseq()); |
| | | locDto.getIsoseq(), |
| | | locDto.getProcessSts()); |
| | | }); |
| | | updateAgvLocMast(agvLocMastService.selectById(wrkMast.getSourceLocNo()),"P"); |
| | | //更新目标站点状态 |
| | |
| | | //生成移库工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId,getContainerTypeByloc(sourceLocNo)); |
| | | //生成工作党明细 |
| | | createWrkDetlReWrite(sourceLocDetl.getMatnr(),wrkMast.getWrkNo(),null,sourceLocDetl.getBatch(),sourceLocDetl.getAnfme(),sourceLocDetl.getZpallet(),now,userId,sourceLocDetl.getThreeCode(),sourceLocDetl.getDeadTime()); |
| | | createWrkDetlReWrite(sourceLocDetl.getMatnr(),wrkMast.getWrkNo(),null,sourceLocDetl.getBatch(),sourceLocDetl.getAnfme(),sourceLocDetl.getZpallet(),now,userId,sourceLocDetl.getThreeCode(),sourceLocDetl.getDeadTime(),sourceLocDetl.getProcessSts()); |
| | | //修改目标库位状态 |
| | | updateAgvLocMast(targetLocMast,"S"); |
| | | //修改原库位状态 |
| | |
| | | if(!Cools.isEmpty(agvWaitPakinList)){ |
| | | AtomicBoolean isCurrLev = new AtomicBoolean(false); |
| | | agvWaitPakinList.forEach(agvWaitPakin -> { |
| | | if (agvWaitPakin.getProcessSts() == 1) { |
| | | isCurrLev.set(true); |
| | | if (!Cools.isEmpty(agvWaitPakin.getProcessSts())) { |
| | | if (agvWaitPakin.getProcessSts() == 1) { |
| | | isCurrLev.set(true); |
| | | } |
| | | } |
| | | }); |
| | | if (isCurrLev.get()) { |
| | |
| | | //货架码 |
| | | private String containerCode; |
| | | |
| | | // 工序状态 1:待加工,2:已加工,3:无需加工 |
| | | private Integer processSts; |
| | | |
| | | public LocDto() { |
| | | } |
| | | |
| | |
| | | this.containerCode = containerCode; |
| | | } |
| | | |
| | | public LocDto(String locNo, Double anfme, String matnr, String batch, String csocode, String isoseq, String containerCode,Integer processSts) { |
| | | this.locNo = locNo; |
| | | this.anfme = anfme; |
| | | this.matnr = matnr; |
| | | this.batch = batch; |
| | | this.csocode = csocode; |
| | | this.isoseq = isoseq; |
| | | this.containerCode = containerCode; |
| | | this.processSts = processSts; |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String batch, Double anfme) { |
| | | this.locNo = locNo; |
| | | this.matnr = matnr; |
| | |
| | | ,{field: 'maktx', align: 'center',title: '商品名称'} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false} |
| | | ,{field: 'threeCode', align: 'center',title: '销售订单号'} |
| | | ,{field: 'deadTime', align: 'center',title: '销售订单行号'} |
| | | ,{field: 'deadTime', align: 'center',title: '销售订单行号' ,hide: true} |
| | | ,{field: 'specs', align: 'center',title: '规格型号', hide: false} |
| | | ,{field: 'model', align: 'center',title: '通用型号', hide: false} |
| | | ,{field: 'processSts$', align: 'center',title: '工序', hide: false} |
| | | |
| | | ,{field: 'brand', align: 'center',title: '商品分类编码', hide: true} |
| | | ,{field: 'color', align: 'center',title: '商品分类名称', hide: true} |