This commit is contained in:
守护自己的云 2024-07-16 17:18:31 +08:00
parent 6dd80a46ca
commit f9bb041a2e
26 changed files with 1995 additions and 14 deletions

185
erp/custom.go Normal file
View File

@ -0,0 +1,185 @@
package erp
import (
"context"
client2 "git.kumo.work/shama/service/client"
custom2 "git.kumo.work/shama/service/erp/custom"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
"time"
)
type custom struct {
custom2.Custom
}
type ArgsCustomList struct {
Page bean.Page
Search CustomSearch
}
type CustomSearch struct {
Name string // 公司名称
ShortName string // 公司简称
Rank string // 客户等级
TradeCountry string // 贸易国别
Origin string // 客户来源
DepartmentIds []int64 // 所属部门
BanFlag int64 // 禁用标记 1=禁用 2=启用
StaffIds []int64 // 业务员
}
type ReplyCustomList struct {
List []CustomItem `json:"list"`
Total int64 `json:"total"`
}
type CustomItem struct {
Id int64 `json:"id"`
Serial string `json:"serial"`
BanFlag int64 `json:"banFlag"`
Name string `json:"name"`
ShortName string `json:"shortName"`
Type string `json:"type"`
Rank string `json:"rank"`
Origin string `json:"origin"`
TradeCountry string `json:"tradeCountry"`
Country string `json:"country"`
City string `json:"city"`
TradeScope string `json:"tradeScope"`
Intent string `json:"intent"`
CompanyPhone string `json:"companyPhone"`
CompanyFax string `json:"companyFax"`
CompanyWebsite string `json:"companyWebsite"`
CompanyZipCode string `json:"companyZipCode"`
CompanyAddress string `json:"companyAddress"`
CompanyCnAddress string `json:"companyCnAddress"`
SalesCurrency string `json:"salesCurrency"`
PayWay string `json:"payWay"`
PayDown decimal.Decimal `json:"payDown"`
PayCycle int64 `json:"payCycle"`
PayTerms string `json:"payTerms"`
CargoCompany string `json:"cargoCompany"`
Info string `json:"info"`
MarkText string `json:"markText"`
MarkImg string `json:"markImg"`
ImgFilePaths []string `json:"imgFilePaths"`
Status int64 `json:"status"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 客户列表
func (c *custom) List(ctx context.Context, args ArgsCustomList) (reply ReplyCustomList, err error) {
xClient, err := client2.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsCustomAdd struct {
StaffId int64
CustomAdd
}
type CustomAdd struct {
Serial string // 客户编号
BanFlag int64 // 禁用标记 1=禁用 2=启用
Name string // 公司名称
ShortName string // 公司简称
Type string // 客户类型
Rank string // 客户等级
Origin string // 客户来源
TradeCountry string // 贸易国别
Country string // 国家区域
City string // 所在城市
TradeScope string // 业务范围
Intent string // 意向产品
CompanyPhone string // 公司电话
CompanyFax string // 公司传真
CompanyWebsite string // 公司网址
CompanyZipCode string // 公司邮编
CompanyAddress string // 公司英文详细地址
CompanyCnAddress string // 公司详细中文地址
SalesCurrency string // 销售币种
PayWay string // 付款方式
PayDown decimal.Decimal // 定金比例
PayCycle int64 // 付款周期
PayTerms string // 价格条款
CargoCompany string // 货运公司
Info string // 备注
MarkText string // 唛头文字
MarkImg string // 唛头图片
ImgFilePaths []string // 图片地址集合
}
// Add @TITLE 添加客户
func (c *custom) Add(ctx context.Context, args ArgsCustomAdd) (customId int64, err error) {
xClient, err := client2.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &customId)
return
}
type ReplyCustomInfo struct {
Id int64 `json:"id"`
Serial string `json:"serial"` // 客户编号
BanFlag int64 `json:"banFlag"` // 禁用标记 1=禁用 2=启用
Name string `json:"name"` // 公司名称
ShortName string `json:"shortName"` // 公司简称
Type string `json:"type"` // 客户类型
Rank string `json:"rank"` // 客户等级
Origin string `json:"origin"` // 客户来源
TradeCountry string `json:"tradeCountry"` // 贸易国别
Country string `json:"country"` // 国家区域
City string `json:"city"` // 所在城市
TradeScope string `json:"tradeScope"` // 业务范围
Intent string `json:"intent"` // 意向产品
CompanyPhone string `json:"companyPhone"` // 公司电话
CompanyFax string `json:"companyFax"` // 公司传真
CompanyWebsite string `json:"companyWebsite"` // 公司网址
CompanyZipCode string `json:"companyZipCode"` // 公司邮编
CompanyAddress string `json:"companyAddress"` // 公司英文详细地址
CompanyCnAddress string `json:"companyCnAddress"` // 公司详细中文地址
SalesCurrency string `json:"salesCurrency"` // 销售币种
PayWay string `json:"payWay"` // 付款方式
PayDown decimal.Decimal `json:"payDown"` // 定金比例
PayCycle int64 `json:"payCycle"` // 付款周期
PayTerms string `json:"payTerms"` // 价格条款
CargoCompany string `json:"cargoCompany"` // 货运公司
Info string `json:"info"` // 备注
MarkText string `json:"markText"` // 唛头文字
MarkImg string `json:"markImg"` // 唛头图片
ImgFilePaths []string `json:"imgFilePaths"` // 图片地址集合
Status int64 `json:"status"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 客户详情
func (c *custom) Info(ctx context.Context, customId int64) (reply ReplyCustomInfo, err error) {
xClient, err := client2.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", customId, &reply)
return
}
type ArgsCustomEdit struct {
CustomId int64
CustomAdd
}
// Edit @TITLE 编辑客户
func (c *custom) Edit(ctx context.Context, args ArgsCustomEdit) (err error) {
xClient, err := client2.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}

81
erp/custom/consignee.go Normal file
View File

@ -0,0 +1,81 @@
package custom
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type consignee struct {
}
type ConsigneeItem struct {
Id int64 `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Phone string `json:"phone"`
Address string `json:"address"`
Port string `json:"port"`
Info string `json:"info"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取收货人
func (c *consignee) All(ctx context.Context, customId int64) (reply []ConsigneeItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", customId, &reply)
return
}
type ArgsConsigneeAdd struct {
CustomId int64 // 客户ID
ConsigneeAdd
}
type ConsigneeAdd struct {
Type string // 类型
Name string // 姓名
Phone string // 联系电话
Address string // 地址
Port string // 卸货港
Info string // 备注
}
// Add @TITLE 添加收货人
func (c *consignee) Add(ctx context.Context, args ArgsConsigneeAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsConsigneeEdit struct {
ConsigneeId int64 // 收货人ID
ConsigneeAdd
}
// Edit @TITLE 编辑收货人
func (c *consignee) Edit(ctx context.Context, args ArgsConsigneeEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除收货人
func (c *consignee) Delete(ctx context.Context, consigneeIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", consigneeIds, &reply)
}

105
erp/custom/contact.go Normal file
View File

@ -0,0 +1,105 @@
package custom
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type contact struct {
}
type ContactItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
Sex string `json:"sex"`
Dept string `json:"dept"`
Job string `json:"job"`
Email string `json:"email"`
Fax string `json:"fax"`
Phone string `json:"phone"`
Tel string `json:"tel"`
Birthday string `json:"birthday"`
Twitter string `json:"twitter"`
Facebook string `json:"facebook"`
Wechat string `json:"wechat"`
Qq string `json:"qq"`
Diet string `json:"diet"`
Religion string `json:"religion"`
Hobby string `json:"hobby"`
Info string `json:"info"`
MainFlag int64 `json:"mainFlag"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取联系人
func (c *contact) All(ctx context.Context, customId int64) (reply []ContactItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", customId, &reply)
return
}
type ArgsContactAdd struct {
CustomId int64 // 客户ID
ContactAdd
}
type ContactAdd struct {
Name string // 姓名
Sex string // 性别
Dept string // 部门
Job string // 职务
Email string // 邮箱
Fax string // 传真
Phone string // 手机号码
Tel string // 固定电话
Birthday string // 生日
Twitter string // twitter
Facebook string // facebook
Wechat string // wechat
Qq string // qq
Diet string // 饮食习惯
Religion string // 宗教信仰
Hobby string // 兴趣爱好
Info string // 备注
MainFlag int64 // 主联系人标记1=是2=不是)
}
// Add @TITLE 添加联系人
func (c *contact) Add(ctx context.Context, args ArgsContactAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsContactEdit struct {
ContactId int64 // 联系人ID
ContactAdd
}
// Edit @TITLE 编辑联系人
func (c *contact) Edit(ctx context.Context, args ArgsContactEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除联系人
func (c *contact) Delete(ctx context.Context, contactIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", contactIds, &reply)
}

6
erp/custom/custom.go Normal file
View File

@ -0,0 +1,6 @@
package custom
type Custom struct {
Contact contact
Consignee consignee
}

8
erp/erp.go Normal file
View File

@ -0,0 +1,8 @@
package erp
type Erp struct {
Factory factory
Custom custom
Product product
Sale sale
}

211
erp/factory.go Normal file
View File

@ -0,0 +1,211 @@
package erp
import (
"context"
"git.kumo.work/shama/service/client"
factory2 "git.kumo.work/shama/service/erp/factory"
"git.kumo.work/shama/service/lib/bean"
"time"
)
type factory struct {
factory2.Factory
}
type ArgsFactoryList struct {
Page bean.Page
Search FactorySearch
}
type FactorySearch struct {
Name string // 工厂名称
CreatedStaffIds []int64 // 录入人
CreatedAtStart *time.Time // 录入开始时间
CreatedAtEnd *time.Time // 录入结束时间
Origin string // 工厂来源
City string // 所在城市
BanFlag int64 // 禁用标记 1=禁用 2=正常
}
type ReplyFactoryList struct {
List []FactoryItem `json:"list"`
Total int64 `json:"total"`
}
type FactoryItem struct {
Id int64 `json:"id"`
Serial string `json:"serial"`
Name string `json:"name"`
ShortName string `json:"shortName"`
EngName string `json:"engName"`
City string `json:"city"`
Address string `json:"address"`
EngAddress string `json:"engAddress"`
ZipCode string `json:"zipCode"`
DomesticSupply string `json:"domesticSupply"`
Origin string `json:"origin"`
TradeScope string `json:"tradeScope"`
CreditRank string `json:"creditRank"`
TeamRank string `json:"teamRank"`
PayWay string `json:"payWay"`
Bank string `json:"bank"`
BankAccount string `json:"bankAccount"`
BankAddress string `json:"bankAddress"`
TaxNumber string `json:"taxNumber"`
Info string `json:"info"`
LegalPerson string `json:"legalPerson"`
RegCapital string `json:"regCapital"`
RegAddress string `json:"regAddress"`
RegOffice string `json:"regOffice"`
YearSale string `json:"yearSale"`
Contact string `json:"contact"`
OpStartAt *time.Time `json:"opStartAt"`
OpEndAt *time.Time `json:"opEndAt"`
LicenseFilePath string `json:"licenseFilePath"`
LicenseStartAt *time.Time `json:"licenseStartAt"`
LicenseEndAt *time.Time `json:"licenseEndAt"`
ReportFilePath string `json:"reportFilePath"`
ReportStartAt *time.Time `json:"reportStartAt"`
ReportEndAt *time.Time `json:"reportEndAt"`
ImgFilePaths []string `json:"imgFilePaths"`
BanFlag int64 `json:"banFlag"`
MaterialQuality string `json:"materialQuality"`
InvoiceType string `json:"invoiceType"`
Status *int64 `json:"status"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 工厂列表
func (f *factory) List(ctx context.Context, args ArgsFactoryList) (reply ReplyFactoryList, err error) {
xClient, err := client.GetClient(f)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsFactoryAdd struct {
StaffId int64
FactoryAdd
}
type FactoryAdd struct {
Serial string // 工厂编号
ImgFilePaths []string // 图片地址
Name string // 工厂名称
ShortName string // 工厂简称
EngName string // 英文名称
Origin string // 工厂来源
MaterialQuality string // 材质
InvoiceType string // 发票
BanFlag int64 // 禁用标记 1=禁用 2=正常
City string // 所在城市
Address string // 工厂地址
EngAddress string // 英文地址
ZipCode string // 邮编
DomesticSupply string // 境内货源地
TradeScope string // 工厂业务范围
CreditRank string // 信用等级
TeamRank string // 合作等级
PayWay string // 结算方式
Bank string // 开户银行
BankAccount string // 银行账号
BankAddress string // 银行地址
TaxNumber string // 工厂税号
Info string // 备注说明
LegalPerson string // 法人
RegCapital string // 注册资金
RegAddress string // 注册地址
RegOffice string // 注册机关
YearSale string // 年销售额
Contact string // 联系方式
LicenseFilePath string // 营业执照图片
ReportFilePath string // 验厂报告图片
OpStartAt *time.Time // 营业期限 起
OpEndAt *time.Time // 营业期限 止
LicenseStartAt *time.Time // 营业执照 起
LicenseEndAt *time.Time // 营业执照 止
ReportStartAt *time.Time // 验厂报告 起
ReportEndAt *time.Time // 验厂报告 止
Contacts []factory2.ContactAdd // 联系人
}
// Add @TITLE 添加工厂
func (f *factory) Add(ctx context.Context, args ArgsFactoryAdd) (factoryId int64, err error) {
xClient, err := client.GetClient(f)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &factoryId)
return
}
type ReplyFactoryInfo struct {
Id int64 `json:"id"`
Serial string `json:"serial"`
Name string `json:"name"`
ShortName string `json:"shortName"`
EngName string `json:"engName"`
City string `json:"city"`
Address string `json:"address"`
EngAddress string `json:"engAddress"`
ZipCode string `json:"zipCode"`
DomesticSupply string `json:"domesticSupply"`
Origin string `json:"origin"`
TradeScope string `json:"tradeScope"`
CreditRank string `json:"creditRank"`
TeamRank string `json:"teamRank"`
PayWay string `json:"payWay"`
Bank string `json:"bank"`
BankAccount string `json:"bankAccount"`
BankAddress string `json:"bankAddress"`
TaxNumber string `json:"taxNumber"`
Info string `json:"info"`
LegalPerson string `json:"legalPerson"`
RegCapital string `json:"regCapital"`
RegAddress string `json:"regAddress"`
RegOffice string `json:"regOffice"`
YearSale string `json:"yearSale"`
Contact string `json:"contact"`
OpStartAt *time.Time `json:"opStartAt"`
OpEndAt *time.Time `json:"opEndAt"`
LicenseFilePath string `json:"licenseFilePath"`
LicenseStartAt *time.Time `json:"licenseStartAt"`
LicenseEndAt *time.Time `json:"licenseEndAt"`
ReportFilePath string `json:"reportFilePath"`
ReportStartAt *time.Time `json:"reportStartAt"`
ReportEndAt *time.Time `json:"reportEndAt"`
ImgFilePaths []string `json:"imgFilePaths"`
BanFlag int64 `json:"banFlag"`
MaterialQuality string `json:"materialQuality"`
InvoiceType string `json:"invoiceType"`
Status *int64 `json:"status"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 工厂详情
func (f *factory) Info(ctx context.Context, factoryId int64) (reply ReplyFactoryInfo, err error) {
xClient, err := client.GetClient(f)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", factoryId, &reply)
return
}
type ArgsFactoryEdit struct {
FactoryId int64
FactoryAdd
}
// Edit @TITLE 编辑工厂
func (f *factory) Edit(ctx context.Context, args ArgsFactoryEdit) (err error) {
xClient, err := client.GetClient(f)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}

93
erp/factory/contact.go Normal file
View File

@ -0,0 +1,93 @@
package factory
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type contact struct {
}
type ContactItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
Sex string `json:"sex"`
Dept string `json:"dept"`
Job string `json:"job"`
Phone string `json:"phone"`
Fax string `json:"fax"`
Email string `json:"email"`
Tel string `json:"tel"`
Info string `json:"info"`
MainFlag int64 `json:"mainFlag"`
Qq string `json:"qq"`
WeChat string `json:"weChat"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取联系人
func (c *contact) All(ctx context.Context, factoryId int64) (reply []ContactItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", factoryId, &reply)
return
}
type ArgsContactAdd struct {
FactoryId int64 // 工厂ID
ContactAdd
}
type ContactAdd struct {
Name string // 联系人姓名
Sex string // 性别
Dept string // 部门
Job string // 职位
Phone string // 电话
Fax string // 传真
Email string // 邮箱
Tel string // 移动电话
Info string // 联系人备注
MainFlag int64 // 主联系人 1=主联系人
Qq string // QQ
WeChat string // 微信
}
// Add @TITLE 添加联系人
func (c *contact) Add(ctx context.Context, args ArgsContactAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsContactEdit struct {
ContactId int64 // 联系人ID
ContactAdd
}
// Edit @TITLE 编辑联系人
func (c *contact) Edit(ctx context.Context, args ArgsContactEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除联系人
func (c *contact) Delete(ctx context.Context, contactIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", contactIds, &reply)
}

5
erp/factory/factory.go Normal file
View File

@ -0,0 +1,5 @@
package factory
type Factory struct {
Contact contact
}

259
erp/product.go Normal file
View File

@ -0,0 +1,259 @@
package erp
import (
"context"
"git.kumo.work/shama/service/client"
product2 "git.kumo.work/shama/service/erp/product"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
"time"
)
type product struct {
product2.Product
}
type ArgsProductList struct {
Page bean.Page
Search ProductSearch
}
type ProductSearch struct {
CategoryId int64 // 分类id
Serial string // 产品货号
CustomSerial string // 客户货号
Type string // 产品类型
Mold int64 // 组成方式 1=单件 2=套件
CreatedStaffIds []int64 // 录入人
CreatedDepartmentIds []int64 // 归属部门
BanFlag int64 // 禁用标记 1=禁用 2=可用
Name string // 中文品名
CreatedAtStart *time.Time // 录入开始时间
CreatedAtEnd *time.Time // 录入结束时间
ParentIds []int64 // 上级id
}
type ProductItem struct {
Id int64 `json:"id"`
Mold int64 `json:"mold"`
Serial string `json:"serial"`
CustomSerial string `json:"customSerial"`
Name string `json:"name"`
EngName string `json:"engName"`
ImgFilePaths []string `json:"imgFilePaths"`
CategoryId *int64 `json:"categoryId"`
CategoryName string `json:"categoryName"`
Weight *decimal.Decimal `json:"weight"`
Texture string `json:"texture"`
SalePrice *decimal.Decimal `json:"salePrice"`
BanFlag int64 `json:"banFlag"`
Type string `json:"type"`
Barcode string `json:"barcode"`
SellCountry string `json:"sellCountry"`
Info string `json:"info"`
CreatedStaffId int64 `json:"createdStaffId"`
DepartmentId int64 `json:"departmentId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
type ReplyProductList struct {
List []ProductItem `json:"list"`
Total int64 `json:"total"`
}
// List @TITLE 产品列表
func (p *product) List(ctx context.Context, args ArgsProductList) (reply ReplyProductList, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsProductAdd struct {
StaffId int64 // 员工id
ProductAdd
}
type ProductAdd struct {
Serial string // 货号
CustomSerial string // 客户货号
Name string // 中文品名
EngName string // 英文品名
CategoryId *int64 // 类目ID
Weight *decimal.Decimal // 重量
Texture string // 材质
SalePrice *decimal.Decimal // 销售单价
BanFlag int64 // 禁用标记 1=禁用2=可用
Mold int64 // 组成类型 1=单件 2=套件
ParentId int64 // 子套件父级ID
Type string // 产品类型
Barcode string // 条形码
SellCountry string // 销售国家
Info string // 备注
Description string // 中文描述
EngDescription string // 英文描述
PackageDescription string // 包装中文描述
PackageEngDescription string // 包装英文描述
PackageInfoFile string // 包装描述文件
Packages []ProductPackage // 包装
Customs ProductCustoms // 海关
Quotes []product2.ArgsQuoteAdd // 工厂报价
ImgFilePaths []string // 图片地址集合
}
type ProductCustoms struct {
Serial string // 海关编码
Name string // 中文报关名称
DomesticSupply string // 境内货源地
AddTaxRate *decimal.Decimal // 增值税率
MinusTaxRate *decimal.Decimal // 退税率
MeasureUnit string // 报关单位
InvoiceUnit string // 开票单位
Info string // 备注
HsSerial int64 // 是否商检 1=商检 2=未商检
Brand string // 品牌
Detail string // 报关要素
}
type ProductPackage struct {
Type int64 // 包装类型 1=内盒 2=外箱
Material string // 材质
Num *int64 // 入数
Length *decimal.Decimal // 长
Width *decimal.Decimal // 宽
Height *decimal.Decimal // 高
GrossWeight *decimal.Decimal // 毛重
NetWeight *decimal.Decimal // 净重
Info string // 包装备注
}
// Add @TITLE 添加商品
func (p *product) Add(ctx context.Context, args ArgsProductAdd) (productId int64, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &productId)
return
}
type ProductCustomsInfo struct {
Id int64 `json:"id"`
Serial string `json:"serial"`
Name string `json:"name"`
DomesticSupply string `json:"domesticSupply"`
AddTaxRate *decimal.Decimal `json:"addTaxRate"`
MinusTaxRate *decimal.Decimal `json:"minusTaxRate"`
MeasureUnit string `json:"measureUnit"`
InvoiceUnit string `json:"invoiceUnit"`
Info string `json:"info"`
HsSerial int64 `json:"hsSerial"`
Brand string `json:"brand"`
Detail string `json:"detail"`
}
type ReplyProductInfo struct {
Id int64 `json:"id"`
Mold int64 `json:"mold"`
Serial string `json:"serial"`
CustomSerial string `json:"customSerial"`
Name string `json:"name"`
EngName string `json:"engName"`
ImgFilePaths []string `json:"imgFilePaths"`
CategoryId *int64 `json:"categoryId"`
CategoryName string `json:"categoryName"`
Weight *decimal.Decimal `json:"weight"`
Texture string `json:"texture"`
SalePrice *decimal.Decimal `json:"salePrice"`
BanFlag int64 `json:"banFlag"`
Type string `json:"type"`
Barcode string `json:"barcode"`
SellCountry string `json:"sellCountry"`
Info string `json:"info"`
Description string `json:"description"`
EngDescription string `json:"engDescription"`
PackageDescription string `json:"packageDescription"`
PackageEngDescription string `json:"packageEngDescription"`
PackageInfoFile string `json:"packageInfoFile"`
CreatedStaffId int64 `json:"createdStaffId"`
DepartmentId int64 `json:"departmentId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Packages []ProductPackageInfo `json:"packages"`
Customs ProductCustomsInfo `json:"customs"`
Quotes []ProductQuoteInfo `json:"quotes"`
Children []ReplyProductInfo `json:"children"` // 子组件
}
type ProductPackageInfo struct {
Type int64 `json:"type"`
Material string `json:"material"`
Num *int64 `json:"num"`
Length *decimal.Decimal `json:"length"`
Width *decimal.Decimal `json:"width"`
Height *decimal.Decimal `json:"height"`
Volume *decimal.Decimal `json:"volume"`
GrossWeight *decimal.Decimal `json:"grossWeight"`
NetWeight *decimal.Decimal `json:"netWeight"`
Info string `json:"info"`
}
type ProductQuoteInfo struct {
Id int64 `json:"id"`
FactorySerial string `json:"factorySerial"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
Price *decimal.Decimal `json:"price"`
StartNum *int64 `json:"startNum"`
MeasureUnit string `json:"measureUnit"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate *decimal.Decimal `json:"currencyRate"`
MainFlag int64 `json:"mainFlag"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 产品详情
func (p *product) Info(ctx context.Context, productId int64) (reply ReplyProductInfo, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", productId, &reply)
return
}
// Infos @TITLE 产品详情
func (p *product) Infos(ctx context.Context, productIds []int64) (reply []ReplyProductInfo, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Infos", productIds, &reply)
return
}
type ArgsProductEdit struct {
ProductId int64 // 产品ID
ProductAdd
}
// 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)
}
// Delete @TITLE 删除产品
func (p *product) Delete(ctx context.Context, productIds []int64) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", productIds, &reply)
}

75
erp/product/category.go Normal file
View File

@ -0,0 +1,75 @@
package product
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type category struct {
}
type CategoryItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
Sort int64 `json:"sort"`
ParentId int64 `json:"parentId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Children []*CategoryItem `json:"children"`
}
type ArgsCategoryAll struct {
}
// All @TITLE 全部分类
func (c *category) All(ctx context.Context, args ArgsCategoryAll) (reply []CategoryItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", args, &reply)
return
}
type ArgsCategoryAdd struct {
Name string // 分类名称
Sort int64 // 排序
ParentId int64 // 父级分类
}
// Add @TITLE 添加分类
func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Add", args, &reply)
return
}
type ArgsCategoryEdit struct {
CategoryId int64 // 分类id
ArgsCategoryAdd
}
// Edit @TITLE 编辑分类
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Edit", args, &reply)
return
}
// Delete @TITLE 删除分类
func (c *category) Delete(ctx context.Context, categoryIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Delete", categoryIds, &reply)
return
}

5
erp/product/product.go Normal file
View File

@ -0,0 +1,5 @@
package product
type Product struct {
Category category
}

92
erp/product/quote.go Normal file
View File

@ -0,0 +1,92 @@
package product
import (
"context"
"git.kumo.work/shama/service/client"
"github.com/shopspring/decimal"
"time"
)
type quote struct {
}
type QuoteItem struct {
Id int64 `json:"id"`
ProductId int64 `json:"productId"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
FactorySerial string `json:"factorySerial"`
Price *decimal.Decimal `json:"price"`
StartNum *int64 `json:"startNum"`
MeasureUnit string `json:"measureUnit"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate *decimal.Decimal `json:"currencyRate"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
type ArgsQuoteAll struct {
}
// All @TITLE 全部工厂报价
func (c *quote) All(ctx context.Context, args ArgsQuoteAll) (reply []QuoteItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", args, &reply)
return
}
type ArgsQuoteAdd struct {
Id int64 // 工厂报价id
ProductId int64 // 产品id
FactorySerial string // 工厂货号
FactoryId int64 // 工厂id
Price *decimal.Decimal // 采购单价
StartNum *int64 // 起订量
MeasureUnit string // 数量单位
Currency string // 币种
CurrencyName string // 币种名称
CurrencySymbol string // 币种符号
CurrencyRate *decimal.Decimal // 币种汇率
MainFlag int64 // 主联系人标记1=是2=不是)
}
// Add @TITLE 添加工厂报价
func (c *quote) Add(ctx context.Context, args ArgsQuoteAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Add", args, &reply)
return
}
type ArgsQuoteEdit struct {
QuoteId int64 // 工厂报价id
ArgsQuoteAdd
}
// Edit @TITLE 编辑工厂报价
func (c *quote) Edit(ctx context.Context, args ArgsQuoteEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Edit", args, &reply)
return
}
// Delete @TITLE 删除工厂报价
func (c *quote) Delete(ctx context.Context, quoteIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Delete", quoteIds, &reply)
return
}

View File

@ -0,0 +1,73 @@
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type annotations struct {
}
type AnnotationsItem struct {
Id int64 `json:"id"`
Sort int64 `json:"sort"`
Value string `json:"value"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取附注
func (a *annotations) All(ctx context.Context, purchaseId int64) (reply []AnnotationsItem, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsAnnotationsAdd struct {
PurchaseId int64 // 采购合同ID
AnnotationsAdd
}
type AnnotationsAdd struct {
Sort int64 // 排序
Value string // 内容
}
// Add @TITLE 添加附注
func (a *annotations) Add(ctx context.Context, args ArgsAnnotationsAdd) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsAnnotationsEdit struct {
AnnotationsId int64 // 附注ID
AnnotationsAdd
}
// Edit @TITLE 编辑附注
func (a *annotations) Edit(ctx context.Context, args ArgsAnnotationsEdit) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除附注
func (a *annotations) Delete(ctx context.Context, annotationsIds []int64) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", annotationsIds, &reply)
}

75
erp/purchase/clause.go Normal file
View File

@ -0,0 +1,75 @@
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type clause struct {
}
type ClauseItem struct {
Id int64 `json:"id"`
Sort int64 `json:"sort"`
Key string `json:"key"`
Value string `json:"value"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取条款
func (c *clause) All(ctx context.Context, purchaseId int64) (reply []ClauseItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsClauseAdd struct {
PurchaseId int64 // 采购合同ID
ClauseAdd
}
type ClauseAdd struct {
Sort int64 // 排序
Key string // 项目
Value string // 内容
}
// Add @TITLE 添加条款
func (c *clause) Add(ctx context.Context, args ArgsClauseAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsClauseEdit struct {
ClauseId int64 // 条款ID
ClauseAdd
}
// Edit @TITLE 编辑条款
func (c *clause) Edit(ctx context.Context, args ArgsClauseEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除条款
func (c *clause) Delete(ctx context.Context, clauseIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", clauseIds, &reply)
}

76
erp/purchase/cost.go Normal file
View File

@ -0,0 +1,76 @@
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"github.com/shopspring/decimal"
"time"
)
type cost struct {
}
type CostItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
Amount decimal.Decimal `json:"amount"`
Remarks string `json:"remarks"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取费用
func (c *cost) All(ctx context.Context, purchaseId int64) (reply []CostItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsCostAdd struct {
PurchaseId int64 // 采购合同ID
CostAdd
}
type CostAdd struct {
Name string // 费用名
Amount decimal.Decimal // 金额
Remarks string // 备注信息
}
// Add @TITLE 添加费用
func (c *cost) Add(ctx context.Context, args ArgsCostAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsCostEdit struct {
CostId int64 // 费用ID
CostAdd
}
// Edit @TITLE 编辑费用
func (c *cost) Edit(ctx context.Context, args ArgsCostEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除费用
func (c *cost) Delete(ctx context.Context, costIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", costIds, &reply)
}

4
erp/purchase/product.go Normal file
View File

@ -0,0 +1,4 @@
package purchase
type product struct {
}

8
erp/purchase/purchase.go Normal file
View File

@ -0,0 +1,8 @@
package purchase
type Purchase struct {
Cost cost
Clause clause
Annotations annotations
Product product
}

230
erp/sale.go Normal file
View 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)
}

76
erp/sale/cost.go Normal file
View File

@ -0,0 +1,76 @@
package sale
import (
"context"
"git.kumo.work/shama/service/client"
"github.com/shopspring/decimal"
"time"
)
type cost struct {
}
type CostItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
Amount decimal.Decimal `json:"amount"`
Remarks string `json:"remarks"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取费用
func (c *cost) All(ctx context.Context, saleId int64) (reply []CostItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", saleId, &reply)
return
}
type ArgsCostAdd struct {
SaleId int64 // 销售合同ID
CostAdd
}
type CostAdd struct {
Name string // 费用名
Amount decimal.Decimal // 金额
Remarks string // 备注信息
}
// Add @TITLE 添加费用
func (c *cost) Add(ctx context.Context, args ArgsCostAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsCostEdit struct {
CostId int64 // 费用ID
CostAdd
}
// Edit @TITLE 编辑费用
func (c *cost) Edit(ctx context.Context, args ArgsCostEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除费用
func (c *cost) Delete(ctx context.Context, costIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", costIds, &reply)
}

287
erp/sale/product.go Normal file
View File

@ -0,0 +1,287 @@
package sale
import (
"context"
"git.kumo.work/shama/service/client"
product2 "git.kumo.work/shama/service/erp/product"
"github.com/shopspring/decimal"
"time"
)
type product struct {
product2.Product
}
type ProductItem struct {
Id int64 `json:"id"`
Mold int64 `json:"mold"`
ParentId int64 `json:"parentId"`
Serial string `json:"serial"`
Po string `json:"po"`
CustomSerial string `json:"customSerial"`
Name string `json:"name"`
EngName string `json:"engName"`
ImgFilePaths []string `json:"imgFilePaths"`
Weight *decimal.Decimal `json:"weight"`
Texture string `json:"texture"`
SalePrice decimal.Decimal `json:"salePrice"`
BanFlag int64 `json:"banFlag"`
Type string `json:"type"`
Barcode string `json:"barcode"`
SellCountry string `json:"sellCountry"`
Info string `json:"info"`
Sort int64 `json:"sort"`
SaleCount int64 `json:"saleCount"`
SaleAmount decimal.Decimal `json:"saleAmount"`
BoxCount int64 `json:"boxCount"`
QuotePrice decimal.Decimal `json:"quotePrice"`
QuoteFactorySerial string `json:"quoteFactorySerial"`
QuoteFactoryID int64 `json:"quoteFactoryID"`
QuoteFactoryName string `json:"quoteFactoryName"`
QuoteStartNum int64 `json:"quoteStartNum"`
QuoteMeasureUnit string `json:"quoteMeasureUnit"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Children []*ProductItem `json:"children"`
}
// All @TITLE 获取产品
func (p *product) All(ctx context.Context, saleId int64) (reply []ProductItem, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "All", saleId, &reply)
return
}
type ArgsProductAdd struct {
SaleId int64 // 销售合同id
ProductAdds []ProductAdd // 产品数组
}
type ProductAdd struct {
ProductId int64 // 产品id
Serial string // 货号
CustomSerial string // 客户货号
Name string // 中文品名
EngName string // 英文品名
Weight *decimal.Decimal // 重量
Texture string // 材质
SalePrice decimal.Decimal // 销售单价
BanFlag int64 // 禁用标记 1=禁用2=可用
Mold int64 // 组成类型 1=单件 2=套件
Type string // 产品类型
Barcode string // 条形码
SellCountry string // 销售国家
Info string // 备注
Description string // 中文描述
EngDescription string // 英文描述
PackageDescription string // 包装中文描述
PackageEngDescription string // 包装英文描述
PackageInfoFile string // 包装描述文件
Sort int64 // 排序
SaleCount int64 // 销售数量/合同数量
Packages []ProductPackage // 包装
Customs ProductCustoms // 海关
Quote ProductQuote // 工厂报价
ImgFilePaths []string // 图片地址集合
Children []ProductAdd // 子组件
}
type ProductCustoms struct {
Serial string // 海关编码
Name string // 中文报关名称
DomesticSupply string // 境内货源地
AddTaxRate *decimal.Decimal // 增值税率
MinusTaxRate *decimal.Decimal // 退税率
MeasureUnit string // 报关单位
InvoiceUnit string // 开票单位
Info string // 备注
HsSerial int64 // 是否商检 1=商检 2=未商检
Brand string // 品牌
Detail string // 报关要素
}
type ProductPackage struct {
Type int64 // 包装类型 1=内盒 2=外箱
Material string // 材质
Num *int64 // 入数
Length *decimal.Decimal // 长
Width *decimal.Decimal // 宽
Height *decimal.Decimal // 高
GrossWeight *decimal.Decimal // 毛重
NetWeight *decimal.Decimal // 净重
Info string // 包装备注
}
type ProductQuote struct {
FactorySerial string // 工厂货号
FactoryId int64 // 工厂id
FactoryName string // 工厂名称
Price decimal.Decimal // 采购单价
StartNum int64 // 起订量
MeasureUnit string // 数量单位
Currency string // 币种
CurrencyName string // 币种名称
CurrencySymbol string // 币种符号
CurrencyRate 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 ProductCustomsInfo struct {
Id int64 `json:"id"`
Serial string `json:"serial"`
Name string `json:"name"`
DomesticSupply string `json:"domesticSupply"`
AddTaxRate *decimal.Decimal `json:"addTaxRate"`
MinusTaxRate *decimal.Decimal `json:"minusTaxRate"`
MeasureUnit string `json:"measureUnit"`
InvoiceUnit string `json:"invoiceUnit"`
Info string `json:"info"`
HsSerial int64 `json:"hsSerial"`
Brand string `json:"brand"`
Detail string `json:"detail"`
}
type ReplyProductInfo struct {
Id int64 `json:"id"`
Mold int64 `json:"mold"`
Serial string `json:"serial"`
CustomSerial string `json:"customSerial"`
Name string `json:"name"`
EngName string `json:"engName"`
ImgFilePaths []string `json:"imgFilePaths"`
Weight *decimal.Decimal `json:"weight"`
Texture string `json:"texture"`
SalePrice decimal.Decimal `json:"salePrice"`
BanFlag int64 `json:"banFlag"`
Type string `json:"type"`
Barcode string `json:"barcode"`
SellCountry string `json:"sellCountry"`
Info string `json:"info"`
Description string `json:"description"`
EngDescription string `json:"engDescription"`
PackageDescription string `json:"packageDescription"`
PackageEngDescription string `json:"packageEngDescription"`
PackageInfoFile string `json:"packageInfoFile"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Packages []ProductPackageInfo `json:"packages"`
Customs ProductCustomsInfo `json:"customs"`
Quote ProductQuoteInfo `json:"quotes"`
}
type ProductPackageInfo struct {
Type int64 `json:"type"`
Material string `json:"material"`
Num *int64 `json:"num"`
Length *decimal.Decimal `json:"length"`
Width *decimal.Decimal `json:"width"`
Height *decimal.Decimal `json:"height"`
Volume *decimal.Decimal `json:"volume"`
GrossWeight *decimal.Decimal `json:"grossWeight"`
NetWeight *decimal.Decimal `json:"netWeight"`
Info string `json:"info"`
}
type ProductQuoteInfo struct {
Id int64 `json:"id"`
FactorySerial string `json:"factorySerial"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
Price decimal.Decimal `json:"price"`
StartNum int64 `json:"startNum"`
MeasureUnit string `json:"measureUnit"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 产品详情
func (p *product) Info(ctx context.Context, saleProductId int64) (reply ReplyProductInfo, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", saleProductId, &reply)
return
}
type ArgsProductEdit struct {
SaleProductId int64 // 产品ID
ProductEdit
}
type ProductEdit struct {
Serial string // 货号
CustomSerial string // 客户货号
Name string // 中文品名
EngName string // 英文品名
Weight *decimal.Decimal // 重量
Texture string // 材质
SalePrice decimal.Decimal // 销售单价
BanFlag int64 // 禁用标记 1=禁用2=可用
Mold int64 // 组成类型 1=单件 2=套件
Type string // 产品类型
Barcode string // 条形码
SellCountry string // 销售国家
Info string // 备注
Description string // 中文描述
EngDescription string // 英文描述
PackageDescription string // 包装中文描述
PackageEngDescription string // 包装英文描述
PackageInfoFile string // 包装描述文件
Packages []ProductPackage // 包装
Customs ProductCustoms // 海关
Quote ProductQuote // 工厂报价
ImgFilePaths []string // 图片地址集合
}
// 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 MultiData struct {
SaleProductId int64 // 产品id
PO string // PO
QuotePrice decimal.Decimal // 采购单价
SalePrice decimal.Decimal // 销售单价
SaleCount int64 // 销售数量
Info string // 备注
}
// MultiEdit @TITLE 批量编辑
func (p *product) MultiEdit(ctx context.Context, args []MultiData) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "MultiEdit", args, &reply)
}
// Delete @TITLE 删除产品
func (p *product) Delete(ctx context.Context, saleProductIds []int64) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", saleProductIds, &reply)
}

6
erp/sale/sale.go Normal file
View File

@ -0,0 +1,6 @@
package sale
type Sale struct {
Cost cost
Product product
}

1
go.mod
View File

@ -4,6 +4,7 @@ go 1.21.5
require (
github.com/rpcxio/libkv v0.5.1
github.com/shopspring/decimal v1.4.0
github.com/smallnest/rpcx v1.8.31
)

2
go.sum
View File

@ -264,6 +264,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUt
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil/v3 v3.20.10 h1:7zomV9HJv6UGk225YtvEa5+camNLpbua3MAz/GqiVJY=
github.com/shirou/gopsutil/v3 v3.20.10/go.mod h1:igHnfak0qnw1biGeI2qKQvu0ZkwvEkUcCLlYhZzdr/4=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/smallnest/quick v0.2.0 h1:AEvm7ZovZ6Utv+asFDBh866G4ufMNhRNMKbZHVMFYPE=

View File

@ -15,6 +15,9 @@ func (p *Page) GetPage() int {
// GetLimit @Title 获取分页大小
func (p *Page) GetLimit() int {
if p.Limit <= 0 {
return -1
}
return p.Limit
}

View File

@ -15,18 +15,19 @@ type ArgsStaffLogin struct {
}
type ReplyStaffInfo struct {
Id int64 `json:"id"`
Name string `json:"name"`
EnName string `json:"enName"`
Account string `json:"account"`
Status int64 `json:"status"`
Avatar string `json:"avatar"`
Gender string `json:"gender"`
Phone string `json:"phone"`
Email string `json:"email"`
DepartmentId int64 `json:"departmentId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Id int64 `json:"id"`
Name string `json:"name"`
EnName string `json:"enName"`
Account string `json:"account"`
Status int64 `json:"status"`
Avatar string `json:"avatar"`
Gender string `json:"gender"`
Phone string `json:"phone"`
Email string `json:"email"`
DepartmentId int64 `json:"departmentId"`
DepartmentName string `json:"departmentName"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// Login @TITLE 登录
@ -143,6 +144,16 @@ func (s *staff) Info(ctx context.Context, staffId int64) (reply ReplyStaffInfo,
return
}
// Infos @TITLE 员工详情
func (s *staff) Infos(ctx context.Context, staffIds []int64) (reply []ReplyStaffInfo, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Infos", staffIds, &reply)
return
}
type ArgsStaffEdit struct {
StaffId int64 // 员工id
ArgsStaffAdd

8
rpc.go
View File

@ -1,9 +1,13 @@
package service
import "git.kumo.work/shama/service/oa"
import (
"git.kumo.work/shama/service/erp"
"git.kumo.work/shama/service/oa"
)
var Rpc = &rpc{}
type rpc struct {
Oa oa.Oa
Oa oa.Oa
Erp erp.Erp
}