From d82c813f4c07b13801a92fc20b3054d23a32ec58 Mon Sep 17 00:00:00 2001
From: yanyuan <yuan.yan@capgemini.com>
Date: 星期三, 01 十一月 2023 16:47:02 +0800
Subject: [PATCH] Fix InventoryCost error
---
_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl | 8 ++++----
_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl | 3 +++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
index 4116cce..9dec2cd 100644
--- a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
@@ -32,16 +32,16 @@
//if( isnull( account ) ) {
// error( "account not found" );
//}
- result := InventoryValueAndCost::FindById( macroPlan, stockingPointId,productId,start,id );
+ result := InventoryValueAndCost::FindById( macroPlan, stockingPointId, productId, start, id );
if( not isnull( product) and not isnull( stockingPoint) and not isnull( account)){
if( isnull( result ) ) {
result := InventoryValueAndCost::Create( id, product, stockingPoint, account, costDriver, start, cost, true ).astype( InventoryValueAndCost );
} else if( result.ProductID() <> productId ) {
info( "cannot change product of inventory value and cost" )
}
- // else {
- // result.Update( account, costDriver, start, account.DefaultTimeUnit(), account.DefaultLengthOfTime(), cost, true );
- // }
+ else {
+ result.Update( account, costDriver, start, account.DefaultTimeUnit(), account.DefaultLengthOfTime(), cost, true );
+ }
}
return result;
diff --git a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
index 133145d..e49e111 100644
--- a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
+++ b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
@@ -12,6 +12,9 @@
[*
// yypsybs Aug-16-2023 (created)
value := select( macroPlan, Product_MP.InventoryValueAndCost, item, true, item.ProductID()=productId and item.StockingPointID() = stockPointId and item.Start() = start );
+ if( isnull( value ) ){
+ value := select( macroPlan, Product_MP.InventoryValueAndCost, item, true, item.ID() = id );
+ }
return value;
*]
}
--
Gitblit v1.9.3