diff --git a/erp/accounting/accounting.go b/erp/accounting/accounting.go index c32a805..0700149 100644 --- a/erp/accounting/accounting.go +++ b/erp/accounting/accounting.go @@ -6,4 +6,5 @@ type Accounting struct { Product product Remark remark Old old + Append append } diff --git a/erp/accounting/append.go b/erp/accounting/append.go new file mode 100644 index 0000000..9366207 --- /dev/null +++ b/erp/accounting/append.go @@ -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 +} diff --git a/erp/accounting/audit.go b/erp/accounting/audit.go index 1a94275..cdc6a10 100644 --- a/erp/accounting/audit.go +++ b/erp/accounting/audit.go @@ -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 +} diff --git a/erp/accounting/cost.go b/erp/accounting/cost.go index 1a5fe29..6d65926 100644 --- a/erp/accounting/cost.go +++ b/erp/accounting/cost.go @@ -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 diff --git a/erp/constant.go b/erp/constant.go index 0d74d15..afdbe24 100644 --- a/erp/constant.go +++ b/erp/constant.go @@ -2,19 +2,20 @@ package erp type BusinessType = string // 业务类型 const ( - BusinessTypeSaleAudit BusinessType = "saleAudit" // 销售合同审核 - BusinessTypeSaleAuditClose BusinessType = "saleAuditClose" // 销售合同关单审核 - BusinessTypeSaleAppendAudit BusinessType = "saleAuditAppend" // 销售合同追加商品 - BusinessTypeSaleChangeAudit BusinessType = "saleAuditChange" // 销售合同修改产品 - BusinessTypeSaleBenefitAudit BusinessType = "saleAuditBenefit" // 销售合同修改效益测算 - BusinessTypePurchaseAudit BusinessType = "purchaseAudit" // 采购合同审核 - BusinessTypeShipmentAudit BusinessType = "shipmentAudit" // 订舱单审核 - BusinessTypeShipmentModifyAudit BusinessType = "shipmentModifyAudit" // 订舱单修改单审核 - BusinessTypeAccountingAudit BusinessType = "accountingAudit" // 做账合同审核 - BusinessTypeAccountingAuditV2 BusinessType = "accountingAuditV2" // 做账合同审核 - BusinessTypeExpense BusinessType = "expenseAudit" // 报销单 - BusinessTypeRequest BusinessType = "requestAudit" // 申请单 - BusinessTypePayment BusinessType = "paymentAudit" // 申请单 + BusinessTypeSaleAudit BusinessType = "saleAudit" // 销售合同审核 + BusinessTypeSaleAuditClose BusinessType = "saleAuditClose" // 销售合同关单审核 + BusinessTypeSaleAppendAudit BusinessType = "saleAuditAppend" // 销售合同追加商品 + BusinessTypeSaleChangeAudit BusinessType = "saleAuditChange" // 销售合同修改产品 + BusinessTypeSaleBenefitAudit BusinessType = "saleAuditBenefit" // 销售合同修改效益测算 + BusinessTypePurchaseAudit BusinessType = "purchaseAudit" // 采购合同审核 + BusinessTypeShipmentAudit BusinessType = "shipmentAudit" // 订舱单审核 + BusinessTypeShipmentModifyAudit BusinessType = "shipmentModifyAudit" // 订舱单修改单审核 + BusinessTypeAccountingAudit BusinessType = "accountingAudit" // 做账合同审核 + BusinessTypeAccountingAuditV2 BusinessType = "accountingAuditV2" // 做账合同审核 + BusinessTypeAccountingAppendCostAudit BusinessType = "accountingAppendCostAudit" // 做账合同追加费用审核 + BusinessTypeExpense BusinessType = "expenseAudit" // 报销单 + BusinessTypeRequest BusinessType = "requestAudit" // 申请单 + BusinessTypePayment BusinessType = "paymentAudit" // 申请单 ) var BusinessTypeName = map[BusinessType]string{ diff --git a/erp/payable.go b/erp/payable.go index d0e4379..5292241 100644 --- a/erp/payable.go +++ b/erp/payable.go @@ -59,6 +59,16 @@ func (p *payable) List(ctx context.Context, args ArgsPayableList) (reply ReplyPa return } +// Gen @TITLE 生成应付单 +func (p *payable) Gen(ctx context.Context, accountingId int64) (err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Gen", accountingId, &reply) +} + type ReplyPayableInfo struct { Id int64 `json:"id"` PayableSerial string `json:"payableSerial"` diff --git a/erp/receivable.go b/erp/receivable.go index 0ad6f8b..57e6471 100644 --- a/erp/receivable.go +++ b/erp/receivable.go @@ -59,6 +59,16 @@ func (r *receivable) List(ctx context.Context, args ArgsReceivableList) (reply R return } +// Gen @TITLE 生成应收单 +func (r *receivable) Gen(ctx context.Context, shipmentId int64) (err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Gen", shipmentId, &reply) +} + type ReplyReceivableInfo struct { Id int64 `json:"id"` ReceivableSerial string `json:"receivableSerial"` diff --git a/erp/sale/benefit.go b/erp/sale/benefit.go index 9a5aa69..d939bb9 100644 --- a/erp/sale/benefit.go +++ b/erp/sale/benefit.go @@ -97,7 +97,6 @@ type ArgsBenefitEdit struct { SaleId int64 // 销售合同 DomesticShippingCost decimal.Decimal // 国内运杂费 DocumentCost decimal.Decimal // 单证费 - OtherCost decimal.Decimal // 其他成本 TotalSaleAmount decimal.Decimal // 出口总价 ForeignShippingCost decimal.Decimal // 国外运杂费 BankFees decimal.Decimal // 银行手续费