更新
This commit is contained in:
1 parent
5718a00e31
commit
1850ac640e
226 files changed
+37772
-12071
No files matched your search
@@ -0,0 +1,115 @@
|
||||
package controllers
|
||||
|
||||
// 移动端进销存档案接口:商品、分类、仓库、客商。
|
||||
//
|
||||
// 档案维护(新建/修改/删除)仍留在 Web 端,手机端只读——开单时需要选商品、
|
||||
// 选仓库、选客户/供应商,因此这里提供与 Web 端同一份过滤与补字段口径的列表/详情。
|
||||
|
||||
// AppErpArchiveController 档案查询(移动端只读)
|
||||
type AppErpArchiveController struct {
|
||||
AppErpBaseController
|
||||
}
|
||||
|
||||
// ProductList GET /api/erp/product/list 商品列表(含分类名、全仓库存与预警状态)
|
||||
func (c *AppErpArchiveController) ProductList() {
|
||||
cl, err := c.erpClaims()
|
||||
if c.erpDenied(err) {
|
||||
return
|
||||
}
|
||||
page, pageSize := c.erpPage()
|
||||
f := erpProductFilter{
|
||||
Keyword: c.erpQuery("keyword"),
|
||||
CategoryID: c.erpUint("category_id"),
|
||||
Brand: c.erpQuery("brand"),
|
||||
Status: c.erpQuery("status"),
|
||||
IsDraft: c.erpQuery("is_draft"),
|
||||
OnlyEnabled: c.erpFlag("only_enabled"),
|
||||
}
|
||||
list, total, code, msg := erpProductListCore(c.actor(cl), f, page, pageSize)
|
||||
if msg != "" {
|
||||
c.erpFail(code, code, msg)
|
||||
return
|
||||
}
|
||||
c.erpListOK(list, total, page, pageSize, nil)
|
||||
}
|
||||
|
||||
// ProductDetail GET /api/erp/product/detail/:id 商品详情(含分仓/分批次结存)
|
||||
func (c *AppErpArchiveController) ProductDetail() {
|
||||
cl, err := c.erpClaims()
|
||||
if c.erpDenied(err) {
|
||||
return
|
||||
}
|
||||
p, code, msg := erpProductDetailCore(c.actor(cl), c.erpPathID())
|
||||
if msg != "" {
|
||||
c.erpFail(code, code, msg)
|
||||
return
|
||||
}
|
||||
c.erpOk(p)
|
||||
}
|
||||
|
||||
// CategoryList GET /api/erp/product/category/list 商品分类(列表 + 树)
|
||||
func (c *AppErpArchiveController) CategoryList() {
|
||||
cl, err := c.erpClaims()
|
||||
if c.erpDenied(err) {
|
||||
return
|
||||
}
|
||||
rows, tree, code, msg := erpCategoryListCore(c.actor(cl))
|
||||
if msg != "" {
|
||||
c.erpFail(code, code, msg)
|
||||
return
|
||||
}
|
||||
c.erpOk(map[string]interface{}{"list": rows, "tree": tree})
|
||||
}
|
||||
|
||||
// WarehouseList GET /api/erp/warehouse/list 仓库列表(含在库品种数与货值)
|
||||
func (c *AppErpArchiveController) WarehouseList() {
|
||||
cl, err := c.erpClaims()
|
||||
if c.erpDenied(err) {
|
||||
return
|
||||
}
|
||||
rows, code, msg := erpWarehouseListCore(c.actor(cl), c.erpQuery("keyword"), c.erpQuery("status"), c.erpFlag("only_enabled"))
|
||||
if msg != "" {
|
||||
c.erpFail(code, code, msg)
|
||||
return
|
||||
}
|
||||
c.erpOk(map[string]interface{}{"list": rows})
|
||||
}
|
||||
|
||||
// PartnerList GET /api/erp/partner/list?partner_type=supplier|customer 客商列表
|
||||
// 供应商与客户统一出参(partner_type/partner_name/open_amount),手机端开单与对账只需对接一种结构。
|
||||
func (c *AppErpArchiveController) PartnerList() {
|
||||
cl, err := c.erpClaims()
|
||||
if c.erpDenied(err) {
|
||||
return
|
||||
}
|
||||
page, pageSize := c.erpPage()
|
||||
partnerType := c.erpQuery("partner_type")
|
||||
if partnerType != "supplier" {
|
||||
partnerType = "customer"
|
||||
}
|
||||
list, total, code, msg := erpPartnerListCore(c.actor(cl), partnerType,
|
||||
c.erpQuery("keyword"), c.erpFlag("only_enabled"), page, pageSize)
|
||||
if msg != "" {
|
||||
c.erpFail(code, code, msg)
|
||||
return
|
||||
}
|
||||
c.erpListOK(list, total, page, pageSize, nil)
|
||||
}
|
||||
|
||||
// PartnerDetail GET /api/erp/partner/detail/:id?partner_type= 客商详情
|
||||
func (c *AppErpArchiveController) PartnerDetail() {
|
||||
cl, err := c.erpClaims()
|
||||
if c.erpDenied(err) {
|
||||
return
|
||||
}
|
||||
partnerType := c.erpQuery("partner_type")
|
||||
if partnerType != "supplier" {
|
||||
partnerType = "customer"
|
||||
}
|
||||
data, code, msg := erpPartnerDetailCore(c.actor(cl), partnerType, c.erpPathID())
|
||||
if msg != "" {
|
||||
c.erpFail(code, code, msg)
|
||||
return
|
||||
}
|
||||
c.erpOk(data)
|
||||
}
|
||||
Reference in new issue
Block a user