部署
This commit is contained in:
117
erp/accounting/product.go
Normal file
117
erp/accounting/product.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user