use of de.metas.handlingunits.model.I_M_ReceiptSchedule in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_ReceiptSchedule_SelectHUsToReverse method checkPreconditionsApplicable.
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context) {
if (!context.isSingleSelection()) {
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
// Receipt schedule shall not be already closed
final IReceiptScheduleBL receiptScheduleBL = Services.get(IReceiptScheduleBL.class);
final I_M_ReceiptSchedule receiptSchedule = context.getSelectedModel(I_M_ReceiptSchedule.class);
if (receiptScheduleBL.isClosed(receiptSchedule)) {
return ProcessPreconditionsResolution.reject("already closed");
}
// Receipt schedule shall not be about packing materials
if (receiptSchedule.isPackagingMaterial()) {
return ProcessPreconditionsResolution.reject("not applying for packing materials");
}
return ProcessPreconditionsResolution.accept();
}
use of de.metas.handlingunits.model.I_M_ReceiptSchedule in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_ReceiptSchedule_RunMaterialReceiptJasper method doIt.
@Override
protected String doIt() throws Exception {
final I_M_ReceiptSchedule receiptSchedule = getRecord(I_M_ReceiptSchedule.class);
HUReceiptScheduleReportExecutor.get(receiptSchedule).executeHUReport();
return MSG_OK;
}
use of de.metas.handlingunits.model.I_M_ReceiptSchedule in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_ReceiptSchedule_ReceiveHUs_Base method doIt.
@Override
@RunOutOfTrx
protected final String doIt() throws Exception {
final I_M_ReceiptSchedule receiptSchedule = getM_ReceiptSchedule();
final ReceiptScheduleHUGenerator huGenerator = ReceiptScheduleHUGenerator.newInstance(this).addM_ReceiptSchedule(receiptSchedule).setUpdateReceiptScheduleDefaultConfiguration(isUpdateReceiptScheduleDefaultConfiguration());
//
// Get/Create the initial LU/TU configuration
final I_M_HU_LUTU_Configuration lutuConfigurationOrig = getCurrentLUTUConfiguration(receiptSchedule);
//
// Create the effective LU/TU configuration
final I_M_HU_LUTU_Configuration lutuConfiguration = createM_HU_LUTU_Configuration(lutuConfigurationOrig);
Services.get(ILUTUConfigurationFactory.class).save(lutuConfiguration);
huGenerator.setM_HU_LUTU_Configuration(lutuConfiguration);
//
// Calculate the target CUs that we want to allocate
final ILUTUProducerAllocationDestination lutuProducer = huGenerator.getLUTUProducerAllocationDestination();
final Quantity qtyCUsTotal = lutuProducer.calculateTotalQtyCU();
if (qtyCUsTotal.isInfinite()) {
throw new TerminalException("LU/TU configuration is resulting to infinite quantity: " + lutuConfiguration);
}
huGenerator.setQtyToAllocateTarget(qtyCUsTotal);
//
// Generate the HUs
final List<I_M_HU> hus = huGenerator.generateWithinOwnTransaction();
openHUsToReceive(hus);
return MSG_OK;
}
use of de.metas.handlingunits.model.I_M_ReceiptSchedule in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_ReceiptSchedule_ReceiveHUs_UsingDefaults method buildDefaultPackingInfo.
private String buildDefaultPackingInfo(final IProcessPreconditionsContext context) {
final I_M_ReceiptSchedule receiptSchedule = context.getSelectedModel(I_M_ReceiptSchedule.class);
if (receiptSchedule == null) {
// no override
return null;
}
final I_M_HU_LUTU_Configuration lutuConfig = getCurrentLUTUConfiguration(receiptSchedule);
adjustLUTUConfiguration(lutuConfig, receiptSchedule);
return HUPackingInfoFormatter.newInstance().setShowLU(// NOTE: don't show LU info because makes the whole label to long. see https://github.com/metasfresh/metasfresh-webui-frontend/issues/315#issuecomment-280624562
false).format(HUPackingInfos.of(lutuConfig));
}
use of de.metas.handlingunits.model.I_M_ReceiptSchedule in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_ReceiptSchedule_ReceiveHUs_UsingConfig method getDefaultLUTUConfiguration.
private I_M_HU_LUTU_Configuration getDefaultLUTUConfiguration() {
if (_defaultLUTUConfiguration == null) {
final I_M_ReceiptSchedule receiptSchedule = getM_ReceiptSchedule();
final I_M_HU_LUTU_Configuration defaultLUTUConfiguration = getCurrentLUTUConfiguration(receiptSchedule);
adjustLUTUConfiguration(defaultLUTUConfiguration, receiptSchedule);
_defaultLUTUConfiguration = defaultLUTUConfiguration;
}
return _defaultLUTUConfiguration;
}
Aggregations