use of de.metas.picking.model.I_M_PickingSlot in project metasfresh-webui-api by metasfresh.
the class PickingHUsRepositoryTests method createPickingSlot.
private static final I_M_PickingSlot createPickingSlot(final boolean pickingRackSystem) {
final I_M_PickingSlot pickingSlot = newInstance(I_M_PickingSlot.class);
pickingSlot.setIsPickingRackSystem(pickingRackSystem);
save(pickingSlot);
return pickingSlot;
}
use of de.metas.picking.model.I_M_PickingSlot in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewRepositoryTests method testRetrievePickingSlotRows_One_TU_with_CU.
@Test
public void testRetrievePickingSlotRows_One_TU_with_CU() {
final I_M_ShipmentSchedule shipmentSchedule = newInstance(I_M_ShipmentSchedule.class);
save(shipmentSchedule);
final I_M_PickingSlot pickingSlot = newInstance(I_M_PickingSlot.class);
save(pickingSlot);
final boolean pickingSlotRowProcessed = false;
final PickingSlotRepoQuery query = PickingSlotRepoQuery.of(shipmentSchedule.getM_ShipmentSchedule_ID());
// set up a picked TU with a CU to be returned by the pickingHUsRepo.
{
final ListMultimap<Integer, PickedHUEditorRow> husIndexedByPickingSlotId = ImmutableListMultimap.of(pickingSlot.getM_PickingSlot_ID(), new PickedHUEditorRow(HUEditorRow.builder(WindowId.of(423)).setRowId(HUEditorRowId.ofTopLevelHU(100)).setType(HUEditorRowType.TU).setTopLevel(true).addIncludedRow(HUEditorRow.builder(WindowId.of(423)).setRowId(HUEditorRowId.ofHU(101, 100)).setType(HUEditorRowType.VHU).setTopLevel(false).build()).build(), pickingSlotRowProcessed));
// @formatter:off return an empty list
new Expectations() {
{
pickingHUsRepo.retrievePickedHUsIndexedByPickingSlotId(query);
result = husIndexedByPickingSlotId;
}
};
// @formatter:on
}
final PickingSlotViewRepository pickingSlotViewRepository = createPickingSllotViewRepository();
final List<PickingSlotRow> rowsByShipmentScheduleId = pickingSlotViewRepository.retrievePickingSlotRows(query);
assertThat(rowsByShipmentScheduleId.size(), is(1));
final PickingSlotRow pickingSlotRow = rowsByShipmentScheduleId.get(0);
assertThat(pickingSlotRow.isPickingSlotRow(), is(true));
assertThat(pickingSlotRow.isPickedHURow(), is(false));
assertThat(pickingSlotRow.isProcessed(), is(pickingSlotRowProcessed));
assertThat(pickingSlotRow.getIncludedRows().size(), is(1));
final PickingSlotRow tuRow = pickingSlotRow.getIncludedRows().get(0);
assertThat(tuRow.isPickingSlotRow(), is(false));
assertThat(tuRow.isPickedHURow(), is(true));
assertThat(tuRow.getHuId(), is(100));
assertThat(tuRow.getIncludedRows().size(), is(1));
final PickingSlotRow whuRow = tuRow.getIncludedRows().get(0);
assertThat(whuRow.isPickingSlotRow(), is(false));
assertThat(whuRow.isPickedHURow(), is(true));
assertThat(whuRow.getHuId(), is(101));
}
use of de.metas.picking.model.I_M_PickingSlot in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_HU_Pick_ParametersFiller method getPickingSlotValues.
public LookupValuesList getPickingSlotValues(@NonNull final LookupDataSourceContext context) {
if (shipmentScheduleId <= 0) {
return LookupValuesList.EMPTY;
}
final IShipmentScheduleEffectiveBL shipmentScheduleEffectiveBL = Services.get(IShipmentScheduleEffectiveBL.class);
final I_M_ShipmentSchedule shipmentSchedule = load(shipmentScheduleId, I_M_ShipmentSchedule.class);
final PickingSlotQuery pickingSlotQuery = PickingSlotQuery.builder().availableForBPartnerId(shipmentScheduleEffectiveBL.getC_BP_Location_ID(shipmentSchedule)).availableForBPartnerLocationId(shipmentScheduleEffectiveBL.getC_BP_Location_ID(shipmentSchedule)).build();
final List<I_M_PickingSlot> availablePickingSlots = Services.get(IPickingSlotDAO.class).retrievePickingSlots(pickingSlotQuery);
return availablePickingSlots.stream().map(pickingSlot -> IntegerLookupValue.of(pickingSlot.getM_PickingSlot_ID(), createPickingSlotLabel(pickingSlot))).collect(LookupValuesList.collect());
}
use of de.metas.picking.model.I_M_PickingSlot in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewRepositoryTests method testRetrievePickingSlotRows_No_HUs_show_PickingSlotsOnly.
/**
* Verifies {@link PickingSlotViewRepository#retrieveRows(PickingSlotRepoQuery)}<br>
* when there are no HUs (no picking candidates) assigned to a picking slot, but still the picking slot itself shall be shown.
*/
@Test
public void testRetrievePickingSlotRows_No_HUs_show_PickingSlotsOnly() {
final I_M_ShipmentSchedule shipmentSchedule = newInstance(I_M_ShipmentSchedule.class);
save(shipmentSchedule);
final I_M_PickingSlot pickingSlot = newInstance(I_M_PickingSlot.class);
pickingSlot.setIsPickingRackSystem(true);
save(pickingSlot);
final PickingSlotRepoQuery query = PickingSlotRepoQuery.of(shipmentSchedule.getM_ShipmentSchedule_ID());
// @formatter:off return an empty list
new Expectations() {
{
pickingHUsRepo.retrievePickedHUsIndexedByPickingSlotId(query);
result = ImmutableListMultimap.of();
}
};
// @formatter:on
final NullLookupDataSource nullDS = NullLookupDataSource.instance;
final PickingSlotViewRepository pickingSlotViewRepository = new PickingSlotViewRepository(pickingHUsRepo, () -> nullDS, () -> nullDS, () -> nullDS);
final List<PickingSlotRow> pickingSlotRows = pickingSlotViewRepository.retrievePickingSlotRows(query);
// even if there are no HUs, there shall still be a row for our picking slot.
assertThat(pickingSlotRows.size(), is(1));
final PickingSlotRow pickingSlotRow = pickingSlotRows.get(0);
assertThat(pickingSlotRow.getType()).isEqualTo(PickingSlotRowType.forPickingSlotRow());
}
use of de.metas.picking.model.I_M_PickingSlot in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewRepository method retrievePickingSlotsForShipmentSchedule.
/**
* Retrieves the M_PickingSlots that are available for the given shipmentSchedules' partner and location.
* Assumes that all shipment schedules have the same partner and location (needs to be made sure) before starting all this stuff
*
* @param shipmentSchedule
* @return
*/
private static List<I_M_PickingSlot> retrievePickingSlotsForShipmentSchedule(@NonNull final PickingSlotRepoQuery repoQuery) {
final I_M_ShipmentSchedule shipmentSchedule = loadOutOfTrx(repoQuery.getCurrentShipmentScheduleId(), I_M_ShipmentSchedule.class);
final IShipmentScheduleEffectiveBL shipmentScheduleEffectiveBL = Services.get(IShipmentScheduleEffectiveBL.class);
final PickingSlotQuery pickingSlotQuery = PickingSlotQuery.builder().availableForBPartnerId(shipmentScheduleEffectiveBL.getC_BPartner_ID(shipmentSchedule)).availableForBPartnerLocationId(shipmentScheduleEffectiveBL.getC_BP_Location_ID(shipmentSchedule)).warehouseId(shipmentScheduleEffectiveBL.getWarehouseId(shipmentSchedule)).barcode(repoQuery.getPickingSlotBarcode()).build();
final IPickingSlotDAO pickingSlotDAO = Services.get(IPickingSlotDAO.class);
final List<I_M_PickingSlot> pickingSlots = pickingSlotDAO.retrievePickingSlots(pickingSlotQuery);
return pickingSlots;
}
Aggregations