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 public boolean canCreateLineItemReceivingDocument(PurchaseOrderDocument purchaseOrderDocument, String receivingDocumentNumber) throws RuntimeException;
72
73 /**
74 * Determines if a receiving line document can be created at the time the user requests it.
75 * This version requires the purchase order being evaluated to be passed in.
76 *
77 * @param po
78 * @return
79 * @throws RuntimeException
80 */
81 public boolean canCreateLineItemReceivingDocument(PurchaseOrderDocument po) throws RuntimeException;
82
83 /**
84 * @param rl
85 * @return
86 * @throws RuntimeException
87 */
88 public boolean canCreateCorrectionReceivingDocument(LineItemReceivingDocument rl) throws RuntimeException;
89
90 /**
91 * @param rl
92 * @param receivingCorrectionDocNumber
93 * @return
94 * @throws RuntimeException
95 */
96 public boolean canCreateCorrectionReceivingDocument(LineItemReceivingDocument rl, String receivingCorrectionDocNumber) throws RuntimeException;
97
98 /**
99 * Checks for duplicate Receiving Line documents and passes back a list of those found
100 * where vendor date, packing slip number or bill of lading match on previous receiving line
101 * documents by purchase order.
102 *
103 * @param rlDoc
104 * @return
105 */
106 public HashMap<String, String> receivingLineDuplicateMessages(LineItemReceivingDocument rlDoc);
107
108 /**
109 * This method deletes unneeded items and updates the totals on the po and does any additional processing based on items i.e. FYI etc
110 *
111 * @param receivingDocument receiving document
112 */
113 public void completeReceivingDocument(ReceivingDocument receivingDocument);
114
115 /**
116 * This method updates the corrected quantities on the receiving document.
117 *
118 * @param receivingDocument receivingCorrectionDocument
119 */
120 public void completeCorrectionReceivingDocument(ReceivingDocument correctionDocument);
121
122 /**
123 * Adds a note to a receiving document.
124 *
125 * @param receivingDocument
126 * @param note
127 * @throws Exception
128 */
129 public void addNoteToReceivingDocument(ReceivingDocument receivingDocument, String note) throws Exception;
130
131 /**
132 * Returns a delivery campus code on a receiving document based on the purchase order passed in.
133 *
134 * @param po
135 * @return
136 */
137 public String getReceivingDeliveryCampusCode(PurchaseOrderDocument po);
138
139 /**
140 * Determines if there is at least one receiving line document that has gone to final for a purchase order.
141 *
142 * @param poId
143 * @return
144 * @throws RuntimeException
145 */
146 public boolean isLineItemReceivingDocumentGeneratedForPurchaseOrder(Integer poId) throws RuntimeException;
147
148 public void createNoteForReturnedAndDamagedItems(ReceivingDocument recDoc);
149
150 /**
151 * This method iterates all the line item receiving documents with Awaiting Purchase Order Open Status and approves it if the
152 * associated PO is available for amedment.
153 */
154 public void approveReceivingDocsForPOAmendment();
155
156 /**
157 * Returns a list of line item receiving documents in process for a purchase order
158 *
159 * @param receivingDocumentNumber
160 * @return
161 */
162 public List<String> getLineItemReceivingDocumentNumbersInProcessForPurchaseOrder(Integer poId, String receivingDocumentNumber);
163
164 /**
165 * Returns a list of line item receiving documents in final status for a purchase order
166 *
167 * @param receivingDocumentNumber
168 * @return
169 */
170 public List<LineItemReceivingDocument> getLineItemReceivingDocumentsInFinalForPurchaseOrder(Integer poId);
171
172
173 /**
174 * Returns a list of correction receiving documents in process for a purchase order
175 *
176 * @param poId
177 * @param receivingDocumentNumber
178 * @return
179 */
180 public List<String> getCorrectionReceivingDocumentNumbersInProcessForPurchaseOrder(Integer poId, String receivingDocumentNumber);
181
182 /**
183 * Returns true, if the po is active for receiving document creation
184 */
185 public boolean isPurchaseOrderActiveForLineItemReceivingDocumentCreation(Integer poId);
186
187 /**
188 * Checks if there're newly added items in the given LineItemReceivingDocument.
189 *
190 * @param rlDoc the given LineItemReceivingDocument
191 * @return true if there're newly added (unordered) items; false otherwise.
192 */
193 public boolean hasNewUnorderedItem(LineItemReceivingDocument rlDoc);
194
195 }