feat(采购): 新增批次相关功能

- 在 product 服务中添加 BatchCount 方法,用于获取产品批次数量信息
- 在 purchase服务中添加 Batch 方法,用于获取采购合同的批次数据
- 更新 Purchase 结构,将 Batch 字段改为 Batches
- 在 ArgsPurchaseEdit 结构中添加 BatchNo 字段,用于编辑批次号
This commit is contained in:
守护自己的云 2025-07-10 16:34:19 +08:00
parent 121dafa2f9
commit a0f333a112
2 changed files with 42 additions and 1 deletions

View File

@ -80,7 +80,7 @@ type PurchaseProduct struct {
CurrencySymbol string // 币种符号 CurrencySymbol string // 币种符号
CurrencyRate decimal.Decimal // 币种汇率 CurrencyRate decimal.Decimal // 币种汇率
MeasureUnit string // 数量单位 MeasureUnit string // 数量单位
Batch []PurchaseProductBatch // 产品批次 Batches []PurchaseProductBatch // 产品批次
} }
type PurchaseProductBatch struct { type PurchaseProductBatch struct {
BatchNo int64 `binding:"required" label:"批次号"` BatchNo int64 `binding:"required" label:"批次号"`
@ -146,6 +146,7 @@ func (p *purchase) Info(ctx context.Context, purchaseId int64) (reply ReplyPurch
type ArgsPurchaseEdit struct { type ArgsPurchaseEdit struct {
PurchaseId int64 // 采购合同id PurchaseId int64 // 采购合同id
PoSerial string // PoSerial PoSerial string // PoSerial
BatchNo int64 // 批次号
Remark string // 备注 Remark string // 备注
OrderDate *time.Time // 下单日期 OrderDate *time.Time // 下单日期
FactoryAddress string // 工厂地址 FactoryAddress string // 工厂地址
@ -235,3 +236,23 @@ func (p *purchase) CancelAudit(ctx context.Context, purchaseId int64) (err error
err = xClient.Call(ctx, "CancelAudit", purchaseId, &reply) err = xClient.Call(ctx, "CancelAudit", purchaseId, &reply)
return 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
}

View File

@ -142,3 +142,23 @@ func (p *product) ListAccounting(ctx context.Context, args ArgsListAccounting) (
err = xClient.Call(ctx, "ListAccounting", args, &reply) err = xClient.Call(ctx, "ListAccounting", args, &reply)
return 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
}