FengChaoYu 7 månader sedan
förälder
incheckning
c13e0cc342

+ 2 - 1
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/MaterialMapper.java

@@ -150,7 +150,8 @@ public interface MaterialMapper {
                                              @Param("categoryId") String categoryId,
                                              @Param("goodsName") String goodsName,
                                              @Param("goodsSpecification") String goodsSpecification,
-                                             @Param("partType") String partType);
+                                             @Param("partType") String partType,
+                                             @Param("storageId") String storageId);
 
     /**
      * 查询配件

+ 6 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/material/manage/WebsitSalesController.java

@@ -195,9 +195,10 @@ public class WebsitSalesController {
             @ApiParam(value = "分类id", required = true) @RequestParam(required = false) String categoryId,
             @ApiParam(value = "商品类型", required = true) @RequestParam WebsitGoodsTypeEnum type,
             @ApiParam(value = "商品名称") @RequestParam(required = false) String goodsName,
-            @ApiParam(value = "工程基础资料id") @RequestParam(required = false) String orderEnginBaseId
+            @ApiParam(value = "工程基础资料id") @RequestParam(required = false) String orderEnginBaseId,
+            @ApiParam(value = "仓库id") @RequestParam(required = false) String storageId
     ) throws RemoteServiceException {
-        List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoods(saleType, websitId, categoryId, type, goodsName, orderEnginBaseId);
+        List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoods(saleType, websitId, categoryId, type, goodsName, orderEnginBaseId, storageId);
         return ResponseHelper.success(list);
     }
 
@@ -209,9 +210,10 @@ public class WebsitSalesController {
             @ApiParam(value = "商品类型", required = false) @RequestParam WebsitGoodsTypeEnum type,
             @ApiParam(value = "商品名称") @RequestParam(required = false) String goodsName,
             @ApiParam(value = "规格") @RequestParam(required = false) String goodsSpecification,
-            @ApiParam(value = "配件类型") @RequestParam(required = false) String partType
+            @ApiParam(value = "配件类型") @RequestParam(required = false) String partType,
+            @ApiParam(value = "仓库id") @RequestParam(required = false) String storageId
     ) throws RemoteServiceException {
-        List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoodsList(websitId, categoryId, type, goodsName, goodsSpecification, partType);
+        List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoodsList(websitId, categoryId, type, goodsName, goodsSpecification, partType, storageId);
         return ResponseHelper.success(list);
     }
 

+ 4 - 4
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/manage/WebsitMPurchaseLogic.java

@@ -220,12 +220,12 @@ public class WebsitMPurchaseLogic {
                 if (Objects.nonNull(relaGoods.getCostRangeMini())
                         && relaGoods.getCostRangeMini().compareTo(BigDecimal.ZERO) > 0
                         && itemBean.getApplyCost().compareTo(relaGoods.getCostRangeMini()) < 0) {
-                    throw new RemoteServiceException(preStr + "不能低于辅材资料最小进价范围值");
+                    throw new RemoteServiceException(preStr + "不能低于辅材资料最小进价范围值" + relaGoods.getCostRangeMini());
                 }
                 if (Objects.nonNull(relaGoods.getCostRangeMax())
                         && relaGoods.getCostRangeMax().compareTo(BigDecimal.ZERO) > 0
                         && itemBean.getApplyCost().compareTo(relaGoods.getCostRangeMax()) > 0) {
-                    throw new RemoteServiceException(preStr + "不能高于辅材资料最大进价范围值");
+                    throw new RemoteServiceException(preStr + "不能高于辅材资料最大进价范围值" + relaGoods.getCostRangeMax());
                 }
                 // 申请进价*申请数量=申请进价金额
                 itemBean.setApplyCostValue(itemBean.getApplyCost().multiply(itemBean.getApplyQty()).setScale(2, BigDecimal.ROUND_DOWN));
@@ -243,12 +243,12 @@ public class WebsitMPurchaseLogic {
                 if (Objects.nonNull(relaGoods.getCostRangeMini())
                         && relaGoods.getCostRangeMini().compareTo(BigDecimal.ZERO) > 0
                         && itemBean.getCost().compareTo(relaGoods.getCostRangeMini()) < 0) {
-                    throw new RemoteServiceException(preStr + "不能低于辅材资料最小进价范围值");
+                    throw new RemoteServiceException(preStr + "不能低于辅材资料最小进价范围值" + relaGoods.getCostRangeMini());
                 }
                 if (Objects.nonNull(relaGoods.getCostRangeMax())
                         && relaGoods.getCostRangeMax().compareTo(BigDecimal.ZERO) > 0
                         && itemBean.getCost().compareTo(relaGoods.getCostRangeMax()) > 0) {
-                    throw new RemoteServiceException(preStr + "不能高于辅材资料最大进价范围值");
+                    throw new RemoteServiceException(preStr + "不能高于辅材资料最大进价范围值" + relaGoods.getCostRangeMax());
                 }
                 itemBean.setInStockCost(itemBean.getCost());
                 itemBean.setInStockQty(itemBean.getRecQty().add(itemBean.getRecGiftQty()));

+ 2 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/manage/WebsitPurchaseAdjustmentLogic.java

@@ -224,12 +224,12 @@ public class WebsitPurchaseAdjustmentLogic {
             if (Objects.nonNull(goods.getCostRangeMini())
                     && goods.getCostRangeMini().compareTo(BigDecimal.ZERO) > 0
                     && item.getAdjustCost().compareTo(goods.getCostRangeMini()) < 0) {
-                throw new RemoteServiceException(preStr + "不能低于辅材资料最小进价范围值");
+                throw new RemoteServiceException(preStr + "不能低于辅材资料最小进价范围值" + goods.getCostRangeMini());
             }
             if (Objects.nonNull(goods.getCostRangeMax())
                     && goods.getCostRangeMax().compareTo(BigDecimal.ZERO) > 0
                     && item.getAdjustCost().compareTo(goods.getCostRangeMax()) > 0) {
-                throw new RemoteServiceException(preStr + "不能高于辅材资料最大进价范围值");
+                throw new RemoteServiceException(preStr + "不能高于辅材资料最大进价范围值" + goods.getCostRangeMax());
             }
 
             item.setAdjustInStockCost(item.getAdjustCost());

+ 5 - 4
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/manage/WebsitSalesLogic.java

@@ -584,7 +584,7 @@ public class WebsitSalesLogic {
     }
 
     public List<WebsitSalesGoodsVO> existStockGoods(String saleType, String websitId, String categoryId, WebsitGoodsTypeEnum type,
-                                                    String goodsName, String orderEnginBaseId) {
+                                                    String goodsName, String orderEnginBaseId, String storageId) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
         String companyId = "";
         if (Objects.nonNull(adminUser.getAdminCompanyWechat())) {
@@ -596,7 +596,7 @@ public class WebsitSalesLogic {
         }
         List<WebsitSalesGoodsVO> goodsList;
         if (type.getKey().equals(WebsitGoodsTypeEnum.M.getKey())) {
-            goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, null, null);
+            goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, null, null, storageId);
         } else {
             goodsList = materialMapper.notStockGoods(companyId, websitId, type.getKey(), goodsName);
         }
@@ -685,7 +685,8 @@ public class WebsitSalesLogic {
 
 
     public List<WebsitSalesGoodsVO> existStockGoodsList(String websitId, String categoryId, WebsitGoodsTypeEnum type,
-                                                        String goodsName, String goodsSpecification, String partType) {
+                                                        String goodsName, String goodsSpecification, String partType,
+                                                        String storageId) {
 
         AdminUserCom adminUser = commonLogic.getAdminUser();
         String companyId = "";
@@ -693,7 +694,7 @@ public class WebsitSalesLogic {
             companyId = adminUser.getAdminCompanyWechat().getCompanyWechatId();
         }
 
-        List<WebsitSalesGoodsVO> goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, goodsSpecification, partType);
+        List<WebsitSalesGoodsVO> goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, goodsSpecification, partType, storageId);
         if (CollectionUtil.isNotEmpty(goodsList) && WebsitGoodsTypeEnum.P.getKey().equals(type.getKey())) {
             for (WebsitSalesGoodsVO vo : goodsList) {
                 this.computeSalesPrice(companyId, vo);

+ 5 - 3
mall-server-api/src/main/resources/mapper/MaterialMapper.xml

@@ -255,19 +255,21 @@
         <if test="goodsSpecification!=null and goodsSpecification!=''">
             AND b.goods_specification LIKE CONCAT('%',#{goodsSpecification},'%')
         </if>
-          AND a.websit_id = #{websitId}
+            AND a.websit_id = #{websitId}
         <if test="goodsType!=null and goodsType!=''">
-
             AND a.goods_type = #{goodsType}
         </if>
         <if test="partType!=null and partType!=''">
             AND b.part_type = #{partType}
         </if>
+        <if test="storageId!=null and storageId!=''">
+            AND a.storage_id = #{storageId}
+        </if>
         <if test="goodsType=='P'.toString()">
             AND a.qty > 0
         </if>
         GROUP BY a.goods_id
-        LIMIT 100
+        LIMIT 200
     </select>
 
     <select id="notStockGoods" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesGoodsVO">