diff --git a/.agents/workflows/compiler-apk.md b/.agents/workflows/compiler-apk.md index 08cd42d..a2242dd 100644 --- a/.agents/workflows/compiler-apk.md +++ b/.agents/workflows/compiler-apk.md @@ -157,6 +157,7 @@ if [ -n "$APK_SOURCE" ]; then echo "* 版本名稱 (versionName):$VERSION_NAME" echo "* 版本代碼 (versionCode):$VERSION_CODE" echo "* APK 檔案名稱:$APK_NAME" + echo "* 更新說明:[請在此處附上口語化的一句話更新說明]" echo "==================================================" else echo "❌ 找不到編譯產出的 APK 檔案,複製失敗!" diff --git a/.agents/workflows/release-apk.md b/.agents/workflows/release-apk.md index 074916a..2f91a70 100644 --- a/.agents/workflows/release-apk.md +++ b/.agents/workflows/release-apk.md @@ -42,10 +42,16 @@ if [ "$TARGET_FLAVOR" != "General" ] && [ "$TARGET_FLAVOR" != "Chengwai" ] && [ exit 1 fi -echo "📦 [Release] 開始編譯正式版變體: ${TARGET_FLAVOR}S12XYURelease" +# 根據專案 Flavor 判定硬體 Flavor(中國醫 Cmuh 使用 S9XYU,其餘使用 S12XYU) +HW_FLAVOR="S12XYU" +if [ "$TARGET_FLAVOR" = "Cmuh" ]; then + HW_FLAVOR="S9XYU" +fi + +echo "📦 [Release] 開始編譯正式版變體: ${TARGET_FLAVOR}${HW_FLAVOR}Release" # 使用 clean 確保完整重新編譯,避開 incremental 快取問題 -./gradlew clean :app:assemble${TARGET_FLAVOR}S12XYURelease --no-daemon +./gradlew clean :app:assemble${TARGET_FLAVOR}${HW_FLAVOR}Release --no-daemon ``` ## 步驟二:導出正式 APK 並產出後台 Keyin 派送參考資料 @@ -62,8 +68,13 @@ if [ -n "$1" ]; then TARGET_FLAVOR=$(echo "$1" | awk '{print toupper(substr($0,1,1))tolower(substr($0,2))}') fi +HW_FLAVOR="S12XYU" +if [ "$TARGET_FLAVOR" = "Cmuh" ]; then + HW_FLAVOR="S9XYU" +fi + # 動態尋找編譯產出的最新正式版 APK 檔案 -APK_SOURCE=$(find app/build/outputs/apk/${TARGET_FLAVOR}S12XYU/release/ -name "app-S_12_XY_U_${TARGET_FLAVOR}-*-release.apk" | head -n 1) +APK_SOURCE=$(find app/build/outputs/apk/${TARGET_FLAVOR}${HW_FLAVOR}/release/ -name "app-S_*_${TARGET_FLAVOR}-*-release.apk" | head -n 1) if [ -n "$APK_SOURCE" ]; then APK_NAME=$(basename "$APK_SOURCE") @@ -74,12 +85,19 @@ if [ -n "$APK_SOURCE" ]; then echo "==================================================" # 提取與計算版本資訊 - MAJOR=$(grep "def verMajor" app/build.gradle | awk '{print $4}') MINOR=$(grep "def verMinor" app/build.gradle | awk '{print $4}') PATCH=$(grep "def verPatch" app/build.gradle | awk '{print $4}') + + # 根據硬體規格決定 Major (S9XYU 為 21 吋,S12XYU 為 10 吋) + if [ "$HW_FLAVOR" = "S9XYU" ]; then + MAJOR=21 + else + MAJOR=10 + fi + VERSION_NAME="${MAJOR}_0${MINOR}_${PATCH}_R" VERSION_CODE=$((MAJOR * 10000 + MINOR * 100 + PATCH)) - FLAVOR="${TARGET_FLAVOR}S12XYU" + FLAVOR="${TARGET_FLAVOR}${HW_FLAVOR}" echo "🚀 實體販賣機 OTA 後台新增版本 Keyin 參考資料:" echo "--------------------------------------------------" diff --git a/app/build.gradle b/app/build.gradle index 1d4925c..6bc7304 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ plugins { // 避免不同尺寸機台間版本號產生衝突。 // ========================================================================= def verMinor = 1 -def verPatch = 33 +def verPatch = 66 android { diff --git a/app/src/Cmuh/java/com/unibuy/smartdevice/ui/SaleFlowHandler.java b/app/src/Cmuh/java/com/unibuy/smartdevice/ui/SaleFlowHandler.java index 218ce96..2c94e2e 100644 --- a/app/src/Cmuh/java/com/unibuy/smartdevice/ui/SaleFlowHandler.java +++ b/app/src/Cmuh/java/com/unibuy/smartdevice/ui/SaleFlowHandler.java @@ -322,14 +322,36 @@ public class SaleFlowHandler { haveValuestate = true; if (requestQty > 1) { - int checkcount = 0; - int slotnum = 0; + class TempSlot { + int slotNo; + int stock; + TempSlot(int slotNo, int stock) { + this.slotNo = slotNo; + this.stock = stock; + } + } + String[] slotPairs = medicineList.get(i).getMedicineSlot().split(","); + java.util.List tempSlots = new java.util.ArrayList<>(); + for (String pair : slotPairs) { + if (pair.trim().isEmpty()) continue; + String[] parts = pair.split("-"); + if (parts.length == 2) { + tempSlots.add(new TempSlot(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]))); + } + } + + int slotIdx = 0; for (int j = 0; j < requestQty; j++) { - checkcount += 1; - if (checkcount > Integer.valueOf(medicineList.get(i).getMedicineSlot().split(",")[0].split("-")[1])) { - slotnum = Integer.valueOf(medicineList.get(i).getMedicineSlot().split(",")[1].split("-")[0]); + while (slotIdx < tempSlots.size() && tempSlots.get(slotIdx).stock <= 0) { + slotIdx++; + } + int slotnum; + if (slotIdx < tempSlots.size()) { + TempSlot activeSlot = tempSlots.get(slotIdx); + slotnum = activeSlot.slotNo; + activeSlot.stock--; } else { - slotnum = Integer.valueOf(medicineList.get(i).getMedicineSlot().split(",")[0].split("-")[0]); + slotnum = tempSlots.get(tempSlots.size() - 1).slotNo; } addMedicineToBuyList( medicineList.get(i).getProductId(), diff --git a/app/src/Cmuh/res/layout/activity_fontend.xml b/app/src/Cmuh/res/layout/activity_fontend.xml new file mode 100644 index 0000000..66c6859 --- /dev/null +++ b/app/src/Cmuh/res/layout/activity_fontend.xml @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +