use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.
the class PickingHURowsRepository method retrieveSourceHUs.
/**
* Retrieve the union of all HUs that match any one of the given shipment schedule IDs and that are flagged to be fine picking source HUs.
*
* @param shipmentScheduleIds
* @return
*/
public List<HUEditorRow> retrieveSourceHUs(@NonNull final PickingSlotRepoQuery query) {
final HUEditorViewRepository huEditorRepo = getHUEditorViewRepository();
final MatchingSourceHusQuery matchingSourceHUsQuery = createMatchingSourceHusQuery(query);
final Set<HuId> sourceHUIds = SourceHUsService.get().retrieveMatchingSourceHUIds(matchingSourceHUsQuery);
return huEditorRepo.retrieveHUEditorRows(sourceHUIds, HUEditorRowFilter.ALL);
}
use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.
the class PickingSlotRowId method fromStringPartsList.
public static final PickingSlotRowId fromStringPartsList(final List<String> parts) {
final int partsCount = parts.size();
if (partsCount < 1) {
throw new IllegalArgumentException("Invalid id: " + parts);
}
final PickingSlotId pickingSlotId = !Check.isEmpty(parts.get(0), true) ? PickingSlotId.ofRepoIdOrNull(Integer.parseInt(parts.get(0))) : null;
final HuId huId = partsCount >= 2 ? HuId.ofRepoIdOrNull(Integer.parseInt(parts.get(1))) : null;
final int huStorageProductId = partsCount >= 3 ? Integer.parseInt(parts.get(2)) : 0;
return new PickingSlotRowId(pickingSlotId, huId, huStorageProductId);
}
use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.
the class PickingSlotRowId method ofPickingSlotId.
public static final PickingSlotRowId ofPickingSlotId(final PickingSlotId pickingSlotId) {
final HuId huId = null;
final int huStorageProductId = -1;
return new PickingSlotRowId(pickingSlotId, huId, huStorageProductId);
}
use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.
the class ProductsToPickRowsDataFactoryTest method test_AlreadyExistingPickingCandidate.
@Test
public void test_AlreadyExistingPickingCandidate() {
final HuId huId1 = testHelper.prepareExistingHU().locatorId(locatorId).productId(productId).qty(Quantity.of(999, uomKg)).build();
final I_M_Picking_Candidate pickingCandidateRecord = newInstance(I_M_Picking_Candidate.class);
pickingCandidateRecord.setM_ShipmentSchedule_ID(shipmentScheduleId.getRepoId());
pickingCandidateRecord.setStatus(PickingCandidateStatus.Draft.getCode());
pickingCandidateRecord.setPickStatus(PickingCandidatePickStatus.PICKED.getCode());
pickingCandidateRecord.setApprovalStatus(PickingCandidateApprovalStatus.TO_BE_APPROVED.getCode());
pickingCandidateRecord.setQtyPicked(new BigDecimal("5"));
pickingCandidateRecord.setC_UOM_ID(uomKg.getC_UOM_ID());
pickingCandidateRecord.setPickFrom_HU_ID(huId1.getRepoId());
saveRecord(pickingCandidateRecord);
final PackageableRow packageableRow = preparePackageableRow().qtyToDeliver(5).bestBeforePolicy(ShipmentAllocationBestBeforePolicy.Expiring_First).build();
final ProductsToPickRowsDataFactory productsToPickRowsDataFactory = testHelper.createProductsToPickRowsDataFactory();
final Collection<ProductsToPickRow> rows = productsToPickRowsDataFactory.create(packageableRow).getTopLevelRows();
assertThat(rows).hasSize(1);
final ProductsToPickRow row = rows.iterator().next();
assertThat(row.getQtyEffective()).isEqualTo(Quantity.of(5, uomKg));
assertThat(row.getType()).isEqualTo(ProductsToPickRowType.PICK_FROM_HU);
assertThat(row.getPickFromHUId()).isEqualTo(huId1);
}
use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.
the class WEBUI_HUsToPick_PickCU method performPickCU.
private HuId performPickCU() {
final HuId huIdToSplit = retrieveHUIdToSplit();
final List<I_M_HU> splitHUs = HUSplitBuilderCoreEngine.builder().huToSplit(handlingUnitsDAO.getById(huIdToSplit)).requestProvider(this::createSplitAllocationRequest).destination(HUProducerDestination.ofVirtualPI()).build().withPropagateHUValues().withAllowPartialUnloads(// we allow partial loads and unloads so if a user enters a very large number, then that will just account to "all of it" and there will be no error
true).performSplit();
final I_M_HU splitCU = CollectionUtils.singleElement(splitHUs);
final HuId splitCUId = HuId.ofRepoId(splitCU.getM_HU_ID());
addHUIdToCurrentPickingSlot(splitCUId);
return splitCUId;
}
Aggregations