This commit is contained in:
2024-10-08 09:35:07 +08:00
parent 64ea8da4fe
commit 8219a1dd58
8 changed files with 485 additions and 6 deletions

View File

@@ -0,0 +1,8 @@
package accounting
type Accounting struct {
Audit audit
Cost cost
Product product
Remark remark
}

25
erp/accounting/audit.go Normal file
View File

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

80
erp/accounting/cost.go Normal file
View File

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

117
erp/accounting/product.go Normal file
View File

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

75
erp/accounting/remark.go Normal file
View File

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