| | |
| | | |
| | | 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("没有更多新数据需要同步"); |
| | |
| | | sku.setFormModifiedTime(AliDingUtils.parseUtcTime(item.getString("modifiedTimeGMT"))); |
| | | sku.setCreateTime(now); |
| | | sku.setUpdateTime(now); |
| | | sku.setType(1); |
| | | |
| | | list.add(sku); |
| | | } |
| | |
| | | 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("删除物料失败"); |
| | | } |