diff --git a/erp/constant.go b/erp/constant.go index 49cdfea..24e87d3 100644 --- a/erp/constant.go +++ b/erp/constant.go @@ -4,11 +4,13 @@ type BusinessType = string // 业务类型 const ( BusinessTypeSaleAudit BusinessType = "saleAudit" // 销售合同审核 BusinessTypePurchaseAudit BusinessType = "purchaseAudit" // 销售合同审核 + BusinessTypeShipmentAudit BusinessType = "shipmentAudit" // 销售合同审核 ) var BusinessTypeName = map[BusinessType]string{ BusinessTypeSaleAudit: "销售合同审核", BusinessTypePurchaseAudit: "采购合同审核", + BusinessTypeShipmentAudit: "订舱单审核", } type AuditStatus = int64 // 审核状态 @@ -31,4 +33,5 @@ type ExportType = string // 导出类型 const ( ExportTypeSalePi = "salePi" // 销售pi导出 ExportTypeSaleBenefit = "saleBenefit" // 效益测算导出 + ExportTypePurchase = "purchase" // 采购导出 ) diff --git a/erp/purchase/annotations.go b/erp/purchase/annotations.go index 2c8af70..f49afdc 100644 --- a/erp/purchase/annotations.go +++ b/erp/purchase/annotations.go @@ -10,20 +10,21 @@ 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"` + Id int64 `json:"id"` + PurchaseId int64 `json:"purchaseId"` + 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) { +func (a *annotations) All(ctx context.Context, purchaseIds []int64) (reply []AnnotationsItem, err error) { xClient, err := client.GetClient(a) if err != nil { return } - err = xClient.Call(ctx, "All", purchaseId, &reply) + err = xClient.Call(ctx, "All", purchaseIds, &reply) return } diff --git a/erp/purchase/clause.go b/erp/purchase/clause.go index 57cf714..30dc8d9 100644 --- a/erp/purchase/clause.go +++ b/erp/purchase/clause.go @@ -10,21 +10,22 @@ 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"` + Id int64 `json:"id"` + PurchaseId int64 `json:"purchaseId"` + 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) { +func (c *clause) All(ctx context.Context, purchaseIds []int64) (reply []ClauseItem, err error) { xClient, err := client.GetClient(c) if err != nil { return } - err = xClient.Call(ctx, "All", purchaseId, &reply) + err = xClient.Call(ctx, "All", purchaseIds, &reply) return } diff --git a/erp/sale.go b/erp/sale.go index 6b00a7a..6812807 100644 --- a/erp/sale.go +++ b/erp/sale.go @@ -83,6 +83,7 @@ type SaleItem struct { HasPurchase int64 `json:"hasPurchase"` PurchaseStatus int64 `json:"purchaseStatus"` ShipmentStatus int64 `json:"shipmentStatus"` + TotalSaleAmount decimal.Decimal `json:"totalSaleAmount"` CreatedStaffId int64 `json:"createdStaffId"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` diff --git a/erp/shipment/audit.go b/erp/shipment/audit.go new file mode 100644 index 0000000..2e55103 --- /dev/null +++ b/erp/shipment/audit.go @@ -0,0 +1,25 @@ +package shipment + +import ( + "context" + "git.kumo.work/shama/service/client" +) + +type audit struct { +} +type ArgsAuditSubmit struct { + StaffId int64 // 操作人 + ShipmentId 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 +} diff --git a/erp/shipment/customsCost.go b/erp/shipment/customsCost.go new file mode 100644 index 0000000..9f94bb4 --- /dev/null +++ b/erp/shipment/customsCost.go @@ -0,0 +1,76 @@ +package shipment + +import ( + "context" + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" + "time" +) + +type customsCost struct { +} + +type CustomsCostItem 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 *customsCost) All(ctx context.Context, purchaseId int64) (reply []CustomsCostItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", purchaseId, &reply) + return +} + +type ArgsCustomsCostAdd struct { + ShipmentId int64 // 订舱单ID + CustomsCostAdd +} + +type CustomsCostAdd struct { + Name string // 费用名 + Amount decimal.Decimal // 金额 + Remarks string // 备注信息 +} + +// Add @TITLE 添加费用 +func (c *customsCost) Add(ctx context.Context, args ArgsCustomsCostAdd) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsCustomsCostEdit struct { + CustomsCostId int64 // 费用ID + CustomsCostAdd +} + +// Edit @TITLE 编辑费用 +func (c *customsCost) Edit(ctx context.Context, args ArgsCustomsCostEdit) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除费用 +func (c *customsCost) Delete(ctx context.Context, customsCostIds []int64) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", customsCostIds, &reply) +} diff --git a/erp/shipment/gift.go b/erp/shipment/gift.go new file mode 100644 index 0000000..5a680fc --- /dev/null +++ b/erp/shipment/gift.go @@ -0,0 +1,103 @@ +package shipment + +import ( + "context" + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" + "time" +) + +type gift struct { +} + +type GiftItem struct { + Id int64 `json:"id"` + Name string `json:"name"` + EngName string `json:"engName"` + CustomsName string `json:"customsName"` + CustomsSerial string `json:"customsSerial"` + CustomsMeasureUnit string `json:"customsMeasureUnit"` + CustomsInvoiceUnit string `json:"customsInvoiceUnit"` + CustomsDetail string `json:"customsDetail"` + ShipmentCount int64 `json:"shipmentCount"` + OuterBoxCount int64 `json:"outerBoxCount"` + TotalVolume decimal.Decimal `json:"totalVolume"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` + CustomsPrice decimal.Decimal `json:"customsPrice"` + CustomsAmount decimal.Decimal `json:"customsAmount"` + DomesticSupply string `json:"domesticSupply"` + Remark string `json:"remark"` + Sort int64 `json:"sort"` + CreatedAt *time.Time `json:"createdAt"` +} + +// All @TITLE 全部赠品 +func (g *gift) All(ctx context.Context, shipmentId int64) (reply []GiftItem, err error) { + xClient, err := client.GetClient(g) + if err != nil { + return + } + err = xClient.Call(ctx, "All", shipmentId, &reply) + return +} + +type ArgsGiftAdd struct { + ShipmentId int64 // 订舱单ID + GiftAdd +} + +type GiftAdd struct { + Name string // 中文品名 + EngName string // 英文品名 + CustomsName string // 中文报关名称 + CustomsSerial string // 海关编码 + CustomsMeasureUnit string // 报关单位 + CustomsInvoiceUnit string // 开票单位 + CustomsDetail string // 申报要素 + ShipmentCount int64 // 出运数量 + OuterBoxCount int64 // 箱数 + TotalVolume decimal.Decimal // 总体积 + TotalGrossWeight decimal.Decimal // 总毛重 + TotalNetWeight decimal.Decimal // 总净重 + CustomsPrice decimal.Decimal // 报关单价 + CustomsAmount decimal.Decimal // 报关总价 + DomesticSupply string // 境内货源地 + Remark string // 备注 + Sort int64 // 排序 +} + +// Add @TITLE 添加赠品 +func (g *gift) Add(ctx context.Context, args ArgsGiftAdd) (err error) { + xClient, err := client.GetClient(g) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type GiftEdit struct { + GiftId int64 // 费用ID + GiftAdd +} + +// Edit @TITLE 编辑赠品 +func (g *gift) Edit(ctx context.Context, args []GiftEdit) (err error) { + xClient, err := client.GetClient(g) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除赠品 +func (g *gift) Delete(ctx context.Context, giftIds []int64) (err error) { + xClient, err := client.GetClient(g) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", giftIds, &reply) +} diff --git a/erp/shipment/saleProduct.go b/erp/shipment/saleProduct.go index fab4140..154a9b2 100644 --- a/erp/shipment/saleProduct.go +++ b/erp/shipment/saleProduct.go @@ -16,6 +16,7 @@ type SaleProductItem struct { Sort int64 `json:"sort"` Po string `json:"po"` Serial string `json:"serial"` + ImgFilePaths []string `json:"imgFilePaths"` CustomSerial string `json:"customSerial"` PackageDescription string `json:"packageDescription"` PackageEngDescription string `json:"packageEngDescription"` @@ -86,7 +87,6 @@ type ArgsSaleProductAdd struct { } type SaleProductAdd struct { SaleProductId int64 // 销售商品id - Sort int64 // 排序 CustomSerial string // 客户货号 PackageEngDescription string // 包装英文描述 Name string // 中文品名 @@ -109,6 +109,10 @@ type SaleProductAdd struct { GrossWeight *decimal.Decimal // 毛重 NetGrossVolume int64 // 净毛体计算类型 1=内盒 2=外箱 CustomsBrand string // 品牌 + DomesticSupply string // 货源地 + FactoryName string // 工厂名称 + HsSerial int64 // 是否商检 1=商检 2=未商检 + Texture string // 材质 EpmNo string // EPM NO TaxExemption string // 免征税 ItemNumber string // 项号 @@ -133,26 +137,49 @@ func (s *saleProduct) Add(ctx context.Context, args ArgsSaleProductAdd) (err err } type ArgsSaleProductEdit struct { - ShipmentSaleProductId int64 - Product SaleProductEdit + ShipmentId int64 // 订舱单id + Products []SaleProductEdit } type SaleProductEdit struct { - SaleProductId int64 // 销售商品id - ShipmentCount int64 // 出运数量 - NetGrossVolume int64 // 净毛体计算类型 1=内盒 2=外箱 - EpmNo string // EPM NO - TaxExemption string // 免征税 - ItemNumber string // 项号 - Remark1 string // 备注1 - Remark2 string // 备注2 - Remark3 string // 备注3 - Remark4 string // 备注4 - Remark5 string // 备注5 - Remark6 string // 备注6 - ContainerNumber string // 箱号 - SealNumber string // 封号 - Sort int64 // 排序 - BlEngName string // 提单英文名 + ShipmentSaleProductId int64 // 出舱单商品id + Sort int64 // 排序 + CustomSerial string // 客户货号 + PackageEngDescription string // 包装英文描述 + Name string // 中文品名 + EngName string // 英文品名 + CustomsSerial string // 海关编码 + CustomsName string // 中文报关名称 + CustomsMeasureUnit string // 报关单位 + CustomsInvoiceUnit string // 开票单位 + CustomsDetail string // 申报要素 + BlEngName string // 提单英文名 + InnerNum *int64 // 内盒入数 + BoxNumUnit string // 箱数单位 + OuterNum *int64 // 装箱单数 + ShipmentCount int64 // 出运数量 + ShipmentCountUnit string // 数量单位 + Length *decimal.Decimal // 长 + Width *decimal.Decimal // 宽 + Height *decimal.Decimal // 高 + NetWeight *decimal.Decimal // 净重 + GrossWeight *decimal.Decimal // 毛重 + NetGrossVolume int64 // 净毛体计算类型 1=内盒 2=外箱 + CustomsBrand string // 品牌 + DomesticSupply string // 货源地 + FactoryName string // 工厂名称 + HsSerial int64 // 是否商检 1=商检 2=未商检 + Texture string // 材质 + EpmNo string // EPM NO + TaxExemption string // 免征税 + ItemNumber string // 项号 + Remark1 string // 备注1 + Remark2 string // 备注2 + Remark3 string // 备注3 + Remark4 string // 备注4 + Remark5 string // 备注5 + Remark6 string // 备注6 + ContainerNumber string // 箱号 + SealNumber string // 封号 } // Edit @TITLE 编辑 diff --git a/erp/shipment/shipment.go b/erp/shipment/shipment.go index 3207e33..2f3f590 100644 --- a/erp/shipment/shipment.go +++ b/erp/shipment/shipment.go @@ -4,4 +4,7 @@ type Shipment struct { Sale sale Cost cost SaleProduct saleProduct + Audit audit + CustomsCost customsCost + Gift gift }