use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class WEBUI_SalesOrder_Apply_Availability_Row method doIt.
@Override
protected String doIt() throws Exception {
final //
Multimap<PurchaseRow, PurchaseRow> lineRows2availabilityRows = extractLineRow2availabilityRows();
Check.errorIf(hasMultipleAvailabilityRowsPerLineRow(lineRows2availabilityRows), "The selected rows contain > 1 availability row for one line row; lineRows2availabilityRows={}", lineRows2availabilityRows);
final Set<DocumentId> documentIdsToUpdate = new HashSet<>();
for (final Entry<PurchaseRow, PurchaseRow> lineRow2availabilityRow : lineRows2availabilityRows.entries()) {
final DocumentId groupRowDocumentId = updateLineAndGroupRow(lineRow2availabilityRow);
documentIdsToUpdate.add(groupRowDocumentId);
}
ViewChangesCollector.getCurrentOrAutoflush().collectRowsChanged(getView(), DocumentIdsSelection.of(documentIdsToUpdate));
return MSG_OK;
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class WEBUI_SalesOrder_Apply_Availability_Row method updateLineAndGroupRow.
public DocumentId updateLineAndGroupRow(@NonNull final Entry<PurchaseRow, PurchaseRow> lineRow2availabilityRow) {
final PurchaseRow lineRow = lineRow2availabilityRow.getKey();
final PurchaseRowId lineRowId = PurchaseRowId.fromDocumentId(lineRow.getId());
final DocumentId groupRowDocumentId = lineRowId.toGroupRowId().toDocumentId();
final PurchaseRow groupRow = getView().getById(groupRowDocumentId);
final PurchaseRow availabilityRow = lineRow2availabilityRow.getValue();
if (availabilityRow.getDatePromised() != null) {
groupRow.changeDatePromised(lineRowId, availabilityRow.getDatePromised());
}
groupRow.changeQtyToPurchase(lineRowId, availabilityRow.getQtyToPurchase());
return groupRowDocumentId;
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRepository method commit.
private final void commit(final ASIDocument asiDoc) {
final DocumentId asiDocId = asiDoc.getDocumentId();
if (asiDoc.isCompleted()) {
final ASIDocument asiDocRemoved = id2asiDoc.remove(asiDocId);
logger.trace("Removed from repository by ID={}: {}", asiDocId, asiDocRemoved);
} else {
final ASIDocument asiDocReadonly = asiDoc.copy(CopyMode.CheckInReadonly, NullDocumentChangesCollector.instance);
id2asiDoc.put(asiDocId, asiDocReadonly);
logger.trace("Added to repository: {}", asiDocReadonly);
}
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRestController method getAttributeTypeahead.
@GetMapping("/{asiDocId}/field/{attributeName}/typeahead")
public JSONLookupValuesList getAttributeTypeahead(//
@PathVariable("asiDocId") final String asiDocIdStr, //
@PathVariable("attributeName") final String attributeName, //
@RequestParam(name = "query", required = true) final String query) {
userSession.assertLoggedIn();
final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
return asiRepo.forASIDocumentReadonly(asiDocId, asiDoc -> asiDoc.getFieldLookupValuesForQuery(attributeName, query)).transform(JSONLookupValuesList::ofLookupValuesList);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRestController method getAttributeDropdown.
@GetMapping("/{asiDocId}/field/{attributeName}/dropdown")
public JSONLookupValuesList getAttributeDropdown(//
@PathVariable("asiDocId") final String asiDocIdStr, //
@PathVariable("attributeName") final String attributeName) {
userSession.assertLoggedIn();
final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
return asiRepo.forASIDocumentReadonly(asiDocId, asiDoc -> asiDoc.getFieldLookupValues(attributeName)).transform(JSONLookupValuesList::ofLookupValuesList);
}
Aggregations