From 405060f625812cc6b6004fcdaf393c8ebfc2f9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Wed, 31 May 2023 23:37:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E5=95=86=E5=93=81=E5=AF=BC=E5=85=A5ex?= =?UTF-8?q?cel=E8=A7=A3=E5=86=B3=E5=A4=9A=E5=B1=9E=E6=80=A7=E5=B8=A6?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jsh/erp/constants/ExceptionConstants.java | 3 +++ .../com/jsh/erp/service/material/MaterialService.java | 8 ++++++-- .../jsh/erp/service/systemConfig/SystemConfigService.java | 6 ------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index 39074331..9ffa6c22 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -332,6 +332,9 @@ public class ExceptionConstants { //型号长度超出 public static final int MATERIAL_MODEL_OVER_CODE = 8000024; public static final String MATERIAL_MODEL_OVER_MSG = "第%s行型号长度超出100个字符"; + //多属性商品不能输入库存,建议进行盘点录入 + public static final int MATERIAL_SKU_BEGIN_STOCK_FAILED_CODE = 8000025; + public static final String MATERIAL_SKU_BEGIN_STOCK_FAILED_MSG = "多属性商品%s不能输入库存,建议进行盘点录入"; /** * 单据信息 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java index 6eada973..c5a77c7a 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -7,7 +7,6 @@ import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.*; -import com.jsh.erp.datasource.vo.MaterialExtendVo4List; import com.jsh.erp.datasource.vo.MaterialVoSearch; import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.JshException; @@ -25,7 +24,6 @@ import jxl.Sheet; import jxl.Workbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.request.RequestContextHolder; @@ -759,6 +757,12 @@ public class MaterialService { BigDecimal stock = stockMap.get(depot.getId()); //新增初始库存 if(stock!=null && stock.compareTo(BigDecimal.ZERO)!=0) { + String basicStr = materialExObj.getString("basic"); + MaterialExtend materialExtend = JSONObject.parseObject(basicStr, MaterialExtend.class); + if(StringUtil.isNotEmpty(materialExtend.getSku())) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SKU_BEGIN_STOCK_FAILED_CODE, + String.format(ExceptionConstants.MATERIAL_SKU_BEGIN_STOCK_FAILED_MSG, materialExtend.getBarCode())); + } if(materialDepotInitialMap.get(materialDepotKey)==null) { MaterialInitialStock materialInitialStock = new MaterialInitialStock(); materialInitialStock.setMaterialId(mId); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java index be237f5e..86d244ab 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java @@ -2,18 +2,14 @@ package com.jsh.erp.service.systemConfig; import com.alibaba.fastjson.JSONObject; import com.jsh.erp.constants.BusinessConstants; -import com.jsh.erp.constants.ExceptionConstants; -import com.jsh.erp.datasource.entities.Supplier; import com.jsh.erp.datasource.entities.SystemConfig; import com.jsh.erp.datasource.entities.SystemConfigExample; import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.SystemConfigMapper; import com.jsh.erp.datasource.mappers.SystemConfigMapperEx; -import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; -import com.jsh.erp.utils.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -40,8 +36,6 @@ public class SystemConfigService { @Resource private LogService logService; - private static final String TEST_USER = "jsh"; - public SystemConfig getSystemConfig(long id)throws Exception { SystemConfig result=null; try{