Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions grails-app/controllers/org/pih/warehouse/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,12 @@ class UrlMappings {
action = [GET: "refreshFilteredBinLocations"]
}

// Custom: putaway-document-upload
"/api/custom/putaways/$id/documents"(parseRequest: true) {
controller = "customPutawayDocument"
action = [GET: "list", POST: "upload"]
}

// Requirement API

"/api/requirements"(parseRequest: true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package org.pih.warehouse.custom.putawayDocuments

import grails.converters.JSON
import org.pih.warehouse.custom.stockTransferDocuments.UploadValidationException
import org.pih.warehouse.order.Order
import org.springframework.context.i18n.LocaleContextHolder
import org.springframework.web.multipart.MultipartFile
import org.springframework.web.multipart.MultipartHttpServletRequest

class CustomPutawayDocumentController {

def customPutawayDocumentService
def messageSource

def list() {
Order order = Order.get(params.id)
if (!order) {
response.status = 404
render([errorMessage: "No putaway found for order ID ${params.id}"] as JSON)
return
}

render([
data: [
documentRequired: customPutawayDocumentService.isDocumentRequired(params.id),
documents : customPutawayDocumentService.listDocuments(params.id),
],
] as JSON)
}

def upload() {
MultipartFile fileContents = (request instanceof MultipartHttpServletRequest)
? (request as MultipartHttpServletRequest).getFile("fileContents")
: null
if (!fileContents || fileContents.empty) {
response.status = 400
render([errorMessage: "fileContents is required"] as JSON)
return
}

try {
customPutawayDocumentService.uploadDocument(params.id, fileContents)
render([data: "Document was uploaded successfully"] as JSON)
} catch (UploadValidationException ex) {
log.warn "custom_putaway_document_upload_rejected putawayId=${params.id}" +
" code=${ex.messageCode} originalFilename=${fileContents.originalFilename}" +
" contentType=${fileContents.contentType} size=${fileContents.size}"
response.status = 400
render([errorMessage: resolveMessage(ex)] as JSON)
} catch (IllegalArgumentException ex) {
log.warn "custom_putaway_document_upload_bad_request putawayId=${params.id} message=${ex.message}"
response.status = 404
render([errorMessage: ex.message] as JSON)
} catch (Exception ex) {
log.error "custom_putaway_document_upload_failed putawayId=${params.id}", ex
response.status = 500
render([errorMessage: 'Document upload failed. Please try again.'] as JSON)
}
}

private String resolveMessage(UploadValidationException ex) {
try {
return messageSource.getMessage(
ex.messageCode,
ex.messageArgs,
ex.message,
LocaleContextHolder.locale)
} catch (Exception ignore) {
return ex.message
}
}
}
9 changes: 5 additions & 4 deletions grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ enum.ActivityCode.ENABLE_FULFILLER_APPROVAL_NOTIFICATIONS=Enable fulfiller appro
enum.ActivityCode.PACK_SHIPMENT=Pack shipment
enum.ActivityCode.PARTIAL_RECEIVING=Partial receiving
enum.ActivityCode.REQUIRE_ACCOUNTING=Require accounting
enum.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=Require document on outbound stock transfer
enum.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=Require document on inbound stock transfer
enum.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=Require document on outbound
enum.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=Require document on inbound
enum.ActivityCode.ENABLE_CENTRAL_PURCHASING=Enable central purchasing
enum.ActivityCode.HOLD_STOCK=Hold stock
enum.ActivityCode.SUBMIT_REQUEST=Submit request
Expand Down Expand Up @@ -4330,8 +4330,8 @@ react.locationsConfiguration.ActivityCode.ENABLE_NOTIFICATIONS=Enable Notificati
react.locationsConfiguration.ActivityCode.PACK_SHIPMENT=Pack shipment
react.locationsConfiguration.ActivityCode.PARTIAL_RECEIVING=Partial receiving
react.locationsConfiguration.ActivityCode.REQUIRE_ACCOUNTING=Require accounting
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=Require document on outbound stock transfer
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=Require document on inbound stock transfer
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=Require document on outbound
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=Require document on inbound
react.locationsConfiguration.ActivityCode.ENABLE_CENTRAL_PURCHASING=Enable central purchasing
react.locationsConfiguration.ActivityCode.HOLD_STOCK=Hold stock
react.locationsConfiguration.ActivityCode.SUBMIT_REQUEST=Submit request
Expand Down Expand Up @@ -4961,3 +4961,4 @@ customStockTransferDocument.upload.invalidFilename.error=File name is missing or
react.custom.stockTransferDocuments.upload.invalidType.error=Unsupported file type. Allowed: PDF, image, Word, Excel, CSV, ZIP.
react.custom.stockTransferDocuments.upload.tooLarge.error=File is too large.
react.custom.stockTransferDocuments.upload.invalidFilename.error=File name is missing or invalid.
react.custom.putawayDocuments.required.warning=A document must be attached before this putaway can be completed
9 changes: 5 additions & 4 deletions grails-app/i18n/messages_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ enum.ActivityCode.ENABLE_FULFILLER_APPROVAL_NOTIFICATIONS=\u0412\u043a\u043b\u04
enum.ActivityCode.PACK_SHIPMENT=\u041f\u0430\u043a\u0435\u0442\u043d\u0430\u044f \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0430
enum.ActivityCode.PARTIAL_RECEIVING=\u0427\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u0435\u043c
enum.ActivityCode.REQUIRE_ACCOUNTING=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0441\u043a\u0438\u0439 \u0443\u0447\u0435\u0442
enum.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0442\u043e\u0432\u0430\u0440\u0430
enum.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0442\u043e\u0432\u0430\u0440\u0430
enum.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445
enum.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445
enum.ActivityCode.ENABLE_CENTRAL_PURCHASING=\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u0443\u043f\u043a\u0438
enum.ActivityCode.HOLD_STOCK=\u0414\u0435\u0440\u0436\u0438\u0442\u0435 \u0437\u0430\u043f\u0430\u0441
enum.ActivityCode.SUBMIT_REQUEST=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441
Expand Down Expand Up @@ -4297,8 +4297,8 @@ react.locationsConfiguration.ActivityCode.ENABLE_NOTIFICATIONS=\u0412\u043a\u043
react.locationsConfiguration.ActivityCode.PACK_SHIPMENT=\u041f\u0430\u043a\u0435\u0442\u043d\u0430\u044f \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0430
react.locationsConfiguration.ActivityCode.PARTIAL_RECEIVING=\u0427\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u0435\u043c
react.locationsConfiguration.ActivityCode.REQUIRE_ACCOUNTING=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0441\u043a\u0438\u0439 \u0443\u0447\u0435\u0442
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0442\u043e\u0432\u0430\u0440\u0430
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0442\u043e\u0432\u0430\u0440\u0430
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445
react.locationsConfiguration.ActivityCode.ENABLE_CENTRAL_PURCHASING=\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u0443\u043f\u043a\u0438
react.locationsConfiguration.ActivityCode.HOLD_STOCK=\u0414\u0435\u0440\u0436\u0438\u0442\u0435 \u0437\u0430\u043f\u0430\u0441
react.locationsConfiguration.ActivityCode.SUBMIT_REQUEST=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441
Expand Down Expand Up @@ -4919,3 +4919,4 @@ customStockTransferDocument.upload.invalidFilename.error=\u0418\u043c\u044f \u04
react.custom.stockTransferDocuments.upload.invalidType.error=\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0444\u0430\u0439\u043b\u0430. \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b: PDF, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, Word, Excel, CSV, ZIP.
react.custom.stockTransferDocuments.upload.tooLarge.error=\u0424\u0430\u0439\u043b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439.
react.custom.stockTransferDocuments.upload.invalidFilename.error=\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.
react.custom.putawayDocuments.required.warning=\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442
9 changes: 5 additions & 4 deletions grails-app/i18n/messages_tg.properties
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ enum.ActivityCode.ENABLE_FULFILLER_APPROVAL_NOTIFICATIONS=\u041e\u0433\u043e\u04
enum.ActivityCode.PACK_SHIPMENT=\u0418\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0431\u0430\u0441\u0442\u0430\u0431\u0430\u043d\u0434\u04e3
enum.ActivityCode.PARTIAL_RECEIVING=\u049a\u0438\u0441\u043c\u0430\u043d \u049b\u0430\u0431\u0443\u043b
enum.ActivityCode.REQUIRE_ACCOUNTING=\u0411\u0430\u04b3\u0438\u0441\u043e\u0431\u0433\u0438\u0440\u0438\u0438 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0440\u043e \u0442\u0430\u043b\u0430\u0431 \u043a\u0443\u043d\u0435\u0434
enum.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0437\u0430\u0445\u0438\u0440\u0430\u0438 \u0431\u0435\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
enum.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0437\u0430\u0445\u0438\u0440\u0430\u0438 \u0434\u0430\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
enum.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0431\u0435\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
enum.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0434\u0430\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
enum.ActivityCode.ENABLE_CENTRAL_PURCHASING=\u0425\u0430\u0440\u0438\u0434\u0438 \u043c\u0430\u0440\u043a\u0430\u0437\u0438\u0440\u043e \u0444\u0430\u044a\u043e\u043b \u0441\u043e\u0437\u0435\u0434
enum.ActivityCode.HOLD_STOCK=\u0417\u0430\u0445\u0438\u0440\u0430 \u043d\u0438\u0433\u043e\u04b3 \u0434\u043e\u0440\u0435\u0434
enum.ActivityCode.SUBMIT_REQUEST=\u041f\u0435\u0448\u043d\u0438\u04b3\u043e\u0434\u0438 \u0434\u0430\u0440\u0445\u043e\u0441\u0442
Expand Down Expand Up @@ -4297,8 +4297,8 @@ react.locationsConfiguration.ActivityCode.ENABLE_NOTIFICATIONS=\u041e\u0433\u043
react.locationsConfiguration.ActivityCode.PACK_SHIPMENT=\u0418\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0431\u0430\u0441\u0442\u0430\u0431\u0430\u043d\u0434\u04e3
react.locationsConfiguration.ActivityCode.PARTIAL_RECEIVING=\u049a\u0438\u0441\u043c\u0430\u043d \u049b\u0430\u0431\u0443\u043b
react.locationsConfiguration.ActivityCode.REQUIRE_ACCOUNTING=\u0411\u0430\u04b3\u0438\u0441\u043e\u0431\u0433\u0438\u0440\u0438\u0438 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0440\u043e \u0442\u0430\u043b\u0430\u0431 \u043a\u0443\u043d\u0435\u0434
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0437\u0430\u0445\u0438\u0440\u0430\u0438 \u0431\u0435\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0437\u0430\u0445\u0438\u0440\u0430\u0438 \u0434\u0430\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_OUT_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0431\u0435\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
react.locationsConfiguration.ActivityCode.REQUIRE_TRANSFER_IN_DOCUMENT=\u0411\u0430\u0440\u043e\u0438 \u0438\u043d\u0442\u0438\u049b\u043e\u043b\u0438 \u0434\u0430\u0440\u0443\u043d\u04e3 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0442\u0430\u043b\u0430\u0431 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
react.locationsConfiguration.ActivityCode.ENABLE_CENTRAL_PURCHASING=\u0425\u0430\u0440\u0438\u0434\u0438 \u043c\u0430\u0440\u043a\u0430\u0437\u0438\u0440\u043e \u0444\u0430\u044a\u043e\u043b \u0441\u043e\u0437\u0435\u0434
react.locationsConfiguration.ActivityCode.HOLD_STOCK=\u0417\u0430\u0445\u0438\u0440\u0430 \u043d\u0438\u0433\u043e\u04b3 \u0434\u043e\u0440\u0435\u0434
react.locationsConfiguration.ActivityCode.SUBMIT_REQUEST=\u041f\u0435\u0448\u043d\u0438\u04b3\u043e\u0434\u0438 \u0434\u0430\u0440\u0445\u043e\u0441\u0442
Expand Down Expand Up @@ -4919,3 +4919,4 @@ customStockTransferDocument.upload.invalidFilename.error=\u041d\u043e\u043c\u043
react.custom.stockTransferDocuments.upload.invalidType.error=\u041d\u0430\u0432\u044a\u0438 \u0444\u0430\u0439\u043b\u0438 \u0434\u0430\u0441\u0442\u0433\u0438\u0440\u043d\u0430\u0448\u0430\u0432\u0430\u043d\u0434\u0430. \u0418\u04b7\u043e\u0437\u0430\u0442 \u0434\u043e\u0434\u0430 \u0448\u0443\u0434\u0430\u0430\u0441\u0442: PDF, \u0442\u0430\u0441\u0432\u0438\u0440, Word, Excel, CSV, ZIP.
react.custom.stockTransferDocuments.upload.tooLarge.error=\u0424\u0430\u0439\u043b \u0430\u0437 \u04b3\u0430\u0434 \u0437\u0438\u0451\u0434 \u043a\u0430\u043b\u043e\u043d \u0430\u0441\u0442.
react.custom.stockTransferDocuments.upload.invalidFilename.error=\u041d\u043e\u043c\u0438 \u0444\u0430\u0439\u043b \u043d\u0435\u0441\u0442 \u0451 \u043d\u043e\u0434\u0443\u0440\u0443\u0441\u0442 \u0430\u0441\u0442.
react.custom.putawayDocuments.required.warning=\u041f\u0435\u0448 \u0430\u0437 \u043e\u043d \u043a\u0438 \u0438\u043d \u04b7\u043e\u0431\u0430\u04b7\u043e\u0433\u0443\u0437\u043e\u0440\u04e3 \u0430\u043d\u04b7\u043e\u043c \u0434\u043e\u0434\u0430 \u0448\u0430\u0432\u0430\u0434, \u0431\u043e\u044f\u0434 \u04b3\u0443\u04b7\u04b7\u0430\u0442 \u0437\u0430\u043c\u0438\u043c\u0430 \u043a\u0430\u0440\u0434\u0430 \u0448\u0430\u0432\u0430\u0434
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.pih.warehouse.custom.putawayDocuments

import grails.gorm.transactions.Transactional
import org.pih.warehouse.api.Putaway
import org.pih.warehouse.custom.stockTransferDocuments.CustomStockTransferDocumentService
import org.pih.warehouse.order.Order
import org.springframework.web.multipart.MultipartFile

@Transactional
class CustomPutawayDocumentService {

CustomStockTransferDocumentService customStockTransferDocumentService

Boolean isDocumentRequired(String putawayId) {
Order order = Order.get(putawayId)
return order ? customStockTransferDocumentService.isDocumentRequired(order) : false
}

List<Map> listDocuments(String putawayId) {
Order order = Order.get(putawayId)
return order ? customStockTransferDocumentService.listDocuments(order) : []
}

Order uploadDocument(String putawayId, MultipartFile fileContents) {
return customStockTransferDocumentService.uploadDocument(putawayId, fileContents)
}

// Skips validation when the underlying Order doesn't exist yet β€” supporting docs can only be
// attached to a saved putaway, so a missing Order can't have a missing-document state.
void validateForCompletion(Putaway putaway) {
if (!putaway?.id) {
return
}
Order order = Order.get(putaway.id)
if (!order) {
return
}
customStockTransferDocumentService.validateForCompletion(order)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PutawayService {
LocationService locationService
InventoryService inventoryService
def productAvailabilityService
def customPutawayDocumentService
GrailsApplication grailsApplication

def getPutawayCandidates(Location location) {
Expand Down Expand Up @@ -136,6 +137,7 @@ class PutawayService {


Order completePutaway(Putaway putaway) {
customPutawayDocumentService.validateForCompletion(putaway)
validatePutaway(putaway)

// Save the putaway as a transfer order
Expand Down
Loading