gongchunyi
3 天以前 3faea5bad90c8e55e8bf83f7a9c603f789ed6c84
src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
@@ -106,7 +106,10 @@
            String searchFieldJson = searchConditions.toJSONString();
            JSONArray dataArr = AliDingUtils.getFormDataList(aliDingConfig, aliDingConfig.getMaterialCodeFormUuid(), searchFieldJson, productMaterialSkuService, ProductMaterialSku::getFormModifiedTime);
            LambdaQueryWrapper<ProductMaterialSku> countWrapper = new LambdaQueryWrapper<>();
            countWrapper.eq(ProductMaterialSku::getType, 1);
            JSONArray dataArr = AliDingUtils.getFormDataList(aliDingConfig, aliDingConfig.getMaterialCodeFormUuid(), searchFieldJson, productMaterialSkuService, ProductMaterialSku::getFormModifiedTime, countWrapper);
            if (dataArr.isEmpty()) {
                log.info("没有更多新数据需要同步");
@@ -169,6 +172,7 @@
            sku.setFormModifiedTime(AliDingUtils.parseUtcTime(item.getString("modifiedTimeGMT")));
            sku.setCreateTime(now);
            sku.setUpdateTime(now);
            sku.setType(1);
            list.add(sku);
        }
@@ -407,6 +411,13 @@
        if (ids == null || ids.isEmpty()) {
            throw new ServiceException("请选择至少一条数据");
        }
        //  存在规格就不能删除
        long skuCount = productMaterialSkuService.count(new LambdaQueryWrapper<ProductMaterialSku>().in(ProductMaterialSku::getProductId, ids));
        if (skuCount > 0) {
            throw new ServiceException("该物料下存在规格数据,无法删除");
        }
        if (!this.removeByIds(ids)) {
            throw new ServiceException("删除物料失败");
        }