1. VmcFragment.updateFlowerBuyList():銷售卡合併同商品多貨道改為「任一可賣貨道(count>0且未鎖未過期)即可售」,庫存只計可賣貨道加總;全部不可賣才依 鎖定>過期>售完 顯示對應遮罩。修正鎖一個貨道或單一貨道過期就把整個商品擋掉的問題。 2. MyApp 新增 allocateBuyStructures():把購買數量依可賣貨道 greedy 拆成多筆 count=1 的 BuyStructure,規避 VMC 出貨狀態機不支援單筆 quantity>1(出完第一個會卡 40 秒看門狗);庫存不足才溢位回代表道,交既有「出貨失敗→後台依 dispense 退款」保護網。 3. CartViewModel.convertToBuyStructure():多品項購物車改用 allocateBuyStructures 拆道,避免同商品買多個時重複出同一貨道而卡頓/出貨失敗。 4. DialogProductDetail 直購:改走 allocateBuyStructures 拆道。 5. PickupSheetSaleFlow:中國醫領藥 buildMaterialSlotMap 與 isAvailableCmuhStock 排除鎖定/過期藥道,避免藥單驗證通過卻在出貨時失敗。 6. build.gradle:verPatch 18→19(versionName 依硬體規格產生)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
154 lines
5.4 KiB
Groovy
154 lines
5.4 KiB
Groovy
plugins {
|
||
alias(libs.plugins.android.application)
|
||
alias(libs.plugins.kotlin.android)
|
||
}
|
||
|
||
// =========================================================================
|
||
// 核心版號與自動連動定義
|
||
// 每次發佈新版本給機台時,只需遞增 verPatch (修補版號)。
|
||
// 螢幕尺寸 (verMajor) 已改為下方依據編譯 Flavor (S12XYU / S9XYU) 自動動態判定,
|
||
// 避免不同尺寸機台間版本號產生衝突。
|
||
// =========================================================================
|
||
def verMinor = 2
|
||
def verPatch = 19
|
||
|
||
|
||
|
||
android {
|
||
namespace 'com.unibuy.smartdevice'
|
||
compileSdk 35
|
||
|
||
defaultConfig {
|
||
applicationId "com.unibuy.smartdevice"
|
||
minSdk 21
|
||
targetSdk 34
|
||
// 預設以 10 吋進行基礎 Sync 估算,實際打包會由下方 applicationVariants 動態覆寫
|
||
versionCode 10 * 10000 + verMinor * 100 + verPatch
|
||
versionName "10_0${verMinor}_${verPatch}_R"
|
||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
}
|
||
|
||
// =====================================================================
|
||
// 單維度 Flavor:hardware(硬體規格 / IPC 世代)
|
||
// 客戶專案(購買流程)已收斂為執行期 shopping_mode(雲端 B014 下發),不再用 flavor 分家。
|
||
// hardware 維度決定螢幕尺寸、minSdk(安卓版本)與 COM port(見 ComPort.getFilepath)。
|
||
// =====================================================================
|
||
flavorDimensions "hardware"
|
||
|
||
productFlavors {
|
||
S12XYU {
|
||
dimension "hardware"
|
||
}
|
||
|
||
S9XYU {
|
||
dimension "hardware"
|
||
minSdk 28
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
signingConfig signingConfigs.debug
|
||
}
|
||
}
|
||
|
||
// 自定義打包檔案名稱與動態版本號計算
|
||
// 遵循公司命名規範:來源_安卓號_主板號_機器系列_專案名稱_螢幕大小_次版號_修補版號_環境
|
||
applicationVariants.all { variant ->
|
||
def hardware = variant.productFlavors[0].name // hardware dimension(唯一維度)
|
||
def buildType = variant.buildType.name
|
||
|
||
// 根據硬體規格自動動態判定螢幕吋數 (verMajor) 與版號
|
||
def verMajor = 10
|
||
def calculatedMinor = verMinor // 預設套用全域次版號
|
||
def calculatedPatch = verPatch // 預設套用全域修補版號
|
||
|
||
if (hardware == "S9XYU") {
|
||
verMajor = 21 // 21.5 吋
|
||
|
||
// 【預留擴充】若中國醫安卓 9 機台未來需要獨立的發版節奏,可直接在此單獨覆寫:
|
||
// calculatedMinor = 1
|
||
// calculatedPatch = 6
|
||
} else if (hardware == "S12XYU") {
|
||
verMajor = 10 // 10 吋
|
||
}
|
||
|
||
// 環境後綴:release → R(正式)、debug → D(測試),供現場一眼辨識 APK 來源
|
||
def envSuffix = (buildType == "release") ? "R" : "D"
|
||
|
||
// 動態重算並覆寫此 Variant 的版本號,避免互相污染
|
||
def calculatedVersionCode = verMajor * 10000 + calculatedMinor * 100 + calculatedPatch
|
||
def calculatedVersionName = "${verMajor}_0${calculatedMinor}_${calculatedPatch}_${envSuffix}"
|
||
|
||
|
||
variant.outputs.each { output ->
|
||
output.versionCodeOverride = calculatedVersionCode
|
||
output.versionNameOverride = calculatedVersionName
|
||
|
||
// 將 hardware flavor 名稱展開為公司規範格式 S12XYU → S_12_XY_U
|
||
def hwFormatted = hardware
|
||
.replaceAll(/^([A-Z])(\d+)([A-Z]+)([A-Z])$/, '$1_$2_$3_$4')
|
||
|
||
// 輸出範例:app-S_12_XY_U-10_08_8_R-release.apk(依硬體分版,購買流程由雲端 shopping_mode 決定)
|
||
output.outputFileName = "app-${hwFormatted}-${calculatedVersionName}-${buildType}.apk"
|
||
}
|
||
}
|
||
|
||
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_11
|
||
targetCompatibility JavaVersion.VERSION_11
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = '11'
|
||
}
|
||
|
||
buildFeatures {
|
||
viewBinding true
|
||
buildConfig true
|
||
}
|
||
|
||
packaging {
|
||
resources {
|
||
excludes += ['META-INF/INDEX.LIST', 'META-INF/io.netty.versions.properties']
|
||
}
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
implementation libs.appcompat
|
||
implementation libs.material
|
||
implementation libs.activity
|
||
implementation libs.constraintlayout
|
||
implementation libs.work.runtime
|
||
testImplementation libs.junit
|
||
androidTestImplementation libs.ext.junit
|
||
androidTestImplementation libs.espresso.core
|
||
|
||
annotationProcessor libs.compiler
|
||
implementation libs.usb.serial.for.android
|
||
implementation libs.android.serialport
|
||
implementation libs.glide
|
||
implementation libs.media3.exoplayer
|
||
implementation libs.media3.ui
|
||
implementation libs.tsnackBar
|
||
|
||
implementation 'com.blankj:utilcodex:1.31.1'
|
||
implementation 'com.hivemq:hivemq-mqtt-client:1.3.3'
|
||
implementation 'io.netty:netty-codec-http:4.1.94.Final'
|
||
implementation 'io.netty:netty-handler:4.1.94.Final'
|
||
implementation 'com.google.code.gson:gson:2.10.1'
|
||
|
||
// Kotlin / MVVM(basic 模式的多品項購物車)
|
||
implementation libs.kotlin.stdlib
|
||
implementation libs.lifecycle.viewmodel.ktx
|
||
implementation libs.lifecycle.livedata.ktx
|
||
implementation libs.lifecycle.runtime.ktx
|
||
implementation libs.brvah
|
||
}
|