一、原有接口
1.新建供应商接口
接口名:/station/stock/settle_supplier
Method: POST
请求参数:
op string M 操作方式:add-新增供应商;
name string M 供应商名称
suppliers string O 供应商品
main_cate string O 主营分类
company_name string O 新公司名称
address string O 公司地址
phone string O 联系电话
bank string O 付款银行
account string O 开户名
card_no string O 银行账号
business_licence string O 营业执照号
contacter: string M 财务联系人
contacter_phone string M 财务联系电话
pay_method int O 付款方式:1-日结;2-周结;3-半月结;4-月结
can_supply_material int O 是否供应原料:字段不存在或值为0则表示不供应,值为1则表示供应;
响应:
code int M 0表示请求成功,其他表示请求失败
data null M 无返回数据
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/settle_supplier
POST参数:
op:add
name:test
suppliers:T010
main_cate:A102
company_name:
address:
phone:
bank:
account:
card_no:
business_licence:
contacter:test
contacter_phone:18888888888
pay_method:
response:
{"code": 0, "data": null, "msg": "ok"}
逻辑:
1.在原有接口的基础上新增can_supply_material字段,字段不存在或值为0则表示不供应,值为1则表示供应
2.修改供应商接口
接口名:/station/stock/settle_supplier/edit
Method:POST
请求参数:
settle_supplier_id string M 供应商ID
name string M 供应商名称
suppliers string O 供应商品
main_cate string O 主营分类
company_name string O 公司名称
address string O 公司地址
phone string O 联系电话
bank string O 付款银行
account string O 开户名
card_no string O 银行账号
business_licence string O 营业执照号
contacter: string M 财务联系人
contacter_phone string M 财务联系电话
pay_method int O 付款方式:1-日结;2-周结;3-半月结;4-月结
can_supply_material int O 是否供应原料:字段不存在或值为0则表示不供应,值为1则表示供应;
响应:
code int M 0表示请求成功,其他表示请求失败
data null M 无返回数据
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/settle_supplier/edit
POST参数:
settle_supplier_id: T1184
name:test
suppliers:T010
main_cate:A102
company_name:
address:
phone:
bank:
account:
card_no:
business_licence:
contacter:test
contacter_phone:18888888888
pay_method:
response:
{"code": 0, "data": null, "msg": "ok"}
逻辑:
1.在原有接口的基础上新增can_supply_material字段,字段不存在或值为0则表示不供应,值为1则表示供应
3.生成预入库单接口
接口名:/station/stock/purchase_sheet/create
Method:POST
请求参数:
settle_supplier_id string M 供应商ID
in_stock_time string M 预入库日期
skus list M 采购商品列表,结构见示例
from_type string O 来源类型
from_id string O 来源ID
响应:
code int M 0表示请求成功,其他表示请求失败
data string M 预入库单ID
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/purchase_sheet/create
POST参数:
settle_supplier_id: T1285
in_stock_time:2016-10-27
skus:[{"sku_id":"D654137","purchase_amount":"1","purchase_price":200}]
from_type:material
from_id:原料出库单ID
response:
{"code": 0, "data": "T002-CGD-2016-10-27-00001", "msg": "ok"}
逻辑:
1.在原有基础之上新增来源(from_type)和来源ID(from_id)字段;
2.根据来源决定预入库单的类型;
4.拉取待处理单据接口
接口名:/station/stock/settle_sheet/get_unhandled_sheet
Method:GET
请求参数:
search_filter string M 搜索条件
begin string M 开始日期
end string M 结束日期
supplier_id string O 供应商ID
settle_supplier_id string O 结算供应商ID
响应:
code int M 0表示请求成功,其他表示请求失败
data string M 单据信息
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/settle_sheet/get_unhandled_sheet?begin=2016-09-01&end=2016-10-27
response:
{
"code": 0,
"data": [
{
"search_filter": 1, # 筛选条件:1:入库退货时间,2:审核通过时间,3:建单时间
"sku_num": 9,
"station_id": "T002",
"date_time": "2016-09-04T21:08:31.856",
"_lock": false,
"status": 2,
"_id": "T002-JHD-2016-09-04-00026",
"type": 1, # 单据类型:1-成品入库单;2-成品退货单;3-原料入库单;4-原料退货单;
"sku_money": 122160,
"supplier_id": "T003",
"settle_supplier_name": "D3小李",
"settle_supplier_id": "T521"
},
],
"msg": "ok"
}
逻辑:
1.请求参数、返回格式不变;
2.type新增其他值,3-原料入库单;4-原料退货单;
3.单据数据源变为成品库、原料库,需要聚合处理;
5.加入结款单接口
接口名:/station/stock/settle_sheet
Method:POST
请求参数:
op string M 操作:add-新建结款单;
supplier_id string M 供应商ID
settle_supplier_id string M 结款供应商ID
sheet_nos string M 待处理单号
remark string O 摘要
响应:
code int M 0表示请求成功,其他表示请求失败
data string M 预入库单ID
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/settle_sheet
POST参数:
op: add
supplier_id: T006
settle_supplier_id: T549
sheet_nos: T002-JHD-2016-10-01-00001
remark:
response:
{
"code": 0,
"data": {
"sheet_no": "T002-FKD-2016-10-28-00001" # 结款单ID
},
"msg": "ok"
}
逻辑:
1.接口参数、返回数据格式不变;
1.后台处理时在原料入库单、退货单上标志结款单ID;
6.提交结款单接口
接口名:/station/stock/settle_sheet/submit
Method:POST
请求参数:
op string M 操作:submit-提交结款单;
sheet_no string M 结款单ID
响应:
code int M 0表示请求成功,其他表示请求失败
data null M 无数据
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/settle_sheet/submit
POST参数:
op: del
sheet_no: T002-FKD-2016-10-28-00002
response:
{"code": 0, "data": null, "msg": "ok"}
逻辑:
1.原有基础之上将原料入库单、退货单的状态改为已结款;
7.红冲接口
接口名:/station/stock/settle_sheet
Method:POST
请求参数:
op string M 操作:del-红冲;
sheet_no string M 结款单ID
响应:
code int M 0表示请求成功,其他表示请求失败
data null M 无数据
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/stock/settle_sheet
POST参数:
op: del
sheet_no: T002-FKD-2016-10-28-00002
response:
{"code": 0, "data": null, "msg": "ok"}
逻辑:
1.参数、返回不变,保留原有功能;
2.取消入库单/退货单的结款ID标志;
3.入库单/退货单的状态更改为已入库/已退货;
7.新增拉取成品库信息接口
接口名:/station/product/get_product_info
Method:GET
请求参数:
search_text string M 搜索内容
响应:
code int M 0表示请求成功,其他表示请求失败
data null M 无数据
msg string M 请求成功是'ok',请求失败则是错误信息
示例:
request:
http://teststation.guanmai.cn/station/product/get_product_info?
search_text=参数
response:
{
"code": 0,
"data": {
"id": "C00011", # id
"std_unit_name": "斤", # 标准单位
"name": "枸杞叶", # 成品名称
"desc": "叶子普通大小", # 描述信息
"pinlei": "果拼类", # 品类信息
},
"msg": "ok"
}
逻辑:
1.接受校验参数
2.查询信息
3.组织返回数据
二、新增接口
1.拉取原料供应商接口:
接口名:/station/suppliers
Method:GET
请求参数:
user M Django用户登录信息
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/station/suppliers
response:
{
'code': 0,
'data': [
{
'id': ’T131‘,
'name': '阿米巴13',
}
],
'msg': 'ok',
}
2.拉取原料列表
接口名:/materials/
Method:GET
请求参数:
user M django user django用户信息
search_text O string 搜索文本
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'id':11112, # 原料ID
'name': '猪', # 原料名称
'stock': 38, # 库存数量
'unit_name': '斤', # 单位
}
],
'msg': 'ok',
}
3.新建原料
接口名:/materials/
Method:POST
请求参数:
user M user django用户信息
name M string 原料名称
unit_name M string 原料单位
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M int 成功新建的原料ID
示例:
request:
POST http://teststation.guanmai.cn/materials
POST参数:
name:'猪'
unit_name: '头'
response:
{
'code': 0,
'msg': 'ok',
'data': 12343,
}
4.编辑原料
接口名:/materials/{{material_id}}
Method:PUT
请求参数:
user M user django用户信息
material_id M int 原料ID
stock M int 库存数量
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/11333
PUT参数:
stock:20
response:
{
'code': 0,
'msg': 'ok',
}
5.删除原料
接口名:/materials/{{material_id}}
Method:DELETE
请求参数:
user M user django用户信息
material_id M int 原料ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
DELETE http://teststation.guanmai.cn/materials/11333
response:
{
'code': 0,
'msg': 'ok',
}
6.拉取配方列表
接口名:/materials/formulas
Method:GET
请求参数:
user M django user django用户信息
search_text O string 搜索文本
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials/formulas
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'id':11112, # 配方ID
'name': '猪的配方', # 配方名称
'desc': '描述', # 配方描述 }
],
'msg': 'ok',
}
7.拉取配方详情
接口名:/materials/formulas/{{formula_id}}
Method:GET
请求参数:
user M user django用户信息
formula_id M int 配方ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M json 配方信息
示例:
request:
GET http://teststation.guanmai.cn/materials/formulas/113332
response:
{
'code': 0,
'msg': 'ok',
'data': {
'_id': 12345,
'name': '配方名',
'desc': '配方描述',
'materials': [
{
'material_id': 1234,
'quantity': 2,
},
{
'material_id': 4321,
'quantity': 1,
},
],
'products': [
{
'sku_id': 'D12345',
'quantity': 5,
},
{
'sku_id': 'D54321',
'quantity': 2,
},
],
'creator': '创建人',
'create_time': '创建时间',
'modifier': '修改的人',
'update_time': 'xxxxxx',
'status': 1-未删除;2-已删除,
'station_id': 'T002',
},
}
8.新建配方
接口名:/materials/formulas/
Method:POST
请求参数:
user M user django用户信息
name M string 配方名称
desc M string 描述
materials M json 原料ID、数量列表
products M json 成本ID、数量列表
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
POST http://teststation.guanmai.cn/materials/formulas
POST参数:
name:'猪的配方'
desc: '猪的配方描述'
materials: [{'id': 11132, 'quantity': 30}]
products: [{'id': 'D12234', 'quantity': 20, 'amount_proportion': 12.00}]
response:
{
'code': 0,
'msg': 'ok',
}
9.编辑配方
接口名:/materials/formulas/{{formula_id}}
Method:PUT
请求参数:
user M user django用户信息
formula_id M int 配方ID
name M string 配方名称
desc M string 配方描述
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/formulas/11333
PUT参数:
name: '改个名字'
desc: '改个描述'
response:
{
'code': 0,
'msg': 'ok',
}
10.删除配方
接口名:/materials/formulas/{{formula_id}}
Method:DELETE
请求参数:
user M user django用户信息
formula_id M int 配方ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
DELETE http://teststation.guanmai.cn/materials/formulas/11333
response:
{
'code': 0,
'msg': 'ok',
}
11.拉取入库单列表
接口名:/materials/stock/in
Method:GET
请求参数:
user M django user django用户信息
time_type M string 时间类型:1-按入库时间搜索;2-按建单时间搜索;
start_date M string 开始日期
end_date M string 截止日期
status O int 状态
search_text O string 搜索文本
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/in?time_type=1&start_date=2016-10-25&end_date=2016-10-26
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'id':11112, # 入库单ID
'in_stock_time': '2016-10-24', # 入库时间
'supplier_id': 'T131', # 供应商ID
‘supplier_name': '阿米巴13', # 供应商名称
'money': 1111, # 入库金额
'status': 2, # 状态 }
],
'msg': 'ok',
}
12.拉取入库单详情
接口名:/materials/stock/in/{{in_stock_id}}
Method:GET
请求参数:
user M user django用户信息
in_stock_id M int 入库单ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M json 入库单信息
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/in/113332
response:
{
'code': 0,
'msg': 'ok',
'data': {
'_id': 11234, # 入库单ID
'create_time': '建单时间',
'creator': '建单人',
'in_stock_time': '入库时间',
'supplier_name': '供应商名称',
'total_price': 12345, # 入库金额
'total_item_price': 10000, # 商品金额
'total_discount_price': 2345, # 折让金额
'status': 1-未入库;2-已入库;3-已冲销,
'details': [
{
'material_id': 1234,
'price': 120,
'quantity': 30,
'total_item_price': 30 x 120,
'operator': '操作人',
},
],
// 分摊
'share': [
{
'operate_time': '操作时间',
'reason': 1-运输费用分摊;2-其他费用分摊,
'money': 1234,
'action': 1-加钱;2-减钱,
'method': 1-金额分摊; 2-入库数分摊,
'remark': '备注',
'operator': '操作人ID',
}
],
// 折让
'discount':[
{
'operate_time': '操作时间',
'reason': 1-运输费用分摊;2-其他费用分摊,
'action': 1-加钱;2-减钱,
'money': 1234,
'remark': '备注',
'operator': '操作人ID',
}
],
'station_id': 'k10admin',
}
}
13.新建入库单
接口名:/materials/stock/in
Method:POST
请求参数:
user M user django用户信息
supplier_id M string 供应商ID
is_submit M int 是否提交为已入库:1-否;2-是
details M json 原料信息,结构见示例
share O json 分摊信息,结构见示例
discount O json 折让信息,结构见示例
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
POST http://teststation.guanmai.cn/materials/stock/in
POST参数:
supplier_id:'T131'
in_stock_time: '2015-02-02 10:00'
is_submit: 1
details: [{'id': 11132, 'quantity': 30, 'price': 20}]
share: [{'reason': 1, 'money': 20, 'action': 1, 'method': 1, 'remark': 'remark',}]
discount: [{'reason': 1, 'action': 1, 'money': 40, 'remark': 'test'}]
response:
{
'code': 0,
'msg': 'ok',
}
14.编辑入库单
接口名:/materials/stock/in/{{in_stock_id}}
Method:PUT
请求参数:
user M user django用户信息
in_stock_id M int 入库单ID
in_stock_time M string 入库时间
is_submit M int 是否提交为已入库:1-否;2-是
details M json 原料信息,结构见示例
share O json 分摊信息,结构见示例
discount O json 折让信息,结构见示例
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/stock/in/13133
PUT参数:
in_stock_id: 13133
in_stock_time: '2015-02-02 10:00'
is_submit: 1
details: [{'id': 11132, 'quantity': 30, 'price': 20, 'operator': 'user_id'}]
share: [{'reason': 1, 'money': 20, 'action': 1, 'method': 1, 'remark': 'remark', 'create_time': '', 'operator': 'user_id'}]
discount: [{'reason': 1, 'action': 1, 'money': 40, 'remark': 'test', 'create_time': '', 'operator': 'user_id'}]
response:
{
'code': 0,
'msg': 'ok',
}
15.冲销
接口名:/materials/stock/in/{{in_stock_id}}/cancel
Method:PUT
请求参数:
user M user django用户信息
in_stock_id M int 入库单ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/stock/in/11333/cancel
response:
{
'code': 0,
'msg': 'ok',
}
16.拉取出库单列表
接口名:/materials/stock/out
Method:GET
请求参数:
user M django user django用户信息
time_type M string 时间类型:1-按出库时间搜索;2-按建单时间搜索;
start_date M string 开始日期
end_date M string 截止日期
status O int 状态:1-未出库;2-已出库
search_text O string 搜索文本
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/out?time_type=1&start_date=2016-10-25&end_date=2016-10-26
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'id':11112, # 入库单ID
'out_stock_time': '2016-10-24', # 出库时间
'money': 1111, # 出库金额
'status': 2, # 状态 }
],
'msg': 'ok',
}
17.拉取出库单详情
接口名:/materials/stock/out/{{stock_out_id}}
Method:GET
请求参数:
user M user django用户信息
out_stock_id M int 出库单ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M json 出库单信息
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/out/113332
response:
{
'code': 0,
'msg': 'ok',
'data': {
'_id': '出库单ID',
'create_time': '建单时间',
'creator': '建单人',
'out_stock_time': '出库时间',
'total_price': 123434,
'status': 1-未出库;2-已出库,
'details': [{
'meterial_id': 12345,
'quantity': 33,
'price': 100,
'total_item_price': 100 x 33,
'fomula_id': 12345,
'operator': 'k10admin',
'create_time': '添加时间',
'update_time': '修改时间',
}],
'station_id': 'k10admin',
}
}
18.新建出库单
接口名:/materials/stock/out
Method:POST
请求参数:
user M user django用户信息
is_submit M int 是否提交为已出库:1-否;2-是
details M json 原料信息,结构见示例
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
POST http://teststation.guanmai.cn/materials/stock/out
POST参数:
out_stock_time: '2015-02-02 10:00'
is_submit: 1
details: [{'formula_id': 11132, 'meterial_id': 3321, 'quantity': 30, 'price': 20}]
response:
{
'code': 0,
'msg': 'ok',
}
19.编辑出库单
接口名:/materials/stock/out/{{stock_out_id}}
Method:PUT
请求参数:
user M user django用户信息
stock_out_id M int 出库单ID
out_stock_time M string 出库时间
is_submit M int 是否提交为已出库:1-否;2-是
details M json 原料信息,结构见示例
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/stock/out/13133
PUT参数:
stock_out_id: 13133
out_stock_time: '2015-02-02 10:00'
is_submit: 1
details: [{'formula_id': 11132, 'meterial_id': 3321, 'quantity': 30, 'price': 20, 'create_time': '', 'operator': 'user_id'}]
response:
{
'code': 0,
'msg': 'ok',
}
20.修改出库单状态
接口名:/materials/stock/out/{{stock_out_id}}/cancel
Method:PUT
请求参数:
user M user django用户信息
stock_out_order_id M int 出库单ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/stock/out/11333/cancel
response:
{
'code': 0,
'msg': 'ok',
}
21.拉取退货单列表
接口名:/materials/stock/return
Method:GET
请求参数:
user M django user django用户信息
time_type M string 时间类型:1-按退货时间搜索;2-按建单时间搜索;
start_date M string 开始日期
end_date M string 截止日期
status O int 状态
search_text O string 搜索文本
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/return?time_type=1&start_date=2016-10-25&end_date=2016-10-26
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'id':11112, # 入库单ID
'return_stock_time': '2016-10-24', # 退货时间
'supplier_id': 'T131', # 供应商ID
‘supplier_name': '阿米巴13', # 供应商名称
'money': 1111, # 退货金额
'status': 2, # 状态 }
],
'msg': 'ok',
}
22.拉取退货单详情
接口名:/materials/stock/return/{{stock_return_id}}
Method:GET
请求参数:
user M user django用户信息
stock_return_id M int 入库单ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M json 入库单信息
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/return/113332
response:
{
'code': 0,
'msg': 'ok',
'data': {
'_id': 'T002-YLTHD-2016-09-04-00008',
'return_stock_time': '退货时间',
'create_time': '建单时间',
'creator': '建单人',
'supplier_id': '供应商ID',
'total_price': 12000,
'status': 1-已退货;2-未退货;3-已冲销,
'details': [
{
'material_id': 'YL12345',
'quantity': 20,
'price': 240,
'total_item_price': 20 x 240,
'operator': 'username',
}
],
// 分摊
'share': [
{
'operate_time': '操作时间',
'reason': 1-运输费用分摊;2-其他费用分摊,
'money': 1234,
'action': 1-加钱;2-减钱,
'method': 1-金额分摊; 2-入库数分摊,
'remark': '备注',
'operator': '操作人ID',
}
],
// 折让
'discount':[
{
'operate_time': '操作时间',
'reason': 1-运输费用分摊;2-其他费用分摊,
'action': 1-加钱;2-减钱,
'money': 1234,
'remark': '备注',
'operator': '操作人ID',
}
],
'station_id': 'T002',
}
}
23.新建退货单
接口名:/materials/stock/return
Method:POST
请求参数:
user M user django用户信息
supplier_id M string 供应商ID
return_stock_time M string 退货时间
is_submit M int 是否提交为已退货:1-否;2-是;
details M json 原料信息,结构见示例
share O json 分摊信息,结构见示例
discount O json 折让信息,结构见示例
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
POST http://teststation.guanmai.cn/materials/stock/return
POST参数:
supplier_id:'T131'
return_stock_time: '2015-02-02 10:00'
is_submit: 1
details: [{'id': 11132, 'quantity': 30, 'price': 20}]
share: [{'reason': 1, 'money': 20, 'action': 1, 'method': 1, 'remark': 'remark'}]
discount: [{'reason': 1, 'action': 1, 'money': 40, 'remark': 'test'}]
response:
{
'code': 0,
'msg': 'ok',
'data': {
'id': 134343,
},
}
24.编辑退货单
接口名:/materials/stock/return/{{stock_return_id}}
Method:PUT
请求参数:
user M user django用户信息
stock_return_id M int 入库单ID
return_stock_time M string 入库时间
is_submit M int 是否提交为已退货:1-否;2-是;
details M json 原料信息,结构见示例
share O json 分摊信息,结构见示例
discount O json 折让信息,结构见示例
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/stock/return/13133
PUT参数:
return_stock_id: 13133
return_stock_time: '2015-02-02 10:00'
is_submit: 1
details: [{'id': 11132, 'quantity': 30, 'price': 20, 'operator': 'user_id'}]
share: [{'reason': 1, 'money': 20, 'action': 1, 'method': 1, 'remark': 'remark', 'create_time': '', 'operator': 'user_id'}]
discount: [{'reason': 1, 'action': 1, 'money': 40, 'remark': 'test', 'create_time': '', 'operator': 'user_id'}]
response:
{
'code': 0,
'msg': 'ok',
}
25.退货单冲销
接口名:/materials/stock/return/{{stock_return_id}}/cancel
Method:PUT
请求参数:
user M user django用户信息
stock_return_id M int 入库单ID
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
示例:
request:
PUT http://teststation.guanmai.cn/materials/stock/return/11333/cancel
response:
{
'code': 0,
'msg': 'ok',
}
26.原料库存记录拉取接口
接口名:/materials/stock/log
Method:GET
请求参数:
station_id M string 站点ID
type M int 记录类型:1-入库;2-出库;3-退货
search_text O string 搜索文本:原料ID或名称
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/log?station_id=T002&type=2&search_text=猪
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'_id': ObjectId('xxxxx'),
'material_id': 12343, # 原料ID
'material_name': 'xxx', # 原料名称
'supplier_name': 'xxx', # 供应商名称,在出库单时不需要
'change_type': 1, # 变动类型:1-入库;2-出库;3-退货
'change_stock_id': 'xxx', # 入库/出库/退货单ID
'status': 1, # 状态:1-删除;2-正常;
'quantity': 30, # 变动数量
'price': 120, # 变动价格
'total_price': 30 x 120, # 变动金额
'create_time': '创建时间',
'station_id': 'T002',
'modifier': 'xxx', # 修改人
'update_time': '修改时间',
}
],
'msg': 'ok',
}
27.拉取报损、报溢信息接口
接口名:/materials/stock/check
Method:GET
请求参数:
user M django user django用户信息
check_type M int 盘点类型:1-报溢;2-报损
search_text O string 搜索文本
export O int 是否导出:0-不导出,默认;1-导出;
offset O int 分页offset
limit O int 分页limit
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 返回信息
data M list 返回json数据,结构看示例
示例:
request:
GET http://teststation.guanmai.cn/materials/stock/check?check_type=2&search_text=猪
response:
{
'code': 0,
'data': {
'offset': 0,
'limit': 20,
'count': 100,
'list': [
{
'_id': 'xxxxxxxxx',
'material_id': 13141,
'name': '猪',
'unit_name': '头',
’type': 2;
'remain_stock': 99, # 抄盘数
'input_stock': 100, # 实盘数
’price': 111,
'quantity': 10,
'total_price': 111 x 10
'operator': '操作人',
'create_time': '记录插入时间',
'station_id': 'T002',
}
],
'msg': 'ok',
}