自动化立体仓库 - WMS系统
#
whycq
2024-05-21 0039eea93ca5fc77b2b9d0b0ab7babefe2316034
src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -523,6 +523,54 @@
        return "ok";
    }
    /*
     * 站点回退
    */
    @Override
    @Transactional
    public String doBack(AgvMobileStartPakin param, Long userId) {
        Date now = new Date();
        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", param.getDevNo()));
        Integer oldWrkNo = agvWrkMast.getWrkNo();
        if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
            throw new CoolException("回退任务的货架码与当前货架码不一致!");
        }
        if (agvWrkMast.getWrkSts() != 205) {
            throw new CoolException("出库任务未完成!");
        }
        // 新建回退工作档
        AgvWrkMast wrkMast = createWrkMast(58, 201L, agvWrkMast.getLocNo(), agvWrkMast.getSourceLocNo(), agvWrkMast.getBarcode(), now, userId, agvWrkMast.getWhsType(), 0);
        // 更新接驳位,更新库位状态
        agvLocMastService.updateLocStsByLocNo(wrkMast.getLocNo(),"S",wrkMast.getBarcode(),wrkMast.getWhsType().shortValue());
        agvBasDevpService.updateLocStsAndBarcodeByDevNo(wrkMast.getSourceLocNo(),"R",wrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
        // 更新工作明细
        List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code", agvWrkMast.getBarcode()));
        for (AgvWrkDetl agvWrkDetl : agvWrkDetls) {
            agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
            // 保持工作档明细
            agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
            agvWrkDetl.setModiUser(userId);
            agvWrkDetl.setModiTime(now);
            if (!agvWrkDetlService.insert(agvWrkDetl)) {
                throw new CoolException("保存工作明细失败");
            }
            // 同步订单数量
            OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("matnr", agvWrkDetl.getMatnr()).eq("three_code",agvWrkDetl.getThreeCode()).in("source",18,31,34));
            orderDetl.setQty(orderDetl.getQty() - agvWrkDetl.getAnfme());
            if (!orderDetlService.update(orderDetl,new EntityWrapper<OrderDetl>().eq("order_no",orderDetl.getOrderNo()).eq("matnr", orderDetl.getMatnr()).eq("three_code",orderDetl.getThreeCode()))){
                throw new CoolException("修改订单明细失败,请联系管理员"+orderDetl.getOrderNo()+orderDetl.getMatnr());
            }
        }
        //生成AGV工作历史档 + 生成AGV工作明细历史档
        agvWrkMastLogService.save(agvWrkMast);
        agvWrkDetlLogService.save(agvWrkMast.getWrkNo());
        //删除AGV工作档
        agvWrkMastService.deleteById(agvWrkMast);
        //删除AGV工作明细档
        agvWrkDetlService.delete(new EntityWrapper<AgvWrkDetl>().eq("wrk_no",oldWrkNo));
        return "ok";
    }
    /*
   更新目标库位信息
    */
    private void updateAgvLocMast(AgvLocMast locMast, String locSts){