From: Bill Erickson Date: Wed, 2 Feb 2022 20:50:02 +0000 (-0500) Subject: LP1952931 Receiving... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=63469485b10298be7ce3462e01f5df8d54400a92;p=working%2FEvergreen.git LP1952931 Receiving... Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html index ec72062935..993a605879 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html @@ -120,8 +120,19 @@ across different vendors to match a container code.
  • +
  • + {{li.lids.length}} item(s) received for line item + #{{li.id}}. +
  • + diff --git a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts index aea6f16bb0..916c714e29 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts @@ -13,6 +13,13 @@ import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/ import {GridComponent} from '@eg/share/grid/grid.component'; import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component'; +interface ReceiveResponse { + progress: number; + lineitems: any[]; + complete: boolean; + po: number; +} + @Component({ templateUrl: 'receive.component.html' }) @@ -26,6 +33,7 @@ export class AsnReceiveComponent implements OnInit { container: IdlObject; entries: IdlObject[] = []; containers: IdlObject[] = []; + receiveResponse: ReceiveResponse; @ViewChild('grid') private grid: GridComponent; @ViewChild('progress') private progress: ProgressInlineComponent; @@ -71,6 +79,7 @@ export class AsnReceiveComponent implements OnInit { } findContainer() { + this.receiving = false; this.container = null; this.containers = []; this.entries = []; @@ -145,8 +154,15 @@ export class AsnReceiveComponent implements OnInit { this.receiving = true; this.dryRun = dryRun; + this.receiveResponse = { + progress: 0, + lineitems: [], + complete: false, + po: null + }; + setTimeout(() => // Allow time to render - this.progress.update({value: 0, max: this.entries.length})); + this.progress.update({value: 0, max: this.affectedItemsCount()})); let method = 'open-ils.acq.shipment_notification.receive_items'; if (dryRun) { method += '.dry_run'; } @@ -155,7 +171,9 @@ export class AsnReceiveComponent implements OnInit { method, this.auth.token(), this.container.id()) .subscribe( resp => { + this.progress.update({value: resp.progress}); console.debug("ASN Receive returned", resp); + this.receiveResponse = resp; }, err => {}, () => { @@ -163,5 +181,10 @@ export class AsnReceiveComponent implements OnInit { } ); } + + clearReceiving() { + this.receiving = false; + this.findContainer(); + } } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index f03eb5f6b3..7a2b7922f0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -4350,8 +4350,8 @@ sub asn_receive_items { my $e = new_editor(xact => 1, authtoken => $auth); return $e->die_event unless $e->checkauth; - my $mgr = - OpenILS::Application::Acq::BatchManager->new(editor => $e, conn => $client); + my $mgr = OpenILS::Application::Acq::BatchManager->new( + editor => $e, conn => $client, throttle => 1); my $asn = $e->retrieve_acq_shipment_notification([$asn_id, {flesh => 1, flesh_fields => {acqsn => ['provider', 'entries']}} @@ -4360,10 +4360,28 @@ sub asn_receive_items { return $e->die_event unless $e->allowed('MANAGE_SHIPMENT_NOTIFICATION', $asn->provider->owner); - for my $entry (@{$asn->entries}) { + my $resp = { + lineitems => [], + progress => 0, + }; + + my @entries = sort {$a->lineitem cmp $b->lineitem} @{$asn->entries}; + + for my $entry (@entries) { + + my $li = $e->retrieve_acq_lineitem($entry->lineitem) + or return $e->die_event; + + my $li_resp = { + id => $entry->lineitem, + po => $li->purchase_order, + lids => [] + }; - my $lid_ids = $e->search_acq_lineitem_detail([ - { lineitem => $entry->lineitem, + push(@{$resp->{lineitems}}, $li_resp); + + my $lid_ids = $e->search_acq_lineitem_detail( + [{ lineitem => $entry->lineitem, recv_time => undef, cancel_reason => undef # TODO delayed? }, { @@ -4381,7 +4399,18 @@ sub asn_receive_items { for my $li_id (@$lid_ids) { return $e->die_event unless receive_lineitem_detail($mgr, $li_id); - $mgr->respond; + + my $lid = $e->retrieve_acq_lineitem_detail($li_id); + + my $note = $lid->note ? $lid->note . "\n" : ''; + $note .= "Received via shipment notification #$asn_id"; + $lid->note($note); + + $e->update_acq_lineitem_detail($lid) or return $e->die_event; + + push(@{$li_resp->{lids}}, $li_id); + $resp->{progress}++; + $client->respond($resp); } } @@ -4391,7 +4420,8 @@ sub asn_receive_items { $e->commit; } - $mgr->respond_complete; + $resp->{complete} = 1; + $client->respond_complete($resp); undef; }