From 7198928294605aea6516fc4f7adba95b2216a974 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 05 七月 2024 16:44:09 +0800 Subject: [PATCH] 修正调拨产生的入库单的操作类型id --- service/operation.go | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/service/operation.go b/service/operation.go index c685dd9..4895c34 100644 --- a/service/operation.go +++ b/service/operation.go @@ -261,7 +261,7 @@ } } if len(internalInputDetails) > 0 { - opTypeId, err := GetTargetOperationTypeIdByOperation(originOperation, constvar.BaseOperationTypeIncoming) + opTypeId, err := GetTargetOperationTypeIdByWarehouseId(originOperation.ToLocation.WarehouseId, constvar.BaseOperationTypeIncoming) if err != nil { return err } @@ -434,3 +434,14 @@ } return targetOT.Id, nil } + +func GetTargetOperationTypeIdByWarehouseId(warehouseId int, baseOT constvar.BaseOperationType) (operationTypeId int, err error) { + if warehouseId == 0 { + return 0, errors.New("warehouseId miss") + } + targetOT, err := models.NewOperationTypeSearch().SetBaseOperationType(baseOT).SetWarehouseId(warehouseId).First() + if err != nil { + return 0, err + } + return targetOT.Id, nil +} -- Gitblit v1.8.0