diff --git a/erp/factory/bank.go b/erp/factory/bank.go new file mode 100644 index 0000000..4e0f818 --- /dev/null +++ b/erp/factory/bank.go @@ -0,0 +1,80 @@ +package factory + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" +) + +type bank struct { +} + +type BankItem struct { + Id int64 `json:"id"` + Bank string `json:"bank"` + BankAccount string `json:"bankAccount"` + BankAddress string `json:"bankAddress"` + BankCode string `json:"bankCode"` + MainFlag int64 `json:"mainFlag"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取银行 +func (c *bank) All(ctx context.Context, factoryId int64) (reply []BankItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", factoryId, &reply) + return +} + +type ArgsBankAdd struct { + FactoryId int64 // 工厂ID + BankAdd +} + +type BankAdd struct { + Bank string // 开户银行 + BankAccount string // 银行账户 + BankAddress string // 银行地址 + BankCode string // 银行联行号 + MainFlag int64 // 主联系人标记(1=是,2=不是) +} + +// Add @TITLE 添加银行 +func (c *bank) Add(ctx context.Context, args ArgsBankAdd) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsBankEdit struct { + BankId int64 // 银行ID + BankAdd +} + +// Edit @TITLE 编辑银行 +func (c *bank) Edit(ctx context.Context, args ArgsBankEdit) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除银行 +func (c *bank) Delete(ctx context.Context, bankIds []int64) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", bankIds, &reply) +}