合同
字段可选
M:must 必填
O:optional 选填
C: conditional 某些条件下必选
合同搜索
接口名
/finance/contract
Method
GET
请求
query_data O string 查询内容,支持客户ID(K001或者1)和合同ID
offset O int 分页缩进,默认0
limit O int 分页每页数量,默认10
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
[
{
"id" M string 合同号
"customer_id" M string 客户ID
"customer_name" M string 客户名
"is_active" M bool 是否激活
"type" M int 合同类型(1:公库;2:私库)
}
]
示例
request
http://test.guanmai.cn:8888/finance/contract?query_data=K00001&offset=0&limit=10
response
{
"data": [{
"id": "HT00109",
"is_active": true,
"type": 1,
"customer_name": "北京客户001",
"customer_id": "K00084"
}],
"code": 0,
"pagination": {
"offset": 0,
"count": 7,
"limit": 10
},
"msg": "ok"
}
可入库的合同
接口名
/finance/contract/stock_in
Method
GET
请求
"customer_id" M string 客户ID
"ware_category_1_id" C string 仓库ID(用于公库)
"ware_category_4_id" C string 通道ID(用于私库)
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回合同ID列表
示例
request
http://test.guanmai.cn:8888/finance/contract/stock_in?customer_id=K00084&ware_category_4_id=WD000974
response
{"data": ["HT00110"], "code": 0, "msg": "ok"}
合同明细
接口名
/finance/contract/detail
Method
GET
请求
"id" M string 合同ID
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回数据
"customer_contact_name" M string 客户联系名
"start_date" M datetime 生效开始日期
"customer_name" M string 客户名
"customer_company" M string 客户公司
"id" M string 合同ID
"type" M int 合同类型(1:公库;2:私库)
"active_periods": [{ O list 私库激活日期区间
"start_date" M datetime 激活开始时间
"end_date" M datetime 激活结束时间
}],
"customer_cellphone" M string 客户手机
"station_id" M string 站点ID
"end_date" M datetime 生效截止日期
"customer_id" M string 客户ID
"is_active" M bool 是否激活
"ware_details": [{ O list 私库仓库信息
"ware_category_2_id" M string 库区ID
"ware_category_1_id" M string 仓库ID
"ware_category_3_id" M string 库位ID
"unit_price" M float 单价
"ware_category_1_name" M string 仓库名
"ware_category_2_name" M string 库区名
"ware_category_3_name" M string 库位名
"ware_category_4_name" M string 通道名
"ware_category_4_id" M string 通道ID
}]
"freeze_fee": { O dict 冷藏费信息
"calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值)
"unit_price" M float 单价
"unit" M int 单位(1:件;2:吨;3:板)
},
"carrying_fee": { O dict 冷藏费信息
"calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值)
"unit_price" M float 单价
"unit" M int 单位(1:件;2:吨;3:板)
},
"storage_fee": { O dict 冷藏费信息
"calculate_method" M int 计费方式(1:不足0.5按0.5算,超过按1算;2:进一法;3:实际值)
"unit_price" M float 单价
"unit" M int 单位(1:件;2:吨;3:板)
}
示例
request
http://test.guanmai.cn:8888/finance/contract/detail?id=HT00084
response
{
"data": {
"ware_category_1_name": "23321",
"start_date": "2016-09-23",
"customer_name": "北京客户001",
"customer_company": "北京客户001公司名称",
"id": "HT00109",
"type": 1,
"freeze_fee": {
"calculate_method": 3,
"unit_price": 111.5,
"unit": 3
},
"customer_cellphone": "12312312312",
"station_id": "T006",
"carrying_fee": {
"calculate_method": 1,
"unit_price": 123.5,
"unit": 2
},
"ware_category_1_id": "WA000970",
"end_date": "2016-10-23",
"customer_contact_name": "北京客户001联系人",
"customer_id": "K00084",
"is_active": true,
"storage_fee": {
"calculate_method": 3,
"unit_price": 222.5,
"unit": 1
}
},
"code": 0,
"msg": "ok"
}
创建合同
接口名
/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:实际值)
"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:实际值)
"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:实际值)
"unit_price" M int 单价
"unit" M int 单位(1:件;2:吨;3:板)
}
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 合同ID
示例
request
http://test.guanmai.cn:8888/finance/contract/create
form-data
start_date: 2016-09-09
type: 1
active_periods: [{"start_date": "2016-09-09", "end_date": "2016-09-19"}],
end_date: 2016-09-29
customer_id: K0001
is_active: 1
ware_details: [{"unit_price": 21.0, "ware_category_4_id": "WD001"}]
freeze_fee: {"calculate_method": 1, "unit_price": 100, "unit": "1"},
carrying_fee: {"calculate_method": 1, "unit_price": 100, "unit": "1"},
storage_fee: {"calculate_method": 1, "unit_price": 100, "unit": "1"},
response
{
"data": "HT0001",
"code": 0,
"msg": "ok"
}
更新合同
接口名
/finance/contract/update
Method
POST
请求
"id" M string 合同ID
"start_date" O datetime 生效开始日期
"end_date" O datetime 生效截止日期
"is_active" O bool 是否激活
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 无
示例
request
http://test.guanmai.cn:8888/finance/contract/update
form-data
id: HT0001
start_date: 2016-09-09
end_date: 2016-09-29
is_active: 1
response
{
"data": "",
"code": 0,
"msg": "ok"
}
替换合同
接口名
/finance/contract/replace
Method
POST
请求
"old_id" M string 被替换掉的合同ID
"new_id" M string 新的合同ID
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 无
示例
request
http://test.guanmai.cn:8888/finance/contract/replace
form-data
old_id: HT0001
new_id: HT0002
response
{
"data": "",
"code": 0,
"msg": "ok"
}
可供替换的合同
接口名
/finance/contract/to_replace
Method
GET
请求
"new_id" M string 新的合同ID
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 可供替换的合同ID列表
示例
request
http://test.guanmai.cn:8888/finance/contract/to_replace?new_id: HT0002
response
{
"data": ["HT00113"],
"code": 0,
"msg": "ok"
}
合同基础信息
接口名
/finance/contract/base_info
Method
GET
请求
无
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 基础信息
示例
request
http://test.guanmai.cn:8888/finance/contract/base_info
response
{
"data": {
"calculate_method": {
"HALF_PLUS": 1,
"REAL": 3,
"ONE_PLUS": 2
},
"share_fee_unit_type": {
"ITEM": 1,
"TON": 2,
"PALLET": 3
},
"type": {
"SHARE": 1,
"PRIVATE": 2
}
},
"code": 0,
"msg": "ok"
}
检查是否存在到期时间小于十五天的私库合同
接口名
/finance/contract/check_near
Method
GET
请求
无
响应
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M bool 是否存在到期时间小于十五天的私库合同
示例
request
http://test.guanmai.cn:8888/finance/contract/check_near
response
{
"code": 0,
"data": true,
"msg": "ok"
}