From 8219a1dd58202eca8e8dd8b87c1b19d5bccdd723 Mon Sep 17 00:00:00 2001 From: kanade Date: Tue, 8 Oct 2024 09:35:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp/accounting.go | 170 +++++++++++++++++++++++++++++++++++ erp/accounting/accounting.go | 8 ++ erp/accounting/audit.go | 25 ++++++ erp/accounting/cost.go | 80 +++++++++++++++++ erp/accounting/product.go | 117 ++++++++++++++++++++++++ erp/accounting/remark.go | 75 ++++++++++++++++ erp/constant.go | 15 ++-- erp/erp.go | 1 + 8 files changed, 485 insertions(+), 6 deletions(-) create mode 100644 erp/accounting.go create mode 100644 erp/accounting/accounting.go create mode 100644 erp/accounting/audit.go create mode 100644 erp/accounting/cost.go create mode 100644 erp/accounting/product.go create mode 100644 erp/accounting/remark.go diff --git a/erp/accounting.go b/erp/accounting.go new file mode 100644 index 0000000..630cb29 --- /dev/null +++ b/erp/accounting.go @@ -0,0 +1,170 @@ +package erp + +import ( + "context" + "git.kumo.work/shama/service/client" + accounting2 "git.kumo.work/shama/service/erp/accounting" + "git.kumo.work/shama/service/lib/bean" + "github.com/shopspring/decimal" + "time" +) + +type accounting struct { + accounting2.Accounting +} +type ArgsAccountingList struct { + Page bean.Page + Search AccountingSearch +} +type AccountingSearch struct { + AccountingSerial string // 做账单号 + CustomName string // 客户名称 + CustomShortName string // 客户简称 + WorkflowStatus []int64 // 审批状态 + CreatedAtStart *time.Time // 创建开始时间 + CreatedAtEnd *time.Time // 创建结束时间 + CreatedStaffIds []int64 // 创建人 +} + +type ReplyAccountingList struct { + List []AccountingItem `json:"list"` + Total int64 `json:"total"` +} +type AccountingItem struct { + Id int64 `json:"id"` + AccountingSerial string `json:"accountingSerial"` + InvoiceDate *time.Time `json:"invoiceDate"` + CreatedAt *time.Time `json:"createdAt"` + CustomShortName string `json:"customShortName"` + CustomName string `json:"customName"` + CreatedStaffId int64 `json:"createdStaffId"` + WorkflowId int64 `json:"workflowId"` + WorkflowStatus int64 `json:"workflowStatus"` + WorkflowReason string `json:"workflowReason"` + TotalBoxCount int64 `json:"totalBoxCount"` + TotalAmount decimal.Decimal `json:"totalAmount"` + TotalVolume decimal.Decimal `json:"totalVolume"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` +} + +// List @TITLE 列表 +func (a *accounting) List(ctx context.Context, args ArgsAccountingList) (reply ReplyAccountingList, err error) { + xClient, err := client.GetClient(a) + if err != nil { + return + } + err = xClient.Call(ctx, "List", args, &reply) + return +} + +type ArgsAccountingAdd struct { + StaffId int64 + AccountingAdd AccountingAdd +} + +type AccountingAdd struct { + CustomId int64 // 客户id + CustomShortName string // 客户简称 + CustomName string // 客户名称 + InvoiceDate *time.Time // 发票日期 + InvoiceDateEnd *time.Time // 开票期限 + AccountingSerial string // 做账合同号 + Remark string // 备注 + Products []AccountingProductItem // 销售产品 +} + +type AccountingProductItem struct { + PurchaseProductId int64 // 采购产品id + AccountingCount int64 // 做账数量 + CustomsSerial string // hs编码 + CustomsName string // 报关名称 + CustomsInvoiceUnit string // 开票单位 + InvoiceType int64 // 开票方式 1=按净重 2=按数量 + InvoiceCount decimal.Decimal // 开票数量 +} + +// Add @TITLE 添加 +func (a *accounting) Add(ctx context.Context, args ArgsAccountingAdd) (accountId int64, err error) { + xClient, err := client.GetClient(a) + if err != nil { + return + } + err = xClient.Call(ctx, "Add", args, &accountId) + return +} + +type ReplyAccountingInfo struct { + Id int64 `json:"id"` + CustomId int64 `json:"customId"` + CustomShortName string `json:"customShortName"` + CustomName string `json:"customName"` + InvoiceDate *time.Time `json:"invoiceDate"` + InvoiceDateEnd *time.Time `json:"invoiceDateEnd"` + AccountingSerial string `json:"accountingSerial"` + Remark string `json:"remark"` + WorkflowId int64 `json:"workflowId"` + WorkflowStatus int64 `json:"workflowStatus"` + WorkflowReason string `json:"workflowReason"` + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` + TotalBoxCount int64 `json:"totalBoxCount"` + TotalAmount decimal.Decimal `json:"totalAmount"` + TotalVolume decimal.Decimal `json:"totalVolume"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` +} + +// Info @TITLE 详情 +func (a *accounting) Info(ctx context.Context, accountingId int64) (reply ReplyAccountingInfo, err error) { + xClient, err := client.GetClient(a) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", accountingId, &reply) + return +} + +type ArgsAccountingEdit struct { + AccountingId int64 // 做账合同id + AccountingEdit AccountingEdit +} + +type AccountingEdit struct { + InvoiceDate *time.Time // 发票日期 + InvoiceDateEnd *time.Time // 开票期限 + AccountingSerial string // 做账合同号 + Remark string // 备注 +} + +// Edit @TITLE 编辑 +func (a *accounting) Edit(ctx context.Context, args ArgsAccountingEdit) (err error) { + xClient, err := client.GetClient(a) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Edit", args, &reply) + return +} + +type InvoiceProductItem struct { + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + CustomsSerial string `json:"customsSerial"` + CustomsName string `json:"customsName"` + CustomsInvoiceUnit string `json:"customsInvoiceUnit"` + InvoiceCount decimal.Decimal `json:"invoiceCount"` + Amount decimal.Decimal `json:"amount"` +} + +// InvoiceProducts @TITLE 开票产品资料 +func (a *accounting) InvoiceProducts(ctx context.Context, accountingId int64) (reply []InvoiceProductItem, err error) { + xClient, err := client.GetClient(a) + if err != nil { + return + } + err = xClient.Call(ctx, "InvoiceProducts", accountingId, &reply) + return + +} diff --git a/erp/accounting/accounting.go b/erp/accounting/accounting.go new file mode 100644 index 0000000..127212e --- /dev/null +++ b/erp/accounting/accounting.go @@ -0,0 +1,8 @@ +package accounting + +type Accounting struct { + Audit audit + Cost cost + Product product + Remark remark +} diff --git a/erp/accounting/audit.go b/erp/accounting/audit.go new file mode 100644 index 0000000..6fd5f60 --- /dev/null +++ b/erp/accounting/audit.go @@ -0,0 +1,25 @@ +package accounting + +import ( + "context" + "git.kumo.work/shama/service/client" +) + +type audit struct { +} +type ArgsAuditSubmit struct { + StaffId int64 // 操作人 + AccountingId 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/accounting/cost.go b/erp/accounting/cost.go new file mode 100644 index 0000000..1a5fe29 --- /dev/null +++ b/erp/accounting/cost.go @@ -0,0 +1,80 @@ +package accounting + +import ( + "context" + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" + "time" +) + +type cost struct { +} + +type CostItem struct { + Id int64 `json:"id"` + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + FactoryShortName string `json:"factoryShortName"` + 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, accountingId int64) (reply []CostItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", accountingId, &reply) + return +} + +type ArgsCostAdd struct { + AccountingId int64 // 做账合同ID + CostAdd +} + +type CostAdd struct { + FactoryId int64 // 工厂id + 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/accounting/product.go b/erp/accounting/product.go new file mode 100644 index 0000000..b05a398 --- /dev/null +++ b/erp/accounting/product.go @@ -0,0 +1,117 @@ +package accounting + +import ( + "context" + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + +type product struct { +} + +type ProductItem struct { + Id int64 `json:"id"` + PurchaseProductId int64 `json:"purchaseProductId"` + SaleProductId int64 `json:"saleProductId"` + Sort int64 `json:"sort"` + Serial string `json:"serial"` + CustomSerial string `json:"customSerial"` + Name string `json:"name"` + CustomsSerial string `json:"customsSerial"` + CustomsName string `json:"customsName"` + CustomsInvoiceUnit string `json:"customsInvoiceUnit"` + InvoiceType int64 `json:"invoiceType"` + InvoiceCount decimal.Decimal `json:"invoiceCount"` + AccountingCount int64 `json:"accountingCount"` + OuterNum *int64 `json:"outerNum"` + BoxCount int64 `json:"boxCount"` + PurchasePrice decimal.Decimal `json:"purchasePrice"` + Amount decimal.Decimal `json:"amount"` + Volume *decimal.Decimal `json:"volume"` + TotalVolume decimal.Decimal `json:"totalVolume"` + GrossWeight *decimal.Decimal `json:"grossWeight"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + NetWeight *decimal.Decimal `json:"netWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` + PackageDescription string `json:"packageDescription"` + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + SaleProductAccountingCount int64 `json:"saleProductAccountingCount"` + SaleProductPurchasedCount int64 `json:"saleProductPurchasedCount"` +} + +// All @TITLE 获取产品 +func (p *product) All(ctx context.Context, accountingId int64) (reply []ProductItem, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "All", accountingId, &reply) + return +} + +type ArgsProductAdd struct { + AccountingId int64 // 做账合同ID + Products []ProductAdd +} + +type ProductAdd struct { + PurchaseProductId int64 // 采购产品id + AccountingCount int64 // 做账数量 + CustomsSerial string // hs编码 + CustomsName string // 报关名称 + CustomsInvoiceUnit string // 开票单位 + InvoiceType int64 // 开票方式 1=按净重 2=按数量 + InvoiceCount decimal.Decimal // 开票数量 +} + +// Add @TITLE 添加产品 +func (p *product) Add(ctx context.Context, args ArgsProductAdd) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsProductEdit struct { + AccountingId int64 // 做账合同ID + Products []ProductEdit +} + +type ProductEdit struct { + AccountingProductId int64 // 做账产品id + Sort int64 // 排序 + AccountingCount int64 // 做账数量 + CustomsSerial string // hs编码 + CustomsName string // 报关名称 + CustomsInvoiceUnit string // 开票单位 + InvoiceType int64 // 开票方式 1=按净重 2=按数量 + InvoiceCount decimal.Decimal // 开票数量 +} + +// Edit @TITLE 编辑费用 +func (p *product) Edit(ctx context.Context, args ArgsProductEdit) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +type ArgsProductDelete struct { + AccountingId int64 // 做账合同ID + AccountingProductIds []int64 // 做账产品id +} + +// Delete @TITLE 删除费用 +func (p *product) Delete(ctx context.Context, args ArgsProductDelete) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", args, &reply) +} diff --git a/erp/accounting/remark.go b/erp/accounting/remark.go new file mode 100644 index 0000000..bc4f8c8 --- /dev/null +++ b/erp/accounting/remark.go @@ -0,0 +1,75 @@ +package accounting + +import ( + "context" + "git.kumo.work/shama/service/client" + "time" +) + +type remark struct { +} + +type RemarkItem struct { + Id int64 `json:"id"` + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + FactoryShortName string `json:"factoryShortName"` + Remarks string `json:"remarks"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取备注 +func (r *remark) All(ctx context.Context, accountingId int64) (reply []RemarkItem, err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + err = xClient.Call(ctx, "All", accountingId, &reply) + return +} + +type ArgsRemarkAdd struct { + AccountingId int64 // 做账合同ID + RemarkAdd +} + +type RemarkAdd struct { + FactoryId int64 // 工厂id + Remarks string // 备注信息 +} + +// Add @TITLE 添加备注 +func (r *remark) Add(ctx context.Context, args ArgsRemarkAdd) (err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsRemarkEdit struct { + RemarkId int64 // 备注ID + RemarkAdd +} + +// Edit @TITLE 编辑备注 +func (r *remark) Edit(ctx context.Context, args ArgsRemarkEdit) (err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除备注 +func (r *remark) Delete(ctx context.Context, remarkIds []int64) (err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", remarkIds, &reply) +} diff --git a/erp/constant.go b/erp/constant.go index 445e2d4..7e3067c 100644 --- a/erp/constant.go +++ b/erp/constant.go @@ -2,15 +2,17 @@ package erp type BusinessType = string // 业务类型 const ( - BusinessTypeSaleAudit BusinessType = "saleAudit" // 销售合同审核 - BusinessTypePurchaseAudit BusinessType = "purchaseAudit" // 采购合同审核 - BusinessTypeShipmentAudit BusinessType = "shipmentAudit" // 订舱单审核 + BusinessTypeSaleAudit BusinessType = "saleAudit" // 销售合同审核 + BusinessTypePurchaseAudit BusinessType = "purchaseAudit" // 采购合同审核 + BusinessTypeShipmentAudit BusinessType = "shipmentAudit" // 订舱单审核 + BusinessTypeAccountingAudit BusinessType = "accountingAudit" // 做账合同审核 ) var BusinessTypeName = map[BusinessType]string{ - BusinessTypeSaleAudit: "销售合同审核", - BusinessTypePurchaseAudit: "采购合同审核", - BusinessTypeShipmentAudit: "订舱单审核", + BusinessTypeSaleAudit: "销售合同审核", + BusinessTypePurchaseAudit: "采购合同审核", + BusinessTypeShipmentAudit: "订舱单审核", + BusinessTypeAccountingAudit: "做账合同审核", } type AuditStatus = int64 // 审核状态 @@ -39,4 +41,5 @@ const ( ExportTypeSerial = "serial" // 商检导出 ExportTypeCustoms = "customs" // 报关导出 ExportTypeExchangeSettlement = "exchangeSettlement" // 结汇导出 + ExportTypeAccounting = "accounting" // 做账导出 ) diff --git a/erp/erp.go b/erp/erp.go index c7d02f5..779d3dd 100644 --- a/erp/erp.go +++ b/erp/erp.go @@ -11,4 +11,5 @@ type Erp struct { Shipment shipment Contact contact Template template + Accounting accounting }