From 4cf39d4d5ff87d2e1289295aa2790b617b1d4073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Mon, 10 Jun 2019 14:13:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2624b0e7..fed3548f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ * DB: Mysql5.7.4 * JDK: JDK1.8 * Maven: Maven3.2.3+ -* 为方便大家搭建开发环境,分享了下载地址 **http://pan.baidu.com/s/1nuKnlNV** +* 为方便大家搭建开发环境,分享了下载地址 **https://pan.baidu.com/s/1iuNOSuijcU9vrVT4PCl0hQ** 提取码:bik7 # 运行环境 * 数据库服务器:Mysql5.7.4 From 7b795718be6dad6746491fabbc85585ccb3bd4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Mon, 10 Jun 2019 23:14:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8D=95=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=B6=E5=BA=93=E5=AD=98=E6=9C=AA=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E4=BB=93=E5=BA=93=E5=8E=BB=E5=88=A4=E6=96=AD=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/mappers/DepotItemMapperEx.java | 8 ++++++++ .../service/depotItem/DepotItemService.java | 18 +++++++++++++----- .../resources/mapper_xml/DepotItemMapperEx.xml | 17 +++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java index 9a7723c8..f1443bcf 100644 --- a/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java +++ b/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java @@ -51,6 +51,14 @@ public interface DepotItemMapperEx { int findByTypeAndMaterialIdOut( @Param("mId") Long mId); + int findByTypeAndDepotIdAndMaterialIdIn( + @Param("depotId") Long depotId, + @Param("mId") Long mId); + + int findByTypeAndDepotIdAndMaterialIdOut( + @Param("depotId") Long depotId, + @Param("mId") Long mId); + List getDetailList( @Param("headerId") Long headerId); diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index 35157466..e6fd1092 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -307,6 +307,14 @@ public class DepotItemService { return result; } + public int findByTypeAndMaterialIdAndDepotId(String type, Long mId, Long depotId) { + if(type.equals(TYPE)) { + return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdIn(depotId, mId); + } else { + return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdOut(depotId, mId); + } + } + public List getDetailList(Long headerId)throws Exception { List list =null; try{ @@ -588,7 +596,7 @@ public class DepotItemService { if(material==null){ continue; } - if(getCurrentInStock(depotItem.getMaterialid())<(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()){ + if(getCurrentInStock(depotItem.getMaterialid(),depotItem.getDepotid())<(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()){ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE, String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName())); } @@ -711,7 +719,7 @@ public class DepotItemService { } /**出库时处理序列号*/ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){ - if(getCurrentInStock(depotItem.getMaterialid())<(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()){ + if(getCurrentInStock(depotItem.getMaterialid(),depotItem.getDepotid())<(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()){ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE, String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName())); } @@ -754,11 +762,11 @@ public class DepotItemService { * 查询商品当前库存数量是否充足, * * */ - public int getCurrentInStock(Long materialId)throws Exception{ + public int getCurrentInStock(Long materialId, Long depotId){ //入库数量 - int inSum = findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId); + int inSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId, depotId); //出库数量 - int outSum = findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId); + int outSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId ,depotId); return (inSum-outSum); } @Transactional(value = "transactionManager", rollbackFor = Exception.class) diff --git a/src/main/resources/mapper_xml/DepotItemMapperEx.xml b/src/main/resources/mapper_xml/DepotItemMapperEx.xml index 281ea795..4cddb43b 100644 --- a/src/main/resources/mapper_xml/DepotItemMapperEx.xml +++ b/src/main/resources/mapper_xml/DepotItemMapperEx.xml @@ -148,6 +148,23 @@ and ifnull(dh.delete_Flag,'0') !='1' + + + +