lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Quintiq file version 2.0
#parent: #root
Method OnOk () id:Method_DialogCreateEditFeedbackTrip_OnOk
{
  #keys: '[146140.0.216521986]'
  Body:
  [*
    // When the user click OK, we either create or edit a feedback operation
    
    data := DataHolderDialogData.Data();
    selection := DataHolderFeedbackTrips.Data().Copy();
    isbatchedit := selection.Size() > 1;
    
    // Not using Data.Attributes because ApplyChanges is not used for feedbacks
    quantity := ApplicationMacroPlanner.FormatStringToReal( EditFieldQuantityUom.Text(), 0.0 );
    description := EditFieldDescription.Text();
    arrival := DateTimeSelectorArrival.DateTime();
    originstockingpointid := DropDownListLaneLeg.Data().OriginStockingPointID(); 
    deststockingpointid := DropDownListLaneLeg.Data().DestinationStockingPointID();
    laneid := DropDownListLaneLeg.Data().LaneID();
    product := DropDownListProduct.Data(); 
    
    // New
    if( isnull( data.WrappedInstance() ) )
    {  
      FeedbackProductInTrip::Create( MacroPlan,
                                     '',  // ID of the feedback. If ID = '', the ID will take MacroPan.IDHolder().GetFeedbackID()
                                     arrival, 
                                     description,
                                     originstockingpointid,
                                     deststockingpointid,
                                     quantity,
                                     laneid,
                                     product.ID(),
                                     false ); // is from db
                                     
    }
    else
    { // Edit
      if( isbatchedit ) // Multiple feedback seleted
      {
        FeedbackProductInTrip::Update( selection, 
                                       quantity,
                                       CheckBoxBatchEditQuantity.Checked(),
                                       description,
                                       CheckBoxBatchEditDescription.Checked() );
      }
      else // Only one feedback
      {
         data.WrappedInstance().Update( arrival,
                                        description,
                                        originstockingpointid,
                                        deststockingpointid,
                                        quantity,
                                        laneid,
                                        product.ID(),
                                        false );
      }
    }
    
    Form.Close();
  *]
}