commit 10/04/2025

This commit is contained in:
rdkartono
2025-04-10 16:21:56 +07:00
parent 7cdefa6f1d
commit b6a3076993
23 changed files with 420 additions and 119681 deletions

View File

@@ -114,21 +114,21 @@ public class CaptureView {
config.Save();
}
private void trigger_autofocus(Cameradetail image) throws InterruptedException {
private void trigger_autofocus(Cameradetail image) {
if (image!=null){
if (image.isCapturing()){
image.setAutoFocus(false);
Thread.sleep(5);
Wait(5);
image.setFocus(0.7);
Thread.sleep(5);
Wait(5);
image.setAutoFocus(true);
Thread.sleep(5);
Wait(5);
}
}
}
@FXML
private void AutoFocus() throws InterruptedException {
private void AutoFocus() {
trigger_autofocus(image1);
trigger_autofocus(image2);
trigger_autofocus(image3);
@@ -533,12 +533,8 @@ public class CaptureView {
long duration = (System.nanoTime() - nanostart) / 1000000; // in milliseconds
System.out.println("TakePhotos duration: "+duration+" ms");
//AutoCloseAlert.show("Photos Taken", "Photos Taken", "Photos Taken", 5, null);
if (AutoCloseAlert.banner_02!=null) {
System.out.println("Showing banner 02 after photo taken");
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
}
String[] files = prc.compressed();
if (files.length>0){
@@ -553,8 +549,17 @@ public class CaptureView {
@Override
public void onPlaybackFinished(String filename) {
UploadFiles(prc, prefix);
if (runningTask!=null) runningTask.cancel(false);
AutoCloseAlert.showpictures(prc.compressed(),2, (s)->{
if (AutoCloseAlert.banner_02!=null) {
System.out.println("Showing banner 02 after photo taken");
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
UploadFiles(prc, prefix);
if (runningTask!=null) runningTask.cancel(false);
}
});
}
@Override
@@ -615,7 +620,6 @@ public class CaptureView {
uploadtask.setOnSucceeded(e-> {
System.out.println("UploadTask succeeded");
clear();
AutoCloseAlert.close();
});
uploadtask.setOnFailed(e-> {
@@ -626,12 +630,12 @@ public class CaptureView {
audioPlayer.PlayFile(audio_upload_gagal, null);
}
}
AutoCloseAlert.show("Upload Failed", "Upload Failed", "Upload Failed", 5, s -> {
clear();
});
AutoCloseAlert.show("Upload Failed", "Upload Failed", "Upload Failed", 5, s -> clear());
});
new Thread(uploadtask).start();
Thread uploadThread = new Thread(uploadtask);
uploadThread.setDaemon(true);
uploadThread.start();
} else ShowAlert(AlertType.ERROR, "Error", "No Photos Taken", "No Photos Taken, please check camera");
}
@@ -713,7 +717,9 @@ public class CaptureView {
Logger.info("Left90 Index: "+indexleft90);
if (indexleft90!=-1){
final int finalindex = indexleft90;
new Thread(()-> SetupCameraWithController(image1, camleft90, finalindex)).start();
Thread c1 = new Thread(()-> SetupCameraWithController(image1, camleft90, finalindex));
c1.setDaemon(true);
c1.start();
}
}
}
@@ -725,7 +731,9 @@ public class CaptureView {
Logger.info("Left45 Index: "+indexleft45);
if (indexleft45!=-1) {
final int finalindex = indexleft45;
new Thread(()-> SetupCameraWithController(image2, camleft45, finalindex)).start();
Thread c2 = new Thread(()-> SetupCameraWithController(image2, camleft45, finalindex));
c2.setDaemon(true);
c2.start();
}
}
}
@@ -737,7 +745,9 @@ public class CaptureView {
Logger.info("Center Index: "+indexcenter);
if (indexcenter!=-1) {
final int finalindex = indexcenter;
new Thread(()-> SetupCameraWithController(image3, camcenter, finalindex)).start();
Thread c3 = new Thread(()-> SetupCameraWithController(image3, camcenter, finalindex));
c3.setDaemon(true);
c3.start();
}
}
}
@@ -749,7 +759,9 @@ public class CaptureView {
Logger.info("Right45 Index: "+indexright45);
if (indexright45!=-1) {
final int finalindex = indexright45;
new Thread(()-> SetupCameraWithController(image4, camright45, finalindex)).start();
Thread c4 = new Thread(()-> SetupCameraWithController(image4, camright45, finalindex));
c4.setDaemon(true);
c4.start();
}
}
@@ -762,7 +774,9 @@ public class CaptureView {
Logger.info("Right90 Index: "+indexright90);
if (indexright90!=-1) {
final int finalindex = indexright90;
new Thread(()-> SetupCameraWithController(image5, camright90, finalindex)).start();
Thread c5 = new Thread(()-> SetupCameraWithController(image5, camright90, finalindex));
c5.setDaemon(true);
c5.start();
}
}
}
@@ -776,11 +790,9 @@ public class CaptureView {
private void clear(){
isTakingPhoto.set(false);
Platform.runLater(()->{
medicalRecordID.setText("");
PatientName.setText("");
barcodeData.setText("");
});
TextAreaSetText(medicalRecordID,"");
TextAreaSetText(PatientName,"");
TextAreaSetText(barcodeData,"");
}
public void Unload(){
@@ -891,9 +903,7 @@ public class CaptureView {
String prefix = barcodeData.getText();
if (!barCode.equals(prefix)){
final String finalbarCode = barCode;
Platform.runLater(()->{
barcodeData.setText(finalbarCode);
});
TextAreaSetText(barcodeData, finalbarCode);
Task<PatientRecord> checkpatientID = new Task<>() {
@Override
protected PatientRecord call() throws Exception {
@@ -916,17 +926,14 @@ public class CaptureView {
}
} else {
Logger.error("Record associated with barcode ",finalbarCode," is empty");
//AutoCloseAlert.show("Data Tidak Ditemukan","Data dengan barcode "+finalbarCode+" ditemukan di server, tetapi kosong","Pastikan data barcode anda benar", 5);
throw new Exception("Data dengan barcode "+finalbarCode+" ditemukan di server, tetapi kosong");
}
} else {
Logger.error("Record associated with barcode ",finalbarCode," is not found");
//AutoCloseAlert.show("Data Tidak Ditemukan","Data dengan barcode "+finalbarCode+" tidak ditemukan di server","Pastikan data barcode anda benar",5);
throw new Exception("Data dengan barcode "+finalbarCode+" tidak ditemukan di server");
}
} else {
Logger.error("BarcodeResullt with barcode ",finalbarCode," is null");
//AutoCloseAlert.show("Data Tidak Ditemukan", "BarcodeResult dengan barcode "+finalbarCode+" menghasilkan null", "Pastikan data barcode anda benar", 5);
throw new Exception("BarcodeResult dengan barcode "+finalbarCode+" menghasilkan null");
}
}
@@ -937,13 +944,13 @@ public class CaptureView {
if (pr!=null){
int medrecid = toInt(pr.medical_record_detail_id);
System.out.println("checkpatientID.setOnSucceeded medrecid : "+medrecid);
Platform.runLater(()->{
medicalRecordID.setText(""+medrecid);
PatientName.setText(pr.name);
});
TextAreaSetText(medicalRecordID,""+medrecid);
TextAreaSetText(PatientName, pr.name);
runningTask = timeoutExecutor.schedule(()->{
// timeout
System.out.println("runningTask timeout after "+timeout+" seconds");
clear();
}, timeout, TimeUnit.SECONDS);
@@ -970,16 +977,13 @@ public class CaptureView {
System.out.println("checkpatientID.setOnFailed message : "+message);
AutoCloseAlert.show("Data Tidak Ditemukan", message, "Pastikan data barcode anda benar", 5, s -> {
clear();
});
AutoCloseAlert.show("Data Tidak Ditemukan", "Pastikan data barcode anda benar", message , 5, s -> clear());
});
new Thread(checkpatientID).start();
Thread checkpatientIDThread = new Thread(checkpatientID);
checkpatientIDThread.setDaemon(true);
checkpatientIDThread.start();
}
}