Skip to content

采购app迭代

数据库修改

tbl_quoted_price

id
spu_id
std_unit_price
std_unit_name
create_time
time_config_id
cycle_start_time
modify_time
remark
extra_1
extra_2
station_id
purchaser_id
新增
spec_id
  • 刷数据库:历史数据的询价是定义在spu级别上的,现在将这个spu下面的所有采购规格刷入询价表里面。

新增接口

搜索任务

/purchase_assistant/task/search

Method
    GET
请求
    settle_supplier_id  O   list  供应商ID
    time_config_id    M   string  时间配置ID
    cycle_start_time  M   datetime  周期开始时间
    status  O   int 任务状态
    sort_type O INT 可选值为(1,2,3) 1代表时间倒序排,2代表按供应商排序,3代表按商品排序
                        不填默认按时间倒序排序。
响应
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   string  返回json数据

    [{
        'spec_id': 'xxxx'  规格id
        'spec_name': 'xxxx' 规格名称
        'purchase_amount': float 已采购数量
        'plan_amount': float 计划采购数量
        'supplier_name': 'xxxx' 供应商名字
        'purchase_price': float 采购单价
        'std_unit_name': 'xxx' 基本单位
        'purchase_unit_name': 'xxx' 采购单位
        'release_time': 'xxx' 发布时间
        'status': INT 1代表完成,0代表未完成
        'release_id': str 任务id
        'ratio': float 转化率
        'supplier_id': str 供应商id
    },
    ...]

获取过滤参数

/purchase_assistant/settle_supplier/get

请求: get
传入参数:
        无
响应:
      {
        code: 0
        msg: ok
        data: {
          [{'settle_supplier_id': 'T100', 'supplier_name': '供应商A'},
           {'settle_supplier_id': 'T101', 'supplier_name': '供应商B'},
          ...]
        }
      }

比较询价

/purchase_assistant/settle_suppliers/compare_quoted_price

请求:get
传入参数:
    sepc_id M string
响应:
    {
      code: 0,
      msg: ok
      data: [{
      supplier_name: 'xxxx'
      quoted_price: 0.8 float
      std_unit_name: 'xxx'
      },
      ...]
    }

拉取供应商询价信息

/purchase_assistant/quoted_settle_suppliers

  • 以前存在的url

请求: get
传入参数:
         无
响应:
    {
      code: 0
      msg: ok
      data: [{
        "supplier_id": "T100",
        "supplier_name": "xxxx",
        "spec_nums": 100,
        "todo_tasks": 50
      }...]
    }

改url

获取供应商具体商品

/purchase_assistant/supplier/get_specs

请求: get
传入参数:
      supplier_id M string
      with_task M 0表示所有商品,1表示任务商品
      from O string 查询起始行,不传默认第0行
      offset O INT 起始行偏移量,不传默认为0
      limit O INT 查询到的条数,不传默认20
      peek O INT 希望窥探的条数,不传就不给窥探
      reverse O INT 是否倒序查 1表示倒序, 0表示正序
响应:
      {
        code: 0,
        msg: ok,
        data[
          {
            "spec_name": "xxxx",
            "spec_id": "D1000",
            "price": 100,
            "std_unit_name": "斤",
            "purchaser_name": "xxxx", 可能没有
            "quoted_time": "xxxxx", 询价时间,可能没有
            "with_task": 1代表是任务商品,0代表非任务商品,
            "remark": "xxxx",
            "origin_place": "xxxx", 产地
            "release_time": M datetime 任务发布时间
            "task_info": [{"plan_amount": float, 
                          "std_unit_name": str, 
                          "release_time": datatime 任务发布时间,
                          "price": int 价格}] 如果是非任务商品 该字段为[]
          }
            "quoted_time": M datetime 没有的话为""
        ...
        ],
        pagination: {
            more     M   bool    是否到头,1:没有更多数据,0:有更多(默认)
            page_obj  M 一个对象
        }
      }

创建采购单

purchase_assistant/purchase_sheet/create

請求:POST
    data: [{'spec_id': 'xxx', 'purchase_price': float, 'purchase_amount': float}, ...] M list
    supplier_id M string 供应商id
响应:
    {
      code: 0
      msg: ok
      data: {
          "sheet_no": "xxxx"
      } 
    }

录入商品询价

purchase_assistant/edit_quoted_price

Method
    POST
请求
    spec_id  M   string  SPU ID
    price   M   int 报价
    remark  O   string  备注
    origin_place O string 产地
    settle_supplier_id M string 结算供应商
响应
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    无

统一开单接口

/purchase_assistant/purchase_sheet/unified_create

Method 
    POST
请求
    release_ids: M list 需要发布的任务release_id
    cycle_start_time: M datetime
    time_config_id: M str
响应
    code: 0
    msg: ok
    data: null

批量提交采购单

/station/stock/purchase_sheet/batch_submit

Method 
    POST
请求
    sheet_nos: ['xx1', 'xx2', ....]
响应:
    code: 0
    msg: ok
    data: null

删除采购单

/station/stock/purchase_sheet/delete

Method
    POST
请求:
    sheet_no M string 采购单id
响应
    code: 0
    msg:ok
    data:null

更新采购单里的采购任务

/station/stock/purchase_sku/update

Method
    post
请求:
    sheet_no M string 采购单id
    id M string 采购任务id
    purchase_price O int 采购单价
    purchase_amout O float 采购数量
响应:
    code: 0
    msg: ok
    data:null

删除采购单中的采购任务

/station/stock/purchase_sku/delete

Method
    POST
请求
    sheet_no M string 采购单id
    id M string 采购任务id
响应:
    code: 0
    msg: ok
    data: null

完成任务

/station/task/purchase/finish_task

Method
    POST
请求:
    release_ids: ['xx1', 'xx2', ...]
响应:
    code: 0
    msg: ok
    data:null

拉取采购单详情

/station/stock/purchase_sheet/details

Method
    GET
请求:
    sheet_no M string 采购单id
响应
    code: 0
    msg: ok
    data: {"tasks": [{
                    'id': 'xxxx', ## 采购任务id
                    'release_id': 'xxxx' ## 任务发布id
                    'spec_name': 'xxxx' ## 规格名字
                    'spec_id': 'xxx' ## 规格id
                    'purchase_amount': float ## 采购数量
                    'std_unit_name': 'xxx' ## 基本单位
                    'ratio':  float ## 转化率
                    'purchase_unit_name': 'xxx' ## 采购单位
                    'purchase_price': float 采购单价
                    'category_name_1': 'xxx' 一级分类名字
                    'category_name_2': 'xxx' 二级分类名字
                    'release_time': 'xxxx' 任务发布时间
                    'plan_amount': float 计划采购量
                }...],
          "purchase_sheet": {
              "create_time": datetime 创建时间
              "submit_time": datetime 提交时间
              "status": 采购单状态
              "settle_supplier_id": 结算供应商id
              "operator": 操作员
              "station_name": 站点名字
          }

采购单信息修改

/purchase_assistant/purchase_sheet_modify/

    Method
        POST
    请求
        purchase_sheet_id   M   采购单id
        settle_supplier_id  M   供应商id
        details: [
                {
                    "purchase_price"  M   采购价格
                    "spec_id"  M   采购规格id
                    "purchase_amount"     M   采购数量,
                    "id"       O       唯一标示
                }
            ]

    响应
        code    M   int     返回码,0表示成功,其他表示错误
        msg     M   string  错误信息
        data    M   string  返回json数据

拉取这个供应商的供应商品

/station/stock/settle_supplier/supply_sku

    Method
        GET
    请求
        settle_supplier_id M 供应商id
        name O 供应商名字
    响应
        code    M   int     返回码,0表示成功,其他表示错误
        msg     M   string  错误信息
        data    M  [{
            'settle_supplier_name': M str,
            'sale_ratio': M float,
            'spec_name': M str,
            'spu_name': M str,
            'spec_id': M str,
            'sale_unit_name': M str,
            'std_unit_name': M str,
            'station_id': M str,
            'settle_supplier_id': M str,
            'purchase_price_limit': M float,
            'category_id_1': M str,
            'category_id_1_name': M str,
            'category_id_2': M str,
            'category_id_2_name': M str,
            'price': M float,
            'plan_amount': None

        }
        ...]

采购任务生成采购单

/station/task/purchase/create_sheet

    Method
        POST
    请求
        release_ids  O  list    发布ID列表
        cycle_start_time  M   datetime  周期时间
        time_config_id  M   string  时间配置ID
        category1_ids  O   list  一级分类ID
        category2_ids  O   list  二级分类ID
        pinlei_ids  O   list    品类ID
        settle_supplier_id  O   string  供应商ID
        status  O   int     任务状态
        order_status  O     int     订单状态
    响应
        code    M   int     返回码,0表示成功,其他表示错误
        msg     M   string  错误信息
        data   采购单ID
    逻辑
        1. 过滤采购任务
        2. 获取报价信息
        3. 按所属供应商分组生成采购单
            1. 没有绑定采购员的供应商不允许生成采购单
            2. 生成采购单商品采购明细
            3. 同步更新采购任务

提交采购单

/station/stock/purchase_sheet/submit

Method
    POST
请求
    sheet_no M string 采购单单号
响应
    code: 0
    msg: ok
    data[
        {
            "release_id": 'xxxx',
            "spec_id": "xxxx",
            "spec_name": "xxxxx",
            "ratio": 0.8,
            "std_unit_name": "xxxx",
            "purchase_unit_name": "xxx",
            "plan_amount": 100.4, ## 计划采购
            "already_purchased_amount": 200.5, ## 已采购
            "release_time": datetime,
            "supplier_name": str 供应商名字
        }
        ...
    ]
如果有已完成的任务,返回已完成任务的id
    code: 2
    msg: ok
    data:[
        'id1', 'id2', ...
    ]

拉去采购单列表

/purchase_assistant/purchase_sheets

Method
    GET
请求
    supplier_ids O list 供应商列表
    sort_type O int 1代表按时间倒序, 2代表按供应商名字排序, 3代表按状态排序 默认为1
    status O int 0代表所有状态,2代表提交状态, 3代表编辑状态
响应
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   string  返回json数据
    [
        {
          "settle_supplier_name": "现金直采(郭航)",   # 供应商名字
          "id": "T002-CGD-2017-04-06-00003",    # 采购单
          "spec_nums": 2,      # 商品数
          "spec_money": 100      # 金额
          "create_time": datetime
          "status": 采购单状态 2为提交状态,3为编辑状态
    ]