yanweiyuan3
2023-10-10 d901b1ab0ee0b690f5ac211b9cdb1db3a58bca86
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
Quintiq file version 2.0
#parent: #root
StaticMethod LockUnlock (
  MacroPlan owner,
  CustomerOrders customerorders,
  Boolean lock
)
{
  Description: '锁定/解锁订单'
  TextBody:
  [*
    // Administrator Sep-21-2023 (created)
    lastmodifytime := DateTime::ActualTime();
    lastmodify := QuintiqUser::CurrentUser().Username();
    if( lock ){
      traverse( customerorders, Elements, order ){
        order.IsLocked( lock );
        order.LastModify( lastmodify );
        order.LastModifyTime( lastmodifytime );
        owner.OrderLockLog( relnew, 
                            CustomerName := order.CustomerName(), 
                            End := order.First().AsPlanningBaseSalesDemandInPeriod().End().Date(), 
                            EndDate := order.StartDate(), 
                            IsLocked := order.IsLocked(), 
                            LastModify := order.LastModify(), 
                            LastModifyTime := order.LastModifyTime(), 
                            OrderID := order.OrderID(), 
                            Price := order.Price(), 
                            ProductID := order.ProductID(), 
                            Quantity := order.Quantity(), 
                            SalesSegmentName := order.SalesSegmentName(), 
                            StockingPointID := order.StockingPointID(), 
                            UnitOfMeasureName := order.UnitOfMeasureName(), 
                            Notes := "添加锁定" );
        }
      }else{
        traverse( customerorders, Elements, order ){
          order.IsLocked( lock );
          order.LastModify( lastmodify );
          order.LastModifyTime( lastmodifytime );
          owner.OrderLockLog( relnew, 
                              CustomerName := order.CustomerName(), 
                              End := order.First().AsPlanningBaseSalesDemandInPeriod().End().Date(), 
                              EndDate := order.StartDate(), 
                              IsLocked := order.IsLocked(), 
                              LastModify := order.LastModify(), 
                              LastModifyTime := order.LastModifyTime(), 
                              OrderID := order.OrderID(), 
                              Price := order.Price(), 
                              ProductID := order.ProductID(), 
                              Quantity := order.Quantity(), 
                              SalesSegmentName := order.SalesSegmentName(), 
                              StockingPointID := order.StockingPointID(), 
                              UnitOfMeasureName := order.UnitOfMeasureName(), 
                              Notes := "解除锁定" );
        }
      }
  *]
}