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