Skip to content

进销存二期

数据库改动点

sku_product 商品信息表

新增库存类型字段stock_type (0:使用上游库存,1:设定库存值,2:同步进销存库存) 老字段stock_is_valid废弃,同步数据到新字段

stock 库存表

新增冻结库存数量 freeze 冻结库存数 是否记录冻结库存来源

接口改动

/station/skuproducts/stocks sku库存设置

老的页面替换为新接口

  1. 拉取库存数据 /product/stocks/list
  2. 设置库存 /product/stocks/edit
  3. 拉取库存流水 /product/stocks/flow

/product/sku_sale/create 新建销售sku

stock_type M int 设置库存(0:读取上游库存;1:不设置库存;2:设置库存;3:同步进销存库存)
stocks O int 库存数量(stock_type为2时表示库存数量)

/product/sku/update 更新sku

stock_type M int 设置库存(0:读取上游库存;1:不设置库存;2:设置库存;3:同步进销存库存)
stocks O int 库存数量(stock_type为2时表示库存数量)

/product/sku_sale/list 获取spu下的售卖商品信息

stock_type M int 设置库存(0:读取上游库存;1:不设置库存;2:设置库存;3:同步进销存库存)
stocks O int 库存数量(stock_type为2时表示库存数量)

/merchandise/spu/index spu索引

stock_type M int 设置库存(0:读取上游库存;1:不设置库存;2:设置库存;3:同步进销存库存)
stocks M int 库存数量(stock_type为2时表示库存数量)

/station/stock/get_stocks 库存展示增加冻结库存

/product/stocks/list 拉取库存信息

接口名: /product/stocks/list
Method: GET
请求:
    salemenu_id M string 销售单ID
    category1_id O string 一级分类ID
    category2_id O string 二级分类ID
    offset O int 偏移个数 默认0
    limit O int 返回数量 默认10
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的sku信息
    [{
        id M string 商品ID,
        name M string 商品名称
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名
        category_id_2 M string 二级分类ID
        category_name_1 M string 二级分类名
        stocks_type M int 库存类型(0:读取上游库存;1:不设置库存;2:设置库存;3:同步进销存库存)
        remain_stocks M int 剩余库存
        sale_unit_name M string 销售单位
        unit_name M string 标准单位
        unit_price M string 标准单价
        sale_ratio M float 规格
        sale_price M string 售卖价
        state M int 状态(1:上架;0:下架)
        outer_id M string 自定义编码
   }]

/product/stocks/edit 修改库存

接口名: /product/stocks/edit
Method: POST
请求:
    sku_id M string 商品ID
    stock_type M int 库存类型(0:读取上游库存;1:不设置库存;2:设置库存;3:同步进销存库存)
    amount O int 库存设置值
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M dict 返回的库存信息
    {
        remain_stocks M int 剩余库存值
        change_stock M int 变动库存值
    }

/product/stocks/flow 获取库存流水

接口名: /product/stocks/flow
Method: GET
请求:
    sku_id M string 商品ID
    start_time O string 开始时间('YYYY-mm-dd')
    end_time O string 结束时间('YYYY-mm-dd')
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的库存流水信息
    [{
        sku_id M string 商品ID
        product_name M string 商品名称
        create_time M string 操作时间
        sale_std M string 规格
        sale_unit_name M string 库存单位
        flow_detail M string 库存明细
        new_stocks M float 变动后库存值
        old_stocks M float 变动前库存值
    }]

/station/stock/out_stock_sheet/submit/batch GET 获取要批量出库的出库单数量

接口名: /station/stock/out_stock_sheet/submit/batch
Method: GET
请求:
    type M int 查询类型(1:出库时间;2:建单时间;3:运营周期)
    start O string 开始时间('YYYY-mm-dd')
    end O string 结束时间('YYYY-mm-dd')
    time_config_id O string 时间配置
    cycle_start_time O string 结束时间('YYYY-mm-dd HH:MM')
    cycle_end_time O string 结束时间('YYYY-mm-dd HH:MM')
    search_text O string 搜索内容
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M int 返回搜索到的出库单数量

/station/stock/out_stock_sheet/submit/batch POST 批量出库

接口名: /station/stock/out_stock_sheet/submit/batch
Method: POST
请求:
    type M int 查询类型(1:出库时间;2:建单时间;3:运营周期)
    start O string 开始时间('YYYY-mm-dd')
    end O string 结束时间('YYYY-mm-dd')
    time_config_id O string 时间配置
    cycle_start_time O string 结束时间('YYYY-mm-dd HH:MM')
    cycle_end_time O string 结束时间('YYYY-mm-dd HH:MM')
    search_text O string 搜索内容
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M dict 返回出库的
    {
        'success' M list 成功的出库单ID列表
        'failed' M list 失败的出库单ID列表
    }

逻辑改动

  1. 拉取库存逻辑兼容新的库存类型(bshop和station)
  2. 订单生成出库单,订单更新与出库单同步
  3. 称重同步更新出库记录中库存数量
  4. 下单更新销售库存,兼容新的库存类型

成品盘点

/station/stock/get 获取库存信息

接口名: /station/stock/get
Method: GET
请求:
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的库存信息
    [{
        spu_id M string 商品ID
        name M string 商品名
        station_id M string 站点ID
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        remain M float 剩余库存
        avg_price M float 均价
    }]

/station/stock/check/template 获取库存模板

接口名: /station/stock/check/template
Method: GET
请求:
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
响应:
    excel文件

/station/stock/check/upload 上传库存修改Excel

接口名: /station/stock/check/upload
Method: POST
请求:
    file M excel 库存文件
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的库存信息
    [{
        spu_id M string 商品ID
        name M string 商品名
        category_name_1 M string 一级分类名称
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        old_stock M float 现有库存
        new_stock M float 新库存
        avg_price M float 均价
    }]

/station/stock/check/batch 批量修改库存

接口名: /station/stock/check/batch
Method: POST
请求:
    stock_details list M 库存信息
    [{
        spu_id M string 商品ID
        new_stock M float 库存值
        remark O string 备注信息
    }]
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

/station/stock/edit 编辑库存

接口名: /station/stock/edit
Method: POST
请求:
    spu_id M string 商品ID
    new_stock M float 库存值
    remark O string 备注信息
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

/station/stock/in_stock_sku 获取入库记录

接口名: /station/stock/in_stock_sku
Method: GET
请求:
    begin M string 开始时间(YYYY-MM-DD)
    end M string 结束时间(YYYY-MM-DD)
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的入库信息
    [{
        sku_id M string 商品ID
        spu_id M string 商品ID
        name M string 商品名
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        sheet_no M string 入库单号
        in_stock_amount M float 入库数
        price M float 入库单价(分)
        type M int 入库类型(1:'正常入库', 2:'补货入库')
        submit_time M string 入库时间
        operator M string 操作人
    }]

/station/stock/out_stock_sku 获取出库记录

接口名: /station/stock/out_stock_sku
Method: GET
请求:
    begin M string 开始时间(YYYY-MM-DD)
    end M string 结束时间(YYYY-MM-DD)
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的出库信息
    [{
        sku_id M string 商品ID
        spu_id M string 商品ID
        name M string 商品名
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 基本单位
        sale_unit_name M string 售卖单位
        out_stock_base M float 出库数基本单位
        out_stock_sale M float 出库数销售单位
        price M float 入库单价(分)
        type M int 入库类型(1:'正常出库', 2:'补货出库')
        order_id M string 出库单号
        create_time M string 出库时间
        operator M string 操作人
        outer_id M string 自定义编码
    }]

/station/stock/return_supply_sku 获取退货记录

接口名: /station/stock/return_supply_sku
Method: GET
请求:
    begin M string 开始时间(YYYY-MM-DD)
    end M string 结束时间(YYYY-MM-DD)
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的入库信息
    [{
        sku_id M string 商品ID
        spu_id M string 商品ID
        name M string 商品名
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        sheet_no M string 入库单号
        in_stock_amount M float 入库数
        price M float 入库单价(分)
        type M int 入库类型(1:'正常入库', 2:'补货入库')
        submit_time M string 入库时间
        operator M string 操作人
    }]

/station/stock/increase 获取报溢信息

接口名: /station/stock/increase
Method: GET
请求:
    begin M string 开始时间(YYYY-MM-DD)
    end M string 结束时间(YYYY-MM-DD)
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的报溢信息
    [{
        spu_id M string 商品ID
        name M string 商品名
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        increase_amount M float 报溢数
        price M float 报溢单价
        old_stock M float 抄盘数
        operator M string 操作人
        create_time M string 时间
        remark M string 备注
    }]

/station/stock/loss 获取报损信息

接口名: /station/stock/loss
Method: GET
请求:
    begin M string 开始时间(YYYY-MM-DD)
    end M string 结束时间(YYYY-MM-DD)
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的报损信息
    [{
        spu_id M string 商品ID
        name M string 商品名
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        loss_amount M float 报损数
        price M float 报损单价
        old_stock M float 抄盘数
        operator M string 操作人
        create_time M string 时间
        remark M string 备注
    }]

/station/stock/refund_stock_sku 获取退货入库信息

接口名: /station/stock/refund_stock_sku
Method: GET
请求:
    begin M string 开始时间(YYYY-MM-DD)
    end M string 结束时间(YYYY-MM-DD)
    category_id_1 O string 一级分类ID
    category_id_2 O string 二级分类ID
    text O string 商品名或者商品ID
    offset O int 偏移量 默认0
    limit O int 限制数量 默认10
    export O int 是否导出(1:导出;2:不导出) 默认0
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的退货入库信息
    [{
        spu_id M string 商品ID
        name M string 商品名
        category_id_1 M string 一级分类ID
        category_name_1 M string 一级分类名称
        category_id_2 M string 二级分类ID
        category_name_2 M string 二级分类名称
        std_unit_name M string 单位
        in_stock_amount M float 入库数
        price M float 入库单价
        order_id M string 订单ID
        operator M string 操作人
        create_time M string 时间
        accept_std_count M float 销售数量
        std_sale_price M float 销售价格
    }]