更新
This commit is contained in:
230
erp/sale.go
Normal file
230
erp/sale.go
Normal file
@@ -0,0 +1,230 @@
|
||||
package erp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.kumo.work/shama/service/client"
|
||||
sale2 "git.kumo.work/shama/service/erp/sale"
|
||||
"git.kumo.work/shama/service/lib/bean"
|
||||
"github.com/shopspring/decimal"
|
||||
"time"
|
||||
)
|
||||
|
||||
type sale struct {
|
||||
sale2.Sale
|
||||
}
|
||||
type ArgsSaleList struct {
|
||||
Page bean.Page
|
||||
Search SaleSearch
|
||||
}
|
||||
type SaleSearch struct {
|
||||
PiSerial string // pi
|
||||
PoSerial string // po
|
||||
}
|
||||
type ReplySaleList struct {
|
||||
List []SaleItem `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
type SaleItem struct {
|
||||
Id int64 `json:"id"`
|
||||
PiSerial string `json:"piSerial"`
|
||||
PoSerial string `json:"poSerial"`
|
||||
ContractDate time.Time `json:"contractDate"`
|
||||
CustomId int64 `json:"customId"`
|
||||
CustomShortName string `json:"customShortName"`
|
||||
CustomName string `json:"customName"`
|
||||
CustomContactName string `json:"customContactName"`
|
||||
CustomContactFax string `json:"customContactFax"`
|
||||
CustomConsigneeName string `json:"customConsigneeName"`
|
||||
CustomConsigneeAddress string `json:"customConsigneeAddress"`
|
||||
EstShipDate time.Time `json:"estShipDate"`
|
||||
EstShipDateEnd time.Time `json:"estShipDateEnd"`
|
||||
EstRecDate *time.Time `json:"estRecDate"`
|
||||
RecBank string `json:"recBank"`
|
||||
RecBankEng string `json:"recBankEng"`
|
||||
RecBankName string `json:"recBankName"`
|
||||
RecBankNameEng string `json:"recBankNameEng"`
|
||||
RecBankCardNo string `json:"recBankCardNo"`
|
||||
RecBankCardName string `json:"recBankCardName"`
|
||||
Currency string `json:"currency"`
|
||||
CurrencyName string `json:"currencyName"`
|
||||
CurrencySymbol string `json:"currencySymbol"`
|
||||
CurrencyRate decimal.Decimal `json:"currencyRate"`
|
||||
PaymentType string `json:"paymentType"`
|
||||
PaymentDepositRate *decimal.Decimal `json:"paymentDepositRate"`
|
||||
PaymentDepositAmount *decimal.Decimal `json:"paymentDepositAmount"`
|
||||
PaymentCycle *int64 `json:"paymentCycle"`
|
||||
PaymentTerms string `json:"paymentTerms"`
|
||||
ShipPort string `json:"shipPort"`
|
||||
DischargePort string `json:"dischargePort"`
|
||||
DischargePortEng string `json:"dischargePortEng"`
|
||||
DeliveryCountry string `json:"deliveryCountry"`
|
||||
DeliveryCountryEng string `json:"deliveryCountryEng"`
|
||||
TradeCountry string `json:"tradeCountry"`
|
||||
FreightCurrency string `json:"freightCurrency"`
|
||||
FreightCurrencyName string `json:"freightCurrencyName"`
|
||||
FreightCurrencySymbol string `json:"freightCurrencySymbol"`
|
||||
FreightCurrencyRate *decimal.Decimal `json:"freightCurrencyRate"`
|
||||
CommissionRate *decimal.Decimal `json:"commissionRate"`
|
||||
ShipMode string `json:"shipMode"`
|
||||
MarkText string `json:"markText"`
|
||||
MarkImg string `json:"markImg"`
|
||||
FrontMark string `json:"frontMark"`
|
||||
SideMark string `json:"sideMark"`
|
||||
InnerBoxText string `json:"innerBoxText"`
|
||||
Remarks string `json:"remarks"`
|
||||
CreatedStaffId int64 `json:"createdStaffId"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// List @TITLE 销售合同列表
|
||||
func (s *sale) List(ctx context.Context, args ArgsSaleList) (reply ReplySaleList, err error) {
|
||||
xClient, err := client.GetClient(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "List", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsSaleAdd struct {
|
||||
StaffId int64 // 员工id
|
||||
SaleAdd
|
||||
}
|
||||
|
||||
type SaleAdd struct {
|
||||
PiSerial string // PI number
|
||||
PoSerial string // PO number
|
||||
ContractDate time.Time // 合同日期
|
||||
CustomId int64 // 客户ID
|
||||
CustomShortName string // 客户简称
|
||||
CustomName string // 客户名称
|
||||
CustomContactName string // 客户联系人
|
||||
CustomContactFax string // 客户联系人传真
|
||||
CustomConsigneeName string // 客户收货人
|
||||
CustomConsigneeAddress string // 客户收货人地址
|
||||
EstShipDate time.Time // 预计出运日期
|
||||
EstShipDateEnd time.Time // 预计出运日期结束
|
||||
EstRecDate *time.Time // 预计收汇日期
|
||||
RecBank string // 收汇银行
|
||||
RecBankEng string // 收汇银行英文
|
||||
RecBankName string // 收汇银行名称
|
||||
RecBankNameEng string // 收汇银行名称英文
|
||||
RecBankCardNo string // 收汇银行卡号
|
||||
RecBankCardName string // 收汇银行卡名
|
||||
Currency string // 币种
|
||||
CurrencyName string // 币种名称
|
||||
CurrencySymbol string // 币种符号
|
||||
CurrencyRate decimal.Decimal // 币种汇率
|
||||
PaymentType string // 付款方式
|
||||
PaymentDepositRate *decimal.Decimal // 订金比例
|
||||
PaymentDepositAmount *decimal.Decimal // 订金金额
|
||||
PaymentCycle *int64 // 付款周期
|
||||
PaymentTerms string // 价格条款
|
||||
ShipPort string // 出运港口
|
||||
DischargePort string // 卸货港口
|
||||
DischargePortEng string // 出运港口英文
|
||||
DeliveryCountry string // 抵运国家
|
||||
DeliveryCountryEng string // 卸货港口英文
|
||||
TradeCountry string // 贸易国别
|
||||
FreightCurrency string // 运费币种
|
||||
FreightCurrencyName string // 运费币种名称
|
||||
FreightCurrencySymbol string // 运费币种符号
|
||||
FreightCurrencyRate *decimal.Decimal // 运费币种汇率
|
||||
CommissionRate *decimal.Decimal // 佣金比例
|
||||
ShipMode string // 运输方式
|
||||
MarkText string // 文字唛头
|
||||
MarkImg string // 图片唛头
|
||||
FrontMark string // 正面唛头
|
||||
SideMark string // 侧面唛头
|
||||
InnerBoxText string // 内盒文字
|
||||
Remarks string // 合同备注
|
||||
}
|
||||
|
||||
// Add @TITLE 添加销售合同
|
||||
func (s *sale) Add(ctx context.Context, args ArgsSaleAdd) (saleId int64, err error) {
|
||||
xClient, err := client.GetClient(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "Add", args, &saleId)
|
||||
return
|
||||
}
|
||||
|
||||
type ReplySaleInfo struct {
|
||||
Id int64 `json:"id"`
|
||||
PiSerial string `json:"piSerial"`
|
||||
PoSerial string `json:"poSerial"`
|
||||
ContractDate time.Time `json:"contractDate"`
|
||||
CustomId int64 `json:"customId"`
|
||||
CustomShortName string `json:"customShortName"`
|
||||
CustomName string `json:"customName"`
|
||||
CustomContactName string `json:"customContactName"`
|
||||
CustomContactFax string `json:"customContactFax"`
|
||||
CustomConsigneeName string `json:"customConsigneeName"`
|
||||
CustomConsigneeAddress string `json:"customConsigneeAddress"`
|
||||
EstShipDate time.Time `json:"estShipDate"`
|
||||
EstShipDateEnd time.Time `json:"estShipDateEnd"`
|
||||
EstRecDate *time.Time `json:"estRecDate"`
|
||||
RecBank string `json:"recBank"`
|
||||
RecBankEng string `json:"recBankEng"`
|
||||
RecBankName string `json:"recBankName"`
|
||||
RecBankNameEng string `json:"recBankNameEng"`
|
||||
RecBankCardNo string `json:"recBankCardNo"`
|
||||
RecBankCardName string `json:"recBankCardName"`
|
||||
Currency string `json:"currency"`
|
||||
CurrencyName string `json:"currencyName"`
|
||||
CurrencySymbol string `json:"currencySymbol"`
|
||||
CurrencyRate decimal.Decimal `json:"currencyRate"`
|
||||
PaymentType string `json:"paymentType"`
|
||||
PaymentDepositRate *decimal.Decimal `json:"paymentDepositRate"`
|
||||
PaymentDepositAmount *decimal.Decimal `json:"paymentDepositAmount"`
|
||||
PaymentCycle *int64 `json:"paymentCycle"`
|
||||
PaymentTerms string `json:"paymentTerms"`
|
||||
ShipPort string `json:"shipPort"`
|
||||
DischargePort string `json:"dischargePort"`
|
||||
DischargePortEng string `json:"dischargePortEng"`
|
||||
DeliveryCountry string `json:"deliveryCountry"`
|
||||
DeliveryCountryEng string `json:"deliveryCountryEng"`
|
||||
TradeCountry string `json:"tradeCountry"`
|
||||
FreightCurrency string `json:"freightCurrency"`
|
||||
FreightCurrencyName string `json:"freightCurrencyName"`
|
||||
FreightCurrencySymbol string `json:"freightCurrencySymbol"`
|
||||
FreightCurrencyRate *decimal.Decimal `json:"freightCurrencyRate"`
|
||||
CommissionRate *decimal.Decimal `json:"commissionRate"`
|
||||
ShipMode string `json:"shipMode"`
|
||||
MarkText string `json:"markText"`
|
||||
MarkImg string `json:"markImg"`
|
||||
FrontMark string `json:"frontMark"`
|
||||
SideMark string `json:"sideMark"`
|
||||
InnerBoxText string `json:"innerBoxText"`
|
||||
Remarks string `json:"remarks"`
|
||||
CreatedStaffId int64 `json:"createdStaffId"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// Info @TITLE 销售合同详情
|
||||
func (s *sale) Info(ctx context.Context, saleId int64) (reply ReplySaleInfo, err error) {
|
||||
xClient, err := client.GetClient(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "Info", saleId, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsSaleEdit struct {
|
||||
SaleId int64 // 销售合同
|
||||
SaleAdd
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑销售合同
|
||||
func (s *sale) Edit(ctx context.Context, args ArgsSaleEdit) (err error) {
|
||||
xClient, err := client.GetClient(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
return xClient.Call(ctx, "Edit", args, &reply)
|
||||
}
|
||||
Reference in New Issue
Block a user