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;
}
Aggregations