Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6934a717

Von Jan Büren vor fast 10 Jahren hinzugefügt

  • ID 6934a717b6f76c27ca7524979723089764e89b5f
  • Vorgänger 991d16bb
  • Nachfolger 2f9a5220

deliver_order_items_id mit inventory verknüpft

Falls Lieferscheine Warenbewegungen auslösen, sind jetzt auch die
einzelnen Position "rückverfolgbar" und nicht nur der Beleg.
Entsprechende Fremdschlüssel gesetzt

Unterschiede anzeigen:

SL/DB/MetaSetup/Inventory.pm
9 9
__PACKAGE__->meta->table('inventory');
10 10

  
11 11
__PACKAGE__->meta->columns(
12
  bestbefore    => { type => 'date' },
13
  bin_id        => { type => 'integer', not_null => 1 },
14
  chargenumber  => { type => 'text', default => '', not_null => 1 },
15
  comment       => { type => 'text' },
16
  employee_id   => { type => 'integer', not_null => 1 },
17
  id            => { type => 'serial', not_null => 1 },
18
  itime         => { type => 'timestamp', default => 'now()' },
19
  mtime         => { type => 'timestamp' },
20
  oe_id         => { type => 'integer' },
21
  orderitems_id => { type => 'integer' },
22
  parts_id      => { type => 'integer', not_null => 1 },
23
  project_id    => { type => 'integer' },
24
  qty           => { type => 'numeric', precision => 25, scale => 5 },
25
  shippingdate  => { type => 'date' },
26
  trans_id      => { type => 'integer', not_null => 1 },
27
  trans_type_id => { type => 'integer', not_null => 1 },
28
  warehouse_id  => { type => 'integer', not_null => 1 },
12
  bestbefore                    => { type => 'date' },
13
  bin_id                        => { type => 'integer', not_null => 1 },
14
  chargenumber                  => { type => 'text', default => '', not_null => 1 },
15
  comment                       => { type => 'text' },
16
  delivery_order_items_stock_id => { type => 'integer' },
17
  employee_id                   => { type => 'integer', not_null => 1 },
18
  id                            => { type => 'serial', not_null => 1 },
19
  itime                         => { type => 'timestamp', default => 'now()' },
20
  mtime                         => { type => 'timestamp' },
21
  oe_id                         => { type => 'integer' },
22
  parts_id                      => { type => 'integer', not_null => 1 },
23
  project_id                    => { type => 'integer' },
24
  qty                           => { type => 'numeric', precision => 25, scale => 5 },
25
  shippingdate                  => { type => 'date' },
26
  trans_id                      => { type => 'integer', not_null => 1 },
27
  trans_type_id                 => { type => 'integer', not_null => 1 },
28
  warehouse_id                  => { type => 'integer', not_null => 1 },
29 29
);
30 30

  
31 31
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
......
38 38
    key_columns => { bin_id => 'id' },
39 39
  },
40 40

  
41
  delivery_order_items_stock => {
42
    class       => 'SL::DB::DeliveryOrderItemsStock',
43
    key_columns => { delivery_order_items_stock_id => 'id' },
44
  },
45

  
41 46
  employee => {
42 47
    class       => 'SL::DB::Employee',
43 48
    key_columns => { employee_id => 'id' },
44 49
  },
45 50

  
51
  oe => {
52
    class       => 'SL::DB::DeliveryOrder',
53
    key_columns => { oe_id => 'id' },
54
  },
55

  
46 56
  parts => {
47 57
    class       => 'SL::DB::Part',
48 58
    key_columns => { parts_id => 'id' },
SL/DO.pm
387 387
                  conv_i($form->{"delivery_order_items_id_$i"}), $sinfo->{qty}, $sinfo->{unit}, conv_i($sinfo->{warehouse_id}),
388 388
                  conv_i($sinfo->{bin_id}));
389 389
       $h_item_stock_id->finish();
390
      # write back the id to the form (important if only transfer was clicked (id fk for invoice)
391
      $form->{"stock_${in_out}_$i"} = YAML::Dump($stock_info);
390 392
      }
391 393
      @values = ($form->{"delivery_order_items_id_$i"}, $sinfo->{qty}, $sinfo->{unit}, conv_i($sinfo->{warehouse_id}),
392 394
                 conv_i($sinfo->{bin_id}), $sinfo->{chargenumber}, conv_date($sinfo->{bestbefore}),
......
403 405
                                name_prefix  => 'ic_',
404 406
                                name_postfix => "_$i",
405 407
                                dbh          => $dbh);
406
    # link order items with doi
408
    # link order items with doi, for future extension look at foreach IS.pm
407 409
    if ($form->{"converted_from_orderitems_id_$i"}) {
408 410
      RecordLinks->create_links('dbh'        => $dbh,
409 411
                                'mode'       => 'ids',
......
1197 1199

  
1198 1200
  foreach my $request (@{ $params{requests} }) {
1199 1201
    push @transfers, {
1200
      'parts_id'               => $request->{parts_id},
1201
      "${prefix}_warehouse_id" => $request->{warehouse_id},
1202
      "${prefix}_bin_id"       => $request->{bin_id},
1203
      'chargenumber'           => $request->{chargenumber},
1204
      'bestbefore'             => $request->{bestbefore},
1205
      'qty'                    => $request->{qty},
1206
      'unit'                   => $request->{unit},
1207
      'oe_id'                  => $form->{id},
1208
      'shippingdate'           => 'current_date',
1209
      'transfer_type'          => $params{direction} eq 'in' ? 'stock' : 'shipped',
1210
      'project_id'             => $request->{project_id},
1202
      'parts_id'                      => $request->{parts_id},
1203
      "${prefix}_warehouse_id"        => $request->{warehouse_id},
1204
      "${prefix}_bin_id"              => $request->{bin_id},
1205
      'chargenumber'                  => $request->{chargenumber},
1206
      'bestbefore'                    => $request->{bestbefore},
1207
      'qty'                           => $request->{qty},
1208
      'unit'                          => $request->{unit},
1209
      'oe_id'                         => $form->{id},
1210
      'shippingdate'                  => 'current_date',
1211
      'transfer_type'                 => $params{direction} eq 'in' ? 'stock' : 'shipped',
1212
      'project_id'                    => $request->{project_id},
1213
      'delivery_order_items_stock_id' => $request->{delivery_order_items_stock_id},
1211 1214
    };
1212 1215
  }
1213 1216

  
SL/WH.pm
110 110
          trans_id         => $trans_id,
111 111
          shippingdate     => !$transfer->{shippingdate} || $transfer->{shippingdate} eq 'current_date'
112 112
                              ? $now : $transfer->{shippingdate},
113
          map { $_ => $transfer->{$_} } qw( chargenumber bestbefore oe_id orderitems_id comment),
113
          map { $_ => $transfer->{$_} } qw( chargenumber bestbefore oe_id delivery_order_items_stock_id comment),
114 114
      );
115 115

  
116 116
      if ($unit) {
sql/Pg-upgrade2/warehouse_add_delivery_order_items_stock_id.sql
1
-- @tag: warehouse_add_delivery_order_items_stock_id
2
-- @description: Constraints für inventory auf delivery_order (dois und do). Ferner sinnvolle Umbenennung zumindestens von einer Spalte (orderitems -> dois)
3
-- @depends: release_3_1_0
4
ALTER TABLE inventory RENAME orderitems_id TO delivery_order_items_stock_id;
5
ALTER TABLE inventory ADD CONSTRAINT delivery_order_items_stock_id_fkey FOREIGN KEY (delivery_order_items_stock_id) REFERENCES delivery_order_items_stock (id);
6
ALTER TABLE inventory ADD CONSTRAINT oe_id_fkey FOREIGN KEY (oe_id) REFERENCES delivery_orders (id);

Auch abrufbar als: Unified diff