Search in sources :

Example 1 with DocumentsStatus

use of com.qcadoo.mes.productFlowThruDivision.constants.DocumentsStatus in project mes by qcadoo.

the class WarehouseIssueDocumentsService method createWarehouseDocument.

public CreationDocumentResponse createWarehouseDocument(final Entity locationFrom, final Entity locationTo, final Collection positions, final String additionalInfo) {
    List<Entity> _issues = Lists.newArrayList(positions);
    for (Entity issue : _issues) {
        reservationsServiceForProductsToIssue.onIssue(issue);
    }
    DrawnDocuments drawnDocument = warehouseIssueParameterService.getDrawnDocument();
    DocumentsStatus documentsStatus = warehouseIssueParameterService.getDocuemtStatusCreatedDocuemnt();
    CreationDocumentResponse response = null;
    switch(drawnDocument) {
        case RECEIPT_RELEASE:
            response = buildReceiptReleasePairDocuments(locationFrom, locationTo, positions, documentsStatus, additionalInfo);
            break;
        case TRANSFER:
            response = buildTransferDocument(locationFrom, locationTo, positions, documentsStatus, additionalInfo);
            break;
    }
    if (response == null) {
        response = new CreationDocumentResponse(false);
    }
    if (!response.isValid()) {
        for (Entity issue : _issues) {
            reservationsServiceForProductsToIssue.onIssueCompensation(issue);
        }
    }
    return response;
}
Also used : Entity(com.qcadoo.model.api.Entity) DrawnDocuments(com.qcadoo.mes.productFlowThruDivision.constants.DrawnDocuments) DocumentsStatus(com.qcadoo.mes.productFlowThruDivision.constants.DocumentsStatus) CreationDocumentResponse(com.qcadoo.mes.productFlowThruDivision.warehouseIssue.CreationDocumentResponse)

Aggregations

DocumentsStatus (com.qcadoo.mes.productFlowThruDivision.constants.DocumentsStatus)1 DrawnDocuments (com.qcadoo.mes.productFlowThruDivision.constants.DrawnDocuments)1 CreationDocumentResponse (com.qcadoo.mes.productFlowThruDivision.warehouseIssue.CreationDocumentResponse)1 Entity (com.qcadoo.model.api.Entity)1