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;
}
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;
}
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);
}
Aggregations