Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 27fe7b11

Von Jan Büren vor mehr als 3 Jahren hinzugefügt

  • ID 27fe7b11f5817702c3b47d0187bc9f0ba5328e2f
  • Vorgänger 639c7f18
  • Nachfolger 8453789b

Reverts 01f650056

Unterschiede anzeigen:

SL/DB/Helper/Mappings.pm
99 99
  ar                             => 'invoice',
100 100
  ap                             => 'purchase_invoice',
101 101
  assembly                       => 'assembly',
102
  assembly_inventory_part        => 'assembly_inventory_part',
103 102
  assortment_items               => 'assortment_item',
104 103
  background_jobs                => 'background_job',
105 104
  background_job_histories       => 'background_job_history',
SL/DB/MetaSetup/AssemblyInventoryPart.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AssemblyInventoryPart;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('assembly_inventory_part');
10

  
11
__PACKAGE__->meta->columns(
12
  inventory_assembly_id => { type => 'integer', not_null => 1 },
13
  inventory_part_id     => { type => 'integer', not_null => 1 },
14
  itime                 => { type => 'timestamp', default => 'now()' },
15
  mtime                 => { type => 'timestamp' },
16
);
17

  
18
__PACKAGE__->meta->primary_key_columns([ 'inventory_assembly_id', 'inventory_part_id' ]);
19

  
20
__PACKAGE__->meta->unique_keys([ 'inventory_part_id', 'inventory_assembly_id' ]);
21

  
22
__PACKAGE__->meta->allow_inline_column_values(1);
23

  
24
__PACKAGE__->meta->foreign_keys(
25
  inventory_assembly => {
26
    class       => 'SL::DB::Inventory',
27
    key_columns => { inventory_assembly_id => 'id' },
28
  },
29

  
30
  inventory_part => {
31
    class       => 'SL::DB::Inventory',
32
    key_columns => { inventory_part_id => 'id' },
33
  },
34
);
35

  
36
1;
37
;
SL/WH.pm
233 233
    my $sth_part_qty_assembly = prepare_execute_query($form, $dbh, $query, $params{assembly_id});
234 234

  
235 235
    my @trans_ids;
236
    my $query_trans_id      = qq|SELECT nextval('inventory_id_seq')|;
237
    my $query_trans_ids     = qq|INSERT INTO assembly_inventory_part (inventory_assembly_id, inventory_part_id) VALUES (?, ?)|;
238
    my $sth_query_trans_ids = prepare_query($form, $dbh, $query_trans_ids);
239 236

  
240 237
    # Hier wird das prepared Statement für die Schleife über alle Lagerplätze vorbereitet
241 238
    my $transferPartSQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, bestbefore, comment, employee_id, qty,
......
283 280
        my $temppart_qty          = $partsQTY * -1;
284 281
        ($trans_id) = selectrow_query($form, $dbh, qq|SELECT nextval('id')| ) unless $trans_id;
285 282

  
286
        my ($trans_id)     = selectrow_query($form, $dbh, $query_trans_id);
287
        push @trans_ids, $trans_id;
288 283
        do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $currentPart_WH_ID,
289 284
                       $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' .
290 285
                       $self->get_part_description(parts_id => $params{assembly_id}), $params{login}, $temppart_qty, $trans_id);
......
333 328
                                              # wenn * -1 als berechnung in der parameter-übergabe angegeben wird.
334 329
                                              # Dieser Wert IST und BLEIBT positiv!! Hilfe.
335 330
                                              # Liegt das daran, dass dieser Wert aus einem SQL-Statement stammt?
336
          my ($trans_id)     = selectrow_query($form, $dbh, $query_trans_id);
337 331
          push @trans_ids, $trans_id;
338 332
          do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $currentPart_WH_ID,
339 333
                       $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' .
......
345 339
          # auf jeden fall war der internal-server-error nach aktivierung von strict und warnings plus ein paar my-definitionen weg
346 340
        } else { # okay, wir haben weniger oder gleich Waren die wir wegbuchen müssen, wir können also aufhören
347 341
          $tmpPartsQTY *=-1;
348
          my ($trans_id)     = selectrow_query($form, $dbh, $query_trans_id);
349
          push @trans_ids, $trans_id;
350 342
          do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $currentPart_WH_ID,
351 343
                       $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' .
352 344
                       $self->get_part_description(parts_id => $params{assembly_id}), $params{login}, $tmpPartsQTY, $trans_id);
......
375 367
    do_statement($form, $sthTransferAssemblySQL, $transferAssemblySQL, $params{assembly_id}, $params{dst_warehouse_id},
376 368
                 $params{dst_bin_id}, $params{chargenumber}, conv_date($params{bestbefore}), $params{comment}, $params{login}, $params{qty}, $trans_id);
377 369

  
378
    # save inventory transactions for this assembly
379
    for my $part_id (@trans_ids) {
380
      do_statement($form, $sth_query_trans_ids, $query_trans_ids, $trans_id, $part_id);
381
    }
382 370

  
383 371
    1;
384 372
  }) or do { return $kannNichtFertigen };
sql/Pg-upgrade2/assembly_inventory_part.sql
1
-- @tag: assembly_inventory_part
2
-- @description: Tabelle für die wirklich verbauten Einzelteile eines Erzeugnis
3
-- @depends: warehouse release_3_5_6_1
4

  
5

  
6
CREATE TABLE assembly_inventory_part (
7
       inventory_part_id        INTEGER        REFERENCES inventory(id),
8
       inventory_assembly_id    INTEGER        REFERENCES inventory(id),
9
       itime                    TIMESTAMP      DEFAULT now(),
10
       mtime                    TIMESTAMP,
11

  
12
       PRIMARY KEY (inventory_assembly_id, inventory_part_id)
13
);
14

  
15
CREATE TRIGGER mtime_assembly_inventory_part BEFORE UPDATE ON assembly_inventory_part FOR EACH ROW EXECUTE PROCEDURE set_mtime();

Auch abrufbar als: Unified diff