Skip to content

分拣重构

数据模型

分拣批次

# tbl_sort_batch
id
station_id
time_config_id
date

package_total
package_finished
package_out_of_stock
package_unfinished
weigh_package_total         # 记重任务数
not_weigh_package_total     # 不记重任务数

批次分类统计

# tbl_sort_batch_category_collect
id
batch_id
category_id

package_total
package_finished
package_out_of_stock
package_unfinished

分拣包

# tbl_sort_package
id
outer_id            # 自定义包装id,方便通过单号和商品来筛选,例如 PL00001_D00001

sku_id
is_weigh            # 是否称重商品
category_id_1       # 一级分类id
category_id_2       # 二级分类id
spu_id              
sale_ratio
std_unit_name
sale_unit_name

quantity    # 数量
sort_quantity       # 实际分拣数量
out_of_stock        # 缺货标记
has_weighed     # 是否已称重
has_printed     # 是否已打印,用于筛选差异新商品
has_changed         # 是否有变动,用于筛选差异变动商品
prev_quantity   # 变动前数量
sort_time           # 分拣时间

sort_way            # 分拣渠道
operator_type       # 操作人类型,管理员,供应商等
operator_id     # 操作人id
operator            # 操作人

batch_id            # 分拣批次号
order_id            # 所属订单,空则是预分拣包
parent_package_id   # 父分拣包id

pstatus         # 删除标记
create_time     # 创建时间
last_modify_time    # 修改时间

订单分拣

# tbl_order_sort_info
order_id
station_id
time_config_id
sort_num
sort_remark

batch_id            # 【新增】分拣批次id
sku_sort_count  # 【新增】订单的已分拣数
sku_count           # 【新增】订单商品总数
sort_percent        # 【新增】分拣进度,单位%
address_id      # 【新增】商户id,用来统计批次商户数
address_name        # 【新增】商户名

接口

同步分拣任务

  1. 支持根据订单号列表,或者筛选条件将订单批量同步到分拣系统。同时满足消息订阅同步,定时校验同步,以及手工全部同步三个场景。
  2. 自动创建分拣批次
  3. 满足幂等性,未同步的创建分拣包,已同步有差异的做更新,已删除的同步删除分拣包。
  4. 更新批次sort_batch, sort_batch_category_collect中的统计数据
  5. 更新order_sort_info中的批次号,统计数据
sync_sort_package
参数:
station_id
time_config_id
date
order_ids

分拣定时同步脚本

分拣任务查询

  1. 根据批次,分类等信息直接查询sort_package,确保查询性能
  2. 满足打印等多种导出的数据格式要求
package/list
参数:
time_config_id
date
is_weigh
has_weighed
category1_ids
category2_ids
spu_ids
group_ids
out_of_group
sku_search
order_search
pack_ids
outer_ids
diff
format      # 返回数据格式,默认格式,打印格式等

分拣打包

  1. 单独创建分拣包,此接口主要用于预分拣场景
 pack
参数:
sku_id
quantity
count       default 1
order_id    【可选】

分拣包称重

  1. 预分拣包称重和常规分拣称重统一一个接口
weigh
参数:
pack_id
outer_id
quantity            # 【可选】称重数量
weigh_pack_id       # 【可选】预分拣称重
weigh_pack_ids      # 【可选】预分拣称重

分拣包取消称重

weigh_cancel
参数:
pack_id
outer_id

分拣包缺货

out_of_stock
参数:
pack_ids
outer_ids

分拣包取消缺货

in_stock
参数:
pack_ids
outer_ids 

删除分拣包

remove
参数:
pack_id

分拣统计

统计数据直接从批次,订单分拣表里面拉出

sort_collect/data
参数:
time_config_id
date

分拣随机订单统计

订单统计数据从订单分拣表拉出

sort_collect/order/random
参数:
time_config_id
date

分拣随机商品统计

商品统计数据从批次商品分类表拉出

sort_collect/sku/random
参数:
time_config_id
date

分拣订单明细

  1. 查询批次订单表获取统计数据
  2. 查询订单表获取订单明细数据
sort_collect/order/details
参数:
time_config_id
date_from
date_to

分拣商品统计明细

  1. 查询分拣包表获取商品统计数据
  2. 查询订单表获取商品明细数据
sort_collect/sku/details
参数:
time_config_id
date_from
date_to

核心接口适配

weight/skus
weight/sku/print/infos
weight/sku/set_weight
weight/sku/out_of_stock
weight/sku/un_out_of_stock
weight/skus/export

预分拣接口适配

1,查询接口改成查询分拣包列表

package/sku/package/list
package/sku/package/get
package/export
package/async_export

2,预分拣包增删接口改为对分拣包打包,删除接口

package/create
package/delete

3,商品删除同步解绑接口可去掉

PDA接口适配

1.查询接口改成对分拣包查询

pda/order/list 
pda/order/detail
pda/sku/list
pda/sku/detail

2.称重,缺货接口统一到核心微服接口

pda/sort/set_weight
pda/sort/out_of_stock

老称重接口适配

station/weigh/get_task
station/weigh/get_all_re_weight
station/weigh/get_diff_order_weight
station/weigh/set_weight

开发计划

第一阶段 核心功能开发 4周 内容:同步,任务列表,打包,称重,缺货

第二阶段 分拣进度 1周

第三阶段 预分拣,PDA接口适配 3周

第四阶段 新接口双写

第五阶段 老接口适配 2周

第六阶段 老接口双写