Search in sources :

Example 41 with I_M_HU

use of de.metas.handlingunits.model.I_M_HU in project metasfresh-webui-api by metasfresh.

the class WEBUI_DD_OrderLine_MoveHU method doIt.

@Override
@RunOutOfTrx
protected String doIt() throws Exception {
    final int ddOrderLineId = getSingleSelectedRow().getId().toInt();
    final I_DD_OrderLine ddOrderLine = load(ddOrderLineId, I_DD_OrderLine.class);
    final I_M_HU hu = load(p_M_HU_ID, I_M_HU.class);
    huDDOrderBL.createMovements().setDDOrderLines(ImmutableList.of(ddOrderLine)).setLocatorToIdOverride(p_M_LocatorTo_ID).setDoDirectMovements(true).setFailIfCannotAllocate(true).allocateHU(hu).processWithinOwnTrx();
    return MSG_OK;
}
Also used : I_M_HU(de.metas.handlingunits.model.I_M_HU) I_DD_OrderLine(org.eevolution.model.I_DD_OrderLine) RunOutOfTrx(de.metas.process.RunOutOfTrx)

Example 42 with I_M_HU

use of de.metas.handlingunits.model.I_M_HU in project metasfresh-webui-api by metasfresh.

the class HUEditorRowAttributes method extractIsReadonly.

private static final boolean extractIsReadonly(final IAttributeStorage attributesStorage) {
    final I_M_HU hu = IHUAware.getM_HUOrNull(attributesStorage);
    if (hu == null) {
        return true;
    }
    if (!hu.isActive()) {
        return true;
    }
    final String huStatus = hu.getHUStatus();
    if (!X_M_HU.HUSTATUS_Planning.equals(huStatus)) {
        return true;
    }
    // not readonly
    return false;
}
Also used : I_M_HU(de.metas.handlingunits.model.I_M_HU)

Example 43 with I_M_HU

use of de.metas.handlingunits.model.I_M_HU in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_Product_LotNumber_Lock method quarantineHUsForLotNo.

private void quarantineHUsForLotNo(final int lotNoLockId) {
    final I_M_Product_LotNumber_Lock lotNoLock = load(lotNoLockId, I_M_Product_LotNumber_Lock.class);
    final I_M_Attribute lotNoAttribute = Services.get(ILotNumberDateAttributeDAO.class).getLotNumberAttribute(getCtx());
    if (lotNoAttribute == null) {
        throw new AdempiereException("Not lotNo attribute found.");
    }
    final int productId = lotNoLock.getM_Product_ID();
    final String lotNoValue = lotNoLock.getLot();
    final List<I_M_HU> husForAttributeStringValue = retrieveHUsForAttributeStringValue(productId, lotNoAttribute, lotNoValue);
    final List<HUToDistribute> husToDistribute = new ArrayList<>();
    for (final I_M_HU hu : husForAttributeStringValue) {
        final List<de.metas.handlingunits.model.I_M_InOutLine> inOutLinesForHU = huInOutDAO.retrieveInOutLinesForHU(hu);
        if (Check.isEmpty(inOutLinesForHU)) {
            continue;
        }
        I_M_InOut firstReceipt = inOutLinesForHU.get(0).getM_InOut();
        final int bpartnerId = firstReceipt.getC_BPartner_ID();
        final int bpLocationId = firstReceipt.getC_BPartner_Location_ID();
        husToDistribute.add(HUToDistribute.builder().hu(hu).lockLotNo(lotNoLock).bpartnerId(bpartnerId).bpartnerLocationId(bpLocationId).build());
    }
    Services.get(IHUDDOrderBL.class).createQuarantineDDOrderForHUs(husToDistribute);
    setExistingInvoiceCandsInDispute(husForAttributeStringValue);
}
Also used : I_M_HU(de.metas.handlingunits.model.I_M_HU) I_M_InOut(org.compiere.model.I_M_InOut) HUToDistribute(de.metas.handlingunits.ddorder.api.impl.HUs2DDOrderProducer.HUToDistribute) ArrayList(java.util.ArrayList) I_M_Product_LotNumber_Lock(de.metas.product.model.I_M_Product_LotNumber_Lock) ILotNumberDateAttributeDAO(org.adempiere.mm.attributes.api.ILotNumberDateAttributeDAO) AdempiereException(org.adempiere.exceptions.AdempiereException) I_M_Attribute(org.compiere.model.I_M_Attribute) IHUDDOrderBL(de.metas.handlingunits.ddorder.api.IHUDDOrderBL)

Aggregations

I_M_HU (de.metas.handlingunits.model.I_M_HU)43 AdempiereException (org.adempiere.exceptions.AdempiereException)12 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)11 PickingSlotRow (de.metas.ui.web.picking.pickingslot.PickingSlotRow)7 List (java.util.List)7 Services (org.adempiere.util.Services)6 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)5 IProcessPrecondition (de.metas.process.IProcessPrecondition)5 ProcessPreconditionsResolution (de.metas.process.ProcessPreconditionsResolution)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 ImmutableList (com.google.common.collect.ImmutableList)4 IAllocationSource (de.metas.handlingunits.allocation.IAllocationSource)4 IProcessDefaultParametersProvider (de.metas.process.IProcessDefaultParametersProvider)4 Param (de.metas.process.Param)4 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)4 BigDecimal (java.math.BigDecimal)4 Collection (java.util.Collection)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)3 I_M_HU_PI_Item (de.metas.handlingunits.model.I_M_HU_PI_Item)3