From 65c59f2c7b2d91186d5736a8ae894a20e75ed73b Mon Sep 17 00:00:00 2001 From: kanade Date: Tue, 13 Aug 2024 16:06:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp/erp.go | 1 + erp/purchase.go | 8 ++ erp/purchase/product.go | 3 + erp/shipment.go | 271 +++++++++++++++++++++++++++++++++++++++ erp/shipment/cost.go | 2 +- erp/shipment/sale.go | 56 ++++++++ erp/shipment/shipment.go | 1 + erp/workflow.go | 3 + 8 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 erp/shipment.go create mode 100644 erp/shipment/sale.go diff --git a/erp/erp.go b/erp/erp.go index d194f23..44d7cb5 100644 --- a/erp/erp.go +++ b/erp/erp.go @@ -8,4 +8,5 @@ type Erp struct { Purchase purchase LogisticsCompany logisticsCompany Workflow workflow + Shipment shipment } diff --git a/erp/purchase.go b/erp/purchase.go index e4f7fe2..abbe1c7 100644 --- a/erp/purchase.go +++ b/erp/purchase.go @@ -108,6 +108,10 @@ type ReplyPurchaseInfo struct { SideMark string `json:"sideMark"` InnerBoxText string `json:"innerBoxText"` Remarks string `json:"remarks"` + 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"` } @@ -138,6 +142,10 @@ type ArgsPurchaseEdit struct { SideMark string // 侧面唛头 InnerBoxText string // 内盒文字 Remarks string // 合同备注 + Currency string // 币种 + CurrencyName string // 币种名称 + CurrencySymbol string // 币种符号 + CurrencyRate decimal.Decimal // 币种汇率 } // Edit @TITLE 编辑采购合同 diff --git a/erp/purchase/product.go b/erp/purchase/product.go index a12f90a..68e3e05 100644 --- a/erp/purchase/product.go +++ b/erp/purchase/product.go @@ -20,12 +20,15 @@ type ProductItem struct { CustomSerial string `json:"customSerial"` Name string `json:"name"` EngName string `json:"engName"` + Description string `json:"description"` + EngDescription string `json:"engDescription"` ImgFilePaths []string `json:"imgFilePaths"` PurchaseAmount decimal.Decimal `json:"purchaseAmount"` Num *int64 `json:"num"` Volume *decimal.Decimal `json:"volume"` GrossWeight *decimal.Decimal `json:"grossWeight"` NetWeight *decimal.Decimal `json:"netWeight"` + MeasureUnit string `json:"measureUnit"` } // All @TITLE 获取产品 diff --git a/erp/shipment.go b/erp/shipment.go new file mode 100644 index 0000000..a82fcc8 --- /dev/null +++ b/erp/shipment.go @@ -0,0 +1,271 @@ +package erp + +import ( + "context" + "git.kumo.work/shama/service/client" + shipment2 "git.kumo.work/shama/service/erp/shipment" + "git.kumo.work/shama/service/lib/bean" + "github.com/shopspring/decimal" + "time" +) + +type shipment struct { + shipment2.Shipment +} +type ArgsShipmentList struct { + Page bean.Page + Search ShipmentSearch +} +type ShipmentSearch struct { + InvoiceSerial string // 出运发票号 + CustomIds []int64 // 客户筛选 + StaffIds []int64 // 业务员筛选 +} +type ReplyShipmentList struct { + List []ShipmentItem `json:"list"` + Total int64 `json:"total"` +} +type ShipmentItem struct { + Id int64 `json:"id"` + PiSerials string `json:"piSerials"` + InvoiceSerial string `json:"invoiceSerial"` + ContractDate *time.Time `json:"contractDate"` + InvoiceDate time.Time `json:"invoiceDate"` + CustomName string `json:"customName"` + CustomShortName string `json:"customShortName"` + EstSailingDate *time.Time `json:"estSailingDate"` + ShipPort string `json:"shipPort"` + DischargePort string `json:"dischargePort"` + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// List @TITLE 列表 +func (s *shipment) List(ctx context.Context, args ArgsShipmentList) (reply ReplyShipmentList, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "List", args, &reply) + return +} + +type ArgsShipmentAdd struct { + StaffId int64 // 员工id + ShipmentAdd ShipmentAdd +} +type ShipmentAdd struct { + CustomID int64 // 客户id + EstSailingDate *time.Time // 预计船期 + InvoiceSerial string // 发票号 + InvoiceDate time.Time // 发票日期 + ContractDate *time.Time // 合同日期 + TradeType string // 贸易类型 + OurCompany string // 我方公司 + PaymentType string // 付款方式 + PaymentDepositRate *decimal.Decimal // 付款定金比例 + PaymentDepositAmount *decimal.Decimal // 定价金额 + PaymentCycle *int64 // 付款周期 + PaymentTerms string // 条款 + CommissionRate *decimal.Decimal // 佣金比例 + TradeCountry string // 贸易国别 + RecBank string // 收汇银行 + RecBankEng string // 收汇银行英文 + RecBankName string // 收汇银行名称 + RecBankNameEng string // 收汇银行名称英文 + RecBankCardNo string // 收汇银行卡号 + RecBankCardName string // 收汇银行户名 + Shipper string // 托运人 + Consignee string // 收货人 + Notifier string // 通知人 + ShipMode string // 运输方式 + ContainerType string // 货柜类型 + ReadyDate *time.Time // 货好时间 + ShipPort string // 出运口岸 + DischargePort string // 卸货港 + DischargePortEng string // 卸货港英文 + DeliveryCountry string // 运抵国 + DeliveryCountryEng string // 运抵国英文 + Destination string // 目的地 + FactoryHaulAdress string // 工厂拖柜地址 + LogisticsCompany string // 物流公司 + LogisticsCompanyContactName string // 物流公司联系人 + LogisticsCompanyContactPhone string // 物流公司手机号 + LogisticsCompanyContactTel string // 物流公司固定电话 + LogisticsCompanyContactEmail string // 物流公司邮箱 + SeparableFlag int64 // 可分批标记(1=可分 2=不可分) + CopyCount *int64 // 提单份数 + InsuranceRatio *int64 // 保险比率 + CreditSerial string // 信用证号 + CreditDate *time.Time // 开证日期 + InlandShipWay string // 内陆运输 + PackagingType string // 包装种类 + ShipmentNo string // shipmentNO + CnoSno string // CONTAINER NO./SEAL NO. + Declare1 string // 声明1 + Declare2 string // 声明2 + Info string // 备注 + RegulatoryMethods string // 监管方式 + TaxExemptionNature string // 征免性质 + MarkText string // 唛头文字 + MarkImg string // 唛头图片 + SaleIds []int64 // 销售合同 +} + +// Add @TITLE 添加 +func (s *shipment) Add(ctx context.Context, args ArgsShipmentAdd) (err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Add", args, &reply) + return +} + +type ReplyShipmentInfo struct { + Id int64 `json:"id"` + CustomName string `json:"customName"` + CustomShortName string `json:"customShortName"` + EstSailingDate *time.Time `json:"estSailingDate"` + InvoiceSerial string `json:"invoiceSerial"` + InvoiceDate time.Time `json:"invoiceDate"` + ContractDate *time.Time `json:"contractDate"` + TradeType string `json:"tradeType"` + OurCompany string `json:"ourCompany"` + PaymentType string `json:"paymentType"` + PaymentDepositRate *decimal.Decimal `json:"paymentDepositRate"` + PaymentDepositAmount *decimal.Decimal `json:"paymentDepositAmount"` + PaymentCycle *int64 `json:"paymentCycle"` + PaymentTerms string `json:"paymentTerms"` + CommissionRate *decimal.Decimal `json:"commissionRate"` + TradeCountry string `json:"tradeCountry"` + RecBank string `json:"recBank"` + RecBankEng string `json:"recBankEng"` + RecBankName string `json:"recBankName"` + RecBankNameEng string `json:"recBankNameEng"` + RecBankCardNo string `json:"recBankCardNo"` + RecBankCardName string `json:"recBankCardName"` + Shipper string `json:"shipper"` + Consignee string `json:"consignee"` + Notifier string `json:"notifier"` + DueRecDate *time.Time `json:"dueRecDate"` + ShipMode string `json:"shipMode"` + ContainerType string `json:"containerType"` + ReadyDate *time.Time `json:"readyDate"` + ShipPort string `json:"shipPort"` + DischargePort string `json:"dischargePort"` + DischargePortEng string `json:"dischargePortEng"` + DeliveryCountry string `json:"deliveryCountry"` + DeliveryCountryEng string `json:"deliveryCountryEng"` + Destination string `json:"destination"` + FactoryHaulAdress string `json:"factoryHaulAdress"` + LogisticsCompany string `json:"logisticsCompany"` + LogisticsCompanyContactName string `json:"logisticsCompanyContactName"` + LogisticsCompanyContactPhone string `json:"logisticsCompanyContactPhone"` + LogisticsCompanyContactTel string `json:"logisticsCompanyContactTel"` + LogisticsCompanyContactEmail string `json:"logisticsCompanyContactEmail"` + SeparableFlag int64 `json:"separableFlag"` + CopyCount *int64 `json:"copyCount"` + InsuranceRatio *int64 `json:"insuranceRatio"` + CreditSerial string `json:"creditSerial"` + CreditDate *time.Time `json:"creditDate"` + InlandShipWay string `json:"inlandShipWay"` + PackagingType string `json:"packagingType"` + ShipmentNo string `json:"shipmentNo"` + CnoSno string `json:"cnoSno"` + Declare1 string `json:"declare1"` + Declare2 string `json:"declare2"` + Info string `json:"info"` + RegulatoryMethods string `json:"regulatoryMethods"` + TaxExemptionNature string `json:"taxExemptionNature"` + MarkText string `json:"markText"` + MarkImg string `json:"markImg"` + WorkflowId int64 `json:"workflowId"` + WorkflowStatus int64 `json:"workflowStatus"` + WorkflowReason string `json:"workflowReason"` + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` +} + +// Info @TITLE 详情 +func (s *shipment) Info(ctx context.Context, shipmentId int64) (reply ReplyShipmentInfo, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", shipmentId, &reply) + return +} + +type ArgsShipmentEdit struct { + ShipmentId int64 // 订舱单id + ArgsShipmentData +} +type ArgsShipmentData struct { + EstSailingDate *time.Time // 预计发运日期 + InvoiceSerial string // 发票编号 + InvoiceDate *time.Time // 发票日期 + ContractDate *time.Time // 合同日期 + TradeType string // 贸易类型 + OurCompany string // 我方公司 + RecBank string // 收款银行 + RecBankEng string // 收款银行英文 + RecBankName string // 收款银行名称 + RecBankNameEng string // 收款银行名称英文 + RecBankCardNo string // 收款银行卡号 + RecBankCardName string // 收款银行卡名 + PaymentTerms string // 付款条件 + TradeCountry string // 贸易国 + PaymentType string // 付款方式 + PaymentDepositRate decimal.Decimal // 定金比例 + PaymentCycle int64 // 付款周期 + CommissionRate decimal.Decimal // 佣金比例 + DueRecDate *time.Time // 预计收汇日期日期 + Shipper string // 发货方 + Consignee string // 收货方 + Notifier string // 通知方 + ShipMode string // 运输方式 + ContainerType string // 柜型 + ReadyDate *time.Time // 预计发运日期 + ShipPort string // 港口 + DischargePort string // 卸货港口 + DischargePortEng string // 卸货港口英文 + DeliveryCountry string // 运抵国 + DeliveryCountryEng string // 运抵国英文 + Destination string // 目的地 + FactoryHaulAdress string // 工厂拖柜地址 + SeparableFlag int64 // 可分批标记(1=可分 2=不可分) + LogisticsCompany string // 物流公司 + LogisticsCompanyContactName string // 物流公司联系人 + LogisticsCompanyContactPhone string // 物流公司联系人电话 + LogisticsCompanyContactTel string // 物流公司联系人固定电话 + LogisticsCompanyContactEmail string // 物流公司联系人邮箱 + CopyCount int64 // 提单份数 + InsuranceRatio int64 // 保险比率 + CreditSerial string // 信用证号 + CreditDate *time.Time // 开证日期 + InlandShipWay string // 内陆运输 + PackagingType string // 包装种类 + ShipmentNo string // shipmentNO + CnoSno string // CONTAINER NO./SEAL NO. + Declare1 string // 声明1 + Declare2 string // 声明2 + Info string // 备注 + RegulatoryMethods string // 监管方式 + TaxExemptionNature string // 征免性质 + MarkText string // 唛头文字 + MarkImg string // 唛头图片 +} + +// Edit @TITLE 编辑 +func (s *shipment) Edit(ctx context.Context, args ArgsShipmentEdit) (err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + reply := 0 + err = xClient.Call(ctx, "Edit", args, &reply) + return +} diff --git a/erp/shipment/cost.go b/erp/shipment/cost.go index 0fcf79f..c48173d 100644 --- a/erp/shipment/cost.go +++ b/erp/shipment/cost.go @@ -30,7 +30,7 @@ func (c *cost) All(ctx context.Context, purchaseId int64) (reply []CostItem, err } type ArgsCostAdd struct { - PurchaseId int64 // 采购合同ID + ShipmentId int64 // 订舱单ID CostAdd } diff --git a/erp/shipment/sale.go b/erp/shipment/sale.go new file mode 100644 index 0000000..fa6beea --- /dev/null +++ b/erp/shipment/sale.go @@ -0,0 +1,56 @@ +package shipment + +import ( + "context" + "git.kumo.work/shama/service/client" +) + +type sale struct { +} + +type SaleItem struct { + Id int64 `json:"id"` + SaleId int64 `json:"saleId"` + PiSerial string `json:"piSerial"` + PoSerial string `json:"poSerial"` +} + +// All @TITLE 获取销售合同 +func (c *sale) All(ctx context.Context, shipmentId int64) (reply []SaleItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", shipmentId, &reply) + return +} + +type ArgsSaleAdd struct { + ShipmentId int64 // 订舱单id + SaleIds []int64 // 销售合同 +} + +// Add @TITLE 添加销售合同 +func (c *sale) Add(ctx context.Context, args ArgsSaleAdd) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsSaleDelete struct { + ShipmentId int64 // 订舱单id + SaleIds []int64 // 销售合同 +} + +// Delete @TITLE 删除销售合同 +func (c *sale) Delete(ctx context.Context, args ArgsSaleDelete) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", args, &reply) +} diff --git a/erp/shipment/shipment.go b/erp/shipment/shipment.go index 582bed0..45f21a6 100644 --- a/erp/shipment/shipment.go +++ b/erp/shipment/shipment.go @@ -1,5 +1,6 @@ package shipment type Shipment struct { + Sale sale Cost cost } diff --git a/erp/workflow.go b/erp/workflow.go index a7e4aa5..1d3f5fd 100644 --- a/erp/workflow.go +++ b/erp/workflow.go @@ -33,8 +33,10 @@ type WorkflowItem struct { Title string `json:"title"` // 审批流标题 Content string `json:"content"` // 审批流内容 Status AuditStatus `json:"status"` // 审批流状态 + ReviewComments string `json:"reviewComments"` // 审批意见 CreatedStaffId int64 `json:"createdStaffId"` // 创建人 CreatedAt *time.Time `json:"createdAt"` // 创建时间 + UpdatedAt *time.Time `json:"updatedAt"` // 更新时间 } // List @TITLE 审核列表 @@ -55,6 +57,7 @@ type ReplyWorkflowInfo struct { Title string `json:"title"` // 审批流标题 Content string `json:"content"` // 审批流内容 Status AuditStatus `json:"status"` // 审批流状态 + ReviewComments string `json:"reviewComments"` // 审批意见 CreatedStaffId int64 `json:"createdStaffId"` // 创建人 CreatedAt *time.Time `json:"createdAt"` // 创建时间 Nodes []WorkflowNodeItem `json:"nodes"`