use of de.metas.adempiere.model.I_M_Product in project metasfresh-webui-api by metasfresh.
the class WEBUI_HUsToPick_PickCU method getProductToPack.
private I_M_Product getProductToPack() {
if (_productToPack == null) {
final PackageableRow packageableRow = getSingleSelectedPackageableRow();
final int productId = packageableRow.getProductId();
_productToPack = loadOutOfTrx(productId, I_M_Product.class);
}
return _productToPack;
}
use of de.metas.adempiere.model.I_M_Product in project metasfresh-webui-api by metasfresh.
the class WEBUI_HUsToPick_PickCU method getProduct.
private I_M_Product getProduct() {
final I_M_Product productToPack = getProductToPack();
// NOTE: scannedProductId might be not set, in case we deactivate the process parameter.
if (scannedProductId > 0 && scannedProductId != productToPack.getM_Product_ID()) {
final I_M_Product scannedProduct = loadOutOfTrx(scannedProductId, I_M_Product.class);
final String scannedProductStr = scannedProduct != null ? scannedProduct.getName() : "?";
final String expectedProductStr = productToPack.getName();
throw new AdempiereException(MSG_InvalidProduct, new Object[] { scannedProductStr, expectedProductStr });
}
return productToPack;
}
use of de.metas.adempiere.model.I_M_Product in project metasfresh-webui-api by metasfresh.
the class WEBUI_HUsToPick_PickCU method pickCUs.
private void pickCUs() {
final I_M_Product product = getProduct();
final I_C_UOM uom = productBL.getStockingUOM(product);
final Date date = SystemTime.asDate();
final int huIdToSplit = retrieveHUIdToSplit();
final List<I_M_HU> splitHUs = HUSplitBuilderCoreEngine.builder().huToSplit(load(huIdToSplit, I_M_HU.class)).requestProvider(huContext -> AllocationUtils.createAllocationRequestBuilder().setHUContext(huContext).setProduct(product).setQuantity(getQtyCU(), uom).setDate(date).setFromReferencedModel(// N/A
null).setForceQtyAllocation(false).create()).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 = ListUtils.singleElement(splitHUs);
addHUIdToCurrentPickingSlot(splitCU.getM_HU_ID());
if (isAutoProcess) {
final PickingSlotRow rowToProcess = getPickingSlotRow();
pickingCandidateService.processForHUIds(ImmutableList.of(rowToProcess.getHuId()), rowToProcess.getPickingSlotId(), OptionalInt.empty());
}
}
use of de.metas.adempiere.model.I_M_Product in project metasfresh-webui-api by metasfresh.
the class WebuiHUTransformParametersFiller method retrieveHUPItemProductsForNewTU.
private static LookupValuesList retrieveHUPItemProductsForNewTU(final HUEditorRow cuRow) {
final I_M_Product product = cuRow.getM_Product();
final I_C_BPartner bPartner = cuRow.getM_HU().getC_BPartner();
return WEBUI_ProcessHelper.retrieveHUPIItemProducts(Env.getCtx(), product, bPartner, // includeVirtualItem = false..moving a cu onto a "virtual" TU makes no sense. Instead, the user can just leave the CU as it is, or take it out of a physical TU
false);
}
use of de.metas.adempiere.model.I_M_Product in project metasfresh-webui-api by metasfresh.
the class PickingHURowsRepositoryTest method testRetrieveActiveSourceHusQuery_fromShipmentSchedules.
@Test
public void testRetrieveActiveSourceHusQuery_fromShipmentSchedules() {
final I_M_Warehouse wh = newInstance(I_M_Warehouse.class);
save(wh);
final I_M_Product product = newInstance(I_M_Product.class);
save(product);
final I_M_ShipmentSchedule shipmentSchedule1 = newInstance(I_M_ShipmentSchedule.class);
shipmentSchedule1.setM_Warehouse(wh);
shipmentSchedule1.setM_Product(product);
save(shipmentSchedule1);
final I_M_ShipmentSchedule shipmentSchedule2 = newInstance(I_M_ShipmentSchedule.class);
shipmentSchedule2.setM_Warehouse(wh);
shipmentSchedule2.setM_Product(product);
save(shipmentSchedule2);
final MatchingSourceHusQuery query = PickingHURowsRepository.createMatchingSourceHusQuery(PickingSlotRepoQuery.builder().currentShipmentScheduleId(shipmentSchedule1.getM_ShipmentSchedule_ID()).shipmentScheduleId(shipmentSchedule1.getM_ShipmentSchedule_ID()).shipmentScheduleId(shipmentSchedule2.getM_ShipmentSchedule_ID()).build());
assertThat(query.getWarehouseId()).isEqualTo(wh.getM_Warehouse_ID());
assertThat(query.getProductIds()).containsExactly(product.getM_Product_ID());
}
Aggregations