From fa23a28fab9b1690355cd920ec16080f1c7f5444 Mon Sep 17 00:00:00 2001 From: kanade Date: Thu, 27 Nov 2025 11:44:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(ik3cloud):=20=E6=96=B0=E5=A2=9E=E5=B7=A5?= =?UTF-8?q?=E5=8E=82=E4=B8=8E=E8=81=94=E7=B3=BB=E4=BA=BA=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加常量定义文件,包含部门、员工、工厂和联系人相关操作类型 - 实现联系人保存与删除接口,支持联系人信息的完整字段 - 实现工厂信息保存接口,包含工厂基本信息及联系人列表 - 定义工厂联系人结构体,支持多个联系人关联工厂信息 - 集成客户端调用逻辑,通过RPC方式与外部服务通信 --- ik3cloud/constant/constant.go | 10 +++++++ ik3cloud/contact.go | 49 +++++++++++++++++++++++++++++++++++ ik3cloud/factory.go | 46 ++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 ik3cloud/constant/constant.go create mode 100644 ik3cloud/contact.go create mode 100644 ik3cloud/factory.go diff --git a/ik3cloud/constant/constant.go b/ik3cloud/constant/constant.go new file mode 100644 index 0000000..6fbe6b1 --- /dev/null +++ b/ik3cloud/constant/constant.go @@ -0,0 +1,10 @@ +package constant + +type Action = string // 方法 + +const ( + ActionDepartment Action = "BD_Department" // 部门 + ActionStaff Action = "BD_Empinfo" // 员工 + ActionFactory Action = "BD_Supplier" // 工厂 + ActionContact Action = "BD_CommonContact" // 工厂联系人 +) diff --git a/ik3cloud/contact.go b/ik3cloud/contact.go new file mode 100644 index 0000000..c46cd45 --- /dev/null +++ b/ik3cloud/contact.go @@ -0,0 +1,49 @@ +package ik3cloud + +import ( + "context" + + "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/ik3cloud/constant" +) + +type contact struct { +} + +type ArgsContactSave struct { + CompanyType constant.Action + Contacts []ContactItem +} +type ContactItem struct { + ContactId int64 // 部门id + Number string // 部门编码 + Name string // 部门名称 + Sex string // 性别 + Job string // 职位 + Tel string // 电话 + Phone string // 手机 + Fax string // 传真 + Email string // 邮箱 + IsDefault bool // 是否默认/主联系人 + CompanyNumber string // 关联订单编码 +} + +// Save @TITLE 保存联系人 +func (c *contact) Save(ctx context.Context, args ArgsContactSave) (entities []Entity, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "Save", args, &entities) + return +} + +// Delete @TITLE 删除联系人 +func (c *contact) Delete(ctx context.Context, args Unique) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + var reply int + return xClient.Call(ctx, "Delete", args, &reply) +} diff --git a/ik3cloud/factory.go b/ik3cloud/factory.go new file mode 100644 index 0000000..75150a6 --- /dev/null +++ b/ik3cloud/factory.go @@ -0,0 +1,46 @@ +package ik3cloud + +import ( + "context" + + "git.kumo.work/shama/service/client" +) + +type factory struct { +} +type ArgsFactorySave struct { + FactoryId int64 // 工厂id + Number string // 工厂编码 + Name string // 工厂名称 + ShortName string // 简称 + Address string // 地址 + ZipCode string + LegalPerson string + TaxNumber string + RegAddress string + Bank string + BankAccount string + Contacts []FactoryContactItem +} + +type FactoryContactItem struct { + ContactNumber string // 联系人编号 + Name string // 部门名称 + Sex string // 性别 + Job string // 职位 + Tel string // 电话 + Phone string // 手机 + Fax string // 传真 + Email string // 邮箱 + IsDefault bool // 是否默认/主联系人 +} + +// Save @TITLE 保存工厂 +func (f *factory) Save(ctx context.Context, args ArgsFactorySave) (entity Entity, err error) { + xClient, err := client.GetClient(f) + if err != nil { + return + } + err = xClient.Call(ctx, "Save", args, &entity) + return +}