From 12c74cf4642c8dd57fc209a8bcc0d0ba82216008 Mon Sep 17 00:00:00 2001 From: kanade Date: Thu, 23 Jul 2026 09:06:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(shipment):=20=E6=B7=BB=E5=8A=A0=E6=B7=B7?= =?UTF-8?q?=E8=A3=85=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 shipment 结构体中新增 Mixed 类型字段 - 创建 mixed 包及其相关结构体定义 - 实现混装列表查询、生成等功能接口 - 添加混装箱体和产品的数据模型及操作方法 - 集成客户端调用逻辑并实现 RPC 接口 - 定义混装相关的参数结构体和返回值类型 --- erp/shipment/mixed.go | 59 ++++++++++++++++++ erp/shipment/mixed/box.go | 112 ++++++++++++++++++++++++++++++++++ erp/shipment/mixed/mixed.go | 6 ++ erp/shipment/mixed/product.go | 55 +++++++++++++++++ erp/shipment/shipment.go | 1 + 5 files changed, 233 insertions(+) create mode 100644 erp/shipment/mixed.go create mode 100644 erp/shipment/mixed/box.go create mode 100644 erp/shipment/mixed/mixed.go create mode 100644 erp/shipment/mixed/product.go diff --git a/erp/shipment/mixed.go b/erp/shipment/mixed.go new file mode 100644 index 0000000..88b3092 --- /dev/null +++ b/erp/shipment/mixed.go @@ -0,0 +1,59 @@ +package shipment + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" + mixed2 "git.kumo.work/shama/service/erp/shipment/mixed" + "git.kumo.work/shama/service/lib/bean" +) + +type mixed struct { + Mixed mixed2.Mixed +} + +type ArgsMixedList struct { + Page bean.Page + Search MixedSearch +} +type MixedSearch struct { + InvoiceSerial string // 出运发票号 + CreatedStaffIds []int64 // 业务员筛选 +} +type ReplyMixedList struct { + List []MixedItem `json:"list"` + Total int64 `json:"total"` +} +type MixedItem struct { + Id int64 `json:"id"` + ShipmentId int64 `json:"shipmentId"` + InvoiceSerial string `json:"invoiceSerial"` + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` +} + +// List @TITLE 列表 +func (m *mixed) List(ctx context.Context, args ArgsMixedList) (reply ReplyMixedList, err error) { + xClient, err := client.GetClient(m) + if err != nil { + return + } + err = xClient.Call(ctx, "List", args, &reply) + return +} + +type ArgsMixedGen struct { + ShipmentId int64 // 订舱单id + StaffId int64 // 业务员id +} + +// Gen @TITLE 生成 +func (m *mixed) Gen(ctx context.Context, args ArgsMixedGen) error { + xClient, err := client.GetClient(m) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Gen", args, &reply) +} diff --git a/erp/shipment/mixed/box.go b/erp/shipment/mixed/box.go new file mode 100644 index 0000000..b0c3001 --- /dev/null +++ b/erp/shipment/mixed/box.go @@ -0,0 +1,112 @@ +package mixed + +import ( + "context" + + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + +type box struct { +} + +type BoxItem struct { + Id int64 `json:"id"` + Serial string `json:"serial"` + CustomSerial string `json:"customSerial"` + Po string `json:"po"` + BlEngName string `json:"blEngName"` + InnerNum int64 `json:"innerNum"` + OuterBoxCount int64 `json:"outerBoxCount"` + Length decimal.Decimal `json:"length"` + Width decimal.Decimal `json:"width"` + Height decimal.Decimal `json:"height"` + Volume decimal.Decimal `json:"volume"` + TotalVolume decimal.Decimal `json:"totalVolume"` + OuterNum int64 `json:"outerNum"` + Products []BoxProduct `json:"products"` +} + +type BoxProduct struct { + Id int64 `json:"id"` + ShipmentProductId int64 `json:"shipmentProductId"` + Serial string `json:"serial"` + CustomSerial string `json:"customSerial"` + Po string `json:"po"` + Name string `json:"name"` + BlEngName string `json:"blEngName"` + ShipmentCount int64 `json:"shipmentCount"` + OuterNum int64 `json:"outerNum"` + OuterBoxCount int64 `json:"outerBoxCount"` +} + +// All @TITLE 获取全部混装 +func (b *box) All(ctx context.Context, mixedId int64) (reply []BoxItem, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "All", mixedId, &reply) + return +} + +type ArgsBoxAdd struct { + MixedId int64 // 混装单id + BoxAdd +} + +type BoxAdd struct { + Serial string // 货号 + CustomSerial string // 客户货号 + Po string // PO + BlEngName string // 提单英文名 + InnerNum int64 // 内盒入数 + OuterBoxCount int64 // 箱数 + Length decimal.Decimal // 长 + Width decimal.Decimal // 宽 + Height decimal.Decimal // 高 + Volume decimal.Decimal // 体积 + TotalVolume decimal.Decimal // 总体积 + OuterNum int64 // 外箱入数 + Products []BoxProductItem // 箱内商品 +} + +type BoxProductItem struct { + ShipmentProductId int64 // 订舱产品id + OuterNum int64 // 外箱入数 +} + +// Add @TITLE 添加费用 +func (b *box) Add(ctx context.Context, args ArgsBoxAdd) (err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsBoxEdit struct { + BoxId int64 // 混装单id + BoxAdd +} + +// Edit @TITLE 编辑 +func (b *box) Edit(ctx context.Context, args ArgsBoxEdit) (err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除 +func (b *box) Delete(ctx context.Context, boxId int64) (err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", boxId, &reply) +} diff --git a/erp/shipment/mixed/mixed.go b/erp/shipment/mixed/mixed.go new file mode 100644 index 0000000..9b16528 --- /dev/null +++ b/erp/shipment/mixed/mixed.go @@ -0,0 +1,6 @@ +package mixed + +type Mixed struct { + Box box + Product product +} diff --git a/erp/shipment/mixed/product.go b/erp/shipment/mixed/product.go new file mode 100644 index 0000000..7b62080 --- /dev/null +++ b/erp/shipment/mixed/product.go @@ -0,0 +1,55 @@ +package mixed + +import ( + "context" + + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + +type product struct { +} + +type ProductItem struct { + Id int64 `json:"id"` + MixedFlag int64 `json:"mixedFlag"` + Serial string `json:"serial"` + CustomSerial string `json:"customSerial"` + Po string `json:"po"` + Name string `json:"name"` + BlEngName string `json:"blEngName"` + ShipmentCount int64 `json:"shipmentCount"` + InnerNum *int64 `json:"innerNum"` + InnerBoxCount *int64 `json:"innerBoxCount"` + OuterNum *int64 `json:"outerNum"` + OuterBoxCount int64 `json:"outerBoxCount"` + CustomsSerial string `json:"customsSerial"` + CustomsName string `json:"customsName"` + CustomsDetail string `json:"customsDetail"` + CustomsMeasureUnit string `json:"customsMeasureUnit"` + ShipmentCountUnit string `json:"shipmentCountUnit"` + CustomsGrossWeight decimal.Decimal `json:"customsGrossWeight"` + TotalCustomsGrossWeight decimal.Decimal `json:"totalCustomsGrossWeight"` + CustomsNetWeight decimal.Decimal `json:"customsNetWeight"` + TotalCustomsNetWeight decimal.Decimal `json:"totalCustomsNetWeight"` + DomesticSupply string `json:"domesticSupply"` + FactoryName string `json:"factoryName"` + SalePrice decimal.Decimal `json:"salePrice"` + SaleAmount decimal.Decimal `json:"saleAmount"` + CustomsPrice decimal.Decimal `json:"customsPrice"` + CustomsAmount decimal.Decimal `json:"customsAmount"` + OuterLength *decimal.Decimal `json:"outerLength"` + OuterWidth *decimal.Decimal `json:"outerWidth"` + OuterHeight *decimal.Decimal `json:"outerHeight"` + OuterVolume *decimal.Decimal `json:"outerVolume"` +} + +// All @TITLE 获取全部产品 +func (p *product) All(ctx context.Context, mixedId int64) (reply []ProductItem, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "All", mixedId, &reply) + return +} diff --git a/erp/shipment/shipment.go b/erp/shipment/shipment.go index 5fdefc8..102d57e 100644 --- a/erp/shipment/shipment.go +++ b/erp/shipment/shipment.go @@ -11,4 +11,5 @@ type Shipment struct { Customs customs ExchangeSettlement exchangeSettlement Modify modify + Mixed mixed }