Skip to content

station

修改接口

/station/stock/edit

接口名: /station/stock/edit
Method: POST
请求参数:
    spu_id M string 
    remark O string
    threshold O float spu安全库存 新增  
    new_stock O float  spu库存
    threshold_using O int 1:设置,2:不设置 
    new_stock和threshold_using两个可选参数必须传一个,当threshold_using为1时,threshold必须传值
响应: 略
新增逻辑:
    当用户进行安全库存设置时,数据库stock_new里需要同步设置threshold和threshold_remain_difference字段。
    threshold_remain_difference=remain-threshold。

/station/stock/get

接口名:/station/stock/get
Method: GET
请求参数:略
响应:   
     code
     msg
     data [
     {
            ...
            threshold M float 安全库存,spu未设置安全库存,传null  新增
            threshold_remain_difference M float 库存与安全库存的差值,无值时,传null
        },],
        pagination: {
            count 
            limit
            offset
        }
新增逻辑:
    返回数据,会把库存值小于安全库存的优先返回,并根据库存和安全库存的差值进行降次排序。

新增接口

接口名: /station/stock/warning 
Method: GET
请求参数:无
响应:
    code M int 
    msg M string    
    data M str 值:'存在库存小于安全库存的商品'和'不存在库存小于安全库存的商品'

逻辑:
    当用户存在安全库存预警的权限时,会去判断商品的库存是否小于安全库存。

数据库中间层操作

更改函数

函数:         
    update_stock_in、update_stock_in_amount、update_stock_out_nolock
新加逻辑:
    当前文档里存在 threshold_remain_difference字段,那么当进行库存(remain)更新时,同样需要对 threshold_remain_difference进行更新。

新增函数

函数:
    update_security_stock_in
逻辑:
    设置文档的security_stock字段,同时设置security_remain_difference设置。

数据库表

xnn_core_product

auth_permission[mysql]
权限表里添加安全库存预警的权限(get_stock_threshold_warning)和录入安全库存权限(edit_stock_threshold)

stock_new[mongo]
库存表里添加两个字段
 threshold_remain_difference 库存与安全库存的差值
 threshold 阈值(安全库存),当阈值为-99999.99时,表示当前不设置安全库存。