部署
This commit is contained in:
parent
81ffde828c
commit
d2303e1658
20
erp/constant.go
Normal file
20
erp/constant.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package erp
|
||||||
|
|
||||||
|
type BusinessType = string // 业务类型
|
||||||
|
const (
|
||||||
|
BusinessTypeSaleAudit BusinessType = "saleAudit" // 销售合同审核
|
||||||
|
BusinessTypePurchaseAudit BusinessType = "purchaseAudit" // 销售合同审核
|
||||||
|
)
|
||||||
|
|
||||||
|
var BusinessTypeName = map[BusinessType]string{
|
||||||
|
BusinessTypeSaleAudit: "销售合同审核",
|
||||||
|
BusinessTypePurchaseAudit: "采购合同审核",
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuditStatus = int64 // 审核状态
|
||||||
|
const (
|
||||||
|
AuditStatusNone AuditStatus = 1 // 待提交
|
||||||
|
AuditStatusIng AuditStatus = 2 // 审核中
|
||||||
|
AuditStatusAdopt AuditStatus = 3 // 审核通过
|
||||||
|
AuditStatusReject AuditStatus = 4 // 审核驳回
|
||||||
|
)
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
purchase2 "git.kumo.work/shama/service/erp/purchase"
|
purchase2 "git.kumo.work/shama/service/erp/purchase"
|
||||||
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -11,6 +12,50 @@ import (
|
|||||||
type purchase struct {
|
type purchase struct {
|
||||||
purchase2.Purchase
|
purchase2.Purchase
|
||||||
}
|
}
|
||||||
|
type ArgsPurchaseList struct {
|
||||||
|
Page bean.Page
|
||||||
|
Search PurchaseSearch
|
||||||
|
}
|
||||||
|
type PurchaseSearch struct {
|
||||||
|
PiSerial string // 采购合同编号
|
||||||
|
PoSerial string // po
|
||||||
|
CustomShortName string // 客户简称
|
||||||
|
CreatedStaffIds []int64 // 创建人筛选
|
||||||
|
FactoryName string // 采购工厂
|
||||||
|
}
|
||||||
|
type ReplyPurchaseList struct {
|
||||||
|
List []PurchaseItem `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type PurchaseItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
SaleId int64 `json:"saleId"`
|
||||||
|
PiSerial string `json:"piSerial"`
|
||||||
|
PoSerial string `json:"poSerial"`
|
||||||
|
CustomName string `json:"customName"`
|
||||||
|
CustomShortName string `json:"customShortName"`
|
||||||
|
DeliveryDate *time.Time `json:"deliveryDate"`
|
||||||
|
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
|
||||||
|
OrderDate time.Time `json:"orderDate"`
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
|
WorkflowId int64 `json:"workflowId"`
|
||||||
|
WorkflowStatus int64 `json:"workflowStatus"`
|
||||||
|
FactoryName string `json:"factoryName"`
|
||||||
|
FactoryId int64 `json:"factoryId"`
|
||||||
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @TITLE 采购合同列表
|
||||||
|
func (p *purchase) List(ctx context.Context, args ArgsPurchaseList) (reply ReplyPurchaseList, err error) {
|
||||||
|
xClient, err := client.GetClient(p)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
type ArgsPurchaseAdd struct {
|
type ArgsPurchaseAdd struct {
|
||||||
SaleId int64 // 销售合同
|
SaleId int64 // 销售合同
|
||||||
Products []PurchaseProduct
|
Products []PurchaseProduct
|
||||||
@ -38,11 +83,51 @@ func (p *purchase) Add(ctx context.Context, args ArgsPurchaseAdd) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ReplyPurchaseInfo struct {
|
||||||
|
PurchaseId int64 `json:"purchaseId"`
|
||||||
|
FactoryId int64 `json:"factoryId"`
|
||||||
|
FactoryName string `json:"factoryName"`
|
||||||
|
FactoryAddress string `json:"factoryAddress"`
|
||||||
|
FactoryContact string `json:"factoryContact"`
|
||||||
|
FactoryPhone string `json:"factoryPhone"`
|
||||||
|
FactoryFax string `json:"factoryFax"`
|
||||||
|
DeliveryDate *time.Time `json:"deliveryDate"`
|
||||||
|
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
|
||||||
|
DeliveryPlace string `json:"deliveryPlace"`
|
||||||
|
AdvancePayment *decimal.Decimal `json:"advancePayment"`
|
||||||
|
PoSerial string `json:"poSerial"`
|
||||||
|
PiSerial string `json:"piSerial"`
|
||||||
|
WorkflowId int64 `json:"workflowId"`
|
||||||
|
WorkflowStatus int64 `json:"workflowStatus"`
|
||||||
|
WorkflowReason string `json:"workflowReason"`
|
||||||
|
OrderDate time.Time `json:"orderDate"`
|
||||||
|
CustomShortName string `json:"customShortName"`
|
||||||
|
OurCompany string `json:"ourCompany"`
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
|
FrontMark string `json:"frontMark"`
|
||||||
|
SideMark string `json:"sideMark"`
|
||||||
|
InnerBoxText string `json:"innerBoxText"`
|
||||||
|
Remarks string `json:"remarks"`
|
||||||
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @TITLE 采购合同详情
|
||||||
|
func (p *purchase) Info(ctx context.Context, purchaseId int64) (reply ReplyPurchaseInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(p)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", purchaseId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
type ArgsPurchaseEdit struct {
|
type ArgsPurchaseEdit struct {
|
||||||
PurchaseId int64 // 采购合同id
|
PurchaseId int64 // 采购合同id
|
||||||
Po string // po
|
Po string // po
|
||||||
OrderDate *time.Time // 下单日期
|
OrderDate *time.Time // 下单日期
|
||||||
FactoryAddress string // 工厂地址
|
FactoryAddress string // 工厂地址
|
||||||
|
FactoryContact string // 工厂联系人
|
||||||
FactoryPhone string // 工厂电话
|
FactoryPhone string // 工厂电话
|
||||||
FactoryFax string // 工厂传真
|
FactoryFax string // 工厂传真
|
||||||
DeliveryDate *time.Time // 采购交期
|
DeliveryDate *time.Time // 采购交期
|
||||||
|
25
erp/purchase/audit.go
Normal file
25
erp/purchase/audit.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package purchase
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type audit struct {
|
||||||
|
}
|
||||||
|
type ArgsAuditSubmit struct {
|
||||||
|
StaffId int64 // 操作人
|
||||||
|
PurchaseId 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
|
||||||
|
}
|
@ -72,6 +72,8 @@ type SaleItem struct {
|
|||||||
SideMark string `json:"sideMark"`
|
SideMark string `json:"sideMark"`
|
||||||
InnerBoxText string `json:"innerBoxText"`
|
InnerBoxText string `json:"innerBoxText"`
|
||||||
Remarks string `json:"remarks"`
|
Remarks string `json:"remarks"`
|
||||||
|
WorkflowId int64 `json:"workflowId"`
|
||||||
|
WorkflowStatus int64 `json:"workflowStatus"`
|
||||||
CreatedStaffId int64 `json:"createdStaffId"`
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
CreatedAt *time.Time `json:"createdAt"`
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
UpdatedAt *time.Time `json:"updatedAt"`
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
@ -112,6 +114,7 @@ type SaleAdd struct {
|
|||||||
RecBankNameEng string // 收汇银行名称英文
|
RecBankNameEng string // 收汇银行名称英文
|
||||||
RecBankCardNo string // 收汇银行卡号
|
RecBankCardNo string // 收汇银行卡号
|
||||||
RecBankCardName string // 收汇银行卡名
|
RecBankCardName string // 收汇银行卡名
|
||||||
|
OurCompany string // 我方公司
|
||||||
Currency string // 币种
|
Currency string // 币种
|
||||||
CurrencyName string // 币种名称
|
CurrencyName string // 币种名称
|
||||||
CurrencySymbol string // 币种符号
|
CurrencySymbol string // 币种符号
|
||||||
@ -172,6 +175,7 @@ type ReplySaleInfo struct {
|
|||||||
RecBankNameEng string `json:"recBankNameEng"`
|
RecBankNameEng string `json:"recBankNameEng"`
|
||||||
RecBankCardNo string `json:"recBankCardNo"`
|
RecBankCardNo string `json:"recBankCardNo"`
|
||||||
RecBankCardName string `json:"recBankCardName"`
|
RecBankCardName string `json:"recBankCardName"`
|
||||||
|
OurCompany string `json:"ourCompany"`
|
||||||
Currency string `json:"currency"`
|
Currency string `json:"currency"`
|
||||||
CurrencyName string `json:"currencyName"`
|
CurrencyName string `json:"currencyName"`
|
||||||
CurrencySymbol string `json:"currencySymbol"`
|
CurrencySymbol string `json:"currencySymbol"`
|
||||||
@ -199,6 +203,10 @@ type ReplySaleInfo struct {
|
|||||||
SideMark string `json:"sideMark"`
|
SideMark string `json:"sideMark"`
|
||||||
InnerBoxText string `json:"innerBoxText"`
|
InnerBoxText string `json:"innerBoxText"`
|
||||||
Remarks string `json:"remarks"`
|
Remarks string `json:"remarks"`
|
||||||
|
HasEdit bool `json:"hasEdit"`
|
||||||
|
WorkflowId int64 `json:"workflowId"`
|
||||||
|
WorkflowStatus int64 `json:"workflowStatus"`
|
||||||
|
WorkflowReason string `json:"workflowReason"`
|
||||||
CreatedStaffId int64 `json:"createdStaffId"`
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
CreatedAt *time.Time `json:"createdAt"`
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
UpdatedAt *time.Time `json:"updatedAt"`
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
@ -35,7 +35,7 @@ type ProductItem struct {
|
|||||||
BoxCount int64 `json:"boxCount"`
|
BoxCount int64 `json:"boxCount"`
|
||||||
QuotePrice decimal.Decimal `json:"quotePrice"`
|
QuotePrice decimal.Decimal `json:"quotePrice"`
|
||||||
QuoteFactorySerial string `json:"quoteFactorySerial"`
|
QuoteFactorySerial string `json:"quoteFactorySerial"`
|
||||||
QuoteFactoryID int64 `json:"quoteFactoryID"`
|
QuoteFactoryId int64 `json:"quoteFactoryId"`
|
||||||
QuoteFactoryName string `json:"quoteFactoryName"`
|
QuoteFactoryName string `json:"quoteFactoryName"`
|
||||||
QuoteStartNum int64 `json:"quoteStartNum"`
|
QuoteStartNum int64 `json:"quoteStartNum"`
|
||||||
QuoteMeasureUnit string `json:"quoteMeasureUnit"`
|
QuoteMeasureUnit string `json:"quoteMeasureUnit"`
|
||||||
|
@ -3,39 +3,82 @@ package erp
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
workflow2 "git.kumo.work/shama/service/erp/workflow"
|
||||||
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type workflow struct {
|
type workflow struct {
|
||||||
|
workflow2.Workflow
|
||||||
}
|
}
|
||||||
type ArgsWorkflowAdopt struct {
|
type ArgsWorkflowList struct {
|
||||||
StaffId int64 // 审核人
|
Page bean.Page
|
||||||
WorkflowId int64 // 工作流
|
Search WorkflowSearch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adopt @TITLE 审核通过
|
type WorkflowSearch struct {
|
||||||
func (w *workflow) Adopt(ctx context.Context, args ArgsWorkflowAdopt) (err error) {
|
BusinessId int64 // 业务id
|
||||||
|
BusinessType string
|
||||||
|
Status AuditStatus
|
||||||
|
}
|
||||||
|
type ReplyWorkflowList struct {
|
||||||
|
List []WorkflowItem
|
||||||
|
Total int64
|
||||||
|
}
|
||||||
|
type WorkflowItem struct {
|
||||||
|
Id int64 `json:"id"` // 审批流id
|
||||||
|
BusinessId int64 `json:"businessId"` // 业务id
|
||||||
|
BusinessType string `json:"businessType"` // 业务类型
|
||||||
|
BusinessName string `json:"businessName"` // 业务名称
|
||||||
|
Title string `json:"title"` // 审批流标题
|
||||||
|
Content string `json:"content"` // 审批流内容
|
||||||
|
Status AuditStatus `json:"status"` // 审批流状态
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"` // 创建人
|
||||||
|
CreatedAt *time.Time `json:"createdAt"` // 创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @TITLE 审核列表
|
||||||
|
func (w *workflow) List(ctx context.Context, args ArgsWorkflowList) (reply ReplyWorkflowList, err error) {
|
||||||
xClient, err := client.GetClient(w)
|
xClient, err := client.GetClient(w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reply := 0
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
err = xClient.Call(ctx, "Adopt", args, &reply)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArgsWorkflowReject struct {
|
type ReplyWorkflowInfo struct {
|
||||||
StaffId int64 // 审核人
|
Id int64 `json:"id"` // 审批流id
|
||||||
WorkflowId int64 // 工作流
|
BusinessId int64 `json:"businessId"` // 业务id
|
||||||
Reason string // 审核结果
|
BusinessType string `json:"businessType"` // 业务类型
|
||||||
|
BusinessName string `json:"businessName"` // 业务名称
|
||||||
|
Title string `json:"title"` // 审批流标题
|
||||||
|
Content string `json:"content"` // 审批流内容
|
||||||
|
Status AuditStatus `json:"status"` // 审批流状态
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"` // 创建人
|
||||||
|
CreatedAt *time.Time `json:"createdAt"` // 创建时间
|
||||||
|
Nodes []WorkflowNodeItem `json:"nodes"`
|
||||||
|
}
|
||||||
|
type WorkflowNodeItem struct {
|
||||||
|
Id int64 `json:"id"` // 审批流节点id
|
||||||
|
Status AuditStatus `json:"status"` // 审批流节点状态
|
||||||
|
ReviewStaffId int64 `json:"reviewStaffId"` // 审批流节点审核人
|
||||||
|
ReviewAt *time.Time `json:"reviewAt"` // 审批流节点审核时间
|
||||||
|
ReviewComments string `json:"reviewComments"` // 审批流节点审核意见
|
||||||
|
Index int64 `json:"index"` // 审批流节点顺序
|
||||||
|
|
||||||
|
}
|
||||||
|
type ArgsWorkflowInfo struct {
|
||||||
|
WorkflowId int64 // 审批流id
|
||||||
|
WorkflowNodeId int64 // 审批流节点
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reject @TITLE 审核驳回
|
// Info @TITLE 审核详情
|
||||||
func (w *workflow) Reject(ctx context.Context, args ArgsWorkflowReject) (err error) {
|
func (w *workflow) Info(ctx context.Context, args ArgsWorkflowInfo) (reply ReplyWorkflowInfo, err error) {
|
||||||
xClient, err := client.GetClient(w)
|
xClient, err := client.GetClient(w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reply := 0
|
err = xClient.Call(ctx, "Info", args, &reply)
|
||||||
err = xClient.Call(ctx, "Reject", args, &reply)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
96
erp/workflow/node.go
Normal file
96
erp/workflow/node.go
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
package workflow
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type node struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsNodeCountSearch struct {
|
||||||
|
StaffIds []int64 // 员工筛选
|
||||||
|
Status []int64 // 状态筛选
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodeCountItem struct {
|
||||||
|
BusinessType string `json:"businessType"`
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count @TITLE 节点统计
|
||||||
|
func (n *node) Count(ctx context.Context, args ArgsNodeCountSearch) (reply []NodeCountItem, err error) {
|
||||||
|
xClient, err := client.GetClient(n)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Count", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsNodeList struct {
|
||||||
|
Page bean.Page
|
||||||
|
Search NodeSearch
|
||||||
|
}
|
||||||
|
type NodeSearch struct {
|
||||||
|
StaffIds []int64 // 员工筛选
|
||||||
|
Status []int64 // 状态筛选
|
||||||
|
BusinessType string // 业务类型
|
||||||
|
}
|
||||||
|
type ReplyNodeList struct {
|
||||||
|
List []NodeItem `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type NodeItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
BusinessId int64 `json:"businessId"`
|
||||||
|
BusinessName string `json:"businessName"`
|
||||||
|
BusinessType string `json:"businessType"`
|
||||||
|
Status int64 `json:"status"`
|
||||||
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @TITLE 节点列表
|
||||||
|
func (n *node) List(ctx context.Context, args ArgsNodeList) (reply ReplyNodeList, err error) {
|
||||||
|
xClient, err := client.GetClient(n)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsNodeAdopt struct {
|
||||||
|
StaffId int64 // 审核人
|
||||||
|
NodeId int64 // 节点id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @TITLE 审核通过
|
||||||
|
func (n *node) Adopt(ctx context.Context, args ArgsNodeAdopt) (err error) {
|
||||||
|
xClient, err := client.GetClient(n)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Adopt", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsNodeReject struct {
|
||||||
|
StaffId int64 // 审核人
|
||||||
|
NodeId int64 // 节点id
|
||||||
|
Reason string // 审核结果
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @TITLE 审核驳回
|
||||||
|
func (n *node) Reject(ctx context.Context, args ArgsNodeReject) (err error) {
|
||||||
|
xClient, err := client.GetClient(n)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
5
erp/workflow/workflow.go
Normal file
5
erp/workflow/workflow.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package workflow
|
||||||
|
|
||||||
|
type Workflow struct {
|
||||||
|
Node node
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user