From a0f333a112893c6dd06795ddaa064c07eb730781 Mon Sep 17 00:00:00 2001 From: kanade Date: Thu, 10 Jul 2025 16:34:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=87=87=E8=B4=AD):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 product 服务中添加 BatchCount 方法,用于获取产品批次数量信息 - 在 purchase服务中添加 Batch 方法,用于获取采购合同的批次数据 - 更新 Purchase 结构,将 Batch 字段改为 Batches - 在 ArgsPurchaseEdit 结构中添加 BatchNo 字段,用于编辑批次号 --- erp/purchase.go | 23 ++++++++++++++++++++++- erp/purchase/product.go | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/erp/purchase.go b/erp/purchase.go index b59bd07..38cba78 100644 --- a/erp/purchase.go +++ b/erp/purchase.go @@ -80,7 +80,7 @@ type PurchaseProduct struct { CurrencySymbol string // 币种符号 CurrencyRate decimal.Decimal // 币种汇率 MeasureUnit string // 数量单位 - Batch []PurchaseProductBatch // 产品批次 + Batches []PurchaseProductBatch // 产品批次 } type PurchaseProductBatch struct { BatchNo int64 `binding:"required" label:"批次号"` @@ -146,6 +146,7 @@ func (p *purchase) Info(ctx context.Context, purchaseId int64) (reply ReplyPurch type ArgsPurchaseEdit struct { PurchaseId int64 // 采购合同id PoSerial string // PoSerial + BatchNo int64 // 批次号 Remark string // 备注 OrderDate *time.Time // 下单日期 FactoryAddress string // 工厂地址 @@ -235,3 +236,23 @@ func (p *purchase) CancelAudit(ctx context.Context, purchaseId int64) (err error err = xClient.Call(ctx, "CancelAudit", purchaseId, &reply) return } + +type ArgsPurchaseBatch struct { + PurchaseId int64 // 采购合同id + FactoryId int64 // 采购工厂id +} +type PurchaseBatchItem struct { + PurchaseId int64 `json:"purchaseId"` + BatchNo int64 `json:"batchNo"` + HasEdit bool `json:"hasEdit"` +} + +// Batch @TITLE 批次数据 +func (p *purchase) Batch(ctx context.Context, args ArgsPurchaseBatch) (reply []PurchaseBatchItem, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "Batch", args, &reply) + return +} diff --git a/erp/purchase/product.go b/erp/purchase/product.go index 2087d0d..ad216fb 100644 --- a/erp/purchase/product.go +++ b/erp/purchase/product.go @@ -142,3 +142,23 @@ func (p *product) ListAccounting(ctx context.Context, args ArgsListAccounting) ( err = xClient.Call(ctx, "ListAccounting", args, &reply) return } + +type ProductBatchCountItem struct { + PurchaseProductId int64 `json:"purchaseProductId"` + SaleCount int64 `json:"saleCount"` + Batches []ProductBatchItem `json:"batch"` +} +type ProductBatchItem struct { + BatchNo int64 `json:"batchNo"` + PurchaseCount int64 `json:"purchaseCount"` +} + +// BatchCount @TITLE 批次数量 +func (p *product) BatchCount(ctx context.Context, purchaseProductIds []int64) (reply []ProductBatchCountItem, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "BatchCount", purchaseProductIds, &reply) + return +}