Commit 1ef1587f authored by 陳煦元's avatar 陳煦元

1130730

修正累加時間
parent 7ab9ec9a
...@@ -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.7(無車辨)" versionName "Dev Ver.3.0.8(無車辨)"
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.7(無車辨)", "versionName": "Dev Ver.3.0.8(無車辨)",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
], ],
......
...@@ -111,7 +111,8 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -111,7 +111,8 @@ public class T02StartActivity extends AppCompatActivity {
private AlertDialog alertDialogProgress; private AlertDialog alertDialogProgress;
private AlertDialogProgressBarBinding alertDialogProgressBarBinding; private AlertDialogProgressBarBinding alertDialogProgressBarBinding;
private static final int LIMIT_FOR_ADD_COUNT = 4;//限制上次累加時間與現在之間隔,在此數值內才可累加,否則開新單(新單號,新時間,舊資料) private static final int LIMIT_FOR_ADD_COUNT = 2;//限制上次累加時間與現在之間隔,在此數值內才可累加,否則開新單(新單號,新時間,舊資料),此為一般車格2小內需累加
private static final int LIMIT_FOR_ADD_COUNT2 = 1;//限制上次累加時間與現在之間隔,在此數值內才可累加,否則開新單(新單號,新時間,舊資料),此為半小記費車格
// 自動順序 // 自動順序
...@@ -861,21 +862,41 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -861,21 +862,41 @@ public class T02StartActivity extends AppCompatActivity {
//takePhoto(cumulativeTimeActivityResultLauncher); //takePhoto(cumulativeTimeActivityResultLauncher);
// 新版,先拍照,選擇完畢直接累加 // 新版,先拍照,選擇完畢直接累加
if (photoFile != null && photoFile.exists()){ if (photoFile != null && photoFile.exists()){
if ((newAddCount.get() - oldAddCount) > LIMIT_FOR_ADD_COUNT) {//檢查開單逾時 if(tempCase.space.spaceRate.perHours==0.5)//若0.5小計費一次的路段
new android.app.AlertDialog.Builder(this) {
.setTitle("開單逾時") if ((newAddCount.get() - oldAddCount) > LIMIT_FOR_ADD_COUNT2 ) {//檢查開單逾時
.setMessage("已超過可進行累加時段,\n將開"新單"並"列印"!") new android.app.AlertDialog.Builder(this)
.setIcon(R.drawable.ic_report_black_24dp) .setTitle("開單逾時")
.setNeutralButton(getString(R.string.label_cancel), null) .setMessage("已超過可進行累加時段,\n將開"新單"並"列印"!")
.setPositiveButton(getString(R.string.label_ok_and_print), (dI, i) -> { .setIcon(R.drawable.ic_report_black_24dp)
t02StartViewModel.setNewCase(tempCase, photoFile);//使用"新單號、時間"和"舊路段、格位、車輛資料"進行初始化 .setNeutralButton(getString(R.string.label_cancel), null)
btnPrintOnClicked(); .setPositiveButton(getString(R.string.label_ok_and_print), (dI, i) -> {
}).show(); t02StartViewModel.setNewCase(tempCase, photoFile);//使用"新單號、時間"和"舊路段、格位、車輛資料"進行初始化
}else { btnPrintOnClicked();
t02StartViewModel.cumulativeTime(photoFile, false); }).show();
takePhoto(addPhotosActivityResultLauncher); }else {
//1130709 t02StartViewModel.cumulativeTime(photoFile, false);
takePhoto(addPhotosActivityResultLauncher);
}
} }
else if(tempCase.space.spaceRate.perHours==1)//若1小計費一次的路段
{
if ((newAddCount.get() - oldAddCount) >= LIMIT_FOR_ADD_COUNT ) {//檢查開單逾時
new android.app.AlertDialog.Builder(this)
.setTitle("開單逾時")
.setMessage("已超過可進行累加時段,\n將開"新單"並"列印"!")
.setIcon(R.drawable.ic_report_black_24dp)
.setNeutralButton(getString(R.string.label_cancel), null)
.setPositiveButton(getString(R.string.label_ok_and_print), (dI, i) -> {
t02StartViewModel.setNewCase(tempCase, photoFile);//使用"新單號、時間"和"舊路段、格位、車輛資料"進行初始化
btnPrintOnClicked();
}).show();
}else {
t02StartViewModel.cumulativeTime(photoFile, false);
takePhoto(addPhotosActivityResultLauncher);
}
}
}else{ }else{
Toast.makeText(this, "讀取相片失敗,請重新操作",Toast.LENGTH_SHORT).show(); Toast.makeText(this, "讀取相片失敗,請重新操作",Toast.LENGTH_SHORT).show();
} }
......
...@@ -39,6 +39,7 @@ public class T03ListFilesActivity extends AppCompatActivity { ...@@ -39,6 +39,7 @@ public class T03ListFilesActivity extends AppCompatActivity {
private int userId; private int userId;
private Shift shift; private Shift shift;
private String plateNumber; private String plateNumber;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -70,7 +71,7 @@ public class T03ListFilesActivity extends AppCompatActivity { ...@@ -70,7 +71,7 @@ public class T03ListFilesActivity extends AppCompatActivity {
} }
}); });
infoRepository = new InfoRepository(getApplication()); infoRepository = new InfoRepository(getApplication());
//caseAndAllCasePhotos = infoRepository.caseDao.getAllWithCasePhotoByShitAndUserId(shift, userId); // caseAndAllCasePhotos = infoRepository.caseDao.getAllWithCasePhotoByShitAndUserId(shift, userId);
caseAndAllCasePhotos = infoRepository.getAllCaseWithCasePhotoByShiftAndUserToday(shift, userId); caseAndAllCasePhotos = infoRepository.getAllCaseWithCasePhotoByShiftAndUserToday(shift, userId);
caseListAdapter.submitList(caseAndAllCasePhotos); caseListAdapter.submitList(caseAndAllCasePhotos);
dataBinding.rvCaseList.setLayoutManager(new LinearLayoutManager(this)); dataBinding.rvCaseList.setLayoutManager(new LinearLayoutManager(this));
...@@ -123,6 +124,7 @@ public class T03ListFilesActivity extends AppCompatActivity { ...@@ -123,6 +124,7 @@ public class T03ListFilesActivity extends AppCompatActivity {
caseListAdapter.submitList(caseAndAllCasePhotos); caseListAdapter.submitList(caseAndAllCasePhotos);
dataBinding.rvCaseList.setLayoutManager(new LinearLayoutManager(this)); dataBinding.rvCaseList.setLayoutManager(new LinearLayoutManager(this));
dataBinding.rvCaseList.setAdapter(caseListAdapter); dataBinding.rvCaseList.setAdapter(caseListAdapter);
caseListAdapter.notifyDataSetChanged(); caseListAdapter.notifyDataSetChanged();
} }
} }
\ No newline at end of file
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