use of de.metas.ui.web.handlingunits.process.WebuiHUTransformCommand.ActionType in project metasfresh-webui-api by metasfresh.
the class WebuiHUTransformParametersFiller method getTUsLookupValues_All.
private LookupValuesList getTUsLookupValues_All(final LookupDataSourceContext context) {
final ActionType actionType = getActionType();
if (actionType == ActionType.CU_To_ExistingTU) {
// TODO: cache the descriptor
// TODO: filter by TUs
// TODO: search by barcode too
final LookupDescriptor lookupDescriptor = SqlLookupDescriptor.builder().setCtxTableName(// ctxTableName
null).setCtxColumnName("M_HU_ID").setDisplayType(DisplayType.Search).buildForDefaultScope();
LookupDataSource dataSource = LookupDataSourceFactory.instance.getLookupDataSource(lookupDescriptor);
final LookupValuesList result = dataSource.findEntities(context, context.getFilter(), context.getOffset(0), context.getLimit(10));
return result;
}
return LookupValuesList.EMPTY;
}
use of de.metas.ui.web.handlingunits.process.WebuiHUTransformCommand.ActionType in project metasfresh-webui-api by metasfresh.
the class WebuiHUTransformParametersFiller method getLUsLookupValues_All.
private LookupValuesList getLUsLookupValues_All(final LookupDataSourceContext context) {
final ActionType actionType = getActionType();
if (actionType == ActionType.TU_To_ExistingLU) {
// TODO: cache the descriptor
// TODO: filter by LUs
// TODO: search by barcode too
final LookupDescriptor lookupDescriptor = SqlLookupDescriptor.builder().setCtxTableName(// ctxTableName
null).setCtxColumnName("M_HU_ID").setDisplayType(DisplayType.Search).buildForDefaultScope();
LookupDataSource dataSource = LookupDataSourceFactory.instance.getLookupDataSource(lookupDescriptor);
final LookupValuesList result = dataSource.findEntities(context, context.getFilter(), context.getOffset(0), context.getLimit(10));
return result;
} else {
return LookupValuesList.EMPTY;
}
}
use of de.metas.ui.web.handlingunits.process.WebuiHUTransformCommand.ActionType in project metasfresh-webui-api by metasfresh.
the class WebuiHUTransformParametersFiller method getM_HU_PI_Item_IDs.
public LookupValuesList getM_HU_PI_Item_IDs() {
final ActionType actionType = getActionType();
if (actionType != ActionType.TU_To_NewLUs) {
return LookupValuesList.EMPTY;
}
final HUEditorRow tuRow = getSelectedRow();
final I_M_HU tuHU = tuRow.getM_HU();
final I_M_HU_PI_Version effectivePIVersion = handlingUnitsBL.getEffectivePIVersion(tuHU);
Check.errorIf(effectivePIVersion == null, "tuHU is inconsistent; hu={}", tuHU);
final List<I_M_HU_PI_Item> luPIItems = handlingUnitsDAO.retrieveParentPIItemsForParentPI(effectivePIVersion.getM_HU_PI(), null, tuHU.getC_BPartner());
return luPIItems.stream().filter(luPIItem -> luPIItem.getM_HU_PI_Version().isCurrent() && luPIItem.getM_HU_PI_Version().isActive() && luPIItem.getM_HU_PI_Version().getM_HU_PI().isActive()).map(luPIItem -> IntegerLookupValue.of(luPIItem.getM_HU_PI_Item_ID(), WEBUI_ProcessHelper.buildHUPIItemString(luPIItem))).sorted(Comparator.comparing(IntegerLookupValue::getDisplayName)).collect(LookupValuesList.collect());
}
Aggregations