1 /*
2 * Copyright 2008 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.ole.module.purap.document.service;
17
18 import org.kuali.ole.module.purap.document.CorrectionReceivingDocument;
19 import org.kuali.ole.module.purap.document.LineItemReceivingDocument;
20 import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
21 import org.kuali.ole.module.purap.document.ReceivingDocument;
22 import org.kuali.rice.kew.api.exception.WorkflowException;
23
24 import java.util.HashMap;
25 import java.util.List;
26
27 public interface ReceivingService {
28
29 /**
30 * Populates a Receiving Line Document with information from a Purchase Order.
31 *
32 * @param rlDoc
33 */
34 public void populateReceivingLineFromPurchaseOrder(LineItemReceivingDocument rlDoc);
35
36 /**
37 * Populates a Receiving Correction Document with information from a Receiving Line.
38 *
39 * @param rcDoc
40 */
41 public void populateCorrectionReceivingFromReceivingLine(CorrectionReceivingDocument rcDoc);
42
43 /**
44 * A save is done passing the continue purap event so as to call a populate within
45 * prepare for save.
46 *
47 * @param rlDoc
48 * @throws WorkflowException
49 */
50 public void populateAndSaveLineItemReceivingDocument(LineItemReceivingDocument rlDoc) throws WorkflowException;
51
52 /**
53 * Populates the receiving correction document.
54 *
55 * @param rcDoc
56 */
57 public void populateCorrectionReceivingDocument(CorrectionReceivingDocument rcDoc);
58
59 /**
60 * Determines if a receiving line document can be created at the time the user requests it.
61 * This version looks up the current purchase order by po id and also excludes the current receiving
62 * document from the check.
63 *
64 * @param poId
65 * @param receivingDocumentNumber
66 * @return
67 * @throws RuntimeException
68 */
69 public boolean canCreateLineItemReceivingDocument(Integer poId, String receivingDocumentNumber) throws RuntimeException;
70
71 /**
72 * Determines if a receiving line document can be created at the time the user requests it.
73 * This version requires the purchase order being evaluated to be passed in.
74 *
75 * @param po
76 * @return
77 * @throws RuntimeException
78 */
79 public boolean canCreateLineItemReceivingDocument(PurchaseOrderDocument po) throws RuntimeException;
80
81 /**
82 * @param rl
83 * @return
84 * @throws RuntimeException
85 */
86 public boolean canCreateCorrectionReceivingDocument(LineItemReceivingDocument rl) throws RuntimeException;
87
88 /**
89 * @param rl
90 * @param receivingCorrectionDocNumber
91 * @return
92 * @throws RuntimeException
93 */
94 public boolean canCreateCorrectionReceivingDocument(LineItemReceivingDocument rl, String receivingCorrectionDocNumber) throws RuntimeException;
95
96 /**
97 * Checks for duplicate Receiving Line documents and passes back a list of those found
98 * where vendor date, packing slip number or bill of lading match on previous receiving line
99 * documents by purchase order.
100 *
101 * @param rlDoc
102 * @return
103 */
104 public HashMap<String, String> receivingLineDuplicateMessages(LineItemReceivingDocument rlDoc);
105
106 /**
107 * This method deletes unneeded items and updates the totals on the po and does any additional processing based on items i.e. FYI etc
108 *
109 * @param receivingDocument receiving document
110 */
111 public void completeReceivingDocument(ReceivingDocument receivingDocument);
112
113 /**
114 * This method updates the corrected quantities on the receiving document.
115 *
116 * @param receivingDocument receivingCorrectionDocument
117 */
118 public void completeCorrectionReceivingDocument(ReceivingDocument correctionDocument);
119
120 /**
121 * Adds a note to a receiving document.
122 *
123 * @param receivingDocument
124 * @param note
125 * @throws Exception
126 */
127 public void addNoteToReceivingDocument(ReceivingDocument receivingDocument, String note) throws Exception;
128
129 /**
130 * Returns a delivery campus code on a receiving document based on the purchase order passed in.
131 *
132 * @param po
133 * @return
134 */
135 public String getReceivingDeliveryCampusCode(PurchaseOrderDocument po);
136
137 /**
138 * Determines if there is at least one receiving line document that has gone to final for a purchase order.
139 *
140 * @param poId
141 * @return
142 * @throws RuntimeException
143 */
144 public boolean isLineItemReceivingDocumentGeneratedForPurchaseOrder(Integer poId) throws RuntimeException;
145
146 public void createNoteForReturnedAndDamagedItems(ReceivingDocument recDoc);
147
148 /**
149 * This method iterates all the line item receiving documents with Awaiting Purchase Order Open Status and approves it if the
150 * associated PO is available for amedment.
151 */
152 public void approveReceivingDocsForPOAmendment();
153
154 /**
155 * Returns a list of line item receiving documents in process for a purchase order
156 *
157 * @param receivingDocumentNumber
158 * @return
159 */
160 public List<String> getLineItemReceivingDocumentNumbersInProcessForPurchaseOrder(Integer poId, String receivingDocumentNumber);
161
162 /**
163 * Returns a list of line item receiving documents in final status for a purchase order
164 *
165 * @param receivingDocumentNumber
166 * @return
167 */
168 public List<LineItemReceivingDocument> getLineItemReceivingDocumentsInFinalForPurchaseOrder(Integer poId);
169
170
171 /**
172 * Returns a list of correction receiving documents in process for a purchase order
173 *
174 * @param poId
175 * @param receivingDocumentNumber
176 * @return
177 */
178 public List<String> getCorrectionReceivingDocumentNumbersInProcessForPurchaseOrder(Integer poId, String receivingDocumentNumber);
179
180 /**
181 * Returns true, if the po is active for receiving document creation
182 */
183 public boolean isPurchaseOrderActiveForLineItemReceivingDocumentCreation(Integer poId);
184
185 /**
186 * Checks if there're newly added items in the given LineItemReceivingDocument.
187 *
188 * @param rlDoc the given LineItemReceivingDocument
189 * @return true if there're newly added (unordered) items; false otherwise.
190 */
191 public boolean hasNewUnorderedItem(LineItemReceivingDocument rlDoc);
192
193 }