Commit 8f909f84 authored by 陳煦元's avatar 陳煦元

V3.0.1

parent cb1410bf
...@@ -10,7 +10,7 @@ android { ...@@ -10,7 +10,7 @@ android {
minSdk 27 minSdk 27
targetSdk 30 targetSdk 30
versionCode 1 versionCode 1
versionName "Dev Ver.3.0.0(無車辨)" versionName "Dev Ver.3.0.1(無車辨)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 1, "versionCode": 1,
"versionName": "Dev Ver.3.0.0(無車辨)", "versionName": "Dev Ver.3.0.1(無車辨)",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
], ],
......
...@@ -71,6 +71,10 @@ public interface CaseDao { ...@@ -71,6 +71,10 @@ public interface CaseDao {
@Query("SELECT * FROM `case` WHERE billingNumber2 IN (:billingNumber2s)") @Query("SELECT * FROM `case` WHERE billingNumber2 IN (:billingNumber2s)")
List<Case> loadAllByIds(String[] billingNumber2s); List<Case> loadAllByIds(String[] billingNumber2s);
@Query("SELECT * FROM `case` WHERE billingNumber2 = :newbillingNumber2 ")
int caseExists(String newbillingNumber2);
@Insert @Insert
void insertAll(Case... cases); void insertAll(Case... cases);
......
...@@ -469,7 +469,16 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -469,7 +469,16 @@ public class T02StartActivity extends AppCompatActivity {
if (photoFile == null) { if (photoFile == null) {
return; return;
} }
t02StartViewModel.addNewPhotos(photoFile); //tempCase.caseStatus = CaseStatus.CHANGED;
if(t02StartViewModel.getCurrentCase().getValue().caseStatus !=CaseStatus.NEW)
{
t02StartViewModel.addNewPhotos(photoFile);
}
else
{
Toast.makeText(this, "請於成功開單後再添加照片", Toast.LENGTH_LONG).show();
}
} }
}); });
...@@ -1056,8 +1065,6 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -1056,8 +1065,6 @@ public class T02StartActivity extends AppCompatActivity {
t02StartViewModel.saveCurrentCase(false); t02StartViewModel.saveCurrentCase(false);
dataBinding.btnCancelbill.setEnabled(true); dataBinding.btnCancelbill.setEnabled(true);
closedatachange(); closedatachange();
}else { }else {
Toast.makeText(this, "請先確認資料後再列印", Toast.LENGTH_LONG).show(); Toast.makeText(this, "請先確認資料後再列印", Toast.LENGTH_LONG).show();
return; return;
...@@ -1083,7 +1090,6 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -1083,7 +1090,6 @@ public class T02StartActivity extends AppCompatActivity {
Toast.makeText(this, "請先連結藍芽印表機裝置", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "請先連結藍芽印表機裝置", Toast.LENGTH_SHORT).show();
return; return;
} }
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("是否重新列印"); builder.setTitle("是否重新列印");
builder.setNegativeButton("否", new DialogInterface.OnClickListener() { builder.setNegativeButton("否", new DialogInterface.OnClickListener() {
...@@ -1101,7 +1107,6 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -1101,7 +1107,6 @@ public class T02StartActivity extends AppCompatActivity {
blueToothViewModel.printCase(finalTempCase); blueToothViewModel.printCase(finalTempCase);
} }
}); });
builder.create().show(); builder.create().show();
} }
} }
......
...@@ -413,29 +413,31 @@ public class T02StartViewModel extends AndroidViewModel { ...@@ -413,29 +413,31 @@ public class T02StartViewModel extends AndroidViewModel {
switch (tempCase.caseStatus){ switch (tempCase.caseStatus){
case NEW: case NEW:
infoRepository.executorService.execute(() -> { infoRepository.executorService.execute(() -> {
tempCase.caseStatus = CaseStatus.LIST; // 检查案件是否已存在 否則新增案件
infoRepository.caseDao.insertAll(tempCase); // if (infoRepository.caseDao.caseExists(tempCase.billingNumber2)>0) {}
tempCase.caseStatus = CaseStatus.LIST;
infoRepository.caseDao.insertAll(tempCase);
for (int i = 0 ; i < tempCasePhoto.size(); i++){
infoRepository.casePhotoDao.insertAll(tempCasePhoto.get(i));
}
tempCasePhoto.clear();
for (int i = 0 ; i < tempCasePhoto.size(); i++){ //存進併檔用文字檔
infoRepository.casePhotoDao.insertAll(tempCasePhoto.get(i));
}
tempCasePhoto.clear();
//存進併檔用文字檔 Common.writeTXT(getApplication(), tempCase.datePath, tempCase.userDateFileName, tempCase.getDetailString());
updateIdx(tempCase);
Common.writeTXT(getApplication(), tempCase.datePath, tempCase.userDateFileName, tempCase.getDetailString()); Common.writeTXT(getApplication(), tempCase.uploadPath, tempCase.getUploadFileName(), tempCase.getDetailString());
updateIdx(tempCase);
Common.writeTXT(getApplication(), tempCase.uploadPath, tempCase.getUploadFileName(), tempCase.getDetailString()); // 跳至新單
if (isFinish2New){
currentCase.postValue(newCase());
}
// 跳至新單 // 加入清單
if (isFinish2New){ cases.add(tempCase);
currentCase.postValue(newCase()); caseCursor.postValue(caseCursor.getValue() + 1);
}
// 加入清單
cases.add(tempCase);
caseCursor.postValue(caseCursor.getValue() + 1);
}); });
break; break;
case LIST: case LIST:
...@@ -600,13 +602,18 @@ public class T02StartViewModel extends AndroidViewModel { ...@@ -600,13 +602,18 @@ public class T02StartViewModel extends AndroidViewModel {
if (tempCase.caseStatus != CaseStatus.NEW) { if (tempCase.caseStatus != CaseStatus.NEW) {
tempCase.caseStatus = CaseStatus.CHANGED; tempCase.caseStatus = CaseStatus.CHANGED;
} }
currentCase.setValue(tempCase); currentCase.setValue(tempCase);
} }
public void addNewPhotos(File photoFile){ public void addNewPhotos(File photoFile){
setNewCasePhoto(photoFile); Case tempCase = currentCase.getValue();
saveCurrentCase(false); //tempCase.caseStatus = CaseStatus.CHANGED;
if(tempCase.caseStatus!=CaseStatus.NEW)
{
setNewCasePhoto(photoFile);
saveCurrentCase(false);//0524
}
} }
...@@ -925,7 +932,6 @@ public class T02StartViewModel extends AndroidViewModel { ...@@ -925,7 +932,6 @@ public class T02StartViewModel extends AndroidViewModel {
String plateNumber = ""; String plateNumber = "";
Bitmap bitmap = BitmapFactory.decodeFile(filePath); Bitmap bitmap = BitmapFactory.decodeFile(filePath);
bitmap = Common.turnPictureDegree(bitmap, filePath); bitmap = Common.turnPictureDegree(bitmap, filePath);
byte[] imageDataBytes = bitampToByteArray(bitmap); byte[] imageDataBytes = bitampToByteArray(bitmap);
BoxInfo[] boxInfos = null; BoxInfo[] boxInfos = null;
boxInfos = EcomALPR.retinaplate_detect(bitmap, imageDataBytes, bitmap.getWidth(), bitmap.getHeight(), threshold, nms_threshold); boxInfos = EcomALPR.retinaplate_detect(bitmap, imageDataBytes, bitmap.getWidth(), bitmap.getHeight(), threshold, nms_threshold);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment