[FIX] 修復中國醫多貨道庫存分配異常與遞增發版版號

1. 修復 SaleFlowHandler.java:重構中國醫客製領藥流程中的多商品貨道分配演算法,引進動態多貨道輪替分配機制,徹底解決一筆單多商品(如 3 個同商品)時貨道重複分配為 3, 4, 4 的 Bug。
2. 更新 build.gradle:配合生產發版,將修補版號 verPatch 遞增至 66,並在背景成功編譯產出正式 Release APK (CmuhS9XYURelease)。
This commit is contained in:
sky121113 2026-06-02 17:49:40 +08:00
parent a5add7d8ae
commit bfc2915403
2 changed files with 29 additions and 7 deletions

View File

@ -9,7 +9,7 @@ plugins {
//
// =========================================================================
def verMinor = 1
def verPatch = 65
def verPatch = 66
android {

View File

@ -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<TempSlot> 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(),