feat(accounting): 添加做账合同追加费用功能
- 新增 append 模块处理追加费用相关逻辑 - 在 accounting 结构体中添加 Append 字段支持追加操作 - 添加 ArgsAuditAppendCost 和 ArgsAppendAddCost 等参数结构体 - 实现 AppendCost 方法用于追加费用审核流程 - 新增 PurchaseCostItem 结构体并实现 Purchase 方法获取采购合同费用 - 在 constant.go 中添加 BusinessTypeAccountingAppendCostAudit 业务类型常量 - 移除 sale/benefit.go 中的 OtherCost 字段优化成本结构 - 添加 payable.Gen 方法用于生成应付单 - 添加 receivable.Gen 方法用于生成应收单
This commit is contained in:
@@ -6,4 +6,5 @@ type Accounting struct {
|
||||
Product product
|
||||
Remark remark
|
||||
Old old
|
||||
Append append
|
||||
}
|
||||
|
||||
47
erp/accounting/append.go
Normal file
47
erp/accounting/append.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package accounting
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.kumo.work/shama/service/client"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type append struct {
|
||||
}
|
||||
|
||||
type ReplyCostInfo struct {
|
||||
AccountingId int64 `json:"accountingId"`
|
||||
FactoryId int64 `json:"factoryId"`
|
||||
Name string `json:"name"`
|
||||
Amount decimal.Decimal `json:"amount"`
|
||||
Remarks string `json:"remarks"`
|
||||
WorkflowId int64 `json:"workflowId"`
|
||||
WorkflowStatus int64 `json:"workflowStatus"`
|
||||
WorkflowReason string `json:"workflowReason"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
Products []CostInfoProductItem `json:"products"`
|
||||
}
|
||||
|
||||
type CostInfoProductItem struct {
|
||||
AccountingProductId int64 `json:"accountingProductId"`
|
||||
BeforeAmount decimal.Decimal `json:"beforeAmount"`
|
||||
Amount decimal.Decimal `json:"amount"`
|
||||
AfterAmount decimal.Decimal `json:"afterAmount"`
|
||||
Serial string `json:"serial"`
|
||||
Name string `json:"name"`
|
||||
BlEngName string `json:"blEngName"`
|
||||
CustomsName string `json:"customsName"`
|
||||
}
|
||||
|
||||
// CostInfo @TITLE 费用详情
|
||||
func (a *append) CostInfo(ctx context.Context, workflowId int64) (reply ReplyCostInfo, err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "CostInfo", workflowId, &reply)
|
||||
return
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"git.kumo.work/shama/service/client"
|
||||
"git.kumo.work/shama/service/erp/bean"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type audit struct {
|
||||
@@ -25,3 +26,35 @@ func (a *audit) Submit(ctx context.Context, args ArgsAuditSubmit) (err error) {
|
||||
err = xClient.Call(ctx, "Submit", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsAuditAppendCost struct {
|
||||
StaffId int64 // 操作人
|
||||
AccountingId int64 // 做账合同id
|
||||
AuditItems []bean.AuditItem // 审核
|
||||
AppendCost ArgsAppendAddCost // 追加费用
|
||||
}
|
||||
|
||||
type ArgsAppendAddCost struct {
|
||||
Products []AppendAddCostProduct
|
||||
FactoryId int64 // 工厂id
|
||||
Name string // 费用名
|
||||
Amount decimal.Decimal // 金额
|
||||
Remarks string // 备注信息
|
||||
}
|
||||
|
||||
type AppendAddCostProduct struct {
|
||||
AccountingProductId int64 // 做账产品id
|
||||
BeforeAmount decimal.Decimal // 改前金额
|
||||
Amount decimal.Decimal // 调整金额
|
||||
AfterAmount decimal.Decimal // 改后金额
|
||||
}
|
||||
|
||||
// AppendCost @TITLE 追加费用
|
||||
func (a *audit) AppendCost(ctx context.Context, args ArgsAuditAppendCost) (workflowId int64, err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "AppendCost", args, &workflowId)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ package accounting
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.kumo.work/shama/service/client"
|
||||
"github.com/shopspring/decimal"
|
||||
"time"
|
||||
)
|
||||
|
||||
type cost struct {
|
||||
@@ -32,6 +33,30 @@ func (c *cost) All(ctx context.Context, accountingId int64) (reply []CostItem, e
|
||||
return
|
||||
}
|
||||
|
||||
type PurchaseCostItem struct {
|
||||
Id int64 `json:"id"`
|
||||
FactoryId int64 `json:"factoryId"`
|
||||
FactoryName string `json:"factoryName"`
|
||||
PiSerial string `json:"piSerial"`
|
||||
PoSerial string `json:"poSerial"`
|
||||
BatchNo int64 `json:"batchNo"`
|
||||
Name string `json:"name"`
|
||||
Amount decimal.Decimal `json:"amount"`
|
||||
Remarks string `json:"remarks"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// Purchase @TITLE 采购合同费用
|
||||
func (c *cost) Purchase(ctx context.Context, accountingId int64) (reply []PurchaseCostItem, err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "Purchase", accountingId, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsCostAdd struct {
|
||||
AccountingId int64 // 做账合同ID
|
||||
CostAdd
|
||||
|
||||
Reference in New Issue
Block a user