需求评审
公库结算个性化配置
需求背景
目前的结算中,公库的处置费、搬运费、冷藏费是有三种写死的计费方式 (1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值),现在的要求是不同城市的站点有可能有 不同的结算需求,需要做一个个性化配置的功能提供他们自行配置。 例如公库计算冷藏费,以15天为周期,小于等于10天,计为10天,大于10天的,计为15天, 其他两种费用同理
改动点
数据库改动
-
合同表修改计费字段
{ "_id" "active_periods": [{C list 激活日期区间(私库下才有) "start_date" M datetime 开始日期 "end_date" M datetime 结束日期 }], "start_date" M datetime 合同有效开始日期(目前仅做展示) "end_date" M datetime 合同有效截止日期(目前仅做展示) "ware_category_1_id" C string 公库合同绑定的仓库ID(私库为空字符串) "station_id" M string 站点ID "type" M int 合同类型(1:公库;2:私库) "is_active" M bool 是否激活 "customer_id" M string 客户ID "goods_details": [{ M list 绑定的品类信息 "goods_category_1_id" M string 一级商品分类ID "goods_category_1_name" M string 一级商品分类名 "goods_category_2_id" M string 二级商品分类ID "goods_category_2_name" M string 二级商品分类名 "goods_category_3_id" M string 品类ID "goods_category_3_name" M string 品类名 }] "ware_details": [{ C list 私库绑定通道信息(公库为空数组) "ware_category_2_id" M string 库区ID "ware_category_2_name" M string 库区名 "ware_category_4_id" M string 通道ID "ware_category_1_id" M string 仓库ID "unit_price" M int 单价(分) "ware_category_3_name" M string 库位名 "ware_category_3_id" M string 库位ID "ware_category_1_name" M string 仓库名 "ware_category_4_name" M string 通道名 }], "freeze_fee": { C dict 冷藏费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M string (1:件;2:吨;3:板) - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] + "date_calculate_cycle_count" M int 日期计费周期 + "date_calculate_section": [{ M list 日期计费区间 + "start_count" M int 区间开始天数 + "end_count" M int 区间截止天数 + "charge_count" M int 计费天数 + }] }, "storage_fee": { C dict 处置费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M string 单位(1:件;2:吨;3:板) - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] }, "carrying_fee": { C dict 搬运费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M string (单位(1:件;2:吨;3:板) - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] }, }
-
站点表修改作业单计费字段(为了统一数据库结构和代码逻辑),添加默认结算模版
{ "_id" "additional_tasks": [{ O list 作业单 "name" M string 作业费用名 - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] "remark" M string 备注 "is_active" M bool 是否激活 "unit_name" M string 计费单位名 "unit_price" M int 单价(分) "task_desc" M string 作业任务描述 "_id" M int 作业ID }], + "default_freeze_fee": { C dict 默认冷藏费 + "unit_price" M int 单价(分) + "unit" M string (1:件;2:吨;3:板) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] + "date_calculate_cycle_count" M int 日期计费周期 + "date_calculate_section": [{ M list 日期计费区间 + "start_count" M int 区间开始天数 + "end_count" M int 区间截止天数 + "charge_count" M int 计费天数 + }] + }, + "default_storage_fee": { C dict 默认处置费 + "unit_price" M int 单价(分) + "unit" M string 单位(1:件;2:吨;3:板) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] + }, + "default_carrying_fee": { C dict 默认搬运费 + "unit_price" M int 单价(分) + "unit" M string (单位(1:件;2:吨;3:板) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] "name" M string 站点名 "telephone" M string 电话 "default_bill_day" M int 默认结款日 "district_code" M string 地区码 "city_name" M string 城市名 "contact_user" M string 联系人 "is_active" M bool 是否激活 "address" M string 地址 }
-
将合同和站点内的老数据结构刷成新的数据结构
接口改动
-
公库合同创建接口计费部分修改参数
接口名 /finance/contract/create Method POST 请求 "start_date" M datetime 生效开始日期 "type" M int 合同类型(1:公库;2:私库) "end_date" M datetime 生效截止日期 "customer_id" M string 客户ID "is_active" M bool 是否激活 "ware_details": [{ O list 私库仓库信息 "unit_price" M int 单价 "ware_category_4_id" M string 通道ID }] "freeze_fee": { O dict 冷藏费信息 - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] + "date_calculate_cycle_count" M int 日期计费周期 + "date_calculate_section": [{ M list 日期计费区间 + "start_count" M int 区间开始天数 + "end_count" M int 区间截止天数 + "charge_count" M int 计费天数 + }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }, "carrying_fee": { O dict 冷藏费信息 - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }, "storage_fee": { O dict 冷藏费信息 - "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) + "calculate_cycle_count" M int 计费周期 + "calculate_section": [{ M list 计费区间 + "start_count" M int 区间开始数量 + "end_count" M int 区间截止数量 + "charge_count" M int 计费数量 + }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }
-
合同明细接口计费部分修改参数
- 入库单明细接口结算部分计算计费数量的逻辑修改
- 作业单同上
- 结款单的可选的结款项以及创建结款单接口的计算计费数量的逻辑修改
- 添加一个站点默认合同模版接口
接口名 /finance/contract/default Method POST 请求 "ware_details": [{ O list 私库仓库信息 "unit_price" M int 单价 "calculate_cycle_type" M int 计费周期 "ware_category_4_id" M string 通道ID }] "freeze_fee": { O dict 冷藏费信息 "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "date_calculate_cycle_count" M int 日期计费周期 "date_calculate_section": [{ M list 日期计费区间 "start_count" M int 区间开始天数 "end_count" M int 区间截止天数 "charge_count" M int 计费天数 }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }, "carrying_fee": { O dict 冷藏费信息 "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }, "storage_fee": { O dict 冷藏费信息 "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }
时间预估
5d
私库结算修改
需求背景
目前的私库结算按天计费,成都要求改成按月收费,涉及改动私库合同的开始截止日期以月长度限定, 单价录入按月录入,私库结款项只能在每月结款日后才可以结算
改动点
数据库改动
-
合同表修改计费字段
{ "_id" "active_periods": [{C list 激活日期区间(私库下才有) "start_date" M datetime 开始日期 "end_date" M datetime 结束日期 }], "start_date" M datetime 合同有效开始日期(目前仅做展示) "end_date" M datetime 合同有效截止日期(目前仅做展示) + "bill_day" M int 结款日 "ware_category_1_id" C string 公库合同绑定的仓库ID(私库为空字符串) "station_id" M string 站点ID "type" M int 合同类型(1:公库;2:私库) "is_active" M bool 是否激活 "customer_id" M string 客户ID "goods_details": [{ M list 绑定的品类信息 "goods_category_1_id" M string 一级商品分类ID "goods_category_1_name" M string 一级商品分类名 "goods_category_2_id" M string 二级商品分类ID "goods_category_2_name" M string 二级商品分类名 "goods_category_3_id" M string 品类ID "goods_category_3_name" M string 品类名 }] "ware_details": [{ C list 私库绑定通道信息(公库为空数组) "ware_category_2_id" M string 库区ID "ware_category_2_name" M string 库区名 "ware_category_4_id" M string 通道ID "ware_category_1_id" M string 仓库ID "unit_price" M int 单价(分) + "calculate_cycle_type" M int 计费周期类型 + "is_bill_day_only" M bool 是否只能在结款日生成结款单 + "is_cycle_detail" M bool 是否每个循环都生成明细 "ware_category_3_name" M string 库位名 "ware_category_3_id" M string 库位ID "ware_category_1_name" M string 仓库名 "ware_category_4_name" M string 通道名 }], "freeze_fee": { C dict 冷藏费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M int (1:件;2:吨;3:板) "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "date_calculate_cycle_count" M int 日期计费周期 "date_calculate_section": [{ M list 日期计费区间 "start_count" M int 区间开始天数 "end_count" M int 区间截止天数 "charge_count" M int 计费天数 }] }, "storage_fee": { C dict 处置费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M int 单位(1:件;2:吨;3:板) "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] }, "carrying_fee": { C dict 搬运费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M int (单位(1:件;2:吨;3:板) "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] }, }
-
将合同老数据结构刷成新的数据结构
接口改动
-
公库合同创建接口计费部分修改参数
接口名 /finance/contract/create Method POST 请求 "start_date" M datetime 生效开始日期 "type" M int 合同类型(1:公库;2:私库) "end_date" M datetime 生效截止日期 "customer_id" M string 客户ID "is_active" M bool 是否激活 "ware_details": [{ O list 私库仓库信息 + "calculate_cycle_type" M int 计费周期类型 "unit_price" M int 单价 "ware_category_4_id" M string 通道ID }] "freeze_fee": { O dict 冷藏费信息 "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "date_calculate_cycle_count" M int 日期计费周期 "date_calculate_section": [{ M list 日期计费区间 "start_count" M int 区间开始天数 "end_count" M int 区间截止天数 "charge_count" M int 计费天数 }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }, "carrying_fee": { O dict 冷藏费信息 "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }, "storage_fee": { O dict 冷藏费信息 "calculate_cycle_count" M int 计费周期 "calculate_section": [{ M list 计费区间 "start_count" M int 区间开始数量 "end_count" M int 区间截止数量 "charge_count" M int 计费数量 }] "unit_price" M int 单价 "unit" M int 单位(1:件;2:吨;3:板) }
-
合同明细接口计费部分修改参数
- 结款单的可选的结款项以及创建结款单接口的计算计费数量的逻辑修改, 出账日只能是合同中的结款日,每个周期一个明细
时间预估
10d
合同和品类绑定(暂不做)
需求背景
目前合同只和客户及仓库绑定,现在要求合同和品类也需要绑定,入库时针对不同品类的商品选择不同的 合同,如果没有对应品类的合同不允许入库
改动点
数据库改动
- 合同表添加品类字段
{ "_id" "storage_fee": { C dict 处置费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M string 单位(1:件;2:吨;3:板) "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) }, "active_periods": [{C list 激活日期区间(私库下才有) "start_date" M datetime 开始日期 "end_date" M datetime 结束日期 }], "start_date" M datetime 合同有效开始日期(目前仅做展示) "ware_category_1_id" C string 公库合同绑定的仓库ID(私库为空字符串) "station_id" M string 站点ID "type" M int 合同类型(1:公库;2:私库) "is_active" M bool 是否激活 "customer_id" M string 客户ID + "goods_details": [{ M list 绑定的品类信息 + "goods_category_1_id" M string 一级商品分类ID + "goods_category_1_name" M string 一级商品分类名 + "goods_category_2_id" M string 二级商品分类ID + "goods_category_2_name" M string 二级商品分类名 + "goods_category_3_id" M string 品类ID + "goods_category_3_name" M string 品类名 + }] "freeze_fee": { C dict 冷藏费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M string (1:件;2:吨;3:板) "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) }, "ware_details": [{ C list 私库绑定通道信息(公库为空数组) "ware_category_2_id" M string 库区ID "ware_category_2_name" M string 库区名 "ware_category_4_id" M string 通道ID "ware_category_1_id" M string 仓库ID "unit_price" M int 单价(分) "ware_category_3_name" M string 库位名 "ware_category_3_id" M string 库位ID "ware_category_1_name" M string 仓库名 "ware_category_4_name" M string 通道名 }], "carrying_fee": { C dict 搬运费(公库才有,私库下为空) "unit_price" M int 单价(分) "unit" M string (单位(1:件;2:吨;3:板) "calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值) }, "end_date" M datetime 合同有效截止日期(目前仅做展示) }
接口改动
- 合同创建接口增加绑定的品类字段(前端需要增加拉取商品库提供选择的逻辑)
- 合同明细接口增加绑定的品类字段(前端以表格形式简单展示)
- 可供替换的合同接口增加检查待替换合同下的批次的品类是否绑定了新合同的逻辑
- 可入库的合同接口增加一个参数goods_category_3_id(品类ID,必填)(前端相应改动) 逻辑上添加检查合同中绑定品类的字段
- 转户同上
时间预估
5d(包括写对应的单元测试)