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