From 81ffde828cd67294dbf698553aca50d1c4c5fa21 Mon Sep 17 00:00:00 2001 From: kanade Date: Thu, 1 Aug 2024 14:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp/erp.go | 11 +- erp/logisticsCompany.go | 140 +++++++++++++++++++++++ erp/logisticsCompany/contact.go | 89 ++++++++++++++ erp/logisticsCompany/logisticsCompany.go | 5 + erp/purchase.go | 67 +++++++++++ erp/purchase/product.go | 89 ++++++++++++++ erp/sale/audit.go | 25 ++++ erp/sale/product.go | 5 + erp/sale/sale.go | 1 + erp/shipment/cost.go | 76 ++++++++++++ erp/shipment/shipment.go | 5 + erp/workflow.go | 41 +++++++ oa/department.go | 26 +++-- 13 files changed, 569 insertions(+), 11 deletions(-) create mode 100644 erp/logisticsCompany.go create mode 100644 erp/logisticsCompany/contact.go create mode 100644 erp/logisticsCompany/logisticsCompany.go create mode 100644 erp/purchase.go create mode 100644 erp/sale/audit.go create mode 100644 erp/shipment/cost.go create mode 100644 erp/shipment/shipment.go create mode 100644 erp/workflow.go diff --git a/erp/erp.go b/erp/erp.go index 9cd02b2..d194f23 100644 --- a/erp/erp.go +++ b/erp/erp.go @@ -1,8 +1,11 @@ package erp type Erp struct { - Factory factory - Custom custom - Product product - Sale sale + Factory factory + Custom custom + Product product + Sale sale + Purchase purchase + LogisticsCompany logisticsCompany + Workflow workflow } diff --git a/erp/logisticsCompany.go b/erp/logisticsCompany.go new file mode 100644 index 0000000..f1396ff --- /dev/null +++ b/erp/logisticsCompany.go @@ -0,0 +1,140 @@ +package erp + +import ( + "context" + client2 "git.kumo.work/shama/service/client" + logisticsCompany2 "git.kumo.work/shama/service/erp/logisticsCompany" + "git.kumo.work/shama/service/lib/bean" + "time" +) + +type logisticsCompany struct { + logisticsCompany2.LogisticsCompany +} +type ArgsLogisticsCompanyList struct { + Page bean.Page + Search LogisticsCompanySearch +} +type LogisticsCompanySearch struct { + Name string // 公司名称 + CreatedStaffIds []int64 // 业务员 + CreatedAtStart *time.Time // 录入开始时间 + CreatedAtEnd *time.Time // 录入结束时间 +} +type ReplyLogisticsCompanyList struct { + List []LogisticsCompanyItem `json:"list"` + Total int64 `json:"total"` +} + +type LogisticsCompanyItem struct { + Id int64 `json:"id"` + Name string `json:"name"` // 公司名称 + NameEn string `json:"nameEn"` // 公司名称英文 + ShortName string `json:"shortName"` // 公司简称 + City string `json:"city"` // 所在城市 + Type string `json:"type"` // 公司类别 + Address string `json:"address"` // 公司地址 + AddressEn string `json:"addressEn"` // 公司地址 + ZipCode string `json:"zipCode"` // 公司邮编 + TeamRank string `json:"teamRank"` // 合作等级 + Website string `json:"website"` // 网址 + Bank string `json:"bank"` // 开户银行 + BankAccount string `json:"bankAccount"` // 银行账户 + TaxNumber string `json:"taxNumber"` // 税号 + Info string `json:"info"` // 备注说明 + ImgFilePaths []string `json:"imgFilePaths"` // 图片地址集合 + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// List @TITLE 客户列表 +func (l *logisticsCompany) List(ctx context.Context, args ArgsLogisticsCompanyList) (reply ReplyLogisticsCompanyList, err error) { + xClient, err := client2.GetClient(l) + if err != nil { + return + } + err = xClient.Call(ctx, "List", args, &reply) + return +} + +type ArgsLogisticsCompanyAdd struct { + StaffId int64 + LogisticsCompanyAdd +} + +type LogisticsCompanyAdd struct { + Serial string // 编号 + Name string // 名称 + NameEn string // 名称英文 + ShortName string // 公司简称【亿星字段】 + City string // 所在城市【亿星字段】 + Type string // 公司类别【亿星字段】 + Address string // 公司地址 + AddressEn string // 公司地址英文 + ZipCode string // 公司邮编 + TeamRank string // 合作等级 + Website string // 公司主页 + Bank string // 开户银行 + BankAccount string // 银行账户 + TaxNumber string // 公司税号 + Info string // 备注说明 + ImgFilePaths []string // 图片地址集合 +} + +// Add @TITLE 添加客户 +func (l *logisticsCompany) Add(ctx context.Context, args ArgsLogisticsCompanyAdd) (logisticsCompanyId int64, err error) { + xClient, err := client2.GetClient(l) + if err != nil { + return + } + err = xClient.Call(ctx, "Add", args, &logisticsCompanyId) + return +} + +type ReplyLogisticsCompanyInfo struct { + Id int64 `json:"id"` + Name string `json:"name"` // 公司名称 + NameEn string `json:"nameEn"` // 公司名称英文 + ShortName string `json:"shortName"` // 公司简称 + City string `json:"city"` // 所在城市 + Type string `json:"type"` // 公司类别 + Address string `json:"address"` // 公司地址 + AddressEn string `json:"addressEn"` // 公司地址 + ZipCode string `json:"zipCode"` // 公司邮编 + TeamRank string `json:"teamRank"` // 合作等级 + Website string `json:"website"` // 网址 + Bank string `json:"bank"` // 开户银行 + BankAccount string `json:"bankAccount"` // 银行账户 + TaxNumber string `json:"taxNumber"` // 税号 + Info string `json:"info"` // 备注说明 + ImgFilePaths []string `json:"imgFilePaths"` // 图片地址集合 + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// Info @TITLE 客户详情 +func (l *logisticsCompany) Info(ctx context.Context, logisticsCompanyId int64) (reply ReplyLogisticsCompanyInfo, err error) { + xClient, err := client2.GetClient(l) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", logisticsCompanyId, &reply) + return +} + +type ArgsLogisticsCompanyEdit struct { + LogisticsCompanyId int64 + LogisticsCompanyAdd +} + +// Edit @TITLE 编辑客户 +func (l *logisticsCompany) Edit(ctx context.Context, args ArgsLogisticsCompanyEdit) (err error) { + xClient, err := client2.GetClient(l) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} diff --git a/erp/logisticsCompany/contact.go b/erp/logisticsCompany/contact.go new file mode 100644 index 0000000..fac3b80 --- /dev/null +++ b/erp/logisticsCompany/contact.go @@ -0,0 +1,89 @@ +package logisticsCompany + +import ( + "context" + "git.kumo.work/shama/service/client" + "time" +) + +type contact struct { +} + +type ContactItem struct { + Id int64 `json:"id"` + Name string `json:"name"` + Sex string `json:"sex"` + Dept string `json:"dept"` + Job string `json:"job"` + Phone string `json:"phone"` + Fax string `json:"fax"` + Email string `json:"email"` + Tel string `json:"tel"` + Info string `json:"info"` + MainFlag int64 `json:"mainFlag"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取联系人 +func (c *contact) All(ctx context.Context, logisticsCompanyId int64) (reply []ContactItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", logisticsCompanyId, &reply) + return +} + +type ArgsContactAdd struct { + LogisticsCompanyId int64 // 物流公司ID + ContactAdd +} + +type ContactAdd struct { + Name string // 联系人姓名 + Sex string // 性别 + Dept string // 部门 + Job string // 职位 + Phone string // 电话 + Fax string // 传真 + Email string // 邮箱 + Tel string // 移动电话 + Info string // 联系人备注 + MainFlag int64 // 主联系人 1=主联系人 +} + +// Add @TITLE 添加联系人 +func (c *contact) Add(ctx context.Context, args ArgsContactAdd) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsContactEdit struct { + ContactId int64 // 联系人ID + ContactAdd +} + +// Edit @TITLE 编辑联系人 +func (c *contact) Edit(ctx context.Context, args ArgsContactEdit) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除联系人 +func (c *contact) Delete(ctx context.Context, contactIds []int64) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", contactIds, &reply) +} diff --git a/erp/logisticsCompany/logisticsCompany.go b/erp/logisticsCompany/logisticsCompany.go new file mode 100644 index 0000000..d134dde --- /dev/null +++ b/erp/logisticsCompany/logisticsCompany.go @@ -0,0 +1,5 @@ +package logisticsCompany + +type LogisticsCompany struct { + Contact contact +} diff --git a/erp/purchase.go b/erp/purchase.go new file mode 100644 index 0000000..72c4cbc --- /dev/null +++ b/erp/purchase.go @@ -0,0 +1,67 @@ +package erp + +import ( + "context" + "git.kumo.work/shama/service/client" + purchase2 "git.kumo.work/shama/service/erp/purchase" + "github.com/shopspring/decimal" + "time" +) + +type purchase struct { + purchase2.Purchase +} +type ArgsPurchaseAdd struct { + SaleId int64 // 销售合同 + Products []PurchaseProduct +} +type PurchaseProduct struct { + SaleProductId int64 // 销售合同产品id + FactoryId int64 // 采购工厂id + Num int64 // 采购数量 + Price decimal.Decimal // 采购单价 + Currency string // 币种 + CurrencyName string // 币种名称 + CurrencySymbol string // 币种符号 + CurrencyRate decimal.Decimal // 币种汇率 + MeasureUnit string // 数量单位 +} + +// Add @TITLE 添加采购合同 +func (p *purchase) Add(ctx context.Context, args ArgsPurchaseAdd) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Add", args, &reply) + return +} + +type ArgsPurchaseEdit struct { + PurchaseId int64 // 采购合同id + Po string // po + OrderDate *time.Time // 下单日期 + FactoryAddress string // 工厂地址 + FactoryPhone string // 工厂电话 + FactoryFax string // 工厂传真 + DeliveryDate *time.Time // 采购交期 + DeliveryDateEnd *time.Time // 采购交期结束 + DeliveryPlace string // 交货地点 + AdvancePayment *decimal.Decimal // 预付款货 + FrontMark string // 正面唛头 + SideMark string // 侧面唛头 + InnerBoxText string // 内盒文字 + Remarks string // 合同备注 +} + +// Edit @TITLE 编辑采购合同 +func (p *purchase) Edit(ctx context.Context, args ArgsPurchaseEdit) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Edit", args, &reply) + return +} diff --git a/erp/purchase/product.go b/erp/purchase/product.go index 1e8462a..a12f90a 100644 --- a/erp/purchase/product.go +++ b/erp/purchase/product.go @@ -1,4 +1,93 @@ package purchase +import ( + "context" + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + type product struct { } +type ProductItem struct { + Id int64 `json:"id"` + PurchasePrice decimal.Decimal `json:"purchasePrice"` + PurchaseCount int64 `json:"purchaseCount"` + BoxCount int64 `json:"boxCount"` + Info string `json:"info"` + Po string `json:"po"` + Mold int64 `json:"mold"` + Serial string `json:"serial"` + CustomSerial string `json:"customSerial"` + Name string `json:"name"` + EngName string `json:"engName"` + ImgFilePaths []string `json:"imgFilePaths"` + PurchaseAmount decimal.Decimal `json:"purchaseAmount"` + Num *int64 `json:"num"` + Volume *decimal.Decimal `json:"volume"` + GrossWeight *decimal.Decimal `json:"grossWeight"` + NetWeight *decimal.Decimal `json:"netWeight"` +} + +// All @TITLE 获取产品 +func (p *product) All(ctx context.Context, purchaseId int64) (reply []ProductItem, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "All", purchaseId, &reply) + return +} + +type ArgsProductEdit struct { + PurchaseId int64 // 采购合同id + Products []ProductEdit +} + +type ProductEdit struct { + PurchaseProductId int64 // 采购合同产品id + Po string // 产品po + Name string // 产品名称 + Description string // 产品中文描述 + PurchasePrice decimal.Decimal // 采购单价 + PurchaseCount int64 // 采购数量 + Info string // 备注 + Sort int64 // 排序 +} + +// Edit @TITLE 编辑产品 +func (p *product) Edit(ctx context.Context, args ArgsProductEdit) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Edit", args, &reply) + return +} + +type ArgsProductChangeFactory struct { + FactoryId int64 // 工厂id + PurchaseProductIds []int64 // 采购商品id +} + +// ChangeFactory @TITLE 更换工厂 +func (p *product) ChangeFactory(ctx context.Context, args ArgsProductChangeFactory) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "ChangeFactory", args, &reply) + return +} + +// Delete @TITLE 删除产品 +func (p *product) Delete(ctx context.Context, purchaseProductIds []int64) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Delete", purchaseProductIds, &reply) + return +} diff --git a/erp/sale/audit.go b/erp/sale/audit.go new file mode 100644 index 0000000..3ac342d --- /dev/null +++ b/erp/sale/audit.go @@ -0,0 +1,25 @@ +package sale + +import ( + "context" + "git.kumo.work/shama/service/client" +) + +type audit struct { +} +type ArgsAuditSubmit struct { + StaffId int64 // 操作人 + SaleId int64 // 销售合同id + AuditStaffIds []int64 // 审核人 +} + +// Submit @TITLE 提交审核 +func (a *audit) Submit(ctx context.Context, args ArgsAuditSubmit) (err error) { + xClient, err := client.GetClient(a) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Submit", args, &reply) + return +} diff --git a/erp/sale/product.go b/erp/sale/product.go index 798d97f..2cf466f 100644 --- a/erp/sale/product.go +++ b/erp/sale/product.go @@ -39,6 +39,11 @@ type ProductItem struct { QuoteFactoryName string `json:"quoteFactoryName"` QuoteStartNum int64 `json:"quoteStartNum"` QuoteMeasureUnit string `json:"quoteMeasureUnit"` + Currency string `json:"currency"` + CurrencyName string `json:"currencyName"` + CurrencySymbol string `json:"currencySymbol"` + CurrencyRate decimal.Decimal `json:"currencyRate"` + PurchaseCount int64 `json:"purchaseCount"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` Children []*ProductItem `json:"children"` diff --git a/erp/sale/sale.go b/erp/sale/sale.go index cf83266..573c259 100644 --- a/erp/sale/sale.go +++ b/erp/sale/sale.go @@ -3,4 +3,5 @@ package sale type Sale struct { Cost cost Product product + Audit audit } diff --git a/erp/shipment/cost.go b/erp/shipment/cost.go new file mode 100644 index 0000000..0fcf79f --- /dev/null +++ b/erp/shipment/cost.go @@ -0,0 +1,76 @@ +package shipment + +import ( + "context" + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" + "time" +) + +type cost struct { +} + +type CostItem struct { + Id int64 `json:"id"` + Name string `json:"name"` + Amount decimal.Decimal `json:"amount"` + Remarks string `json:"remarks"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取费用 +func (c *cost) All(ctx context.Context, purchaseId int64) (reply []CostItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", purchaseId, &reply) + return +} + +type ArgsCostAdd struct { + PurchaseId int64 // 采购合同ID + CostAdd +} + +type CostAdd struct { + Name string // 费用名 + Amount decimal.Decimal // 金额 + Remarks string // 备注信息 +} + +// Add @TITLE 添加费用 +func (c *cost) Add(ctx context.Context, args ArgsCostAdd) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsCostEdit struct { + CostId int64 // 费用ID + CostAdd +} + +// Edit @TITLE 编辑费用 +func (c *cost) Edit(ctx context.Context, args ArgsCostEdit) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除费用 +func (c *cost) Delete(ctx context.Context, costIds []int64) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", costIds, &reply) +} diff --git a/erp/shipment/shipment.go b/erp/shipment/shipment.go new file mode 100644 index 0000000..582bed0 --- /dev/null +++ b/erp/shipment/shipment.go @@ -0,0 +1,5 @@ +package shipment + +type Shipment struct { + Cost cost +} diff --git a/erp/workflow.go b/erp/workflow.go new file mode 100644 index 0000000..18a4691 --- /dev/null +++ b/erp/workflow.go @@ -0,0 +1,41 @@ +package erp + +import ( + "context" + "git.kumo.work/shama/service/client" +) + +type workflow struct { +} +type ArgsWorkflowAdopt struct { + StaffId int64 // 审核人 + WorkflowId int64 // 工作流 +} + +// Adopt @TITLE 审核通过 +func (w *workflow) Adopt(ctx context.Context, args ArgsWorkflowAdopt) (err error) { + xClient, err := client.GetClient(w) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Adopt", args, &reply) + return +} + +type ArgsWorkflowReject struct { + StaffId int64 // 审核人 + WorkflowId int64 // 工作流 + Reason string // 审核结果 +} + +// Reject @TITLE 审核驳回 +func (w *workflow) Reject(ctx context.Context, args ArgsWorkflowReject) (err error) { + xClient, err := client.GetClient(w) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Reject", args, &reply) + return +} diff --git a/oa/department.go b/oa/department.go index d1983ce..e712614 100644 --- a/oa/department.go +++ b/oa/department.go @@ -9,11 +9,12 @@ import ( type department struct { } type DepartmentItem struct { - Id int64 `json:"id"` - Name string `json:"name"` - ParentId int64 `json:"parentId"` - CreatedAt time.Time `json:"createdAt"` - Children []*DepartmentItem `json:"children"` + Id int64 `json:"id"` + Name string `json:"name"` + ParentId int64 `json:"parentId"` + ManageStaffId int64 `json:"manageStaffId"` + CreatedAt time.Time `json:"createdAt"` + Children []*DepartmentItem `json:"children"` } // All @TITLE 获取部门 @@ -27,8 +28,9 @@ func (d *department) All(ctx context.Context) (reply []DepartmentItem, err error } type ArgsDepartmentAdd struct { - Name string // 部门名称 - ParentId int64 // 上级部门id + Name string // 部门名称 + ParentId int64 // 上级部门id + ManageStaffId int64 // 部门负责人 } // Add @TITLE 添加部门 @@ -41,6 +43,16 @@ func (d *department) Add(ctx context.Context, args ArgsDepartmentAdd) (err error return xClient.Call(ctx, "Add", args, &reply) } +// Info @TITLE 部门详情 +func (d *department) Info(ctx context.Context, departmentId int64) (reply DepartmentItem, err error) { + xClient, err := client.GetClient(d) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", departmentId, &reply) + return +} + type ArgsDepartmentEdit struct { DepartmentId int64 // 部门id ArgsDepartmentAdd