Переглянути джерело

Merge branch 'master' of http://101.37.21.97:3000/wash/wash_server_v2

lhch2015 1 місяць тому
батько
коміт
de207aef6b

+ 1 - 1
admin-ui/src/views/goods/commonGoods/index.vue

@@ -79,7 +79,7 @@
           </el-button>
         </template>
       </el-table-column>
-
+            <el-table-column label="库存" align="center" prop="goodsStockNum" width="120" />
       <el-table-column label="支付方式" align="center" width="150">
         <template slot-scope="scope">
           <div>

+ 7 - 7
admin-ui/src/views/system/store/add_store.vue

@@ -540,13 +540,13 @@ export default {
         //     trigger: 'blur'
         //   }
         // ],
-        contactIdcard: [
-          {
-            required: true,
-            trigger: 'blur',
-            validator: this.checkIdCardNumber
-          }
-        ],
+        // contactIdcard: [
+        //   {
+        //     required: true,
+        //     trigger: 'blur',
+        //     validator: this.checkIdCardNumber
+        //   }
+        // ],
         contactPhone: [
           {
             required: true,

+ 6 - 0
yiqi-common/src/main/java/com/yiqi/core/domain/vo/GoodsInfoQueryVO.java

@@ -161,4 +161,10 @@ public class GoodsInfoQueryVO extends BaseEntity {
     @ApiModelProperty("商品物料数量")
     private Long goodsItemNum;
 
+    /**
+     * 商品库存数量
+     */
+    @ApiModelProperty("商品库存数量")
+    private Long goodsStockNum;
+
 }

+ 33 - 0
yiqi-common/src/main/java/com/yiqi/core/domain/vo/GoodsSkuNumDto.java

@@ -0,0 +1,33 @@
+
+package com.yiqi.core.domain.vo;
+
+import com.yiqi.common.annotation.Excel;
+import com.yiqi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 商品管理对象 goods
+ *
+ * @author ruoyi
+ * @date 2023-08-21
+ */
+@ApiModel("商品管理")
+@Data
+public class GoodsSkuNumDto extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("商品物料数量")
+    private Long goodsItemNum;
+
+    /**
+     * 商品库存数量
+     */
+    @ApiModelProperty("商品库存数量")
+    private Long goodsStockNum;
+
+}

+ 2 - 1
yiqi-core/src/main/java/com/yiqi/core/mapper/GoodsSkuMapper.java

@@ -5,6 +5,7 @@ import java.util.Map;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yiqi.core.domain.dto.GoodsSkuDTO;
+import com.yiqi.core.domain.vo.GoodsSkuNumDto;
 import com.yiqi.core.domain.vo.GoodsSkuQueryVO;
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
@@ -149,7 +150,7 @@ public interface GoodsSkuMapper extends BaseMapper<GoodsSku> {
      * @param goodsId 商品id
      * @return 结果
      */
-    public Long getGoodsSkuNumsByGoodsId(@Param("goodsId") Long goodsId);
+    public GoodsSkuNumDto getGoodsSkuNumsByGoodsId(@Param("goodsId") Long goodsId);
 
     /**
      *

+ 10 - 0
yiqi-core/src/main/java/com/yiqi/core/mapper/GoodsSkuStoreMapper.java

@@ -2,6 +2,7 @@ package com.yiqi.core.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yiqi.core.domain.GoodsSkuStore;
+import com.yiqi.core.domain.vo.GoodsSkuNumDto;
 import com.yiqi.system.domain.ManageFactory;
 import com.yiqi.system.domain.SysStore;
 import org.apache.ibatis.annotations.Mapper;
@@ -152,4 +153,13 @@ public interface GoodsSkuStoreMapper extends BaseMapper<GoodsSkuStore> {
      * @return 结果
      */
     int addGoodsSkuStockNotCheckByStore(@Param("sourceType") String sourceType, @Param("orgId") Long orgId, @Param("skuId") Long skuId, @Param("buyNum") Integer buyNum);
+
+
+    /**
+     * 查询商品sku数量
+     *
+     * @param goodsId 商品id
+     * @return 结果
+     */
+    public GoodsSkuNumDto getGoodsStoreSkuNumsByGoodsId(@Param("goodsId") Long goodsId, @Param("storeId") Long storeId);
 }

+ 9 - 1
yiqi-core/src/main/java/com/yiqi/core/service/impl/GoodsInfoServiceImpl.java

@@ -18,6 +18,7 @@ import com.yiqi.core.domain.dto.GoodsInfoDto;
 import com.yiqi.core.domain.dto.GoodsUpdateSalesDTO;
 import com.yiqi.core.domain.dto.weapp.WeAppGoodsInfoQueryDTO;
 import com.yiqi.core.domain.vo.GoodsInfoQueryVO;
+import com.yiqi.core.domain.vo.GoodsSkuNumDto;
 import com.yiqi.core.domain.vo.weapp.WeAppGoodsInfoQueryVO;
 import com.yiqi.core.mapper.*;
 import com.yiqi.core.service.IGoodsInfoService;
@@ -103,7 +104,14 @@ public class GoodsInfoServiceImpl extends ServiceImpl<GoodsInfoMapper, GoodsInfo
     public List<GoodsInfoQueryVO> selectGoodsList(GoodsInfoQueryVO goodsInfoQueryVO) {
         List<GoodsInfoQueryVO> goodsInfoQueryVOList = baseMapper.selectGoodsList(goodsInfoQueryVO);
         for (GoodsInfoQueryVO goodsInfoQuery : goodsInfoQueryVOList) {
-            goodsInfoQuery.setGoodsItemNum(goodsSkuMapper.getGoodsSkuNumsByGoodsId(goodsInfoQuery.getId()));
+            GoodsSkuNumDto goodsSkuNumDto = goodsSkuMapper.getGoodsSkuNumsByGoodsId(goodsInfoQuery.getId());
+            goodsInfoQuery.setGoodsItemNum(goodsSkuNumDto.getGoodsItemNum());
+            goodsInfoQuery.setGoodsStockNum(goodsSkuNumDto.getGoodsStockNum());
+            //如果是门店权限,则查询门店的库存和物料数量
+            if (goodsInfoQuery.getSourceType().equals(SourceType.STORE.getCode())) {
+                GoodsSkuNumDto goodsStoreSkuNumDto = goodsSkuStoreMapper.getGoodsStoreSkuNumsByGoodsId(goodsInfoQuery.getId(), goodsInfoQuery.getTargetId());
+                goodsInfoQuery.setGoodsStockNum(goodsStoreSkuNumDto.getGoodsStockNum());
+            }
         }
         return goodsInfoQueryVOList;
     }

+ 3 - 3
yiqi-core/src/main/resources/mapper/core/GoodsSkuMapper.xml

@@ -329,9 +329,6 @@
         </if>
 
     </select>
-    <select id="getGoodsSkuNumsByGoodsId" resultType="java.lang.Long" parameterType="java.lang.Long">
-        select count(1) from goods_sku where goods_id = #{goodsId} and del_flag = 0
-    </select>
 
     <select id="selectGoodsSkuListByGoodsId" resultType="com.yiqi.core.domain.GoodsSku">
         select * from goods_sku where goods_id = #{goodsId} and del_flag = 0
@@ -352,6 +349,9 @@
             </if>
             group by st.goods_id
     </select>
+    <select id="getGoodsSkuNumsByGoodsId" resultType="com.yiqi.core.domain.vo.GoodsSkuNumDto">
+        select sum(stock) as goodsStockNum, count(1) as goodsItemNum from goods_sku where goods_id = #{goodsId} and del_flag = 0
+    </select>
 
     <update id="minusGoodsSkuStockByHq">
         update goods_sku set stock = stock - #{buyNum} where id = #{skuId} and status = '0' and stock >= #{buyNum}

+ 3 - 0
yiqi-core/src/main/resources/mapper/core/GoodsSkuStoreMapper.xml

@@ -50,6 +50,9 @@
             #{item}
         </foreach>
     </select>
+    <select id="getGoodsStoreSkuNumsByGoodsId" resultType="com.yiqi.core.domain.vo.GoodsSkuNumDto">
+        select sum(stock) as goodsStockNum, count(1) as goodsItemNum from goods_sku_store where  source_type = '02' and target_id = #{storeId} and goods_id = #{goodsId}
+    </select>
 
     <insert id="insertGoodsSkuStore" useGeneratedKeys="true"
             keyProperty="id">