lazhen
2025-01-02 20093dec32a0c814f1db43e87c904890fd8a086f
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
Quintiq file version 2.0
#parent: #root
StaticMethod Generate (
  MacroPlan macroplan,
  InterfaceDataset interfaceDataset,
  Date date,
  String partno,
  String inventory,
  String fac,
  Number quantitiy,
  String dtype
) as InventoryInterfaceDataDetail
{
  TextBody:
  [*
    // 甄兰鸽 Jul-26-2024 (created)
    iid           := selectobject( interfaceDataset, InventoryInterfaceData, iid, iid.Date() = date and iid.PartNumber() = partno );
    if( isnull( iid ) ){
      iid         := interfaceDataset.InventoryInterfaceData( relnew, Date := date, PartNumber := partno );
    }
    product       := selectobject( macroplan, Product_MP, product, product.ID() = partno );
    if( not isnull( product ) and exists( product.GetAllParent(), Elements, proparent, proparent.ID() = 'PL' ) ){
      quantitiy   := floor( [Real]quantitiy / 4 );
    }
    iidl          := selectobject( iid, InventoryInterfaceDataDetail, detail, detail.InventoryPoint() = inventory and detail.Fac() = fac and detail.Dtype() = dtype );
    if( isnull( iidl ) ){
      iidl        := iid.InventoryInterfaceDataDetail( relnew, Date := date, PartNumber := partno, InventoryPoint := inventory, Fac := fac, Quantity := quantitiy, Dtype := dtype );
    }else{
      iidl.Quantity( quantitiy );
    }
    return iidl;
  *]
}