From 908fa48a84920b8da496e8d88c00587da94a8afc Mon Sep 17 00:00:00 2001 From: kanade Date: Wed, 3 Dec 2025 13:49:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(ik3cloud):=20=E6=96=B0=E5=A2=9E=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E3=80=81=E4=BB=98=E6=AC=BE=E5=8D=95=E5=92=8C=E7=89=A9?= =?UTF-8?q?=E6=96=99=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增客户模块,支持客户信息保存功能 - 新增付款单模块,支持付款单据保存功能 - 新增物料模块,支持物料信息保存功能 - 修改部门和员工模块接口,统一使用Save方法替代原有的Add和Edit方法 - 调整金蝶集成接口参数,简化调用方式 - 更新常量定义,增加客户、付款单和物料相关枚举值 --- erp/factory.go | 13 ++++++++++- ik3cloud/constant/constant.go | 5 +++- ik3cloud/custom.go | 43 +++++++++++++++++++++++++++++++++++ ik3cloud/department.go | 24 ++++--------------- ik3cloud/ik3cloud.go | 3 +++ ik3cloud/payment.go | 25 ++++++++++++++++++++ ik3cloud/product.go | 25 ++++++++++++++++++++ ik3cloud/staff.go | 34 ++++++++------------------- oa/department.go | 16 +++++++++---- oa/staff.go | 16 +++++++++---- 10 files changed, 149 insertions(+), 55 deletions(-) create mode 100644 ik3cloud/custom.go create mode 100644 ik3cloud/payment.go create mode 100644 ik3cloud/product.go diff --git a/erp/factory.go b/erp/factory.go index 8bd0029..e1a7370 100644 --- a/erp/factory.go +++ b/erp/factory.go @@ -2,10 +2,11 @@ package erp import ( "context" + "time" + "git.kumo.work/shama/service/client" factory2 "git.kumo.work/shama/service/erp/factory" "git.kumo.work/shama/service/lib/bean" - "time" ) type factory struct { @@ -209,3 +210,13 @@ func (f *factory) Edit(ctx context.Context, args ArgsFactoryEdit) (err error) { reply := 0 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) +} diff --git a/ik3cloud/constant/constant.go b/ik3cloud/constant/constant.go index 6fbe6b1..4d183c1 100644 --- a/ik3cloud/constant/constant.go +++ b/ik3cloud/constant/constant.go @@ -6,5 +6,8 @@ const ( ActionDepartment Action = "BD_Department" // 部门 ActionStaff Action = "BD_Empinfo" // 员工 ActionFactory Action = "BD_Supplier" // 工厂 - ActionContact Action = "BD_CommonContact" // 工厂联系人 + ActionContact Action = "BD_CommonContact" // 联系人 + ActionCustom Action = "BD_Customer" // 客户 + ActionPayment Action = "AR_receivable" // 付款单 + ActionProduct Action = "BD_MATERIAL" // 物料 ) diff --git a/ik3cloud/custom.go b/ik3cloud/custom.go new file mode 100644 index 0000000..89b0ac0 --- /dev/null +++ b/ik3cloud/custom.go @@ -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 +} diff --git a/ik3cloud/department.go b/ik3cloud/department.go index 32ac762..ac27d6f 100644 --- a/ik3cloud/department.go +++ b/ik3cloud/department.go @@ -27,38 +27,24 @@ func (d *department) All(ctx context.Context) (reply []DepartmentItem, err error return } -type ArgsDepartmentAdd struct { +type ArgsDepartmentSave struct { + DepartmentId int64 // 部门id Number string // 部门编码 Name string // 部门名称 ParentNumber string // 上级部门编码 GroupNumber string // 分组编码 } -// Add @TITLE 添加部门 -func (d *department) Add(ctx context.Context, args ArgsDepartmentAdd) (departmentId int64, err error) { +// Save @TITLE 保存部门 +func (d *department) Save(ctx context.Context, args ArgsDepartmentSave) (entity Entity, err error) { xClient, err := client.GetClient(d) if err != nil { return } - err = xClient.Call(ctx, "Add", args, &departmentId) + err = xClient.Call(ctx, "Save", args, &entity) 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 删除部门 func (d *department) Delete(ctx context.Context, numbers []string) (err error) { xClient, err := client.GetClient(d) diff --git a/ik3cloud/ik3cloud.go b/ik3cloud/ik3cloud.go index 0cffa8f..f0b6b42 100644 --- a/ik3cloud/ik3cloud.go +++ b/ik3cloud/ik3cloud.go @@ -5,6 +5,9 @@ type Ik3cloud struct { Staff staff // 员工 Contact contact // 联系人 Factory factory // 工厂 + Custom custom // 客户 + Payment payment // 付款 + Product product // 产品 } type Entity struct { Id int64 `json:"Id"` diff --git a/ik3cloud/payment.go b/ik3cloud/payment.go new file mode 100644 index 0000000..e02dad6 --- /dev/null +++ b/ik3cloud/payment.go @@ -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 +} diff --git a/ik3cloud/product.go b/ik3cloud/product.go new file mode 100644 index 0000000..effd1a8 --- /dev/null +++ b/ik3cloud/product.go @@ -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 +} diff --git a/ik3cloud/staff.go b/ik3cloud/staff.go index 4c7f034..78acf12 100644 --- a/ik3cloud/staff.go +++ b/ik3cloud/staff.go @@ -42,39 +42,25 @@ func (s *staff) List(ctx context.Context, args ArgsStaffList) (reply ReplyStaffL return } -type ArgsStaffAdd struct { - Name string // 姓名 - Number string // 编码 - Mobile any // 手机号 - Tel string // 座机 - Email string // 邮箱 +type ArgsStaffSave struct { + StaffId int64 // 员工id + Name string // 姓名 + Number string // 编码 + Mobile any // 手机号 + Tel string // 座机 + Email string // 邮箱 } -// Add @TITLE 添加员工 -func (s *staff) Add(ctx context.Context, args ArgsStaffAdd) (entity Entity, err error) { +// Save @TITLE 保存员工 +func (s *staff) Save(ctx context.Context, args ArgsStaffSave) (entity Entity, err error) { xClient, err := client.GetClient(s) if err != nil { return } - err = xClient.Call(ctx, "Add", args, &entity) + err = xClient.Call(ctx, "Save", args, &entity) 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 禁用员工 func (s *staff) Disable(ctx context.Context, args Unique) (err error) { xClient, err := client.GetClient(s) diff --git a/oa/department.go b/oa/department.go index 5eaf10e..36cea37 100644 --- a/oa/department.go +++ b/oa/department.go @@ -5,6 +5,7 @@ import ( "time" "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/ik3cloud" ) type department struct { @@ -96,17 +97,22 @@ func (d *department) SetStaff(ctx context.Context, args ArgsDepartmentSetStaff) return xClient.Call(ctx, "SetStaff", args, &reply) } -type ArgsDepartmentIk3cloud struct { - DepartmentId int64 // 部门id - Number string // 金蝶部门编号 +// Ik3cloudInfo @TITLE 金蝶同步信息 +func (d *department) Ik3cloudInfo(ctx context.Context, departmentId int64) (entity ik3cloud.Entity, err error) { + xClient, err := client.GetClient(d) + if err != nil { + return + } + err = xClient.Call(ctx, "Ik3cloudInfo", departmentId, &entity) + return } // 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) if err != nil { return } var reply int - return xClient.Call(ctx, "Ik3cloud", args, &reply) + return xClient.Call(ctx, "Ik3cloud", departmentId, &reply) } diff --git a/oa/staff.go b/oa/staff.go index 1d8d260..7807d52 100644 --- a/oa/staff.go +++ b/oa/staff.go @@ -5,6 +5,7 @@ import ( "time" "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/ik3cloud" "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) } -type ArgsStaffIk3cloud struct { - StaffId int64 // 员工id - Number string // 金蝶员工编号 +// Ik3cloudInfo @TITLE 金蝶同步信息 +func (s *staff) Ik3cloudInfo(ctx context.Context, staffId int64) (entity ik3cloud.Entity, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Ik3cloudInfo", staffId, &entity) + return } // 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) if err != nil { return } var reply int - return xClient.Call(ctx, "Ik3cloud", args, &reply) + return xClient.Call(ctx, "Ik3cloud", staffId, &reply) }