jiazx0107@163.com
2023-05-30 2495e9ab75e6c45af1d6e14414711d8cc79fe2ca
igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java
@@ -118,30 +118,14 @@
    @Override
    public String insertData(InoutData data) {
        try {
            data.setUpdateTime(new Date());
        if (StringUtils.isEmpty(data.getCompanyId())) {
            data.setCompanyId(ContextUtil.getCompanyId());
        }
        // 获取当前仓库的实际库存
        if (StringUtils.isNotEmpty(data.getDepotId())) {
            if (null == data.getFoodYear() || null == data.getFoodType()) {
                Depot depot = commonService.getCacheDepot(data.getCompanyId(), data.getDepotId());
                if (null == data.getFoodYear()) {
                    data.setFoodYear(depot.getFoodYear());
                }
                if (null == data.getFoodType()) {
                    data.setFoodType(depot.getFoodType());
                }
            }
        }
        if (null == data.getRegisterTime()) {
            data.setRegisterTime(new Date());
            if (null == data.getDeptId()) {
                data.setDeptId(ContextUtil.subDeptId(null));
        }
        String id = this.createId(data.getRegisterTime(), data.getCompanyId());
        if (StringUtils.isEmpty(data.getId())) {
            if (InoutConstant.TYPE_IN.equals(data.getType())) {
                data.setId("R_" + id);
@@ -158,19 +142,20 @@
        if (StringUtils.isEmpty(data.getCheckId())) {
            data.setCheckId(id);
        }
        if (null == data.getDeptId()) {
            data.setDeptId(ContextUtil.subDeptId(null));
        }
        if (null == data.getUserName()) {
            data.setUserName("");
        }
        inoutMapper.insertData(data);
        // 如果不是手动补录的数据,添加到缓存中
        if (!InoutConstant.RECORD_STATUS_ADD.equals(data.getRecordStatus())) {
            this.addInoutCache(data);
        } catch (Exception e) {
            log.error("------------出入库执行保存出错---{}", e);
            return "后台异常:" + e.getMessage();
        }
        return null;
    }
@@ -677,6 +662,11 @@
        return result.getNumValue1();
    }
    @Override
    public int checkExist(InoutParam param) {
        return inoutMapper.checkExist(param);
    }
    /**
     * 未完成流程存入缓存
     *