yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
StaticMethod CanBePegged (
  output String feedback_o,
  Supply_MP supply,
  Demand_MP demand
) declarative remote as Boolean
{
  Description: 'Validate the creation of fulfillment, called from designer'
  TextBody:
  [*
    // boon kiat Jul-31-2013 (created)
    
    feedback_o := '';
    
    if( supply.ProductInStockingPointInPeriodPlanning().ProductInStockingPoint_MP() <> demand.GetPISPIP().ProductInStockingPoint_MP() )
    {
      feedback_o := Translations::MP_Fulfillment_CanBePegged_InvalidProductInStockingPoint();
    }
    else if( supply.GetPeriodStart() > demand.GetPeriodStart() )
    {
      feedback_o := Translations::MP_Fulfillment_CanBePegged_InvalidPeriod();
    }
    else if( supply.GetAvailableQuantityForPegging() <= 0 )
    {
      feedback_o := Translations::MP_Fulfillment_CanBePegged_IsAvailableQuantityGreaterThanZero();
    }
    
    return feedback_o = '';
  *]
}