Skip to content

计划一期先跑通多物料,二期加剩余功能 具体安排:优先处理完商品的改造(多物料来源;净菜标记外露)→ 并线进行采购的开发 / 计划的开发 / 领料,库存改造,最后做任务总览 这一期先保留站点的净菜配置,暂不把净菜逻辑通用化,先期完成的接口中,面板和半成品相关的接口这一次后端均无视,半成品相关前端交互全都屏蔽。 称重流程走毛菜逻辑,所有净菜商品都以标品处理。

商品库

product/sku/update 修改sku

参数修改
去掉purchase_spec_id和supplier_id
添加
clean_food M bool 是否净菜
remark_type M string 商品类型
ingredients 列表
[{
    id M string 物料ID
    supplier_id O 只有在商品类型是原料(采购规格)时才需要传
    proportion M float 配比(sku的销售单位vs原料的基本单位)
    remark_type M int 商品类型(1是采购规格,其他是sku)
    attrition_rate M float 损耗率
}]

product/sku_sale/create 创建sku

参数修改
去掉purchase_spec_id和supplier_id
添加
clean_food M bool 是否净菜
remark_type M string 商品类型
ingredients 列表
[{
    id M string 物料ID
    supplier_id O 只有在商品类型是原料(采购规格)时才需要传
    proportion M float 配比(sku的销售单位vs原料的基本单位)
    remark_type M int 商品类型(1是采购规格,其他是sku)
    attrition_rate M float 损耗率
}]

product/sku_sale/list 获取sku详情

原来已有 clean_food bool M 是否净菜
返回新增两个字段
remark_type int O “商品类型”1原料2配料3净料(还有啥)
ingredients 列表
[{
    technic_flow_len M int 工艺流长度
    id M string 物料ID
    'name': string M 原料名,
    'remark_type' int M 商品类型(1普通,2分装)
    'sale_unit_name' string M 销售单位
    'std_unit_name' string M 基本单位
    'ratio' float M 规格
    supplier_id O string 只有在商品类型是原料(采购规格)时才需要传
    supplier_name O string 供应商名
    proportion M float 配比
}]

process/technic_flow/create_technic

修改点:

新加一个参数
ingredient_id M string 原料ID

product/sku/ingredient/list 商品和采购规格搜索

Method: GET

请求:
    q string M 搜索内容
响应:
    code: 0
    msg: ok
    data:
    [{
        category1_name string M 一级分类名
        category2_name string M 一级分类名
        ingredients [{
            'id': string M 原料ID,
            'name': string M 原料名,
            'remark_type' int M 类型(1普通,2分装)
            'sale_unit_name' string M 销售单位
            'std_unit_name' string M 基本单位
            'ratio' float M 规格
        }]
    }]

process/technic_flow/get 工艺流详情

修改点:
新加一个参数
ingredient_id M string 原料ID

process/technic/update 工艺更新

process/technic/delete 工艺删除

查询工艺流做相应改动逻辑修改

todo列表返回规范

加工计划

process/process_order/create 加工计划新建

process/process_order/update

参数修改
原`batch_num`和`recv_amount`字段废弃,换成
```
ingredients O list 原料列表(传了表示需要领料,不传表示不要领,加权平均的都不领料)
[{
    "batch_num" string M 批次号
    "id" string M 原料ID
    "recv_amount" float M 领料数
}]
```
多物料逻辑修改,定重限制逻辑去掉

process/process_order/stock/get 加工计划商品当前库存

返回改成一个列表,支持多物料
返回改成:
    [{
        ingredient_id string M 原料ID
        ingredient_name string M 原料名
        ingredient_type int M 原料类型
        ingredient_stock float M 原料库存
        sale_unit_name string M 销售单位
        std_unit_name string M 基本单位
        ratio float M 规格
    }]

process/process_order/ingredient/avail_batch 加工计划商品原料可用批次

加权平均下返回空
参数添加
ingredient_id M 原料ID

process/process_order/task/list 加工计划对应的任务信息

前端屏蔽,后端不改

process/process_order/check 加工单状态

不改

process/process_order/list 加工计划列表

多物料逻辑修改,且暂时把返回结果里的tasks列表字段干掉

process/process_order/simple_search/list 入库信息中搜索加工单

GET
request
    q   M    str   搜索信息

response
    {
        'code': 0
        'msg': ok
        'data': [{
            'id'              加工单id
            'sku_id'
            'sku_name'
            'ratio'           销售系数
            'std_unit_name'   基本单位
            'sale_unit_name'  销售单位
            'price'           建议价格
        }]
    }

/station/stock/in_stock_sku/product_sku/list 成品入库搜索sku

GET
request
    q   M    str   搜索信息

response
[{
    'category_name_1'  一级分类名
    'category_name_2'  二级分类名
    'spu_name'         spu名
    'skus': [
        'id'    sku_id
        'name'  sku_name
    ]
}]

process/process_order/plan/export 加工计划导出(废弃,与下一个接口合并).

多物料逻辑修改

process/process_order/export 加工单导出

多物料逻辑修改,最好能和上面的接口合并成一个接口

process/process_order/print

多物料逻辑修改
response
    {
        'id': proc_order.id,
        'custom_id': proc_order.custom_id,
        'code': get_proc_order_code(proc_order.id),
        'sku_id'
        'sku_name'
        'std_unit_name'
        'sale_unit_name'
        'plan_amount'
        'finish_amount'
        'status'
        'start_time'
        'finish_time'
        'ingredient': [{
            'batch_num'
            'sku_id'
            'sku_name'
            'std_unit_name'
            'type': 1 原料 3 成品
            'ratio'
            'tasks': [{
                'id'
                'technic_flow_desc'
                'technic_flow_name'
            }]
        }]
    }

process/process_order/submit 下达加工单

    request
        proc_order_ids  M  list 加工单ids
    多物料逻辑修改,下达后,添加生成未领料的领料单逻辑

领料6个接口

process/process_order/ingredient_recv/list
process/process_order/ingredient_recv/export
process/process_order/ingredient_return/list
process/process_order/ingredient_return/export
process/process_order/ingredient_return/create
多物料逻辑修改
领料加出库记录
退料加入库记录

process/process_order/ingredient_recv/update 领料更新

Method: POST

请求:
    id M int 领料ID
    batch_num O string 批次号
    status O int 状态(2已领料)
    amount O float 领料数
    recver O int 领料人id

响应:
    code: 0
    msg: ok
    data

process/process_order/ingredient_recv/list 领料搜索

搜索逻辑添加加工单ID过滤
响应改成:
code: 0
msg: ok
data: [
  {
    id M int ID
    release_time M datetime 下达时间
    spu_id M string SPU_id
    ingredient_id M string 物料ID
    ingredient_name M string 物料名
    batch_num O string 批次号
    proc_order_id M int 加工单ID
    plan_recv_amount float M 计划领取数
    real_recv_amount float O 实际领取数
    unit_name string M 单位
    shelf_name string M 货位
    status int M 状态(1未领料,2已领料)
    recv_time datetime O 领料时间
  }
]
pagination: { M   dict    分页信息
    peek        O   int     实际peek到的条数。
    more     O   bool    是否到头,1:没有更多数据,0:有更多(默认)
    page_obj    M   string  当前页面对象,是一个字符串,作为下次查询的传入串,调用方不需要关心内容
}

/gm_account/station/user/search 搜索领料人

GET

reuqest
response
    {
        code: 0
        msg: ok
        data: {
            user: [{
                name    用户名
                id      用户id
            }]
        }
    }

process/process_order/check 新建退料单前拉取领料记录的接口

GET

request
    code O str 扫码传这个
    q    O str 搜索传这个

response
    {
        code: 0
        msg: ok
        data: [
            {
                'id'  领料id
                'sku_id'   商品id
                'name'    商品名
                'batch_num'    批次号
                'amount'    领料数
            }
        ]
    }

process/process_order/ingredient_return/create 创建退料单

POST
request
    return_list  M  list
    return_list = [{
        'recv_id' 领料id  str
        'amount'  退料数  float >0
    }]
response
    {
        code: 0
        msg: ok
        data:
    }

process/task/in_stock 入库商品(半成品或成品)

本期不改

process/process_order/get

多物料逻辑修改,且暂时把返回结果里的tasks列表字段干掉

采购

station/task/purchase/async_order 生成采购任务

递归拉采购规格逻辑,另外多物料后一个订单有可能存在相同采购规格的条目,需要分开存储,不可合并

搜索打印导出的相关接口

汇总逻辑修改

进销存

/station/stock/in_stock_sheet/product/create 新建成品入库单(新)

Method: POST

请求:
    proc_order_custom_id int O 加工单自定义ID
    proc_order_finish    bool O 是否将加工单标记为已完成
    batch_num string M 商品批次号
    sku_id string M sku_id
    amount float M 入库数
    shelf_id int O 库位
    price float M 入库单价

响应:
    code: 0
    msg: ok
    data:

成品入库单搜索

加参数 proc_order_custom_id string O 加工单自定义ID
加加工单ID字段过滤

成品出库

相关接口逻辑在净菜站点下要改成只能扣减成品库存,不能扣减原料库存

任务总览

process/order_request/list 任务总览搜索

Method: GET

请求:
    status int O 0全部任务1未发布2已发布
    time_config_id M string 运营时间配置ID
    begin_time M datetime 开始时间
    end_time M datetime 结束时间
    [注]:可参考[分页规范详解](https://doc.guanmai.cn/模块文档/分页/)
    page_obj    O   string  起始页(不包含),默认第0页
    reverse     O   bool    是否反向查询。1:是,0:不是。默认为否。
    limit       O   int     返回条数,默认10。传0表示返回所有数据。
    offset      O   int     查询起点偏移条数,默认 0 [注1]
    peek        O   int     是否需要 pick,默认 false;peek 必须大于 limit。
    count       O   bool    是否需要 count,默认 false (部分接口可能不实现本功能, 因为如果数据量极大,count 会很耗时)

响应:
    code: 0
    msg: ok
    data: [{
        "sku_id":   M   string  SKUID
        remark_type M int 商品类型
        "name":     M   string  商品名
        "pinlei_name"   M   string  品类名
        "category2_name"    M   string  分类名
        "category1_name"    M   string  一级分类名
        "sale_unit_name"    M   string  基本单位
        "sale_ratio"    M   float   销售比例
        "plan_amount"  M   float    下单数
        "release_time"  O   datetime    发布时间
        "status"    M   int     任务状态
        "release_id"    O   int     发布ID
        "std_unit_name"     O   string  标准单位
        "stock": float 库存数量
        "tasks": [{     M   list    任务详情列表
            "id"    M   int     任务ID
            order_id M string 订单ID
            "resname"    M   string  商户名
            order_amount M float 下单数
            sort_id M int 分拣序号
            order_status M int 订单状态
        }]
    "release_amount": float M  计划生产数(即发布数)
    }]

     "pagination": {                        M   dict
        "peek": 100,                        O   int     前端传 peek 的话,后端就会返回这个字段
        "more": true,                       M   bool    是否有更多数据
        "page_obj": "gtyuhbgyhbvgyhgvgy",   M   string
        "count": 2000                       O   int     前端传 count 的话,后端就会返回这个字段
    }

process/order_request/release 任务发布

Method: POST

请求:
    time_config_id M string 运营时间配置ID
    begin_time M datetime 开始时间
    end_time M datetime 结束时间
    skus M list [
        {
            sku_id string M sku_id
            amount float M 计划生产数
        }
    ]

响应:
    code: 0
    msg: ok
    data:

process/order_request/async_order 订单异步同步任务接口

Method: POST

请求:
    id string M 订单号
    serial string M 序列号

响应:
    code: 0
    msg: ok
    data:

逻辑参考采购任务同步接口