Răsfoiți Sursa

新增库存预警信息

liuyao 1 an în urmă
părinte
comite
c36ef38aa5

+ 5 - 1
src/main/java/com/dk/mdm/mapper/ivt/InventoryMapper.xml

@@ -57,7 +57,7 @@
                 <result column="cp_id" property="cpId"/>
                 <result column="sku_code" property="skuCode"/>
                 <result column="sku_name" property="skuName"/>
-                  <result column="sku_spec" property="skuSpec"/>
+                <result column="sku_spec" property="skuSpec"/>
                 <result column="sku_model" property="skuModel"/>
                 <result column="brand_name" property="brandName"/>
                 <result column="short_name" property="shortName"/>
@@ -75,6 +75,8 @@
         <result column="seriesName" property="seriesName"/>
         <result column="catName" property="catName"/>
         <result column="price_other" property="priceOther"/>
+        <result column="warning_upper_limit" property="warningUpperLimit"/>
+        <result column="warning_lower_limit" property="warningLowerLimit"/>
         <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
     </resultMap>
@@ -165,6 +167,8 @@
         ,tmgs.sku_images
         ,tmgs.unit_id
         ,tmgs.sub_unit_id
+        ,tmgs.warning_upper_limit
+        ,tmgs.warning_lower_limit
         ,tmgs.pack_box
         ,tmu.unit_name    AS "unitName"
         ,subtmu.unit_name AS "subUnitName"

+ 18 - 9
src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml

@@ -8,7 +8,7 @@
         sku_id, sku_code, sku_name, sku_model, brand_id, category_id, unit_id, sub_unit_id, conversion_factor
         , series_id, sku_spec, price_purchase, price_standard, price_wholesale, price_limited, price_other,sku_images
         , remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id
-        , op_app_code, op_timestamp, op_db_user
+        , op_app_code, op_timestamp, op_db_user, warning_upper_limit, warning_lower_limit
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -30,18 +30,20 @@
                 <result column="price_limited" property="priceLimited"/>
                 <result column="price_other" property="priceOther"/>
                 <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
+                <result column="warning_lower_limit" property="warningLowerLimit"/>
+                <result column="warning_upper_limit" property="warningUpperLimit"/>
                 <result column="remarks" property="remarks"/>
-        <result column="flg_valid" property="flgValid"/>
-        <result column="flg_sub_unit" property="flgSubUnit"/>
-        <result column="flg_opening_inv" property="flgOpeningInv"/>
-        <result column="flg_price" property="flgPrice"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="flg_sub_unit" property="flgSubUnit"/>
+                <result column="flg_opening_inv" property="flgOpeningInv"/>
+                <result column="flg_price" property="flgPrice"/>
                 <result column="cp_id" property="cpId"/>
-            <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
                 <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
-            <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
                 <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
                 <result column="op_app_code" property="opAppCode"/>
-            <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+                <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
                 <result column="op_db_user" property="opDbUser"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
     </resultMap>
@@ -49,7 +51,8 @@
     <sql id="Base_Column_List_JOIN">
         tmgs.price_other,tmgs.sku_id, tmgs.sku_code, tmgs.sku_name, tmgs.sku_model, tmgs.brand_id, tmgs.category_id, tmgs.unit_id, tmgs.sub_unit_id,
               tmgs.conversion_factor, tmgs.series_id, tmgs.sku_spec, tmgs.price_purchase, tmgs.price_standard,
-           tmgs.pack_box,   tmgs.price_wholesale, tmgs.price_limited, tmgs.price_other,tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.flg_sub_unit,  tmgs.flg_opening_inv,  tmgs.flg_price,  tmgs.cp_id
+           tmgs.pack_box,   tmgs.price_wholesale, tmgs.price_limited, tmgs.price_other,tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.flg_sub_unit,  tmgs.flg_opening_inv,  tmgs.flg_price,  tmgs.cp_id,
+        tmgs.warning_lower_limit, tmgs.warning_upper_limit
     </sql>
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.GoodsSkuResponse">
         <id column="sku_id" property="skuId"/>
@@ -87,6 +90,8 @@
         <result column="decimalPlaces" property="decimalPlaces"/>
         <result column="intoing_box" property="box" />
         <result column="intoing_piece" property="piece" />
+        <result column="warning_lower_limit" property="warningLowerLimit"/>
+        <result column="warning_upper_limit" property="warningUpperLimit"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -290,6 +295,8 @@
             remarks,
             cp_id,
             op_app_code,
+            warning_lower_limit,
+            warning_upper_limit
         </trim>
         )
         values
@@ -314,6 +321,8 @@
                 #{item.remarks},
                 #{item.cpId},
                 #{item.opAppCode},
+                #{item.warningLowerLimit},
+                #{item.warningUpperLimit}
             </trim>
             )
         </foreach>

+ 7 - 0
src/main/java/com/dk/mdm/model/pojo/mst/GoodsSku.java

@@ -309,6 +309,13 @@ public class GoodsSku extends PageInfo<GoodsSku> implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
 
     private static final long serialVersionUID = 1L;
 

+ 2 - 0
src/main/java/com/dk/mdm/model/query/ivt/InventoryQuery.java

@@ -152,6 +152,8 @@ public class InventoryQuery extends PageInfo<InventoryQuery>{
     private String desc;
 
     private Boolean invQtyFlag;
+
+    private Boolean winning;
     /*
      * 相关属性
      * @TableField(exist = false)

+ 7 - 0
src/main/java/com/dk/mdm/model/query/mst/GoodsSkuQuery.java

@@ -309,6 +309,13 @@ public class GoodsSkuQuery extends PageInfo<GoodsSku> implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
 
     private static final long serialVersionUID = 1L;
 

+ 9 - 0
src/main/java/com/dk/mdm/model/response/ivt/InventoryResponse.java

@@ -285,6 +285,15 @@ public class InventoryResponse {
     @TableField(exist = false)
     private Integer decimalPlaces;
 
+    // 警戒上限
+    private Long warningUpperLimit;
+    // 警戒下限
+    private Long warningLowerLimit;
+
+    /**
+     * 库存预警消息
+     * */
+    private String warningMsg;
 
     private static final long serialVersionUID = 1L;
 

+ 7 - 0
src/main/java/com/dk/mdm/model/response/mst/GoodsSkuResponse.java

@@ -387,6 +387,13 @@ public class GoodsSkuResponse implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
 
     private static final long serialVersionUID = 1L;
 

+ 8 - 0
src/main/java/com/dk/mdm/model/vo/mst/GoodsSkuVO.java

@@ -337,6 +337,14 @@ public class GoodsSkuVO implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
+
 
     private static final long serialVersionUID = 1L;
 

+ 28 - 1
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -101,7 +101,34 @@ public class InventoryService extends BaseService<Inventory> {
      */
     @Pagination
     public ResponseResultVO<PageList<InventoryResponse>> selectByCond(InventoryQuery inboundQuery) {
-        return super.mergeListWithCount(inboundQuery, inventoryMapper.selectByCond(inboundQuery), inventoryMapper.countByCond(inboundQuery));
+
+        ResponseResultVO<PageList<InventoryResponse>> pageListResponseResultVO = super.mergeListWithCount(inboundQuery, inventoryMapper.selectByCond(inboundQuery), inventoryMapper.countByCond(inboundQuery));
+        if (inboundQuery.getWinning()!=null && inboundQuery.getWinning() == true){
+            PageList<InventoryResponse> data = pageListResponseResultVO.getData();
+            List<InventoryResponse> list = data.getList();
+            List<InventoryResponse> newList = list.stream().filter(item ->
+                    (
+                            item.getWarningLowerLimit()!= 0
+                            || item.getWarningUpperLimit() != 0)
+                            && (item.getInvQty().longValue()>item.getWarningLowerLimit()
+                            || item.getInvQty().longValue()>item.getWarningUpperLimit())
+                    ).collect(Collectors.toList());
+            newList.forEach(item -> {
+                int invQty = item.getInvQty().intValue();
+                Long warningLowerLimit = item.getWarningLowerLimit();
+                Long warningUpperLimit = item.getWarningUpperLimit();
+                if (invQty > warningLowerLimit){
+                    item.setWarningMsg("超出警戒上限");
+                }
+                if (invQty > warningUpperLimit){
+                    item.setWarningMsg("超出警戒下限");
+                }
+            });
+            data.setList(newList);
+            pageListResponseResultVO.setData(data);
+        }
+
+        return pageListResponseResultVO;
     }