周转物管理
db改动
mysql新增
turnover 周转物库存
id 周转物id
group_id
station_id
name 周转物名称
amount 库存
unit_name 单位
price 货值
pstatus 状态(0正常/1删除)
create_time
modify_time
delete_time
turnover_return_sheet 周转物归还单
id
group_id
station_id
sid 商户id 索引
tid 周转物id 索引
amount 归还数
status 归还状态(1待归还/2已归还)
pstatus 状态(0正常/1删除)
driver_id 司机id
create_time
modify_time
finish_time 归还时间
delete_time
turnover_loan_sheet 周转物借出单
id
group_id
station_id
sid 商户id 索引
tid 周转物id 索引
amount 借出数
status 借出状态(1待借出/2已借出)
pstatus 状态(0正常/1删除)
driver_id 司机id
out_stock_sheet_id 关联出库单id 索引
sync_by_order 单据生成渠道 1由订单同步生成/2手动创建
create_time
modify_time
finish_time 借出时间
delete_time
turnover_sku_info 周转物关联商品信息
id
group_id
station_id
tid
sku_id
version_id 关联的sku版本 如 D233#23 #前面是sku_id # 后面是对应的版本号,便于查询
bind_type 绑定关系(1固定数量/2按比例)
ratio 系数(bind_type==1时为固定数量,2时为系数) 销售单位
latest 标记最后一个插入的条目 0/1
pstatus 状态(0正常/1删除)
create_time
modify_time
delete_time
turnover_log 周转物日志
id
group_id
station_id
sheet_type 记录的单据类型 1归还单/2借出单
sid 商户id 索引
tid 周转物id 索引
amount 借出/归还数
status 借出/归还状态(1待借出/归还 / 2已借出/归还 / 3 删除)
driver_id 司机id
pstatus 状态(0正常/1删除)
create_time
modify_time
finish_time 完成时间
delete_time
turnover_address_info 周转物商户信息
id
group_id
station_id
sid 商户id 索引
tid 周转物id 索引
amount 未归还数
pstatus 状态(0正常/1删除)
create_time
modify_time
delete_time
CREATE TABLE `tbl_turnover` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`station_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_id` int(11) NOT NULL,
`name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`unit_name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`amount` decimal(15,4) NOT NULL DEFAULT '0.0000',
`price` decimal(15,4) NOT NULL DEFAULT '0.0000',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pstatus` tinyint(4) NOT NULL DEFAULT '0',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_station_id_name` (`station_id`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `tbl_turnover_address_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`station_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_id` int(11) NOT NULL,
`stid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`tid` int(11) NOT NULL,
`sid` int(11) NOT NULL,
`amount` decimal(15,4) NOT NULL DEFAULT '0.0000',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pstatus` tinyint(4) NOT NULL DEFAULT '0',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `idx_station_id` (`station_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `tbl_turnover_loan_sheet` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`station_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_id` int(11) NOT NULL,
`tid` int(11) NOT NULL,
`sid` int(11) NOT NULL,
`amount` decimal(15,4) NOT NULL DEFAULT '0.0000',
`status` tinyint(4) NOT NULL DEFAULT '1',
`out_stock_sheet_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`sync_by_order` tinyint(4) NOT NULL DEFAULT '1',
`driver_id` int(11) NOT NULL DEFAULT '0',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`finish_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pstatus` tinyint(4) NOT NULL DEFAULT '0',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `idx_station_id` (`station_id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `tbl_turnover_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`station_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_id` int(11) NOT NULL,
`tid` int(11) NOT NULL,
`sid` int(11) NOT NULL,
`sheet_id` int(11) NOT NULL DEFAULT '0',
`sheet_type` tinyint(2) NOT NULL DEFAULT '1',
`amount` decimal(15,4) NOT NULL DEFAULT '0.0000',
`status` tinyint(4) NOT NULL DEFAULT '1',
`out_stock_sheet_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`driver_id` int(11) NOT NULL DEFAULT '0',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`finish_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pstatus` tinyint(4) NOT NULL DEFAULT '0',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `idx_station_id` (`station_id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `tbl_turnover_return_sheet` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`station_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_id` int(11) NOT NULL,
`tid` int(11) NOT NULL,
`sid` int(11) NOT NULL,
`amount` decimal(15,4) NOT NULL DEFAULT '0.0000',
`status` tinyint(4) NOT NULL DEFAULT '1',
`driver_id` int(11) NOT NULL DEFAULT '0',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`finish_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pstatus` tinyint(4) NOT NULL DEFAULT '0',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `idx_station_id` (`station_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `tbl_turnover_sku_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`station_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_id` int(11) NOT NULL,
`tid` int(11) NOT NULL,
`sku_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`version` int(11) NOT NULL,
`version_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`bind_type` tinyint(2) NOT NULL DEFAULT '1',
`ratio` decimal(15,4) NOT NULL DEFAULT '0.0000',
`latest` tinyint(2) NOT NULL DEFAULT '1',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pstatus` tinyint(4) NOT NULL DEFAULT '0',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `idx_station_id` (`station_id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
前端需要一个类似/static_storage/json/common/unit_name.json 的拉取基本单位的接口
/station/turnover/create 新建周转物
POST
request
name M str 周转物名称 站点唯一
unit_name M str 单位名
price M float 单个货值
response
{
code: 0
msg: ok
data:
}
/station/turnover/update 编辑周转物
POST
request
tid M str 周转物id
name O str 周转物名称
unit_name O str 单位名
price O float 单个货值
stock O float 库存(盘库用,暂时不做)
response
{
code: 0
msg: ok
data:
}
/station/turnover/list 获取周转物列表
GET
request
q O 搜索信息
export O bool 默认false 是否为导出操作
page_obj O str
offset O int 查询起点偏移,默认0
limit O int 返回条数,默认10
peek O int 希望peek(窥探)的条数,不传就不做peek。
peek表示希望接口顺便检查,到底有没有peek条数据,但不需要返回对应的数据。
peek必须大于limit。
reverse O bool 是否反向查询
response
{
code: 0
msg: ok
data: [
{
id
name
unit_name
price
stock
}
]
pagination: {
page_obj
peek
more
}
}
/station/turnover/delete 删除周转物
POST
request
tid M str 周转物id
response
{
code: 0
msg: ok
data
}
存在不能删除的情况 type: 1 存在关联商品 2 存在待归还条目 3 存在待借出条目 4 存在未归还条目
{
code: 99
msg: ok
data: [
{
type: 1
sku_info [
{
name
id
}
]
}
{
type: 2
}
{
type: 3
}
{
type: 4
address_info [
{
name
id
amount
}
]
}
]
}
/station/turnover/return_sheet/create 新建周转物归还
POST
request
address_id M str 商户id
tid M str 周转物id
amount M float 数量
driver_id O int 司机id
response
{
code: 0
msg: ok
data
}
/station/turnover/return_sheet/update 编辑周转物归还
POST
request
id M int 归还记录id
amount O float 数量
status O int 状态 1已归还
driver_id O int 司机id
response
{
code: 0
msg: ok
data
}
/station/turnover/return_sheet/list 拉取周转物归还列表
POST
request
start_date M date
end_date M date
status O int None全部/1待归还/2已归还/3删除
q O str 搜索信息
export O bool 默认false 是否为导出操作 后台导出,
page_obj O str
limit O int 返回条数,默认10
reverse O bool 是否反向查询
response
{
code: 0
msg: ok
data: [
{
sid 商户id
sname 商户名
finish_time 归还时间
tid 周转物id
tname 周转物name
amount 数量
status 状态
driver_id 司机id
driver_name 司机名
}
]
pagination: {
page_obj
peek
more
}
}
/station/turnover/return_sheet/delete 删除周转物归还
POST
request
id M int 归还记录id
response
{
code: 0
msg: ok
data
}
/station/turnover/loan_sheet/create 新建周转物借出
POST
request
address_id M str 商户id
tid M str 周转物id
amount M float 数量
driver_id O int 司机id
out_stock_sheet_id O str 关联出库单id
response
{
code: 0
msg: ok
data
}
/station/turnover/loan_sheet/batch_loan 周转物批量借出
POST
request
start_date M date
end_date M date
status O int None全部/1待借出/2已借出/3删除
q O str 搜索信息
ids M list 借出记录ids
response
{
code: 0
msg: ok
data
}
/station/turnover/loan_sheet/update 编辑周转物借出
POST
request
id M int 借出记录id
amount M float 数量
driver_id O int 司机id
status O int 状态 1已借出
out_stock_sheet_id O str 关联出库单id
response
{
code: 0
msg: ok
data
}
/station/turnover/loan_sheet/list 拉取周转物借出列表
POST
request
start_date M date
end_date M date
status O int None全部/1待借出/2已借出/3删除
q O str 搜索信息
export O bool 默认false 是否为导出操作
page_obj O str
limit O int 返回条数,默认10
reverse O bool 是否反向查询
response
{
code: 0
msg: ok
data: [
{
sid 商户id
sname 商户名
finish_time 借出时间
out_stock_sheet_id 关联出库单id
tid 周转物id
tname 周转物name
amount 数量
status 状态
driver_id 司机id
driver_name 司机名
}
]
pagination: {
page_obj
peek
more
}
}
/station/turnover/loan_sheet/delete 删除周转物借出
POST
request
id M int 借出记录id
response
{
code: 0
msg: ok
data
}
{
code: 99
msg: '删除该借出条目将导致该商户未归还货值为负数,请核对借出归还明细'
data:
}
========xth部分=========
/station/turnover/no_return/list 周转物借出归还历史统计列表
POST
request
q O str 搜索信息
export O bool 默认false 是否为导出操作
page_obj O str
limit O int 返回条数,默认10
reverse O bool 是否反向查询
response
{
code: 0
msg: ok
data: [
{
sid 商户id
sname 商户名
amount 未归还数
price 未归还货值
tlist: [ 周转物列表
{
tid 周转物id
tname 周转物名称
amount 未归还数
price 未归还货值
}
]
}
]
pagination: {
page_obj
peek
more
}
}
/station/turnover/history/list 周转物借出归还历史统计详情
POST
request
sid M str 商户id
tid M str 周转物id
start_date M date
end_date M date
op_type O int None全部/1借出/2归还/3借出删除/4归还删除
export O bool 默认false 是否为导出操作
page_obj O str
limit O int 返回条数,默认10
reverse O bool 是否反向查询
response
{
code: 0
msg: ok
data: {
sid 商户id
sname 商户名
tid 周转物id
tname 周转物名
amount 未归还数
price 未归还货值
op_list: [ 明细列表
{
finish_time 操作时间
loan_sheet_id 关联出库单id
op_type 1借出/2归还/3借出删除/4归还删除
amount 变动数
price 变动货值
driver_id 司机id
driver_name 司机名
}
]
}
pagination: {
page_obj
more
}
}
/station/turnover/sync_by_order 异步生成借出单据
/station/turnover/sync_driver 同步借出单司机
老接口修改
/product/sku_sale/list 拉取spu下sku信息
method
GET
request
response
{
新增
turnover bool 是否开启周转物关联
tid str 关联周转物id
turnover_cal_type int 1固定值/2按比例
turnover_amount float 周转物数量
}
stock_value_new
/product/sku/update 编辑商品
POST
request
新增
turnover M bool 是否开启周转物关联
tid O str 关联周转物id
turnover_cal_type O int 1固定值/2按比例
turnover_amount O float 周转物数量
response
{
code: 0
msg: ok
data:
}
同步绑定的借出单状态
out_stock_sheet/modify
out_stock_sheet/cancel
out_stock_sheet/submit/batch
发消息同步借出单司机
/station/task/distribute/edit_assign 分配司机
会用到的老接口(可能需改动或仿写符合需求的逻辑)
搜索司机 /station/task/distribute/get_drivers
搜索商户 /station/order/customer/search
搜索出库单 /station/stock/out_stock_sheet/list 可能要写个轻量化的类似逻辑接口