From 84b69cf17a12522dc7cd3f186e7e2f38f0c11062 Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期二, 12 九月 2023 23:29:52 +0800
Subject: [PATCH] 库存持有成本修改
---
_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl | 34 +++++++++++++++++++---------------
_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl | 21 ++++++++++++---------
_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl | 5 ++++-
3 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
index 4c0470e..4116cce 100644
--- a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
@@ -23,23 +23,27 @@
product := Product_MP::FindById( macroPlan, productId );
stockingPoint := StockingPoint_MP::FindById( macroPlan, stockingPointId );
account := Account_MP::FindByName( macroPlan, accountName );
- if( isnull( product ) ) {
- error( "product not found" );
- }
- if( isnull( stockingPoint ) ) {
- error( "stocking point not found" );
- }
- if( isnull( account ) ) {
- error( "account not found" );
- }
- result := InventoryValueAndCost::FindById( macroPlan, id );
- if( isnull( result ) ) {
+ //if( isnull( product ) ) {
+ // error( "product not found" );
+ //}
+ //if( isnull( stockingPoint ) ) {
+ // error( "stocking point not found" );
+ //}
+ //if( isnull( account ) ) {
+ // error( "account not found" );
+ //}
+ 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 ) {
- error( "cannot change product of inventory value and cost" )
- } else {
- result.Update( account, costDriver, start, account.DefaultTimeUnit(), account.DefaultLengthOfTime(), cost, true );
+ } 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 );
+ // }
}
+
return result;
*]
}
diff --git a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
index b0dc53e..133145d 100644
--- a/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
+++ b/_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
@@ -2,13 +2,16 @@
#parent: #root
StaticMethod FindById (
MacroPlan macroPlan,
+ String productId,
+ String stockPointId,
+ Date start,
String id
) as InventoryValueAndCost
{
TextBody:
[*
// yypsybs Aug-16-2023 (created)
- value := select( macroPlan, Product_MP.InventoryValueAndCost, item, true, item.ID() = id );
+ value := select( macroPlan, Product_MP.InventoryValueAndCost, item, true, item.ProductID()=productId and item.StockingPointID() = stockPointId and item.Start() = start );
return value;
*]
}
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl
index 013af33..0789263 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl
@@ -7,21 +7,24 @@
// yypsybs Aug-15-2023 (created)
listtodeal := selectset( this,MappingInventoryValueAndCost,item,true );
totalcount := listtodeal.Size();
+
info( "InventoryCost has " + totalcount.AsQUILL() + " rows in total" );
count := 0;
traverse( listtodeal, Elements, item ) {
- count := count + 1;
- if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
- info( "Now is dealing with the " + count.AsQUILL() + "InventoryCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
+ count := count + 1;
+ if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
+ info( "Now is dealing with the " + count.AsQUILL() + "InventoryCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
}
- if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){
- InventoryValueAndCost::CreateOrUpdate( this, item.ID(), item.ProductID(),
+
+ InventoryValueAndCost::CreateOrUpdate( this, item.ID(), item.ProductID(),
item.StockingPointID(),
- item.AccountName(), item.CostDriver(), item.Start(), item.Cost() );
- }else{
- info( "invaild product: " + item.ProductID().AsQUILL() );
- }
+ item.AccountName(), item.CostDriver(), item.Start(), item.Cost());
+ // if( not isnull( Product_MP::FindProductTypeIndex( item.ProductID() ) ) and not isnull( StockingPoint_MP :: FindStockingPointTypeIndex( item.StockingPointID()))){
+ //
+ // }else{
+ // info( "invaild product: " + item.ProductID().AsQUILL() );
+ // }
}
*]
}
--
Gitblit v1.9.3