|
|
|
|
@ -5,6 +5,9 @@
|
|
|
|
|
*/
|
|
|
|
|
package id.amigogroup.posterminal.transaksi;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
|
|
import id.amigogroup.posterminal.api.AmigoPosRx;
|
|
|
|
|
import id.amigogroup.posterminal.model.Barang;
|
|
|
|
|
import id.amigogroup.posterminal.model.DNotaRetur;
|
|
|
|
|
@ -208,7 +211,37 @@ public class FormTransaksiReturController implements Initializable {
|
|
|
|
|
@FXML
|
|
|
|
|
void fldNotaPenjualanOnKeyPressed(KeyEvent event) {
|
|
|
|
|
if (event.getCode() == KeyCode.ENTER) {
|
|
|
|
|
Disposable disposable = posRx.validasiMNotaTunaiByNoNotaTanggal(fldNotaPenjualan.getText())
|
|
|
|
|
.subscribe((response) -> {
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
JsonNode jsonNode = mapper.readTree(response.string());
|
|
|
|
|
ObjectNode node = jsonNode.deepCopy();
|
|
|
|
|
|
|
|
|
|
if (node.get("result") != null && node.get("result").asBoolean()) {
|
|
|
|
|
posRx.getDNotaTunaiByNoNota(fldNotaPenjualan.getText()).subscribe(getDNotaTunaiObserver);
|
|
|
|
|
} else {
|
|
|
|
|
Alert alert = AlertUtil.getAlertError(
|
|
|
|
|
"Nota Tidak Bisa Digunakan",
|
|
|
|
|
node.get("message").asText());
|
|
|
|
|
alert.initOwner(apMain.getScene().getWindow());
|
|
|
|
|
alert.show();
|
|
|
|
|
}
|
|
|
|
|
}, (error) -> {
|
|
|
|
|
if (error instanceof HttpException) {
|
|
|
|
|
switch (((HttpException) error).code()) {
|
|
|
|
|
case HttpURLConnection.HTTP_NOT_FOUND:
|
|
|
|
|
Platform.runLater(() -> {
|
|
|
|
|
Alert alert = AlertUtil.getAlertError(
|
|
|
|
|
AlertUtil.ERROR_TIDAK_DITEMUKAN_TITLE,
|
|
|
|
|
"Data nota tidak ditemukan.");
|
|
|
|
|
alert.initOwner(apMain.getScene().getWindow());
|
|
|
|
|
alert.show();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
AmigoPosRx.handleGenericError(error, apMain.getScene().getWindow());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|