分拣进度页面
db变动
mysql
新增
tbl_sorting_collect
| 字段 | 备注 |
| -------------- | ------ |
| id | 主键id |
| station_id | 站点id |
| order_id | 订单id |
| time_config_id | 时间配置 |
| start_date | 周期开始日期 |
| total | 总任务数 |
| finished | 已完成数 |
| out_of_stock | 缺货数 |
| weight_count | 计重任务 |
| unweight_count | 不计重任务 |
| address_id | 商户id |
| sku_ids | sku_id 列表json |
tbl_sorting_category_collect
| 字段 | 备注 |
| -------------- | ------ |
| id | 主键id |
| station_id | 站点id |
| time_config_id | 时间配置 |
| start_date | 周期开始日期 |
| total | 总任务数 |
| finished | 已完成数 |
| out_of_stock | 缺货数 |
| category_count | 商品种类数 |
/weight/weight_collect/weight_info/get 分拣进度获取展示数据
接口名: /weight/weigh_collect/weight_info/get
Method: GET
请求:
time_config_id M str 运营周期id
target_date M str 运营日期
响应:
{
"code": 0,
"msg": "ok"
"data": {
'total_schedule': {
'total_count' 总任务数
'finished_count' 已完成任务数
'unfinished_count' 未完成任务数
'out_of_stock_count' 缺货任务数
},
'category_schedule': [{
'name' 一级分类名
'finished_count' 已完成任务数
'unfinished_count' 未完成任务数
'out_of_stock_count' 缺货任务数
}],
'sort_data': {
'weight_count' 计重任务数
'unweight_count' 不计重任务数
'sku_count' 商品种类数
'address_count' 商户数
}
}
}
/station/service_time 获取运营周期信息
接口名: /station/service_time
Method: GET
请求:
响应:
{
"msg": "ok",
"code": 0,
"data": [{
"type": 0,
"_id": "ST001",
"receive_time_limit": {
"start": "06:00",
"s_span_time": 1,
"receiveTimeSpan": "30",
"end": "12:00",
"e_span_time": 1
},
"order_time_limit": {
"start": "06:00",
"end": "23:00",
"e_span_time": 0
},
"task_begin_time": "06:00",
"service_time_creator": "T001",
"final_distribute_time": "06:00",
"final_distribute_time_span": 1,
"desc": "默认服务时间",
"name": "默认服务时间"
}]
}
需要增加统计操作的接口
订单部分
/station/order/set_status
/station/order/update/status/preconfig
/station/order/update/status/child_station
/station/order/create
/station/order/create_old
/station/order/edit
/station/order/edit_old
/station/order/delete
/station/order/delete_old
/station/order/real_quantity/update
/station/order/batch_out_of_stock/update
/station/order/batch/create
tools.crontab_tasks.set_order_status_sorting.py
称重部分
/weight/sku/set_weight
/weight/sku/out_of_stock
/weight/sku/un_out_of_stock
/station/order/edit 获取订单详情
接口名: /station/order/edit
Method: GET
请求:
响应:
{
"data": {
"details": [{
新增
is_print 商品是否已打印 bool
}],
},
"msg": "ok",
"code": 0
}
/station/order/order_sku_list
Method: GET
请求:
响应:
{
"data": {
"list": [{
新增
is_print 商品是否已打印 bool
}],
},
"msg": "ok",
"code": 0
}
分拣明细页面
/weight/weight_collect/task/list 拉取分拣任务
Method: GET
请求:
| 参数名 | 必选M/可选O | 类型 | 说明
| -------------- | ------- | ---- | ------|
| time_config_id | M | str | 运营配置id
| start_date | M | str | 周期起始时间
| end_date | M | str | 周期结束时间
| search | O | str | 搜索
| category_id_1 | O | list | 一级分类
| category_id_2 | O | list | 二级分类
| pinlei_id | O | list | 品类id
| remark | O | str | 分拣备注
| is_weigh | O | bool | 是否称重商品
| weighed | O | bool | 是否已称重
| printed | O | bool | 是否已打印
| status | O | int | 订单转态
| salemenu_id | O | str | 销售单
| route_id | O | str | 路线
| page_obj | O | str | 分页规范
| peek | O | int | 分页规范
| offset | O | int | 分页规范
| limit | O | int | 分页规范
| reverse | O | int | 分页规范
响应:
{
"data": {
"list": [{
'sku_id' 商品id str
'name' 商品名 str
'std_unit_name' 基本单位 str
'sale_unit_name' 销售单位 str
'quantity' 下单数/销售单位 float
'std_quantity' 下单数/基本单位 float
'real_quantity' 出库数 float
'std_real_quantity'基本单位出库数 float
'category1_name' 一级分类名 str
'category1_id' 一级分类id str
'category2_name' 二级分类名 str
'category2_id' 二级分类id str
'pinlei_name' 品类名 str
'pinlei_id' 品类id str
'salemenu_id' 销售单id str
'salemenu_name' 销售单名 str
'address_name' 商户名 str
'address_id' 商户id str
'route' 路线 str
'sort_id' 分拣序号 int
'is_weight' 任务状态 bool 是否已称重
'real_is_weight' 任务类型 bool 是否为记重任务
'is_print' 打印状态 bool 是否已打印
'order_id' 订单号 str
'status' 订单状态 int
'sort_remark' 分拣备注 str
'is_exc' 是否存在异常或退货 bool
'source_order_id' O 非必传字段
}],
'pagination': {
'page_obj'
'more'
'peek'
}
},
"msg": "ok",
"code": 0
}
/weight/batch_out_of_stock/update 批量设置缺货
Method: POST
请求:
有以下字段为部分修改
| skus | O | list 缺货sku信息
[{
'order_id': '', M
'sku_id': '' , M
'source_order_id': '' O 返回的数据中有source_order_id字段时原样返回
}]
有以下字段为全部修改
| time_config_id | M | str | 运营配置id
| start_date | M | str | 周期起始时间
| end_date | M | str | 周期结束时间
| search | O | str | 搜索
| category_id_1 | O | list | 一级分类
| category_id_2 | O | list | 二级分类
| pinlei_id | O | list | 品类id
| remark | O | str | 分拣备注
| is_weigh | O | bool | 是否称重商品
| weighed | O | bool | 是否已称重
| printed | O | bool | 是否已打印
| status | O | int | 订单转态
| salemenu_id | O | str | 销售单
| route_id | O | str | 路线
响应:
{
"msg": "ok",
"code": 0
}
会用到的老接口
分拣明细页面搜索部分
/merchandise/category1/get 拉取商品一级分类
/merchandise/category2/get 拉取商品二级分类
/merchandise/pinlei/get 拉取商品品类
/salemenu/sale/list 拉取销售单
/station/service_time 拉取运营周期
/station/address_route/list 拉取路线
/station/order/remark/get 拉取分拣备注
列表操作区部分
/weight/sku/set_weight 设置出库数
reuqest:
weights list M
[{
'order_id': '', M
'sku_id': '' , M
'source_order_id': '' O 返回的数据中有source_order_id字段时原样返回
"weight": 10, M 原出库数
"set_weight": 10 M 填入的出库数
}]
# sku weight未更新,返回sku最新的数据
{
"D00001": {
"id": "",
"is_weight": 1,
"has_weight": 1,
"quantity": 10, # 下单数
"weight_quantity": 12, # 称重数
"real_quantity": 10, # 出库数
'std_quantity' 基本单位下单数
'std_real_quantity' 基本单位出库数
}
}
/weight/skus/export 缺货导出 export 2 绩效导出 export 1
date 与 start_date/end_date 二选一,同时传优先date
请求:
time_config_id str M 运营时间配置id
date str O 日期,形如 2017-08-01
start_date str O 日期,形如 2017-08-01
end_date str O 日期,形如 2017-08-01
export int M 1:导出已称重商品,2:导出缺货商品。
返回数据:
{
"code": 0,
"msg": "",
"data": {
"蔬菜": [
{
"resname": "商户名称A",
"category1_name": "蔬菜",
"category2_name": "叶菜",
"order_id": "PL1050756",
"sort_id": 1, # 分拣号
"spu_id": "C115348",
"id": "D1475919",
"name": "菜心|小条",
"is_weight": true, # 是否称重商品
"quantity": "3.00斤", # 下单数
"real_quantity": "3.50斤", # 出库数
"driver_name": null, # 司机
"user_name": "ceshik10admin", # 用户名
"employee_number": "1", # 工号
"operate_time": "2018-01-12 14:47:04" # 操作时间
}
],
CREATE TABLE `tbl_sorting_category_collect` (
`id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`order_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`station_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`category_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`time_config_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`total` int(11) DEFAULT '0',
`finished` int(11) DEFAULT '0',
`unfinished` int(11) DEFAULT '0',
`out_of_stock` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `tbl_sorting_collect` (
`id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`station_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`address_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`time_config_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`totle` int(11) DEFAULT '0',
`finished` int(11) DEFAULT '0',
`unfinished` int(11) DEFAULT '0',
`out_of_stock` int(11) DEFAULT '0',
`weight_count` int(11) DEFAULT '0',
`unweight_count` int(11) DEFAULT '0',
`sku_ids` json NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;