use of com.qcadoo.mes.columnExtension.constants.ColumnAlignment in project mes by qcadoo.
the class OperationProductInTable method prepareOperationProductsValue.
private List<OperationProductHelper> prepareOperationProductsValue(Entity order, final List<Entity> operationProducts, final Set<Map.Entry<OperationProductColumn, ColumnAlignment>> alignments) {
List<OperationProductHelper> operationProductsValue = Lists.newArrayList();
for (Entity operationProduct : operationProducts) {
OperationProductHelper operationProductHelper = new OperationProductHelper();
List<OperationProductColumnHelper> operationProductColumnHelpers = Lists.newArrayList();
for (Map.Entry<OperationProductColumn, ColumnAlignment> e : alignments) {
String columnValue = e.getKey().getColumnValue(operationProduct);
if (StringUtils.isEmpty(columnValue)) {
columnValue = e.getKey().getColumnValueForOrder(order, operationProduct);
}
OperationProductColumnHelper operationProductColumnHelper = new OperationProductColumnHelper(e.getValue(), columnValue, e.getKey().getIdentifier());
operationProductColumnHelpers.add(operationProductColumnHelper);
}
operationProductHelper.setOperationProductColumnHelpers(operationProductColumnHelpers);
operationProductsValue.add(operationProductHelper);
}
return operationProductsValue;
}
use of com.qcadoo.mes.columnExtension.constants.ColumnAlignment in project mes by qcadoo.
the class OperationProductInTable method print.
public void print(final Entity workPlan, final GroupingContainer groupingContainer, final OrderOperationComponent orderOperationComponent, final Document document, final Locale locale) throws DocumentException {
Entity order = orderOperationComponent.getOrder();
Entity operationComponent = orderOperationComponent.getOperationComponent();
Map<Long, Map<OperationProductColumn, ColumnAlignment>> map = groupingContainer.getOperationComponentIdProductInColumnToAlignment();
Map<OperationProductColumn, ColumnAlignment> operationProductColumnAlignmentMap = map.get(operationComponent.getId());
int columnCount = operationProductColumnAlignmentMap.size();
Map<String, HeaderAlignment> headerAlignments = new HashMap<>(columnCount);
List<String> headers = new ArrayList<>(columnCount);
fill(locale, operationProductColumnAlignmentMap, headers, headerAlignments);
PdfPTable table = pdfHelper.createTableWithHeader(columnCount, headers, false, headerAlignments);
PdfPCell defaultCell = table.getDefaultCell();
List<OperationProductHelper> operationProductsValue = prepareOperationProductsValue(order, orderOperationComponent.getProductionCountingQuantitiesIn(), operationProductColumnAlignmentMap.entrySet());
operationProductsValue = workPlansService.sortByColumn(workPlan, operationProductsValue, headers);
for (OperationProductHelper operationProduct : operationProductsValue) {
for (OperationProductColumnHelper e : operationProduct.getOperationProductColumnHelpers()) {
alignColumn(defaultCell, e.getColumnAlignment());
table.addCell(operationProductPhrase(e.getValue()));
}
}
int additionalRows = workPlansService.getAdditionalRowsFromParameter(ParameterFieldsWP.ADDITIONAL_INPUT_ROWS);
for (int i = 0; i < additionalRows; i++) {
for (Map.Entry<OperationProductColumn, ColumnAlignment> e : operationProductColumnAlignmentMap.entrySet()) {
alignColumn(defaultCell, e.getValue());
table.addCell(" ");
}
}
table.setSpacingAfter(18);
table.setSpacingBefore(9);
document.add(table);
}
use of com.qcadoo.mes.columnExtension.constants.ColumnAlignment in project mes by qcadoo.
the class WorkPlanColumnServiceImpl method getOrderColumns.
@Override
public Map<OrderColumn, ColumnAlignment> getOrderColumns(final Entity workPlan) {
Map<OrderColumn, ColumnAlignment> orderColumnWithAlignment = Maps.newLinkedHashMap();
Map<String, OrderColumn> identifierOrderColumn = applicationContext.getBeansOfType(OrderColumn.class);
List<Entity> columns = getWorkPlanOrderColumns(workPlan);
for (Entity column : columns) {
Entity columnForOrders = getColumnForOrders(column);
String identifier = getIdentifier(columnForOrders);
ColumnAlignment alignment = getColumnAlignment(columnForOrders);
OrderColumn key = identifierOrderColumn.get(identifier);
if (Objects.nonNull(key)) {
orderColumnWithAlignment.put(key, alignment);
}
}
return orderColumnWithAlignment;
}
use of com.qcadoo.mes.columnExtension.constants.ColumnAlignment in project mes by qcadoo.
the class WorkPlanColumnServiceImpl method getOperationProductColumns.
private Map<Long, Map<OperationProductColumn, ColumnAlignment>> getOperationProductColumns(final Entity workPlan, final ProductDirection productDirection) {
Map<Long, Map<OperationProductColumn, ColumnAlignment>> operationComponentIdWithOperationProductColumnAndAlignment = Maps.newHashMap();
Map<String, OperationProductColumn> identifierOperationProductColumn = applicationContext.getBeansOfType(OperationProductColumn.class);
List<Entity> orders = getWorkPlanOrders(workPlan);
for (Entity order : orders) {
Entity technology = getOrderTechnology(order);
List<Entity> operationComponents = getSortedTechnologyOperationComponents(technology);
for (Entity operationComponent : operationComponents) {
List<Entity> columns = getOperationProductColumns(productDirection);
Map<OperationProductColumn, ColumnAlignment> operationProductColumnWithAlignment = Maps.newLinkedHashMap();
for (Entity column : columns) {
String identifier = getIdentifier(column);
ColumnAlignment alignment = getColumnAlignment(column);
OperationProductColumn key = identifierOperationProductColumn.get(identifier);
if (Objects.nonNull(key)) {
operationProductColumnWithAlignment.put(key, alignment);
}
}
operationComponentIdWithOperationProductColumnAndAlignment.put(operationComponent.getId(), operationProductColumnWithAlignment);
}
}
return operationComponentIdWithOperationProductColumnAndAlignment;
}
use of com.qcadoo.mes.columnExtension.constants.ColumnAlignment in project mes by qcadoo.
the class OperationProductOutTable method print.
public void print(final Entity workPlan, final GroupingContainer groupingContainer, final OrderOperationComponent orderOperationComponent, final Document document, final Locale locale) throws DocumentException {
Entity operationComponent = orderOperationComponent.getOperationComponent();
Map<Long, Map<OperationProductColumn, ColumnAlignment>> map = groupingContainer.getOperationComponentIdProductOutColumnToAlignment();
Map<OperationProductColumn, ColumnAlignment> operationProductColumnAlignmentMap = map.get(operationComponent.getId());
int columnCount = operationProductColumnAlignmentMap.size();
Map<String, HeaderAlignment> headerAlignments = new HashMap<String, HeaderAlignment>(columnCount);
List<String> headers = new ArrayList<String>(columnCount);
fill(locale, operationProductColumnAlignmentMap, headers, headerAlignments);
PdfPTable table = pdfHelper.createTableWithHeader(columnCount, headers, false, headerAlignments);
PdfPCell defaultCell = table.getDefaultCell();
List<OperationProductHelper> operationProductsValue = prepareOperationProductsValue(orderOperationComponent.getProductionCountingQuantitiesOut(), operationProductColumnAlignmentMap.entrySet());
operationProductsValue = workPlansService.sortByColumn(workPlan, operationProductsValue, headers);
for (OperationProductHelper operationProduct : operationProductsValue) {
for (OperationProductColumnHelper e : operationProduct.getOperationProductColumnHelpers()) {
alignColumn(defaultCell, e.getColumnAlignment());
table.addCell(operationProductPhrase(e.getValue()));
}
}
int additionalRows = workPlansService.getAdditionalRowsFromParameter(ParameterFieldsWP.ADDITIONAL_OUTPUT_ROWS);
for (int i = 0; i < additionalRows; i++) {
for (Map.Entry<OperationProductColumn, ColumnAlignment> e : operationProductColumnAlignmentMap.entrySet()) {
alignColumn(defaultCell, e.getValue());
table.addCell(" ");
}
}
table.setSpacingAfter(18);
table.setSpacingBefore(9);
document.add(table);
}
Aggregations