[FEAT] General 現金強化版合併(Part 2-2)
移植 Luzui 現金 Dialog 的硬體容錯邏輯(卡鈔偵測+退鈔重試、零錢不足拒收+ 退款保障、暫存區兩階段入帳、找零失敗自癒、百元鈔庫存輪詢、3分鐘閒置逾時), 上報層改接 TaiwanStar 新 MQTT(移除 B600/B650,改 DispatchDialog 統一 Finalize)。 採「獨立類別 + flavor 路由」避免 duplicate class、不污染已上線 flavor: - 新增 src/General CashPayDialogGeneral(Luzui 強化版改名,只 General 編譯) + General layout override dialog_checkout_cash_pay.xml 補 buttonRetryEscrow - showDispatchDialog 改 MQTT 路徑、移除 callB600AndProceed/httpAPI - onCreate(Context) 移除 throws(對齊 TaiwanStar DialogAbstract 簽名) - DialogAbstract.cashDialogClass() 經 SaleFlowHandler 解析各 flavor 現金 Dialog - 三個 SaleFlowHandler 加 cashDialogClass():General→CashPayDialogGeneral、 晟崴/中國醫→標準 CashPayDialog - 3 個呼叫點(BuyDialog/InvoiceBarcodeDialog/InvoiceCustomerIdentifierDialog) case 9 改 changeDialog(cashDialogClass()) 三 flavor 編譯通過、General APK 打包成功。現金硬體容錯需實機驗證(階段 7)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
402490ee58
commit
2315a32f56
@ -42,6 +42,11 @@ public class SaleFlowHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 晟崴版使用標準現金 Dialog。 */
|
||||
public Class<? extends com.unibuy.smartdevice.DialogAbstract> cashDialogClass() {
|
||||
return com.unibuy.smartdevice.ui.dialog.CashPayDialog.class;
|
||||
}
|
||||
|
||||
public void onBarcodeReceived(String rawData) {
|
||||
// 晟崴版不處理掃碼
|
||||
}
|
||||
|
||||
@ -97,6 +97,11 @@ public class SaleFlowHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 中國醫版使用標準現金 Dialog。 */
|
||||
public Class<? extends com.unibuy.smartdevice.DialogAbstract> cashDialogClass() {
|
||||
return com.unibuy.smartdevice.ui.dialog.CashPayDialog.class;
|
||||
}
|
||||
|
||||
public void onBarcodeReceived(String rawData) {
|
||||
// 若是經由其他方式傳入的 Barcode 可在此處直接處理
|
||||
try {
|
||||
|
||||
@ -50,6 +50,11 @@ public class SaleFlowHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** General 使用 Luzui 移植的現金強化版(卡鈔/找零保障/自癒),上報接 TaiwanStar 新 MQTT。 */
|
||||
public Class<? extends com.unibuy.smartdevice.DialogAbstract> cashDialogClass() {
|
||||
return com.unibuy.smartdevice.ui.dialog.CashPayDialogGeneral.class;
|
||||
}
|
||||
|
||||
/** 購物車浮鈕:開啟多品項購物車 Fragment。 */
|
||||
public void onShoppingCartRequested() {
|
||||
if (!(context instanceof FontendActivity)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
168
app/src/General/res/layout/dialog_checkout_cash_pay.xml
Normal file
168
app/src/General/res/layout/dialog_checkout_cash_pay.xml
Normal file
@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/light_gray">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/light_gray"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/red"
|
||||
android:gravity="center"
|
||||
android:text="現金支付"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="280dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.1"
|
||||
android:gravity="center|end"
|
||||
android:text="訂單金額:"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="40sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPrice"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="0.9"
|
||||
android:gravity="center|start"
|
||||
android:text="0"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="40sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="680dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/testOne"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="0.90"
|
||||
android:gravity="center"
|
||||
android:text="請投入硬幣或紙鈔"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="80sp"
|
||||
android:textStyle="bold" />
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/cash"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="0.90"
|
||||
android:gravity="center"
|
||||
android:text="已投入的金額:"
|
||||
android:textColor="#0060E2"
|
||||
android:textSize="40sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/textStatus2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="0.90"
|
||||
android:gravity="center"
|
||||
android:text="未投入的金額:"
|
||||
android:textColor="#ff0000"
|
||||
android:textSize="40sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@null"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/checkout_wait" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="200dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/white"
|
||||
android:text="取消並退幣"
|
||||
android:textSize="28sp"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonChange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/white"
|
||||
android:text="@string/replacement_payment"
|
||||
android:visibility="gone"
|
||||
android:textSize="28sp"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonRetryEscrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="200dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="#FF9800"
|
||||
android:text="嘗試退鈔並重試"
|
||||
android:visibility="gone"
|
||||
android:textSize="28sp"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -144,6 +144,23 @@ public abstract class DialogAbstract extends AlertDialog {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析當前 flavor 要使用的現金付款 Dialog 類別。
|
||||
* General 使用強化版 CashPayDialogGeneral,其餘 flavor 使用標準 CashPayDialog。
|
||||
* 透過 SaleFlowHandler.cashDialogClass() 由各 flavor 決定,避免共用碼直接相依 flavor 類別。
|
||||
*/
|
||||
protected Class<? extends DialogAbstract> cashDialogClass() {
|
||||
Context c = getCtx();
|
||||
if (c instanceof FontendActivity) {
|
||||
com.unibuy.smartdevice.ui.SaleFlowHandler handler =
|
||||
((FontendActivity) c).getSaleFlowHandler();
|
||||
if (handler != null) {
|
||||
return handler.cashDialogClass();
|
||||
}
|
||||
}
|
||||
return com.unibuy.smartdevice.ui.dialog.CashPayDialog.class;
|
||||
}
|
||||
|
||||
|
||||
// public void changeDialog(Class<? extends DialogAbstract> cls) {
|
||||
// try {
|
||||
|
||||
@ -479,7 +479,7 @@ public class BuyDialog extends DialogAbstract {
|
||||
changeDialog(CheckoutFreeGiftCodeDialog.class);
|
||||
break;
|
||||
case 9:
|
||||
changeDialog(CashPayDialog.class);
|
||||
changeDialog(cashDialogClass());
|
||||
break;
|
||||
case 30:
|
||||
changeDialog(CheckoutTapPayDialog.class);
|
||||
|
||||
@ -489,7 +489,7 @@ public class InvoiceBarcodeDialog extends DialogAbstract {
|
||||
changeDialog(CheckoutNfcPhoneDialog.class);
|
||||
break;
|
||||
case 9:
|
||||
changeDialog(CashPayDialog.class);
|
||||
changeDialog(cashDialogClass());
|
||||
break;
|
||||
case 30:
|
||||
changeDialog(CheckoutTapPayDialog.class);
|
||||
|
||||
@ -384,7 +384,7 @@ public class InvoiceCustomerIdentifierDialog extends DialogAbstract {
|
||||
changeDialog(CheckoutNfcPhoneDialog.class);
|
||||
break;
|
||||
case 9:
|
||||
changeDialog(CashPayDialog.class);
|
||||
changeDialog(cashDialogClass());
|
||||
break;
|
||||
case 30:
|
||||
changeDialog(CheckoutTapPayDialog.class);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user