001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.module.purap.document.service; 017 018 import java.util.HashMap; 019 import java.util.List; 020 021 import org.kuali.kfs.module.purap.document.PurchaseOrderDocument; 022 import org.kuali.kfs.module.purap.document.CorrectionReceivingDocument; 023 import org.kuali.kfs.module.purap.document.ReceivingDocument; 024 import org.kuali.kfs.module.purap.document.LineItemReceivingDocument; 025 import org.kuali.rice.kew.exception.WorkflowException; 026 027 public interface ReceivingService { 028 029 /** 030 * Populates a Receiving Line Document with information from a Purchase Order. 031 * 032 * @param rlDoc 033 */ 034 public void populateReceivingLineFromPurchaseOrder(LineItemReceivingDocument rlDoc); 035 036 /** 037 * Populates a Receiving Correction Document with information from a Receiving Line. 038 * 039 * @param rcDoc 040 */ 041 public void populateCorrectionReceivingFromReceivingLine(CorrectionReceivingDocument rcDoc); 042 043 /** 044 * A save is done passing the continue purap event so as to call a populate within 045 * prepare for save. 046 * 047 * @param rlDoc 048 * @throws WorkflowException 049 */ 050 public void populateAndSaveLineItemReceivingDocument(LineItemReceivingDocument rlDoc) throws WorkflowException; 051 052 /** 053 * Populates the receiving correction document. 054 * 055 * @param rcDoc 056 */ 057 public void populateCorrectionReceivingDocument(CorrectionReceivingDocument rcDoc); 058 059 /** 060 * Determines if a receiving line document can be created at the time the user requests it. 061 * This version looks up the current purchase order by po id and also excludes the current receiving 062 * document from the check. 063 * 064 * @param poId 065 * @param receivingDocumentNumber 066 * @return 067 * @throws RuntimeException 068 */ 069 public boolean canCreateLineItemReceivingDocument(Integer poId, String receivingDocumentNumber) throws RuntimeException; 070 071 /** 072 * Determines if a receiving line document can be created at the time the user requests it. 073 * This version requires the purchase order being evaluated to be passed in. 074 * 075 * @param po 076 * @return 077 * @throws RuntimeException 078 */ 079 public boolean canCreateLineItemReceivingDocument(PurchaseOrderDocument po) throws RuntimeException; 080 081 /** 082 * 083 * 084 * @param rl 085 * @return 086 * @throws RuntimeException 087 */ 088 public boolean canCreateCorrectionReceivingDocument(LineItemReceivingDocument rl) throws RuntimeException; 089 090 /** 091 * 092 * 093 * @param rl 094 * @param receivingCorrectionDocNumber 095 * @return 096 * @throws RuntimeException 097 */ 098 public boolean canCreateCorrectionReceivingDocument(LineItemReceivingDocument rl, String receivingCorrectionDocNumber) throws RuntimeException; 099 100 /** 101 * Checks for duplicate Receiving Line documents and passes back a list of those found 102 * where vendor date, packing slip number or bill of lading match on previous receiving line 103 * documents by purchase order. 104 * 105 * @param rlDoc 106 * @return 107 */ 108 public HashMap<String, String> receivingLineDuplicateMessages(LineItemReceivingDocument rlDoc); 109 110 /** 111 * 112 * This method deletes unneeded items and updates the totals on the po and does any additional processing based on items i.e. FYI etc 113 * @param receivingDocument receiving document 114 */ 115 public void completeReceivingDocument(ReceivingDocument receivingDocument); 116 117 /** 118 * This method updates the corrected quantities on the receiving document. 119 * @param receivingDocument receivingCorrectionDocument 120 */ 121 public void completeCorrectionReceivingDocument(ReceivingDocument correctionDocument); 122 123 /** 124 * Adds a note to a receiving document. 125 * 126 * @param receivingDocument 127 * @param note 128 * @throws Exception 129 */ 130 public void addNoteToReceivingDocument(ReceivingDocument receivingDocument, String note) throws Exception; 131 132 /** 133 * Returns a delivery campus code on a receiving document based on the purchase order passed in. 134 * 135 * @param po 136 * @return 137 */ 138 public String getReceivingDeliveryCampusCode(PurchaseOrderDocument po); 139 140 /** 141 * Determines if there is at least one receiving line document that has gone to final for a purchase order. 142 * 143 * @param poId 144 * @return 145 * @throws RuntimeException 146 */ 147 public boolean isLineItemReceivingDocumentGeneratedForPurchaseOrder(Integer poId) throws RuntimeException; 148 149 public void createNoteForReturnedAndDamagedItems(ReceivingDocument recDoc); 150 151 /** 152 * This method iterates all the line item receiving documents with Awaiting Purchase Order Open Status and approves it if the 153 * associated PO is available for amedment. 154 */ 155 public void approveReceivingDocsForPOAmendment(); 156 157 /** 158 * Returns a list of line item receiving documents in process for a purchase order 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 * @param receivingDocumentNumber 167 * @return 168 */ 169 public List<LineItemReceivingDocument> getLineItemReceivingDocumentsInFinalForPurchaseOrder(Integer poId); 170 171 172 /** 173 * Returns a list of correction receiving documents in process for a purchase order 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 }