Revision 227cd5b4
Von Tamino Steinert vor 9 Tagen hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
48 | 48 |
use SL::Helper::CreatePDF qw(:all); |
49 | 49 |
use SL::Helper::PrintOptions; |
50 | 50 |
use SL::Helper::ShippedQty; |
51 |
use SL::Helper::Inventory; |
|
52 |
use SL::Helper::DateTime; |
|
51 | 53 |
use SL::Helper::UserPreferences::DisplayPreferences; |
52 | 54 |
use SL::Helper::UserPreferences::PositionsScrollbar; |
53 | 55 |
use SL::Helper::UserPreferences::UpdatePositions; |
... | ... | |
1140 | 1142 |
} |
1141 | 1143 |
|
1142 | 1144 |
SL::DB->client->with_transaction(sub { |
1145 |
if ($inout eq 'out') { # check stock for enough qty |
|
1146 |
# part_id -> bin_id -> chargenumber -> bestbefore -> qty; |
|
1147 |
my $grouped_qtys; |
|
1148 |
foreach my $request (@transfer_requests) { |
|
1149 |
$grouped_qtys |
|
1150 |
->{$request->parts_id} |
|
1151 |
->{$request->bin_id} |
|
1152 |
->{$request->chargenumber} |
|
1153 |
->{$request->bestbefore} += -$request->qty # qty is negative |
|
1154 |
} |
|
1155 |
|
|
1156 |
my @missing_qtys; |
|
1157 |
foreach my $p_id (keys %{$grouped_qtys}) { |
|
1158 |
foreach my $b_id (keys %{$grouped_qtys->{$p_id}}) { |
|
1159 |
next if $default_transfer |
|
1160 |
&& $::instance_conf->get_transfer_default_ignore_onhand |
|
1161 |
&& $::instance_conf->get_bin_id_ignore_onhand eq $b_id; |
|
1162 |
foreach my $cn (keys %{$grouped_qtys->{$p_id}->{$b_id}}) { |
|
1163 |
foreach my $bb (keys %{$grouped_qtys->{$p_id}->{$b_id}->{$cn}}) { |
|
1164 |
my $stock = SL::Helper::Inventory::get_stock( |
|
1165 |
part => $p_id, |
|
1166 |
bin => $b_id, |
|
1167 |
chargenumber => $cn, |
|
1168 |
bestbefore => DateTime->from_ymdhms($bb) || undef, |
|
1169 |
); |
|
1170 |
if ($stock < $grouped_qtys->{$p_id}->{$b_id}->{$cn}->{$bb}) { |
|
1171 |
my $part = SL::DB::Manager::Part->find_by(id => $p_id); |
|
1172 |
my $bin = SL::DB::Manager::Bin->find_by(id => $b_id); |
|
1173 |
push @missing_qtys, { |
|
1174 |
missing_qty => $grouped_qtys->{$p_id}->{$b_id}->{$cn}->{$bb} - $stock, |
|
1175 |
part => $part, |
|
1176 |
bin => $bin, |
|
1177 |
chargenumber => $cn, |
|
1178 |
bestbefore => $bb |
|
1179 |
} |
|
1180 |
} |
|
1181 |
} |
|
1182 |
} |
|
1183 |
} |
|
1184 |
} |
|
1185 |
if (scalar @missing_qtys) { |
|
1186 |
die t8('The stock is to low: #1.', |
|
1187 |
join(". ", map { |
|
1188 |
t8( |
|
1189 |
"For #1, #2 #3 are missing", |
|
1190 |
$_->{part}->displayable_name, |
|
1191 |
$::form->format_amount(\%::myconfig, $_->{missing_qty}), |
|
1192 |
$_->{part}->unit, |
|
1193 |
) . ( |
|
1194 |
$_->{chargenumber} ? |
|
1195 |
" " . t8("of batch with chargenumber #1", $_->{chargenumber}) |
|
1196 |
: '' |
|
1197 |
) . ( |
|
1198 |
$_->{chargenumber} && $_->{bestbefore} ? |
|
1199 |
" " . t8("and") |
|
1200 |
: '' |
|
1201 |
) . ( |
|
1202 |
$_->{bestbefore} ? |
|
1203 |
" " . t8( |
|
1204 |
"with a bestbefore date of #1", |
|
1205 |
DateTime->from_ymdhms($_->{bestbefore})->to_kivitendo |
|
1206 |
) |
|
1207 |
: '' |
|
1208 |
) . " " . t8( |
|
1209 |
"in bin #1", $_->{bin}->full_description |
|
1210 |
) |
|
1211 |
} @missing_qtys |
|
1212 |
) |
|
1213 |
); |
|
1214 |
} |
|
1215 |
} |
|
1216 |
|
|
1143 | 1217 |
$_->save for @transfer_requests; |
1144 | 1218 |
$self->order->update_attributes(delivered => 1); |
1145 | 1219 |
}); |
locale/de/all | ||
---|---|---|
1816 | 1816 |
'Following year' => 'Folgendes Jahr', |
1817 | 1817 |
'Font' => 'Schriftart', |
1818 | 1818 |
'Font size' => 'Schriftgröße', |
1819 |
'For #1, #2 #3 are missing' => 'Für #1 fehlen #2 #3', |
|
1819 | 1820 |
'For AP transactions it will replace the sales taxkeys with input taxkeys with the same tax rate.' => 'Bei Kreditorenbuchungen werden die Umsatzsteuer-Steuerschlüssel durch Vorsteuer-Steuerschlüssel mit demselben Steuersatz ersetzt.', |
1820 | 1821 |
'For AR transactions it will replace the input taxkeys with sales taxkeys with the same tax rate.' => 'Bei Debitorenbuchungen werden die Vorsteuer-Steuerschlüssel durch Umsatzsteuer-Steuerschlüssel mit demselben Steuersatz ersetzt.', |
1821 | 1822 |
'For Record Type' => 'Für Belegtyp', |
... | ... | |
4301 | 4302 |
'The shop part wasn\'t updated. #1' => 'Der Artikel ist nicht aktualisiert: #1', |
4302 | 4303 |
'The source warehouse does not contain any bins.' => 'Das Quelllager enthält keine Lagerplätze.', |
4303 | 4304 |
'The start date is missing.' => 'Das Startdatum fehlt.', |
4305 |
'The stock is to low: #1.' => 'Der Bestand ist zu niedrig: #1.', |
|
4304 | 4306 |
'The stock will be changed to your target quantity.' => 'Der Lagerbestand wird auf Ihre gezählte Zielmenge geändert.', |
4305 | 4307 |
'The storno credit note has been deleted' => 'Die Stornogutschrift wurde gelöscht', |
4306 | 4308 |
'The storno invoice has been deleted' => 'Die Stornorechnung wurde gelöscht', |
... | ... | |
5116 | 5118 |
'http' => 'http', |
5117 | 5119 |
'https' => 'https', |
5118 | 5120 |
'imported' => 'importiert', |
5121 |
'in bin #1' => 'im Lagerplatz #1', |
|
5119 | 5122 |
'in the time between' => 'Im Zeitraum', |
5120 | 5123 |
'inactive' => 'inaktiv', |
5121 | 5124 |
'income' => 'Einnahmen-Überschuß-Rechnung', |
... | ... | |
5188 | 5191 |
'now' => 'jetzt', |
5189 | 5192 |
'number' => 'Nummer', |
5190 | 5193 |
'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen', |
5194 |
'of batch with chargenumber #1' => 'der Charge mit Chargennummer #1', |
|
5191 | 5195 |
'old' => 'alt', |
5192 | 5196 |
'on the same day' => 'am selben Tag', |
5193 | 5197 |
'once' => 'einmalig', |
... | ... | |
5320 | 5324 |
'warehouse_usage_list' => 'Lagerentnahmeliste', |
5321 | 5325 |
'will be set upon posting' => 'wird beim Buchen vergeben', |
5322 | 5326 |
'will be set upon saving' => 'wird beim Speichern vergeben', |
5327 |
'with a bestbefore date of #1' => 'mit einem Mindesthaltbarkeitsdatum von #1', |
|
5323 | 5328 |
'with fuzzy skonto acc. to pt' => 'unscharfes Skonto nach ZB', |
5324 | 5329 |
'with skonto acc. to pt' => 'mit Skonto nach ZB', |
5325 | 5330 |
'with_fuzzy_skonto_pt' => 'unscharfes Skonto nach ZB', |
locale/en/all | ||
---|---|---|
1816 | 1816 |
'Following year' => '', |
1817 | 1817 |
'Font' => '', |
1818 | 1818 |
'Font size' => '', |
1819 |
'For #1, #2 #3 are missing' => '', |
|
1819 | 1820 |
'For AP transactions it will replace the sales taxkeys with input taxkeys with the same tax rate.' => '', |
1820 | 1821 |
'For AR transactions it will replace the input taxkeys with sales taxkeys with the same tax rate.' => '', |
1821 | 1822 |
'For Record Type' => '', |
... | ... | |
4299 | 4300 |
'The shop part wasn\'t updated. #1' => '', |
4300 | 4301 |
'The source warehouse does not contain any bins.' => '', |
4301 | 4302 |
'The start date is missing.' => '', |
4303 |
'The stock is to low: #1.' => '', |
|
4302 | 4304 |
'The stock will be changed to your target quantity.' => '', |
4303 | 4305 |
'The storno credit note has been deleted' => '', |
4304 | 4306 |
'The storno invoice has been deleted' => '', |
... | ... | |
5114 | 5116 |
'http' => '', |
5115 | 5117 |
'https' => '', |
5116 | 5118 |
'imported' => '', |
5119 |
'in bin #1' => '', |
|
5117 | 5120 |
'in the time between' => '', |
5118 | 5121 |
'inactive' => '', |
5119 | 5122 |
'income' => 'GUV and BWA', |
... | ... | |
5186 | 5189 |
'now' => '', |
5187 | 5190 |
'number' => '', |
5188 | 5191 |
'oe.pl::search called with unknown type' => '', |
5192 |
'of batch with chargenumber #1' => '', |
|
5189 | 5193 |
'old' => '', |
5190 | 5194 |
'on the same day' => '', |
5191 | 5195 |
'once' => '', |
... | ... | |
5318 | 5322 |
'warehouse_usage_list' => '', |
5319 | 5323 |
'will be set upon posting' => '', |
5320 | 5324 |
'will be set upon saving' => '', |
5325 |
'with a bestbefore date of #1' => '', |
|
5321 | 5326 |
'with fuzzy skonto acc. to pt' => '', |
5322 | 5327 |
'with skonto acc. to pt' => '', |
5323 | 5328 |
'with_fuzzy_skonto_pt' => '', |
Auch abrufbar als: Unified diff
FIX: S:C:DeliverOrder: Überprüfen der Lagerbewegungen auf Bestand