#
luxiaotao1123
2021-05-27 87bf4d9932d7e0a12daa98990f08d70e54e01d66
src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
@@ -137,6 +137,62 @@
    @Override
    @Transactional
    public R stockPakout(PakoutParam param, Long userId) {
        Mat mat = matService.selectByMatnr(param.getMatnr());
        Node node = nodeService.selectByUuid(param.getNodeUuid());
        LocDetl locDetl = locDetlService.getLocDetl(node.getId(), mat.getMatnr());
        if (locDetl == null || locDetl.getAnfme() < param.getCount()) {
            return R.error(mat.getMaktx() + "库存不足");
        }
        Pakout pakout = new Pakout(
                String.valueOf(snowflakeIdWorker.nextId()),    // 任务号[非空]
                3L,    // 工作状态
                null,    // 托盘号
                param.getCount(),    // 出库数量
                node.getId(),    // 关联货位[非空]
                node.getUuid(),    // 货位[非空]
                mat.getMatnr(),    // 商品编码[非空]
                null,    // 商品名称
                null,    // 名称
                null,    // 尺码
                null,    // 型号
                null,    // 批号
                null,    // 单位
                null,    // SKC
                null,    // 单据类型
                null,    // 单据编号
                null,    // 客户名称
                null,    // 品项数
                null,    // 数量
                null,    // 重量
                1,    // 状态
                userId,    // 添加人员
                new Date(),    // 添加时间
                userId,    // 修改人员
                new Date(),    // 修改时间
                null    // 备注
        );
        VersionUtils.setPakout(pakout, mat);
        // 保存出库通知单
        if (!pakoutService.insert(pakout)) {
            throw new CoolException("保存出库通知单失败");
        }
        if (param.getCount()>=locDetl.getAnfme()) {
            // 删除库存明细
            if (!locDetlService.removeStock(node.getId(), mat.getMatnr())) {
                throw new CoolException("删除库存明细失败");
            }
        } else {
            // 修改库存明细数量
            if (!locDetlService.reduceStock(node.getId(), mat.getMatnr(), param.getCount())) {
                throw new CoolException("修改库存明细数量失败");
            }
        }
        return R.ok();
    }
    @Override
    @Transactional
    public R stockIn(StockInParam param, Long userId) {
        Node node = nodeService.selectByUuid(param.getNodeId());
        if (node == null) {