use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class LineChangeoverNormsForOrderDetailsViewHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FieldComponent productionLineField = (FieldComponent) view.getComponentByReference(OrderFields.PRODUCTION_LINE);
LookupComponent previousOrderLookup = (LookupComponent) view.getComponentByReference(OrderFieldsLCNFO.PREVIOUS_ORDER);
LookupComponent lineChangeoverNormLookup = (LookupComponent) view.getComponentByReference(OrderFieldsLCNFO.LINE_CHANGEOVER_NORM);
FieldComponent previousOrderTechnologyGroupNumberField = (FieldComponent) view.getComponentByReference("previousOrderTechnologyGroupNumber");
FieldComponent technologyGroupNumberField = (FieldComponent) view.getComponentByReference("technologyGroupNumber");
FieldComponent previousOrderTechnologyNumberField = (FieldComponent) view.getComponentByReference("previousOrderTechnologyNumber");
FieldComponent technologyNumberField = (FieldComponent) view.getComponentByReference("technologyNumber");
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup orders = window.getRibbon().getGroupByName("orders");
RibbonGroup lineChangeoverNorms = window.getRibbon().getGroupByName("lineChangeoverNorms");
RibbonActionItem showPreviousOrder = orders.getItemByName("showPreviousOrder");
RibbonActionItem showBestFittingLineChangeoverNorm = lineChangeoverNorms.getItemByName("showBestFittingLineChangeoverNorm");
RibbonActionItem showChangeoverNormForGroup = lineChangeoverNorms.getItemByName("showLineChangeoverNormForGroup");
RibbonActionItem showChangeoverNormForTechnology = lineChangeoverNorms.getItemByName("showLineChangeoverNormForTechnology");
Entity productionLine = lineChangeoverNormsForOrdersService.getProductionLineFromDB((Long) productionLineField.getFieldValue());
boolean hasDefinedPreviousOrder = !previousOrderLookup.isEmpty();
updateButtonState(showPreviousOrder, hasDefinedPreviousOrder);
boolean hasMatchingChangeoverNorm = !lineChangeoverNormLookup.isEmpty();
updateButtonState(showBestFittingLineChangeoverNorm, hasMatchingChangeoverNorm);
if (StringUtils.isEmpty((String) previousOrderTechnologyGroupNumberField.getFieldValue()) || StringUtils.isEmpty((String) technologyGroupNumberField.getFieldValue())) {
updateButtonState(showChangeoverNormForGroup, false);
} else {
Entity fromTechnologyGroup = lineChangeoverNormsForOrdersService.getTechnologyGroupByNumberFromDB((String) previousOrderTechnologyGroupNumberField.getFieldValue());
Entity toTechnologyGroup = lineChangeoverNormsForOrdersService.getTechnologyGroupByNumberFromDB((String) technologyGroupNumberField.getFieldValue());
if ((changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyGroupWithLine(fromTechnologyGroup, toTechnologyGroup, productionLine) == null) && (changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyGroupWithLine(fromTechnologyGroup, toTechnologyGroup, null) == null)) {
updateButtonState(showChangeoverNormForGroup, false);
} else {
updateButtonState(showChangeoverNormForGroup, true);
}
}
if (StringUtils.isEmpty((String) previousOrderTechnologyNumberField.getFieldValue()) || StringUtils.isEmpty((String) technologyNumberField.getFieldValue())) {
updateButtonState(showChangeoverNormForTechnology, false);
} else {
Entity fromTechnology = lineChangeoverNormsForOrdersService.getTechnologyByNumberFromDB((String) previousOrderTechnologyNumberField.getFieldValue());
Entity toTechnology = lineChangeoverNormsForOrdersService.getTechnologyByNumberFromDB((String) technologyNumberField.getFieldValue());
if ((changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyWithLine(fromTechnology, toTechnology, productionLine) == null) && (changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyWithLine(fromTechnology, toTechnology, null) == null)) {
updateButtonState(showChangeoverNormForTechnology, false);
} else {
updateButtonState(showChangeoverNormForTechnology, true);
}
}
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class DetailedProductionCountingAndProgressListHooksBPC method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
String releaseOfMaterials = parameterService.getParameter().getStringField(ParameterFieldsPC.RELEASE_OF_MATERIALS);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup issueRibbonGroup = ribbon.getGroupByName(L_ISSUE);
RibbonActionItem resourceIssueRibbonActionItem = issueRibbonGroup.getItemByName(L_RESOURCE_ISSUE);
if (!ReleaseOfMaterials.MANUALLY_TO_ORDER_OR_GROUP.getStringValue().equals(releaseOfMaterials)) {
resourceIssueRibbonActionItem.setEnabled(false);
resourceIssueRibbonActionItem.setMessage("basicProductionCounting.detailedProductionCountingAndProgressList.resourceIssue.description");
resourceIssueRibbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class ProductionTrackingServiceImplTest method init.
@Before
public void init() {
MockitoAnnotations.initMocks(this);
productionTrackingService = new ProductionTrackingServiceImpl();
given(view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT)).willReturn(technologyOperationComponentLookup);
given(view.getComponentByReference(QcadooViewConstants.L_WINDOW)).willReturn(window);
given(window.getRibbon()).willReturn(ribbon);
RibbonGroup workTimeGroup = mock(RibbonGroup.class);
given(ribbon.getGroupByName("workTime")).willReturn(workTimeGroup);
given(workTimeGroup.getItemByName("calcTotalLaborTime")).willReturn(calcTotalLaborTimeRibbonBtn);
FormComponent form = mock(FormComponent.class);
given(view.getComponentByReference(QcadooViewConstants.L_FORM)).willReturn(form);
given(form.getEntity()).willReturn(order);
given(form.getPersistedEntityWithIncludedFormValues()).willReturn(order);
given(view.getComponentByReference(L_TIME_TAB)).willReturn(timeTab);
given(view.getComponentByReference(L_PIECEWORK_TAB)).willReturn(pieceworkTab);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class OperationDurationDetailsInOrderHooks method disableCopyRealizationTimeButton.
private void disableCopyRealizationTimeButton(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup realizationTimeGroup = window.getRibbon().getGroupByName("operationDuration");
RibbonActionItem realizationTime = realizationTimeGroup.getItemByName("copy");
if (isGenerated(view)) {
realizationTime.setEnabled(true);
} else {
realizationTime.setEnabled(false);
}
realizationTime.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class OperationDurationDetailsInOrderHooks method disableCreateButton.
void disableCreateButton(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup operationalTasks = window.getRibbon().getGroupByName(L_OPERATIONAL_TASKS);
RibbonActionItem createOperationalTasks = operationalTasks.getItemByName(L_CREATE_OPERATIONAL_TASKS);
if (isGenerated(view) && orderHasTechnologyAndCorrectState(view)) {
createOperationalTasks.setEnabled(true);
} else {
createOperationalTasks.setEnabled(false);
}
createOperationalTasks.requestUpdate(true);
}
Aggregations