feat(erp): 新增字典和分类管理功能
- 添加 dict 包,包含字体、分类和字典相关结构体与方法 - 实现分类的增删改查接口 - 实现字典的增删改查接口 - 在 receivable.go 中扩展字段支持汇率、部门、业务员等信息 - 新增 payment.go 文件,实现付款单保存功能 - 引入 time 和 decimal 包以支持日期和金额类型字段
This commit is contained in:
106
erp/dict.go
Normal file
106
erp/dict.go
Normal file
@@ -0,0 +1,106 @@
|
||||
package erp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
client2 "git.kumo.work/shama/service/client"
|
||||
dict2 "git.kumo.work/shama/service/erp/dict"
|
||||
"git.kumo.work/shama/service/lib/bean"
|
||||
)
|
||||
|
||||
type dict struct {
|
||||
dict2.Dict
|
||||
}
|
||||
type ArgsDictList struct {
|
||||
Page bean.Page
|
||||
Search DictSearch
|
||||
}
|
||||
type DictSearch struct {
|
||||
Name string `label:"名称"`
|
||||
Value2 string `label:"属性值2"`
|
||||
CategoryId int64 `label:"分类ID"`
|
||||
CategoryCode string `label:"分类编码"`
|
||||
}
|
||||
type ReplyDictList struct {
|
||||
List []DictItem `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type DictItem struct {
|
||||
Id int64 `json:"id"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
CategoryCode string `json:"categoryCode"`
|
||||
Sort int64 `json:"sort"`
|
||||
Value1 string `json:"value1"`
|
||||
Value2 string `json:"value2"`
|
||||
Value3 string `json:"value3"`
|
||||
Value4 string `json:"value4"`
|
||||
Value5 string `json:"value5"`
|
||||
Value6 string `json:"value6"`
|
||||
Value7 string `json:"value7"`
|
||||
Value8 string `json:"value8"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// List @TITLE 字典列表
|
||||
func (d *dict) List(ctx context.Context, args ArgsDictList) (reply ReplyDictList, err error) {
|
||||
xClient, err := client2.GetClient(d)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "List", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsDictAdd struct {
|
||||
CategoryId int64 `binding:"required" label:"类目ID"`
|
||||
Sort int64 `label:"排序"`
|
||||
Value1 string `label:"属性值"`
|
||||
Value2 string `label:"属性值"`
|
||||
Value3 string `label:"属性值"`
|
||||
Value4 string `label:"属性值"`
|
||||
Value5 string `label:"属性值"`
|
||||
Value6 string `label:"属性值"`
|
||||
Value7 string `label:"属性值"`
|
||||
Value8 string `label:"属性值"`
|
||||
}
|
||||
|
||||
// Add @TITLE 添加字典
|
||||
func (d *dict) Add(ctx context.Context, args ArgsDictAdd) (err error) {
|
||||
xClient, err := client2.GetClient(d)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Add", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsDictEdit struct {
|
||||
DictId int64 `binding:"required" label:"字典ID"`
|
||||
ArgsDictAdd
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑字典
|
||||
func (d *dict) Edit(ctx context.Context, args ArgsDictEdit) (err error) {
|
||||
xClient, err := client2.GetClient(d)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Edit", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete @TITLE 删除字典
|
||||
func (d *dict) Delete(ctx context.Context, dictIds []int64) (err error) {
|
||||
xClient, err := client2.GetClient(d)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Delete", dictIds, &reply)
|
||||
return
|
||||
}
|
||||
107
erp/dict/category.go
Normal file
107
erp/dict/category.go
Normal file
@@ -0,0 +1,107 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
client2 "git.kumo.work/shama/service/client"
|
||||
"git.kumo.work/shama/service/lib/bean"
|
||||
)
|
||||
|
||||
type category struct {
|
||||
}
|
||||
type ArgsCategoryList struct {
|
||||
Page bean.Page
|
||||
Search CategorySearch
|
||||
}
|
||||
type CategorySearch struct {
|
||||
Name string `label:"名称"`
|
||||
GroupName string `label:"分组名"`
|
||||
}
|
||||
type ReplyCategoryList struct {
|
||||
List []CategoryItem `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type CategoryItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Sort int64 `json:"sort"`
|
||||
Info string `json:"info"`
|
||||
GroupName string `json:"groupName"`
|
||||
Label1 string `json:"label1"`
|
||||
Label2 string `json:"label2"`
|
||||
Label3 string `json:"label3"`
|
||||
Label4 string `json:"label4"`
|
||||
Label5 string `json:"label5"`
|
||||
Label6 string `json:"label6"`
|
||||
Label7 string `json:"label7"`
|
||||
Label8 string `json:"label8"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// List @TITLE 分类列表
|
||||
func (c *category) List(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) {
|
||||
xClient, err := client2.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "List", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsCategoryAdd struct {
|
||||
Name string `binding:"required" label:"名称"`
|
||||
Code string `binding:"required" label:"唯一编码"`
|
||||
Sort int64 `label:"排序"`
|
||||
Info string `label:"备注"`
|
||||
GroupName string `label:"分组名"`
|
||||
Label1 string `label:"属性名称"`
|
||||
Label2 string `label:"属性名称"`
|
||||
Label3 string `label:"属性名称"`
|
||||
Label4 string `label:"属性名称"`
|
||||
Label5 string `label:"属性名称"`
|
||||
Label6 string `label:"属性名称"`
|
||||
Label7 string `label:"属性名称"`
|
||||
Label8 string `label:"属性名称"`
|
||||
}
|
||||
|
||||
// Add @TITLE 添加分类
|
||||
func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) {
|
||||
xClient, err := client2.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Add", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsCategoryEdit struct {
|
||||
CategoryId int64 `binding:"required" label:"分类Id"`
|
||||
ArgsCategoryAdd
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑分类
|
||||
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) {
|
||||
xClient, err := client2.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Edit", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete @TITLE 删除分类
|
||||
func (c *category) Delete(ctx context.Context, categoryIds []int64) (err error) {
|
||||
xClient, err := client2.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Delete", categoryIds, &reply)
|
||||
return
|
||||
}
|
||||
6
erp/dict/dict.go
Normal file
6
erp/dict/dict.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package dict
|
||||
|
||||
type Dict struct {
|
||||
Font font
|
||||
Category category
|
||||
}
|
||||
39
erp/dict/font.go
Normal file
39
erp/dict/font.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.kumo.work/shama/service/client"
|
||||
"git.kumo.work/shama/service/lib/bean"
|
||||
)
|
||||
|
||||
type font struct {
|
||||
}
|
||||
|
||||
type ArgsFontList struct {
|
||||
Page bean.Page
|
||||
Search FontSearch
|
||||
}
|
||||
type FontSearch struct {
|
||||
Name string
|
||||
}
|
||||
type ReplyFontList struct {
|
||||
List []FontItem `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
type FontItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
BoldPath string `json:"boldPath"`
|
||||
}
|
||||
|
||||
// List @TITLE 列表
|
||||
func (f *font) List(ctx context.Context, args ArgsFontList) (reply ReplyFontList, err error) {
|
||||
xClient, err := client.GetClient(f)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "List", args, &reply)
|
||||
return
|
||||
}
|
||||
@@ -17,4 +17,5 @@ type Erp struct {
|
||||
Receipt receipt
|
||||
Expense expense
|
||||
Request request
|
||||
Dict dict
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user