diff --git a/erp/dict.go b/erp/dict.go new file mode 100644 index 0000000..7701f8c --- /dev/null +++ b/erp/dict.go @@ -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 +} diff --git a/erp/dict/category.go b/erp/dict/category.go new file mode 100644 index 0000000..24d8e28 --- /dev/null +++ b/erp/dict/category.go @@ -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 +} diff --git a/erp/dict/dict.go b/erp/dict/dict.go new file mode 100644 index 0000000..9a4f7a5 --- /dev/null +++ b/erp/dict/dict.go @@ -0,0 +1,6 @@ +package dict + +type Dict struct { + Font font + Category category +} diff --git a/erp/dict/font.go b/erp/dict/font.go new file mode 100644 index 0000000..ea6aead --- /dev/null +++ b/erp/dict/font.go @@ -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 +} diff --git a/erp/erp.go b/erp/erp.go index f2087cc..222bbc5 100644 --- a/erp/erp.go +++ b/erp/erp.go @@ -17,4 +17,5 @@ type Erp struct { Receipt receipt Expense expense Request request + Dict dict } diff --git a/ik3cloud/constant/constant.go b/ik3cloud/constant/constant.go index 44c0040..a87bd62 100644 --- a/ik3cloud/constant/constant.go +++ b/ik3cloud/constant/constant.go @@ -11,12 +11,14 @@ const ( ActionFactory Action = "BD_Supplier" // 工厂 ActionContact Action = "BD_CommonContact" // 联系人 ActionCustom Action = "BD_Customer" // 客户 - ActionReceivable Action = "AR_receivable" // 付款单 - ActionPayable Action = "AP_Payable" // 付款单 + ActionReceivable Action = "AR_receivable" // 应收单 + ActionPayable Action = "AP_Payable" // 应付单 ActionProduct Action = "BD_MATERIAL" // 物料 ActionCurrency Action = "BD_Currency" // 币种 ActionSettleType Action = "BD_SETTLETYPE" // 结算方式 ActionRecPayPurpose Action = "CN_RECPAYPURPOSE" // 收付款用途 + ActionExpense Action = "BD_Expense" // 费用项目 + ActionPayment Action = "AP_PAYBILL" // 付款单 ) type OperatorType = string @@ -25,3 +27,11 @@ const ( OperatorTypeXSY OperatorType = "XSY" // 业务员 OperatorTypeCGY OperatorType = "CGY" // 采购员 ) + +type PaymentType = string + +const ( + PaymentTypePurchase PaymentType = "FKDLX09_SYS" // 采购付款单 + PaymentTypeCost PaymentType = "FKDLX10_SYS" // 费用付款单 + PaymentTypeRequest PaymentType = "FKDLX11_SYS" // 报销付款单 +) diff --git a/ik3cloud/ik3cloud.go b/ik3cloud/ik3cloud.go index bedca59..95c3c26 100644 --- a/ik3cloud/ik3cloud.go +++ b/ik3cloud/ik3cloud.go @@ -11,6 +11,7 @@ type Ik3cloud struct { Receivable receivable // 应收 Payable payable // 应付 Dict dict // 字典 + Payment payment // 付款单 } type Entity struct { Id int64 `json:"Id"` diff --git a/ik3cloud/payment.go b/ik3cloud/payment.go new file mode 100644 index 0000000..33afb52 --- /dev/null +++ b/ik3cloud/payment.go @@ -0,0 +1,47 @@ +package ik3cloud + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/ik3cloud/constant" + "github.com/shopspring/decimal" +) + +type payment struct { +} + +type ArgsPaymentSave struct { + PaymentId int64 // 付款单id + Number string // 付款单编号 + PaymentType constant.PaymentType // 付款类型 + PayeeNameType string // 收款单位类型 + PayeeName string // 收款单位 + CurrencyNumber string // 币种 + DepartmentNumber string // 采购部门 + StaffNumber string // 采购员 + Remarks string // 备注 + Costs []PaymentCostItem // 费用 + Rate decimal.Decimal // 汇率 + Date time.Time // 业务日期 2006-01-02 15:04:05 +} +type PaymentCostItem struct { + Amount decimal.Decimal // 金额 + Date time.Time // 费用日期 + InvoiceSerial string // 发票号 + DepartmentNumber string // 核算部门 + SettlementMethod string // 结算方式 + PaymentPurpose string // 付款用途 + ExpenseItem string // 费用项目 +} + +// Save @TITLE 保存付款单 +func (p *payment) Save(ctx context.Context, args ArgsPaymentSave) (entity Entity, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "Save", args, &entity) + return +} diff --git a/ik3cloud/receivable.go b/ik3cloud/receivable.go index e2bc9bd..e10452e 100644 --- a/ik3cloud/receivable.go +++ b/ik3cloud/receivable.go @@ -2,16 +2,36 @@ package ik3cloud import ( "context" + "time" "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" ) type receivable struct { } type ArgsReceivableSave struct { - ReceivableId int64 // 应收单id - Number string // 编码 - CustomNumber string // 客户编码 + ReceivableId int64 // 应收单id + Number string // 编码 + CustomNumber string // 客户编码 + CurrencyNumber string // 币种 + DepartmentNumber string // 部门 + StaffXsyNumber string // 业务员 + Products []ReceivableProductItem // 商品 + Rate decimal.Decimal // 汇率 + Date time.Time // 日期 +} + +type ReceivableProductItem struct { + Number string // 商品编码 + Name string // 商品名称 + Count int64 // 数量 + UnitPrice decimal.Decimal // 含税单价 + AddTaxRate decimal.Decimal // 税率 + ExTaxUnitPrice decimal.Decimal // 不含税单价 + TaxAmount decimal.Decimal // 税额 + UnitAmount decimal.Decimal // 含税金额 + ExTaxUnitAmount decimal.Decimal // 不含税金额 } // Save @TITLE 保存应收