Search in sources :

Example 1 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PP_Order_HUEditor_IssueTUs method doIt.

@Override
protected String doIt() throws Exception {
    final HUEditorRow row = getSingleSelectedRow();
    final I_M_HU sourceLUorTU = row.getM_HU();
    final HUsToNewTUsRequest request = HUsToNewTUsRequest.forSourceHuAndQty(sourceLUorTU, qtyTUs);
    final List<I_M_HU> extractedTUs = HUTransformService.newInstance().husToNewTUs(request);
    if (extractedTUs.isEmpty()) {
        throw new AdempiereException("@NoSelection@");
    }
    final PPOrderLinesView ppOrderView = getPPOrderView().get();
    final int ppOrderId = ppOrderView.getPP_Order_ID();
    Services.get(IHUPPOrderBL.class).createIssueProducer().setTargetOrderBOMLinesByPPOrderId(ppOrderId).createDraftIssues(extractedTUs);
    getView().invalidateAll();
    ppOrderView.invalidateAll();
    return MSG_OK;
}
Also used : IHUPPOrderBL(de.metas.handlingunits.pporder.api.IHUPPOrderBL) PPOrderLinesView(de.metas.ui.web.pporder.PPOrderLinesView) I_M_HU(de.metas.handlingunits.model.I_M_HU) AdempiereException(org.adempiere.exceptions.AdempiereException) HUsToNewTUsRequest(de.metas.handlingunits.allocation.transfer.HUTransformService.HUsToNewTUsRequest) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 2 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class PPOrderLinesLoader method createForPPOrderQty.

private PPOrderLineRow createForPPOrderQty(final I_PP_Order_Qty ppOrderQty, final boolean readonly) {
    final HUEditorRow huEditorRow = huEditorRepo.retrieveForHUId(ppOrderQty.getM_HU_ID());
    final HUEditorRow parentHUViewRecord = null;
    return createForHUViewRecordRecursively(ppOrderQty, huEditorRow, parentHUViewRecord, readonly);
}
Also used : HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 3 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewRepository method createPickedHURow.

/**
 * Creates a HU related picking slot row for the given HU editor row and the given {@code pickingSlotId}.
 *
 * @param from the hu editor row to create a picking slot row for. If it has included HU editor rows, then the method creates an included picking slot line accordingly.
 * @param pickingSlotId
 * @return
 */
private static final PickingSlotRow createPickedHURow(@NonNull final PickedHUEditorRow from, final int pickingSlotId) {
    final HUEditorRow huEditorRow = from.getHuEditorRow();
    final List<PickingSlotRow> includedHURows = huEditorRow.getIncludedRows().stream().map(includedHUEditorRow -> createPickedHURow(// create PickingSlotRows for the included HU rows which shall inherit the parent's processed flag
    new PickedHUEditorRow(includedHUEditorRow, from.isProcessed()), pickingSlotId)).collect(ImmutableList.toImmutableList());
    return PickingSlotRow.fromPickedHUBuilder().pickingSlotId(pickingSlotId).huId(huEditorRow.getHURowId().getHuId()).huStorageProductId(huEditorRow.getHURowId().getStorageProductId()).huEditorRowType(huEditorRow.getType()).processed(from.isProcessed()).huCode(huEditorRow.getValue()).product(huEditorRow.getProduct()).packingInfo(huEditorRow.getPackingInfo()).qtyCU(huEditorRow.getQtyCU()).topLevelHU(huEditorRow.isTopLevel()).includedHURows(includedHURows).build();
}
Also used : Iterables(com.google.common.collect.Iterables) LookupDataSourceFactory(de.metas.ui.web.window.model.lookup.LookupDataSourceFactory) ListMultimap(com.google.common.collect.ListMultimap) InterfaceWrapperHelper.loadOutOfTrx(org.adempiere.model.InterfaceWrapperHelper.loadOutOfTrx) Supplier(com.google.common.base.Supplier) Autowired(org.springframework.beans.factory.annotation.Autowired) I_M_ShipmentSchedule(de.metas.inoutcandidate.model.I_M_ShipmentSchedule) SqlLookupDescriptor(de.metas.ui.web.window.descriptor.sql.SqlLookupDescriptor) ImmutableList(com.google.common.collect.ImmutableList) DisplayType(org.compiere.util.DisplayType) Suppliers(com.google.common.base.Suppliers) I_M_PickingSlot(de.metas.picking.model.I_M_PickingSlot) IPickingSlotDAO(de.metas.picking.api.IPickingSlotDAO) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) IShipmentScheduleEffectiveBL(de.metas.inoutcandidate.api.IShipmentScheduleEffectiveBL) LookupDataSource(de.metas.ui.web.window.model.lookup.LookupDataSource) NonNull(lombok.NonNull) Collectors(java.util.stream.Collectors) Services(org.adempiere.util.Services) List(java.util.List) Component(org.springframework.stereotype.Component) Check(de.metas.printing.esb.base.util.Check) LookupScope(de.metas.ui.web.window.descriptor.LookupDescriptorProvider.LookupScope) DocumentFieldWidgetType(de.metas.ui.web.window.descriptor.DocumentFieldWidgetType) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow) PickingSlotQuery(de.metas.picking.api.IPickingSlotDAO.PickingSlotQuery) VisibleForTesting(com.google.common.annotations.VisibleForTesting) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow)

Example 4 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class PPOrderLinesLoader method createRowsForIssueProductSourceHUs.

private List<PPOrderLineRow> createRowsForIssueProductSourceHUs(int m_Warehouse_ID, @NonNull final List<PPOrderLineRow> bomLineRows) {
    final ImmutableSet<Integer> issueProductIds = bomLineRows.stream().filter(PPOrderLineRow::isIssue).map(PPOrderLineRow::getM_Product_ID).collect(ImmutableSet.toImmutableSet());
    final ImmutableList.Builder<PPOrderLineRow> result = ImmutableList.builder();
    final MatchingSourceHusQuery sourceHusQuery = MatchingSourceHusQuery.builder().productIds(issueProductIds).warehouseId(m_Warehouse_ID).build();
    for (final int sourceHUId : SourceHUsService.get().retrieveMatchingSourceHUIds(sourceHusQuery)) {
        final HUEditorRow huEditorRow = huEditorRepo.retrieveForHUId(sourceHUId);
        result.add(createRowForSourceHU(huEditorRow));
    }
    return result.build();
}
Also used : MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery) ImmutableList(com.google.common.collect.ImmutableList) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 5 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PP_Order_HUEditor_ProcessBase method retrieveEligibleHUEditorRows.

protected static final Stream<HUEditorRow> retrieveEligibleHUEditorRows(@NonNull final Stream<HUEditorRow> inputStream) {
    final SourceHUsService sourceHuService = SourceHUsService.get();
    final IHUPPOrderQtyDAO huPpOrderQtyDAO = Services.get(IHUPPOrderQtyDAO.class);
    return inputStream.filter(huRow -> huRow.isHUStatusActive()).filter(huRow -> !sourceHuService.isHuOrAnyParentSourceHu(huRow.getM_HU_ID())).filter(huRow -> !huPpOrderQtyDAO.isHuIdIssued(huRow.getM_HU_ID()));
}
Also used : HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) IHUPPOrderQtyDAO(de.metas.handlingunits.pporder.api.IHUPPOrderQtyDAO) NonNull(lombok.NonNull) PPOrderLinesView(de.metas.ui.web.pporder.PPOrderLinesView) SourceHUsService(de.metas.handlingunits.sourcehu.SourceHUsService) HUEditorProcessTemplate(de.metas.ui.web.handlingunits.HUEditorProcessTemplate) Services(org.adempiere.util.Services) Stream(java.util.stream.Stream) Adempiere(org.compiere.Adempiere) Optional(java.util.Optional) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) IViewsRepository(de.metas.ui.web.view.IViewsRepository) ViewId(de.metas.ui.web.view.ViewId) SourceHUsService(de.metas.handlingunits.sourcehu.SourceHUsService) IHUPPOrderQtyDAO(de.metas.handlingunits.pporder.api.IHUPPOrderQtyDAO)

Aggregations

HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)28 I_M_HU (de.metas.handlingunits.model.I_M_HU)8 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)6 List (java.util.List)5 NonNull (lombok.NonNull)5 Services (org.adempiere.util.Services)5 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)3 HUTransformService (de.metas.handlingunits.allocation.transfer.HUTransformService)3 IHUPPOrderBL (de.metas.handlingunits.pporder.api.IHUPPOrderBL)3 ITranslatableString (de.metas.i18n.ITranslatableString)3 Check (de.metas.printing.esb.base.util.Check)3 PickedHUEditorRow (de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow)3 PickingSlotRow (de.metas.ui.web.picking.pickingslot.PickingSlotRow)3 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)3 SqlLookupDescriptor (de.metas.ui.web.window.descriptor.sql.SqlLookupDescriptor)3 LookupDataSource (de.metas.ui.web.window.model.lookup.LookupDataSource)3 LookupDataSourceFactory (de.metas.ui.web.window.model.lookup.LookupDataSourceFactory)3 Comparator (java.util.Comparator)3 HashSet (java.util.HashSet)3 Nullable (javax.annotation.Nullable)3