1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.businessobject;
17
18 import org.kuali.ole.docstore.discovery.service.QueryService;
19 import org.kuali.ole.docstore.discovery.service.QueryServiceImpl;
20 import org.kuali.ole.docstore.model.bo.WorkBibDocument;
21 import org.kuali.ole.docstore.model.bo.WorkInstanceDocument;
22 import org.kuali.ole.docstore.model.bo.WorkItemDocument;
23 import org.kuali.ole.docstore.model.enums.DocType;
24 import org.kuali.ole.module.purap.PurapConstants;
25 import org.kuali.ole.module.purap.businessobject.LineItemReceivingItem;
26 import org.kuali.ole.module.purap.businessobject.PurchaseOrderItem;
27 import org.kuali.ole.module.purap.document.LineItemReceivingDocument;
28 import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
29 import org.kuali.ole.module.purap.exception.PurError;
30 import org.kuali.ole.pojo.OleOrderRecord;
31 import org.kuali.ole.select.document.OleLineItemReceivingDocument;
32 import org.kuali.ole.select.document.service.OleDocstoreHelperService;
33 import org.kuali.ole.select.lookup.DocData;
34 import org.kuali.ole.sys.OLEConstants;
35 import org.kuali.ole.sys.context.SpringContext;
36 import org.kuali.rice.core.api.util.type.KualiDecimal;
37 import org.kuali.rice.core.api.util.type.KualiInteger;
38 import org.kuali.rice.krad.service.BusinessObjectService;
39 import org.kuali.rice.krad.util.ObjectUtils;
40
41 import java.util.*;
42
43
44
45
46
47 public class OleLineItemReceivingItem extends LineItemReceivingItem implements OleReceivingItem {
48 private KualiDecimal itemOrderedParts;
49 private KualiDecimal itemReceivedTotalParts;
50 private KualiDecimal itemReturnedTotalParts;
51 private KualiDecimal itemDamagedTotalParts;
52
53 private KualiDecimal itemReceivedPriorParts;
54 private KualiDecimal itemReceivedToBeParts;
55 private Boolean availableToPublic = true;
56 private Integer oleFormatId;
57 protected KualiDecimal itemOriginalReceivedTotalParts;
58 protected KualiDecimal itemOriginalReturnedTotalParts;
59 protected KualiDecimal itemOriginalDamagedTotalParts;
60
61
62 private List<OleReceivingLineExceptionNotes> exceptionNoteList;
63 private Integer exceptionTypeId;
64 private String exceptionNotes;
65
66
67
68 private List<OleLineItemReceivingReceiptNotes> noteList;
69 private List<OleLineItemReceivingReceiptNotes> receiptNoteList;
70 private Integer noteTypeId;
71 private String receiptNotes;
72 private String notes;
73 private Integer receiptNoteListSize;
74
75
76 private List<OleLineItemReceivingReceiptNotes> specialHandlingNoteList;
77 private boolean notesAck = false;
78
79 private String itemTitleId;
80 private BibInfoBean bibInfoBean;
81 private String bibUUID;
82 private DocData docData;
83
84 private List<OleLineItemReceivingDoc> oleLineItemReceivingItemDocList;
85 private BusinessObjectService businessObjectService;
86 private OleOrderRecord oleOrderRecord;
87 protected Integer receiptStatusId;
88 private OleReceiptStatus oleReceiptStatus;
89
90
91
92
93 private Integer itemCopiesId;
94 private KualiInteger parts;
95 private KualiDecimal itemCopies;
96 private String partEnumeration;
97 private String locationCopies;
98 private KualiInteger startingCopyNumber;
99 private List<OleCopies> copies = new ArrayList<OleCopies>();
100
101
102
103
104 private KualiInteger oleItemOrderedQuantity;
105 private KualiInteger oleItemReceivedPriorQuantity;
106 private KualiInteger oleItemReceivedToBeQuantity;
107 private KualiInteger oleItemReceivedTotalQuantity;
108 private KualiInteger oleItemReturnedTotalQuantity;
109 private KualiInteger oleItemDamagedTotalQuantity;
110 private KualiInteger oleItemOrderedParts;
111 private KualiInteger oleItemReceivedPriorParts;
112 private KualiInteger oleItemReceivedToBeParts;
113 private KualiInteger oleItemReceivedTotalParts;
114 private KualiInteger oleItemReturnedTotalParts;
115 private KualiInteger oleItemDamagedTotalParts;
116
117 private String enumeration;
118 private String location;
119 private String copyNumber;
120 private String receiptStatus;
121 private List<OleCopy> copyList = new ArrayList<>();
122 private boolean poSelected;
123
124 public boolean isPoSelected() {
125 return poSelected;
126 }
127
128 public void setPoSelected(boolean poSelected) {
129 this.poSelected = poSelected;
130 }
131
132
133
134
135
136
137 public Integer getReceiptStatusId() {
138 return receiptStatusId;
139 }
140
141
142
143
144
145
146 public void setReceiptStatusId(Integer receiptStatusId) {
147 this.receiptStatusId = receiptStatusId;
148 }
149
150
151
152
153
154
155 public OleReceiptStatus getOleReceiptStatus() {
156 return oleReceiptStatus;
157 }
158
159
160
161
162
163
164 public void setOleReceiptStatus(OleReceiptStatus oleReceiptStatus) {
165 this.oleReceiptStatus = oleReceiptStatus;
166 }
167
168 public OleOrderRecord getOleOrderRecord() {
169 return oleOrderRecord;
170 }
171
172 public void setOleOrderRecord(OleOrderRecord oleOrderRecord) {
173 this.oleOrderRecord = oleOrderRecord;
174 }
175
176 public BusinessObjectService getBusinessObjectService() {
177 return businessObjectService;
178 }
179
180 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
181 this.businessObjectService = businessObjectService;
182 }
183
184
185
186
187
188
189
190
191
192 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OleLineItemReceivingItem.class);
193
194 public List<OleLineItemReceivingDoc> getOleLineItemReceivingItemDocList() {
195 return oleLineItemReceivingItemDocList;
196 }
197
198 public void setOleLineItemReceivingItemDocList(List<OleLineItemReceivingDoc> oleLineItemReceivingItemDocList) {
199 this.oleLineItemReceivingItemDocList = oleLineItemReceivingItemDocList;
200 }
201
202
203
204
205 public OleLineItemReceivingItem() {
206 this.setItemUnitOfMeasureCode(PurapConstants.LineItemReceivingDocumentStrings.CUSTOMER_INVOICE_DETAIL_UOM_DEFAULT);
207 this.setOleItemReceivedTotalQuantity(KualiInteger.ZERO);
208 this.setOleItemReturnedTotalQuantity(KualiInteger.ZERO);
209 this.setOleItemDamagedTotalQuantity(KualiInteger.ZERO);
210 this.setItemOriginalReceivedTotalQuantity(KualiDecimal.ZERO);
211 this.setItemOriginalReturnedTotalQuantity(KualiDecimal.ZERO);
212 this.setItemOriginalDamagedTotalQuantity(KualiDecimal.ZERO);
213 this.setItemReceivedTotalParts(KualiDecimal.ZERO);
214 this.setItemReturnedTotalParts(KualiDecimal.ZERO);
215 this.setItemDamagedTotalParts(KualiDecimal.ZERO);
216 this.setItemOriginalReceivedTotalParts(KualiDecimal.ZERO);
217 this.setItemOriginalReturnedTotalParts(KualiDecimal.ZERO);
218 this.setItemOriginalDamagedTotalParts(KualiDecimal.ZERO);
219 exceptionNoteList = new ArrayList();
220 receiptNoteList = new ArrayList();
221 specialHandlingNoteList = new ArrayList();
222 noteList = new ArrayList();
223 oleLineItemReceivingItemDocList = new ArrayList();
224 }
225
226
227
228
229
230
231 public OleLineItemReceivingItem(LineItemReceivingDocument rld) {
232 super(rld);
233 this.setItemReceivedTotalParts(KualiDecimal.ZERO);
234 this.setItemReturnedTotalParts(KualiDecimal.ZERO);
235 this.setItemDamagedTotalParts(KualiDecimal.ZERO);
236 this.setItemOriginalReceivedTotalParts(KualiDecimal.ZERO);
237 this.setItemOriginalReturnedTotalParts(KualiDecimal.ZERO);
238 this.setItemOriginalDamagedTotalParts(KualiDecimal.ZERO);
239
240 exceptionNoteList = new ArrayList();
241 receiptNoteList = new ArrayList();
242 specialHandlingNoteList = new ArrayList();
243 noteList = new ArrayList();
244 oleLineItemReceivingItemDocList = new ArrayList();
245 }
246
247
248
249
250
251
252
253
254 public OleLineItemReceivingItem(PurchaseOrderItem poi, LineItemReceivingDocument rld) {
255 super(poi, rld);
256 OlePurchaseOrderItem olePoi = (OlePurchaseOrderItem) poi;
257 this.setReceiptStatusId(olePoi.getReceiptStatusId());
258 OleLineItemReceivingDocument oleLineItemRecvDoc = (OleLineItemReceivingDocument) rld;
259 if (this.getItemTitleId() == null) {
260 this.setItemTitleId(olePoi.getItemTitleId());
261 }
262 OleLineItemReceivingDoc oleLineItemReceivingDoc = new OleLineItemReceivingDoc();
263 oleLineItemReceivingDoc.setReceivingLineItemIdentifier(this.getReceivingItemIdentifier());
264 oleLineItemReceivingDoc.setItemTitleId(olePoi.getItemTitleId());
265 oleLineItemReceivingItemDocList = oleLineItemReceivingDoc.getItemTitleId() != null ? Collections.singletonList(oleLineItemReceivingDoc) : new ArrayList();
266 if (ObjectUtils.isNotNull(olePoi.getItemNoOfParts())) {
267 this.setItemOrderedParts((olePoi.getItemNoOfParts().kualiDecimalValue()));
268 } else {
269 this.setItemOrderedParts(new KualiDecimal(0));
270 }
271
272 if (ObjectUtils.isNull(olePoi.getItemReceivedTotalParts())) {
273 this.setItemReceivedPriorParts(KualiDecimal.ZERO);
274 } else {
275 this.setItemReceivedPriorParts(olePoi.getItemReceivedTotalParts());
276 }
277
278 this.setItemReceivedToBeParts(this.getItemOrderedParts().subtract(this.getItemReceivedPriorParts()));
279
280 this.setItemReceivedTotalParts(KualiDecimal.ZERO);
281 this.setItemReturnedTotalParts(KualiDecimal.ZERO);
282 this.setItemDamagedTotalParts(KualiDecimal.ZERO);
283 this.setItemOriginalReceivedTotalParts(KualiDecimal.ZERO);
284 this.setItemOriginalReturnedTotalParts(KualiDecimal.ZERO);
285 this.setItemOriginalDamagedTotalParts(KualiDecimal.ZERO);
286 exceptionNoteList = new ArrayList();
287 receiptNoteList = new ArrayList();
288 specialHandlingNoteList = new ArrayList();
289 noteList = new ArrayList();
290 if (olePoi.getNotes() != null && olePoi.getNotes().size() > 0) {
291 List receiptNoteList = new ArrayList();
292 List specialHandlingNoteList = new ArrayList();
293 List noteList = new ArrayList();
294 for (OleNotes poNote : olePoi.getNotes()) {
295 OleLineItemReceivingReceiptNotes receiptNote = new OleLineItemReceivingReceiptNotes(poNote);
296 receiptNote.setReceivingLineItem(this);
297 receiptNote.setNoteType(poNote.getNoteType());
298 String note = receiptNote.getNoteType().getNoteType();
299 if (note.equalsIgnoreCase(OLEConstants.SPECIAL_PROCESSING_INSTRUCTION_NOTE)) {
300 specialHandlingNoteList.add(receiptNote);
301 } else {
302 receiptNoteList.add(receiptNote);
303 }
304 noteList.add(receiptNote);
305 }
306 this.setSpecialHandlingNoteList(specialHandlingNoteList);
307 this.setReceiptNoteList(receiptNoteList);
308 this.setReceiptNoteListSize(receiptNoteList.size());
309 this.setNoteList(noteList);
310 }
311 this.setPurchaseOrderIdentifier(poi.getItemIdentifier());
312 this.setOleFormatId(olePoi.getFormatTypeId());
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332 this.setCopies(olePoi.getCopies());
333 this.setCopyList(olePoi.getCopyList());
334 List<OleCopy> copyList = this.getCopyList() != null ? this.getCopyList() : new ArrayList<OleCopy>();
335 OleDocstoreHelperService oleDocstoreHelperService = SpringContext
336 .getBean(OleDocstoreHelperService.class);
337
338 HashMap<String, List<OleCopy>> copyListBasedOnCopyNumber = oleDocstoreHelperService.getCopyListBasedOnCopyNumber(copyList);
339 Iterator<Map.Entry<String, List<OleCopy>>> entries = copyListBasedOnCopyNumber.entrySet().iterator();
340 Integer receivedCopyCount = 0;
341 while (entries.hasNext()) {
342 Map.Entry<String, List<OleCopy>> entry = entries.next();
343 List<OleCopy> copyMap = entry.getValue();
344 Integer copyCount = 0;
345 for (OleCopy copy : copyMap) {
346 if (copy.getReceiptStatus().equalsIgnoreCase(OLEConstants.OleLineItemReceiving.RECEIVED_STATUS)) {
347 copyCount++;
348 }
349 }
350 if (copyCount == this.getItemOrderedParts().intValue()) {
351 receivedCopyCount++;
352 }
353 }
354 if (receivedCopyCount > 0) {
355 this.setItemReceivedTotalQuantity(new KualiDecimal(receivedCopyCount));
356 this.setItemReceivedTotalParts(new KualiDecimal(this.getItemOrderedParts().intValue()));
357 }
358 }
359
360
361
362
363
364
365 public KualiDecimal getItemOrderedParts() {
366 return itemOrderedParts;
367 }
368
369
370
371
372
373
374 public void setItemOrderedParts(KualiDecimal itemOrderedParts) {
375 this.itemOrderedParts = itemOrderedParts;
376 }
377
378
379
380
381
382
383 @Override
384 public KualiDecimal getItemReceivedTotalParts() {
385 return itemReceivedTotalParts;
386 }
387
388
389
390
391
392
393 @Override
394 public void setItemReceivedTotalParts(KualiDecimal itemReceivedTotalParts) {
395 this.itemReceivedTotalParts = itemReceivedTotalParts;
396 }
397
398
399
400
401
402
403 @Override
404 public KualiDecimal getItemReturnedTotalParts() {
405 return itemReturnedTotalParts;
406 }
407
408
409
410
411
412
413 @Override
414 public void setItemReturnedTotalParts(KualiDecimal itemReturnedTotalParts) {
415 this.itemReturnedTotalParts = itemReturnedTotalParts;
416 }
417
418
419
420
421
422
423 @Override
424 public KualiDecimal getItemDamagedTotalParts() {
425 return itemDamagedTotalParts;
426 }
427
428
429
430
431
432
433 @Override
434 public void setItemDamagedTotalParts(KualiDecimal itemDamagedTotalParts) {
435 this.itemDamagedTotalParts = itemDamagedTotalParts;
436 }
437
438
439
440
441
442
443 public KualiDecimal getItemReceivedPriorParts() {
444 if (ObjectUtils.isNull(itemReceivedPriorParts)) {
445 OlePurchaseOrderItem olePoi = (OlePurchaseOrderItem) getPurchaseOrderItem();
446 KualiDecimal priorParts = olePoi.getItemReceivedTotalParts();
447 if (priorParts == null) {
448 priorParts = new KualiDecimal(0.00);
449 }
450 setItemReceivedPriorParts(priorParts);
451 }
452 return itemReceivedPriorParts;
453 }
454
455
456
457
458
459
460 public void setItemReceivedPriorParts(KualiDecimal itemReceivedPriorParts) {
461 this.itemReceivedPriorParts = itemReceivedPriorParts;
462 }
463
464
465
466
467
468
469 public KualiDecimal getItemReceivedToBeParts() {
470
471 if (null != this.getItemOrderedParts()) {
472 KualiDecimal priorParts = getItemReceivedPriorParts();
473 if (priorParts == null) {
474 priorParts = new KualiDecimal(0.00);
475 }
476 KualiDecimal toBeParts = this.getItemOrderedParts().subtract(priorParts);
477 if (toBeParts.isNegative()) {
478 toBeParts = KualiDecimal.ZERO;
479 }
480 setItemReceivedToBeParts(toBeParts);
481
482 }
483 return itemReceivedToBeParts;
484 }
485
486
487
488
489
490
491 public void setItemReceivedToBeParts(KualiDecimal itemReceivedToBeParts) {
492 this.itemReceivedToBeParts = itemReceivedToBeParts;
493 }
494
495
496
497
498
499
500 public Boolean getAvailableToPublic() {
501 return availableToPublic;
502 }
503
504
505
506
507
508
509 public void setAvailableToPublic(Boolean availableToPublic) {
510 this.availableToPublic = availableToPublic;
511 }
512
513
514
515
516
517
518 public Integer getOleFormatId() {
519 return oleFormatId;
520 }
521
522
523
524
525
526
527 public void setOleFormatId(Integer oleFormatId) {
528 this.oleFormatId = oleFormatId;
529 }
530
531
532
533
534
535
536 @Override
537 public KualiDecimal getItemOriginalReceivedTotalParts() {
538 return itemOriginalReceivedTotalParts;
539 }
540
541
542
543
544
545
546 @Override
547 public void setItemOriginalReceivedTotalParts(KualiDecimal itemOriginalReceivedTotalParts) {
548 this.itemOriginalReceivedTotalParts = itemOriginalReceivedTotalParts;
549 }
550
551
552
553
554
555
556 @Override
557 public KualiDecimal getItemOriginalReturnedTotalParts() {
558 return itemOriginalReturnedTotalParts;
559 }
560
561
562
563
564
565
566 @Override
567 public void setItemOriginalReturnedTotalParts(KualiDecimal itemOriginalReturnedTotalParts) {
568 this.itemOriginalReturnedTotalParts = itemOriginalReturnedTotalParts;
569 }
570
571
572
573
574
575
576 @Override
577 public KualiDecimal getItemOriginalDamagedTotalParts() {
578 return itemOriginalDamagedTotalParts;
579 }
580
581
582
583
584
585
586 @Override
587 public void setItemOriginalDamagedTotalParts(KualiDecimal itemOriginalDamagedTotalParts) {
588 this.itemOriginalDamagedTotalParts = itemOriginalDamagedTotalParts;
589 }
590
591
592
593
594
595
596 @Override
597 public boolean isConsideredEntered() {
598 LOG.debug("Inside OleLineItemReceivingItem isConsideredEntered");
599 boolean isConsideredEntered = super.isConsideredEntered();
600 if (LOG.isDebugEnabled()) {
601 LOG.debug("isConsideredEntered from LineItemReceivingItem :" + isConsideredEntered);
602 }
603 isConsideredEntered &= !((ObjectUtils.isNotNull(this.getItemOrderedParts()) && this.getItemOrderedParts().isGreaterThan(KualiDecimal.ZERO)) && ((ObjectUtils.isNull(this.getItemReceivedTotalParts()) || this.getItemReceivedTotalParts().isZero()) &&
604 (ObjectUtils.isNull(this.getItemDamagedTotalParts()) || this.getItemDamagedTotalParts().isZero()) &&
605 (ObjectUtils.isNull(this.getItemReturnedTotalParts()) || this.getItemReturnedTotalParts().isZero())));
606
607 if (LOG.isDebugEnabled()) {
608 LOG.debug("isConsideredEntered from OleLineItemReceivingItem :" + isConsideredEntered);
609 }
610 return isConsideredEntered;
611 }
612
613
614
615
616
617
618
619
620 public List<OleReceivingLineExceptionNotes> getExceptionNoteList() {
621 return exceptionNoteList;
622 }
623
624
625
626
627
628
629 public void setExceptionNoteList(List<OleReceivingLineExceptionNotes> exceptionNoteList) {
630 this.exceptionNoteList = exceptionNoteList;
631 }
632
633
634
635
636
637
638 public Integer getExceptionTypeId() {
639 return exceptionTypeId;
640 }
641
642
643
644
645
646
647 public void setExceptionTypeId(Integer exceptionTypeId) {
648 this.exceptionTypeId = exceptionTypeId;
649 }
650
651
652
653
654
655
656 public String getExceptionNotes() {
657 return exceptionNotes;
658 }
659
660
661
662
663
664
665 public void setExceptionNotes(String exceptionNotes) {
666 this.exceptionNotes = exceptionNotes;
667 }
668
669
670
671
672
673
674 public Class getExceptionNotesClass() {
675 return OleReceivingLineExceptionNotes.class;
676 }
677
678
679
680
681
682
683 public void addExceptionNote(OleReceivingLineExceptionNotes exceptionNotes) {
684 exceptionNoteList.add(exceptionNotes);
685
686 }
687
688
689
690
691
692
693 public void deleteExceptionNote(int lineNum) {
694 exceptionNoteList.remove(lineNum);
695
696 }
697
698
699
700
701
702
703
704
705
706 public List<OleLineItemReceivingReceiptNotes> getNoteList() {
707 return noteList;
708 }
709
710
711
712
713
714
715 public void setNoteList(List<OleLineItemReceivingReceiptNotes> noteList) {
716 this.noteList = noteList;
717 }
718
719
720
721
722
723
724 public List<OleLineItemReceivingReceiptNotes> getReceiptNoteList() {
725 return receiptNoteList;
726 }
727
728
729
730
731
732
733 public void setReceiptNoteList(List<OleLineItemReceivingReceiptNotes> receiptNoteList) {
734 this.receiptNoteList = receiptNoteList;
735 }
736
737
738
739
740
741
742 public Integer getNoteTypeId() {
743 return noteTypeId;
744 }
745
746
747
748
749
750
751 public void setNoteTypeId(Integer noteTypeId) {
752 this.noteTypeId = noteTypeId;
753 }
754
755
756
757
758
759
760 public String getReceiptNotes() {
761 return receiptNotes;
762 }
763
764
765
766
767
768
769 public void setReceiptNotes(String receiptNotes) {
770 this.receiptNotes = receiptNotes;
771 }
772
773
774 public String getNotes() {
775 return notes;
776 }
777
778 public void setNotes(String notes) {
779 this.notes = notes;
780 }
781
782
783
784
785
786
787 public Class getOleLineItemReceivingDocClass() {
788 return OleLineItemReceivingDoc.class;
789 }
790
791
792
793
794
795
796 public Class getReceiptNotesClass() {
797 return OleLineItemReceivingReceiptNotes.class;
798 }
799
800
801
802
803
804
805 public void addReceiptNote(OleLineItemReceivingReceiptNotes receiptNotes) {
806 receiptNoteList.add(receiptNotes);
807
808 }
809
810
811
812
813
814
815 public void deleteReceiptNote(int lineNum) {
816 receiptNoteList.remove(lineNum);
817
818 }
819
820
821
822
823
824
825 public void addNote(OleLineItemReceivingReceiptNotes receiptNotes) {
826 noteList.add(receiptNotes);
827 }
828
829
830
831
832
833
834 public void deleteNote(int lineNum) {
835 noteList.remove(lineNum);
836
837 }
838
839
840
841
842
843
844
845 public List<OleLineItemReceivingReceiptNotes> getSpecialHandlingNoteList() {
846 return specialHandlingNoteList;
847 }
848
849
850
851
852
853
854 public void setSpecialHandlingNoteList(List<OleLineItemReceivingReceiptNotes> specialHandlingNoteList) {
855 this.specialHandlingNoteList = specialHandlingNoteList;
856 }
857
858
859
860
861
862
863 public boolean isNotesAck() {
864 return notesAck;
865 }
866
867
868
869
870
871
872 public void setNotesAck(boolean notesAck) {
873 this.notesAck = notesAck;
874 }
875
876
877
878
879
880
881 public Integer getReceiptNoteListSize() {
882 return receiptNoteListSize;
883 }
884
885
886
887
888
889
890 public void setReceiptNoteListSize(Integer receiptNoteListSize) {
891 this.receiptNoteListSize = receiptNoteListSize;
892 }
893
894 public String getItemTitleId() {
895 return itemTitleId;
896 }
897
898 public void setItemTitleId(String itemTitleId) {
899 this.itemTitleId = itemTitleId;
900 }
901
902
903
904
905
906
907
908 @Override
909 public PurchaseOrderItem getPurchaseOrderItem() {
910 if (LOG.isDebugEnabled()) {
911 LOG.debug("Inside OleLineItemReceivingItem getPurchaseOrderItem");
912 LOG.debug("Ole Line Item Receiving Document before refresh :" + getLineItemReceivingDocument());
913 }
914
915 if (ObjectUtils.isNull(this.getLineItemReceivingDocument())) {
916 this.refreshReferenceObject("lineItemReceivingDocument");
917 }
918
919
920
921 if (getLineItemReceivingDocument() != null) {
922 PurchaseOrderDocument po = getLineItemReceivingDocument().getPurchaseOrderDocument();
923 PurchaseOrderItem poi = null;
924 if (this.getItemType().isLineItemIndicator()) {
925 poi = (PurchaseOrderItem) po.getItem(this.getItemLineNumber().intValue() - 1);
926
927 }
928 if (poi != null) {
929 return poi;
930 } else {
931
932
933 return null;
934 }
935 } else {
936 LOG.error("getPurchaseOrderItem() Returning null because paymentRequest object is null");
937 throw new PurError("Receiving Line Object in Purchase Order item line number " + getItemLineNumber() + "or itemType " + getItemTypeCode() + " is null");
938 }
939 }
940
941 public BibInfoBean getBibInfoBean() {
942 return bibInfoBean;
943 }
944
945 public void setBibInfoBean(BibInfoBean bibInfoBean) {
946 this.bibInfoBean = bibInfoBean;
947 }
948
949 public String getBibUUID() {
950 return bibUUID;
951 }
952
953 public void setBibUUID(String bibUUID) {
954 this.bibUUID = bibUUID;
955 }
956
957 public DocData getDocData() {
958 return docData;
959 }
960
961 public void setDocData(DocData docData) {
962 this.docData = docData;
963 }
964
965
966
967
968
969
970 public Integer getItemCopiesId() {
971 return itemCopiesId;
972 }
973
974
975
976
977
978
979 public void setItemCopiesId(Integer itemCopiesId) {
980 this.itemCopiesId = itemCopiesId;
981 }
982
983
984
985
986
987
988 public KualiInteger getParts() {
989 return parts;
990 }
991
992
993
994
995
996
997 public void setParts(KualiInteger parts) {
998 this.parts = parts;
999 }
1000
1001
1002
1003
1004
1005
1006 public KualiDecimal getItemCopies() {
1007 return itemCopies;
1008 }
1009
1010
1011
1012
1013
1014
1015 public void setItemCopies(KualiDecimal itemCopies) {
1016 this.itemCopies = itemCopies;
1017 }
1018
1019
1020
1021
1022
1023
1024 public String getPartEnumeration() {
1025 return partEnumeration;
1026 }
1027
1028
1029
1030
1031
1032
1033 public void setPartEnumeration(String partEnumeration) {
1034 this.partEnumeration = partEnumeration;
1035 }
1036
1037
1038
1039
1040
1041
1042 public String getLocationCopies() {
1043 return locationCopies;
1044 }
1045
1046
1047
1048
1049
1050
1051 public void setLocationCopies(String locationCopies) {
1052 this.locationCopies = locationCopies;
1053 }
1054
1055
1056
1057
1058
1059
1060 public KualiInteger getStartingCopyNumber() {
1061 return startingCopyNumber;
1062 }
1063
1064
1065
1066
1067
1068
1069 public void setStartingCopyNumber(KualiInteger startingCopyNumber) {
1070 this.startingCopyNumber = startingCopyNumber;
1071 }
1072
1073
1074
1075
1076
1077
1078 public List<OleCopies> getCopies() {
1079 return copies;
1080 }
1081
1082
1083
1084
1085
1086
1087 public void setCopies(List<OleCopies> copies) {
1088 this.copies = copies;
1089 }
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100 public List<OleCopies> setCopiesToLineItem(WorkBibDocument workBibDocument) {
1101 List<WorkInstanceDocument> instanceDocuments = workBibDocument.getWorkInstanceDocumentList();
1102 List<OleCopies> copies = new ArrayList<OleCopies>();
1103 for (WorkInstanceDocument workInstanceDocument : instanceDocuments) {
1104 List<WorkItemDocument> itemDocuments = workInstanceDocument.getItemDocumentList();
1105 StringBuffer enumeration = new StringBuffer();
1106 for (int itemDocs = 0; itemDocs < itemDocuments.size(); itemDocs++) {
1107 if (itemDocs + 1 == itemDocuments.size()) {
1108 enumeration = enumeration.append(itemDocuments.get(itemDocs).getEnumeration());
1109 } else {
1110 enumeration = enumeration.append(itemDocuments.get(itemDocs).getEnumeration() + ",");
1111 }
1112
1113 }
1114 int startingCopy = 0;
1115 if (this.getItemReturnedTotalParts().intValue() != 0 && null != enumeration) {
1116 String enumerationSplit = enumeration.substring(1, 2);
1117 boolean isint = checkIsEnumerationSplitIsIntegerOrNot(enumerationSplit);
1118 if (isint) {
1119 startingCopy = Integer.parseInt(enumerationSplit);
1120 }
1121 }
1122 int noOfCopies = workInstanceDocument.getItemDocumentList().size() / this.getItemOrderedParts().intValue();
1123 OleRequisitionCopies copy = new OleRequisitionCopies();
1124 copy.setParts(new KualiInteger(this.getItemOrderedParts().intValue()));
1125 copy.setLocationCopies(workInstanceDocument.getHoldingsDocument().getLocationName());
1126 copy.setItemCopies(new KualiDecimal(noOfCopies));
1127 copy.setPartEnumeration(enumeration.toString());
1128 copy.setStartingCopyNumber(new KualiInteger(startingCopy));
1129 copies.add(copy);
1130 }
1131 return copies;
1132 }
1133
1134 public boolean checkIsEnumerationSplitIsIntegerOrNot(String enumerationSplit) {
1135 try {
1136 int startingCopy = Integer.parseInt(enumerationSplit);
1137 } catch (NumberFormatException e) {
1138 return false;
1139 }
1140 return true;
1141 }
1142
1143
1144
1145
1146
1147
1148
1149
1150 private List<WorkBibDocument> getWorkBibDocuments(List<String> instanceIdsList) {
1151 List<LinkedHashMap<String, String>> instanceIdMapList = new ArrayList<LinkedHashMap<String, String>>();
1152 for (String instanceId : instanceIdsList) {
1153 LinkedHashMap<String, String> instanceIdMap = new LinkedHashMap<String, String>();
1154 instanceIdMap.put(DocType.INSTANCE.getDescription(), instanceId);
1155 instanceIdMapList.add(instanceIdMap);
1156 }
1157
1158 QueryService queryService = QueryServiceImpl.getInstance();
1159 List<WorkBibDocument> workBibDocuments = new ArrayList<WorkBibDocument>();
1160 try {
1161 workBibDocuments = queryService.getWorkBibRecords(instanceIdMapList);
1162 } catch (Exception ex) {
1163
1164 ex.printStackTrace();
1165 }
1166 return workBibDocuments;
1167 }
1168
1169
1170
1171
1172
1173
1174 public KualiInteger getOleItemOrderedQuantity() {
1175 return new KualiInteger(super.getItemOrderedQuantity().intValue());
1176 }
1177
1178
1179
1180
1181
1182
1183 public void setOleItemOrderedQuantity(KualiInteger oleItemOrderedQuantity) {
1184 super.setItemOrderedQuantity(new KualiDecimal(oleItemOrderedQuantity.intValue()));
1185 }
1186
1187
1188
1189
1190
1191
1192 public KualiInteger getOleItemReceivedPriorQuantity() {
1193 return new KualiInteger(super.getItemReceivedPriorQuantity().intValue());
1194 }
1195
1196
1197
1198
1199
1200
1201 public void setOleItemReceivedPriorQuantity(KualiInteger oleItemReceivedPriorQuantity) {
1202 super.setItemReceivedPriorQuantity(new KualiDecimal(oleItemReceivedPriorQuantity.intValue()));
1203 }
1204
1205
1206
1207
1208
1209
1210 public KualiInteger getOleItemReceivedToBeQuantity() {
1211 return new KualiInteger(super.getItemReceivedToBeQuantity().intValue());
1212 }
1213
1214
1215
1216
1217
1218
1219 public void setOleItemReceivedToBeQuantity(KualiInteger oleItemReceivedToBeQuantity) {
1220 super.setItemReceivedToBeQuantity(new KualiDecimal(oleItemReceivedToBeQuantity.intValue()));
1221 }
1222
1223
1224
1225
1226
1227
1228 public KualiInteger getOleItemReceivedTotalQuantity() {
1229 return new KualiInteger(super.getItemReceivedTotalQuantity().intValue());
1230 }
1231
1232
1233
1234
1235
1236
1237 public void setOleItemReceivedTotalQuantity(KualiInteger oleItemReceivedTotalQuantity) {
1238 super.setItemReceivedTotalQuantity(new KualiDecimal(oleItemReceivedTotalQuantity.intValue()));
1239 }
1240
1241
1242
1243
1244
1245
1246 public KualiInteger getOleItemReturnedTotalQuantity() {
1247 return new KualiInteger(super.getItemReturnedTotalQuantity().intValue());
1248 }
1249
1250
1251
1252
1253
1254
1255 public void setOleItemReturnedTotalQuantity(KualiInteger oleItemReturnedTotalQuantity) {
1256 super.setItemReturnedTotalQuantity(new KualiDecimal(oleItemReturnedTotalQuantity.intValue()));
1257 }
1258
1259
1260
1261
1262
1263
1264 public KualiInteger getOleItemDamagedTotalQuantity() {
1265 return new KualiInteger(super.getItemDamagedTotalQuantity().intValue());
1266 }
1267
1268
1269
1270
1271
1272
1273 public void setOleItemDamagedTotalQuantity(KualiInteger oleItemDamagedTotalQuantity) {
1274 super.setItemDamagedTotalQuantity(new KualiDecimal(oleItemDamagedTotalQuantity.intValue()));
1275 }
1276
1277
1278
1279
1280
1281
1282 public KualiInteger getOleItemOrderedParts() {
1283 return new KualiInteger(getItemOrderedParts().intValue());
1284 }
1285
1286
1287
1288
1289
1290
1291 public void setOleItemOrderedParts(KualiInteger oleItemOrderedParts) {
1292 setItemOrderedParts(new KualiDecimal(oleItemOrderedParts.intValue()));
1293 }
1294
1295
1296
1297
1298
1299
1300 public KualiInteger getOleItemReceivedPriorParts() {
1301 return new KualiInteger(getItemReceivedPriorParts().intValue());
1302 }
1303
1304
1305
1306
1307
1308
1309 public void setOleItemReceivedPriorParts(KualiInteger oleItemReceivedPriorParts) {
1310 setItemReceivedPriorParts(new KualiDecimal(oleItemReceivedPriorParts.intValue()));
1311 }
1312
1313
1314
1315
1316
1317
1318 public KualiInteger getOleItemReceivedToBeParts() {
1319 return new KualiInteger(getItemReceivedToBeParts().intValue());
1320 }
1321
1322
1323
1324
1325
1326
1327 public void setOleItemReceivedToBeParts(KualiInteger oleItemReceivedToBeParts) {
1328 setItemReceivedToBeParts(new KualiDecimal(oleItemReceivedToBeParts.intValue()));
1329 }
1330
1331
1332
1333
1334
1335
1336 public KualiInteger getOleItemReceivedTotalParts() {
1337 return new KualiInteger(getItemReceivedTotalParts().intValue());
1338 }
1339
1340
1341
1342
1343
1344
1345 public void setOleItemReceivedTotalParts(KualiInteger oleItemReceivedTotalParts) {
1346 setItemReceivedTotalParts(new KualiDecimal(oleItemReceivedTotalParts.intValue()));
1347 }
1348
1349
1350
1351
1352
1353
1354 public KualiInteger getOleItemReturnedTotalParts() {
1355 return new KualiInteger(getItemReturnedTotalParts().intValue());
1356 }
1357
1358
1359
1360
1361
1362
1363 public void setOleItemReturnedTotalParts(KualiInteger oleItemReturnedTotalParts) {
1364 setItemReturnedTotalParts(new KualiDecimal(oleItemReturnedTotalParts.intValue()));
1365 }
1366
1367
1368
1369
1370
1371
1372 public KualiInteger getOleItemDamagedTotalParts() {
1373 return new KualiInteger(getItemDamagedTotalParts().intValue());
1374 }
1375
1376
1377
1378
1379
1380
1381 public void setOleItemDamagedTotalParts(KualiInteger oleItemDamagedTotalParts) {
1382 setItemDamagedTotalParts(new KualiDecimal(oleItemDamagedTotalParts.intValue()));
1383 }
1384
1385
1386
1387
1388
1389 public String getEnumeration() {
1390 return enumeration;
1391 }
1392
1393 public void setEnumeration(String enumeration) {
1394 this.enumeration = enumeration;
1395 }
1396
1397 public String getLocation() {
1398 return location;
1399 }
1400
1401 public void setLocation(String location) {
1402 this.location = location;
1403 }
1404
1405 public String getCopyNumber() {
1406 return copyNumber;
1407 }
1408
1409 public void setCopyNumber(String copyNumber) {
1410 this.copyNumber = copyNumber;
1411 }
1412
1413 public String getReceiptStatus() {
1414 return receiptStatus;
1415 }
1416
1417 public void setReceiptStatus(String receiptStatus) {
1418 this.receiptStatus = receiptStatus;
1419 }
1420
1421 public List<OleCopy> getCopyList() {
1422 return copyList;
1423 }
1424
1425 public void setCopyList(List<OleCopy> copyList) {
1426 this.copyList = copyList;
1427 }
1428 }
1429