use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class PPOrderLinesLoader method createForHUViewRecordRecursively.
private PPOrderLineRow createForHUViewRecordRecursively(@NonNull final I_PP_Order_Qty ppOrderQty, @NonNull final HUEditorRow huEditorRow, @Nullable final HUEditorRow parentHUEditorRow, final boolean readonly) {
final Quantity quantity = computeQuantityForHuPPOrderLineRow(ppOrderQty, huEditorRow, parentHUEditorRow);
final ImmutableList<PPOrderLineRow> includedRows = huEditorRow.getIncludedRows().stream().map(includedHUEditorRow -> createForHUViewRecordRecursively(ppOrderQty, includedHUEditorRow, huEditorRow, readonly)).collect(ImmutableList.toImmutableList());
return PPOrderLineRow.builderForIssuedOrReceivedHU().rowId(huEditorRow.getId()).type(PPOrderLineType.ofHUEditorRowType(huEditorRow.getType())).ppOrderQty(ppOrderQty).processed(readonly || ppOrderQty.isProcessed()).attributesSupplier(huEditorRow.getAttributesSupplier()).code(huEditorRow.getValue()).product(huEditorRow.getProduct()).packingInfo(huEditorRow.getPackingInfo()).topLevelHU(huEditorRow.isTopLevel()).huStatus(huEditorRow.getHUStatus()).quantity(quantity).includedRows(includedRows).build();
}
use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class WEBUI_PickingSlotsClearingView_TakeOutTUAndAddToLU method doIt.
@Override
protected String doIt() throws Exception {
final PickingSlotRow pickingSlotRow = getSingleSelectedPickingSlotRow();
Check.assume(pickingSlotRow.isTU(), "Picking slot HU shall be a TU: {}", pickingSlotRow);
final I_M_HU tuHU = InterfaceWrapperHelper.load(pickingSlotRow.getHuId(), I_M_HU.class);
final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
Check.assume(packingHURow.isLU(), "Pack to HU shall be a LU: {}", packingHURow);
final I_M_HU luHU = packingHURow.getM_HU();
final BigDecimal qtyTU = BigDecimal.ONE;
final List<Integer> huIdsDestroyedCollector = new ArrayList<>();
HUTransformService.builder().emptyHUListener(EmptyHUListener.doBeforeDestroyed(hu -> huIdsDestroyedCollector.add(hu.getM_HU_ID()))).build().tuToExistingLU(tuHU, qtyTU, luHU);
// Remove from picking slots all destroyed HUs
pickingCandidateService.inactivateForHUIds(huIdsDestroyedCollector);
return MSG_OK;
}
use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class WEBUI_PickingSlotsClearingView_TakeOutTUAndAddToLU method checkPreconditionsApplicable.
@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable() {
// Validate the picking slots clearing selected row (left side)
if (!isSingleSelectedPickingSlotRow()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one picking slots HU");
}
final PickingSlotRow pickingSlotRow = getSingleSelectedPickingSlotRow();
if (!pickingSlotRow.isTU()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select a TU");
}
// Validate the packing HUs selected row (right side)
if (!isSingleSelectedPackingHUsRow()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one HU to pack to");
}
final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
if (!packingHURow.isLU()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select a LU to pack too");
}
//
return ProcessPreconditionsResolution.accept();
}
use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_HUEditor_IssueTopLevelHUs method doIt.
@Override
protected String doIt() throws Exception {
final Stream<HUEditorRow> selectedTopLevelHuRows = streamSelectedRows(HUEditorRowFilter.select(Select.ONLY_TOPLEVEL));
final List<I_M_HU> selectedEligibleRows = retrieveEligibleHUEditorRows(selectedTopLevelHuRows).map(HUEditorRow::getM_HU).collect(ImmutableList.toImmutableList());
final HUEditorView huEditorView = getView();
if (selectedEligibleRows.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(selectedEligibleRows);
huEditorView.removeHUsAndInvalidate(selectedEligibleRows);
ppOrderView.invalidateAll();
return MSG_OK;
}
use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class WEBUI_PickingSlotsClearingView_TakeOutCUsAndAddToTU method getTargetTU.
private I_M_HU getTargetTU() {
final HUEditorRow huRow = getSingleSelectedPackingHUsRow();
Check.assume(huRow.isTU(), "row {} shall be a TU", huRow);
return huRow.getM_HU();
}
Aggregations