hongjli
2023-09-05 c70ff9aa94e34f968851e813a0b80a25a7b4ea74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Quintiq file version 2.0
#parent: #root
Method MappingExternalSupplyData (
  Strings businessTypes,
  Boolean nuclear
)
{
  TextBody:
  [*
    // renhao Aug-14-2023 (created)
    
    listtodeal := selectset( this,MappingExternalSupply,externalSupply, not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) );
    
    traverse( listtodeal,Elements,externalSupply){
    //  product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
    //  
    //  if( not isnull( product)){
    //    productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
    //    stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
    //    if( not isnull(businessTypes)){
    //    
    //      for( i :=0 ;i < businessTypes.Size();i++ ){
    //        businessType := businessTypes.Element( i);
    //        if( product.BusinessType() = businessType and not product.IsCommon()){
    //          InventorySupply::Create(externalSupply.ID(),productMP,stockingpoint,externalSupply.Date(),externalSupply.ManufacturedDate(),externalSupply.UserQuantity(),"在途在制",true);
    //        }
    //      }
    //      
    //    }else{
      productMP :=  Product_MP::FindById( this, externalSupply.ProductID() );
      stockingpoint := StockingPoint_MP::FindById( this, externalSupply.StockingPointID() );
      if( not isnull( stockingpoint) and not isnull( productMP)){
        InventorySupply::Create(externalSupply.ID(),productMP,stockingpoint,externalSupply.Date(),externalSupply.ManufacturedDate(),externalSupply.UserQuantity(),"在途在制",true);
      }
      
    //    }
    //    
    //  }else{
    //    info( "Invaild product" );
    //    }
    }
  *]
}