feat(ik3cloud): 新增工厂与联系人管理功能

- 添加常量定义文件,包含部门、员工、工厂和联系人相关操作类型
- 实现联系人保存与删除接口,支持联系人信息的完整字段
- 实现工厂信息保存接口,包含工厂基本信息及联系人列表
- 定义工厂联系人结构体,支持多个联系人关联工厂信息
- 集成客户端调用逻辑,通过RPC方式与外部服务通信
This commit is contained in:
2025-11-27 11:44:44 +08:00
parent 9c2d9e2f3f
commit fa23a28fab
3 changed files with 105 additions and 0 deletions

View File

@@ -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" // 工厂联系人
)

49
ik3cloud/contact.go Normal file
View File

@@ -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)
}

46
ik3cloud/factory.go Normal file
View File

@@ -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
}