feat(ik3cloud): 新增客户、付款单和物料模块
- 新增客户模块,支持客户信息保存功能 - 新增付款单模块,支持付款单据保存功能 - 新增物料模块,支持物料信息保存功能 - 修改部门和员工模块接口,统一使用Save方法替代原有的Add和Edit方法 - 调整金蝶集成接口参数,简化调用方式 - 更新常量定义,增加客户、付款单和物料相关枚举值
This commit is contained in:
@@ -2,10 +2,11 @@ package erp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
factory2 "git.kumo.work/shama/service/erp/factory"
|
factory2 "git.kumo.work/shama/service/erp/factory"
|
||||||
"git.kumo.work/shama/service/lib/bean"
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type factory struct {
|
type factory struct {
|
||||||
@@ -209,3 +210,13 @@ func (f *factory) Edit(ctx context.Context, args ArgsFactoryEdit) (err error) {
|
|||||||
reply := 0
|
reply := 0
|
||||||
return xClient.Call(ctx, "Edit", args, &reply)
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ik3cloud @TITLE 金蝶同步
|
||||||
|
func (f *factory) Ik3cloud(ctx context.Context, factoryId int64) (err error) {
|
||||||
|
xClient, err := client.GetClient(f)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Ik3cloud", factoryId, &reply)
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,5 +6,8 @@ const (
|
|||||||
ActionDepartment Action = "BD_Department" // 部门
|
ActionDepartment Action = "BD_Department" // 部门
|
||||||
ActionStaff Action = "BD_Empinfo" // 员工
|
ActionStaff Action = "BD_Empinfo" // 员工
|
||||||
ActionFactory Action = "BD_Supplier" // 工厂
|
ActionFactory Action = "BD_Supplier" // 工厂
|
||||||
ActionContact Action = "BD_CommonContact" // 工厂联系人
|
ActionContact Action = "BD_CommonContact" // 联系人
|
||||||
|
ActionCustom Action = "BD_Customer" // 客户
|
||||||
|
ActionPayment Action = "AR_receivable" // 付款单
|
||||||
|
ActionProduct Action = "BD_MATERIAL" // 物料
|
||||||
)
|
)
|
||||||
|
|||||||
43
ik3cloud/custom.go
Normal file
43
ik3cloud/custom.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package ik3cloud
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type custom struct {
|
||||||
|
}
|
||||||
|
type ArgsCustomSave struct {
|
||||||
|
CustomId int64 // 客户id
|
||||||
|
Number string // 编码
|
||||||
|
Name string // 名称
|
||||||
|
ShortName string // 简称
|
||||||
|
Address string // 地址
|
||||||
|
ZipCode string // 邮编
|
||||||
|
Website string // 网站
|
||||||
|
Tel string // 电话
|
||||||
|
Fax string // 传真
|
||||||
|
}
|
||||||
|
|
||||||
|
type FactoryCustomItem struct {
|
||||||
|
ContactNumber string // 联系人编号
|
||||||
|
Name string // 部门名称
|
||||||
|
Sex string // 性别
|
||||||
|
Job string // 职位
|
||||||
|
Tel string // 电话
|
||||||
|
Phone string // 手机
|
||||||
|
Fax string // 传真
|
||||||
|
Email string // 邮箱
|
||||||
|
IsDefault bool // 是否默认/主联系人
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save @TITLE 保存客户
|
||||||
|
func (c *custom) Save(ctx context.Context, args ArgsCustomSave) (entity Entity, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Save", args, &entity)
|
||||||
|
return
|
||||||
|
}
|
||||||
@@ -27,38 +27,24 @@ func (d *department) All(ctx context.Context) (reply []DepartmentItem, err error
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsDepartmentAdd struct {
|
type ArgsDepartmentSave struct {
|
||||||
|
DepartmentId int64 // 部门id
|
||||||
Number string // 部门编码
|
Number string // 部门编码
|
||||||
Name string // 部门名称
|
Name string // 部门名称
|
||||||
ParentNumber string // 上级部门编码
|
ParentNumber string // 上级部门编码
|
||||||
GroupNumber string // 分组编码
|
GroupNumber string // 分组编码
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add @TITLE 添加部门
|
// Save @TITLE 保存部门
|
||||||
func (d *department) Add(ctx context.Context, args ArgsDepartmentAdd) (departmentId int64, err error) {
|
func (d *department) Save(ctx context.Context, args ArgsDepartmentSave) (entity Entity, err error) {
|
||||||
xClient, err := client.GetClient(d)
|
xClient, err := client.GetClient(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = xClient.Call(ctx, "Add", args, &departmentId)
|
err = xClient.Call(ctx, "Save", args, &entity)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsDepartmentEdit struct {
|
|
||||||
DepartmentId int64 // 部门id
|
|
||||||
ArgsDepartmentAdd
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edit @TITLE 编辑部门
|
|
||||||
func (d *department) Edit(ctx context.Context, args ArgsDepartmentEdit) (err error) {
|
|
||||||
xClient, err := client.GetClient(d)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var reply int
|
|
||||||
return xClient.Call(ctx, "Edit", args, &reply)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete @TITLE 删除部门
|
// Delete @TITLE 删除部门
|
||||||
func (d *department) Delete(ctx context.Context, numbers []string) (err error) {
|
func (d *department) Delete(ctx context.Context, numbers []string) (err error) {
|
||||||
xClient, err := client.GetClient(d)
|
xClient, err := client.GetClient(d)
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ type Ik3cloud struct {
|
|||||||
Staff staff // 员工
|
Staff staff // 员工
|
||||||
Contact contact // 联系人
|
Contact contact // 联系人
|
||||||
Factory factory // 工厂
|
Factory factory // 工厂
|
||||||
|
Custom custom // 客户
|
||||||
|
Payment payment // 付款
|
||||||
|
Product product // 产品
|
||||||
}
|
}
|
||||||
type Entity struct {
|
type Entity struct {
|
||||||
Id int64 `json:"Id"`
|
Id int64 `json:"Id"`
|
||||||
|
|||||||
25
ik3cloud/payment.go
Normal file
25
ik3cloud/payment.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package ik3cloud
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type payment struct {
|
||||||
|
}
|
||||||
|
type ArgsPaymentSave struct {
|
||||||
|
PaymentId int64 // 付款单id
|
||||||
|
Number string // 编码
|
||||||
|
CustomNumber 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
|
||||||
|
}
|
||||||
25
ik3cloud/product.go
Normal file
25
ik3cloud/product.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package ik3cloud
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type product struct {
|
||||||
|
}
|
||||||
|
type ArgsProductSave struct {
|
||||||
|
ProductId int64 // 付款单id
|
||||||
|
Number string // 编码
|
||||||
|
Name string // 名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save @TITLE 保存客户
|
||||||
|
func (p *product) Save(ctx context.Context, args ArgsProductSave) (entity Entity, err error) {
|
||||||
|
xClient, err := client.GetClient(p)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Save", args, &entity)
|
||||||
|
return
|
||||||
|
}
|
||||||
@@ -42,39 +42,25 @@ func (s *staff) List(ctx context.Context, args ArgsStaffList) (reply ReplyStaffL
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsStaffAdd struct {
|
type ArgsStaffSave struct {
|
||||||
Name string // 姓名
|
StaffId int64 // 员工id
|
||||||
Number string // 编码
|
Name string // 姓名
|
||||||
Mobile any // 手机号
|
Number string // 编码
|
||||||
Tel string // 座机
|
Mobile any // 手机号
|
||||||
Email string // 邮箱
|
Tel string // 座机
|
||||||
|
Email string // 邮箱
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add @TITLE 添加员工
|
// Save @TITLE 保存员工
|
||||||
func (s *staff) Add(ctx context.Context, args ArgsStaffAdd) (entity Entity, err error) {
|
func (s *staff) Save(ctx context.Context, args ArgsStaffSave) (entity Entity, err error) {
|
||||||
xClient, err := client.GetClient(s)
|
xClient, err := client.GetClient(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = xClient.Call(ctx, "Add", args, &entity)
|
err = xClient.Call(ctx, "Save", args, &entity)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsStaffEdit struct {
|
|
||||||
StaffId int64 // 员工id
|
|
||||||
ArgsStaffAdd
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edit @TITLE 员工编辑
|
|
||||||
func (s *staff) Edit(ctx context.Context, args ArgsStaffEdit) (err error) {
|
|
||||||
xClient, err := client.GetClient(s)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var reply int
|
|
||||||
return xClient.Call(ctx, "Edit", args, &reply)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable @TITLE 禁用员工
|
// Disable @TITLE 禁用员工
|
||||||
func (s *staff) Disable(ctx context.Context, args Unique) (err error) {
|
func (s *staff) Disable(ctx context.Context, args Unique) (err error) {
|
||||||
xClient, err := client.GetClient(s)
|
xClient, err := client.GetClient(s)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/ik3cloud"
|
||||||
)
|
)
|
||||||
|
|
||||||
type department struct {
|
type department struct {
|
||||||
@@ -96,17 +97,22 @@ func (d *department) SetStaff(ctx context.Context, args ArgsDepartmentSetStaff)
|
|||||||
return xClient.Call(ctx, "SetStaff", args, &reply)
|
return xClient.Call(ctx, "SetStaff", args, &reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsDepartmentIk3cloud struct {
|
// Ik3cloudInfo @TITLE 金蝶同步信息
|
||||||
DepartmentId int64 // 部门id
|
func (d *department) Ik3cloudInfo(ctx context.Context, departmentId int64) (entity ik3cloud.Entity, err error) {
|
||||||
Number string // 金蝶部门编号
|
xClient, err := client.GetClient(d)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Ik3cloudInfo", departmentId, &entity)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ik3cloud @TITLE 金蝶集成
|
// Ik3cloud @TITLE 金蝶集成
|
||||||
func (d *department) Ik3cloud(ctx context.Context, args ArgsDepartmentIk3cloud) (err error) {
|
func (d *department) Ik3cloud(ctx context.Context, departmentId int64) (err error) {
|
||||||
xClient, err := client.GetClient(d)
|
xClient, err := client.GetClient(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var reply int
|
var reply int
|
||||||
return xClient.Call(ctx, "Ik3cloud", args, &reply)
|
return xClient.Call(ctx, "Ik3cloud", departmentId, &reply)
|
||||||
}
|
}
|
||||||
|
|||||||
16
oa/staff.go
16
oa/staff.go
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/ik3cloud"
|
||||||
"git.kumo.work/shama/service/lib/bean"
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -266,17 +267,22 @@ func (s *staff) Enable(ctx context.Context, staffIds []int64) (err error) {
|
|||||||
return xClient.Call(ctx, "Enable", staffIds, &reply)
|
return xClient.Call(ctx, "Enable", staffIds, &reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsStaffIk3cloud struct {
|
// Ik3cloudInfo @TITLE 金蝶同步信息
|
||||||
StaffId int64 // 员工id
|
func (s *staff) Ik3cloudInfo(ctx context.Context, staffId int64) (entity ik3cloud.Entity, err error) {
|
||||||
Number string // 金蝶员工编号
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Ik3cloudInfo", staffId, &entity)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ik3cloud @TITLE 金蝶集成
|
// Ik3cloud @TITLE 金蝶集成
|
||||||
func (s *staff) Ik3cloud(ctx context.Context, args ArgsStaffIk3cloud) (err error) {
|
func (s *staff) Ik3cloud(ctx context.Context, staffId int64) (err error) {
|
||||||
xClient, err := client.GetClient(s)
|
xClient, err := client.GetClient(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var reply int
|
var reply int
|
||||||
return xClient.Call(ctx, "Ik3cloud", args, &reply)
|
return xClient.Call(ctx, "Ik3cloud", staffId, &reply)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user