Lagerorte per 10-Zeichen-Code statt fortlaufender ID; iOS-Einlagern ohne Kamerazwang
Lagerort-IDs sind jetzt ein zufaelliger 10-Zeichen-Code (wie die Einzelstueck-UIDs) statt einer fortlaufenden Zahl - so kollidiert die Stammdaten-Sicherung zwischen zwei Instanzen praktisch nie mehr, und der Code ist zugleich der Inhalt des QR /l/<code>. Alle Fremdschluessel (lots, movements, items, Mindestbestaende, parent_id) ziehen mit; die Umstellung laeuft einmalig und transaktional beim Serverstart (_migrate_locations_to_code) und rollt bei Fehlern komplett zurueck. Vor dem Deploy ein DB-Backup machen. iOS-Einlagern oeffnet nicht mehr sofort die Kamera, sondern ein Formular mit Artikelsuche; die Kamera kommt erst per Button. Im Formular laesst sich der Lagerort zusaetzlich per /l/-QR scannen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -58,17 +58,18 @@ struct AssignScanView: View {
|
||||
}
|
||||
|
||||
private func handle(_ code: String) async {
|
||||
// Lagerort-QR (…/l/<ID>)?
|
||||
// Lagerort-QR (…/l/<Code>)? Der Code ist eine 10-stellige Zeichenkette.
|
||||
if let r = code.range(of: "/l/") {
|
||||
let idStr = String(code[r.upperBound...])
|
||||
let locCode = String(code[r.upperBound...])
|
||||
.trimmingCharacters(in: CharacterSet(charactersIn: "/ "))
|
||||
if let locId = Int(idStr) {
|
||||
.uppercased()
|
||||
if !locCode.isEmpty {
|
||||
guard let it = pending else {
|
||||
error = "Erst ein Einzelstück scannen."; status = nil; return
|
||||
}
|
||||
do {
|
||||
_ = try await APIClient.shared.updateItem(id: it.id, ItemUpdateRequest(
|
||||
locationId: locId, shopId: it.shopId,
|
||||
locationId: locCode, shopId: it.shopId,
|
||||
acquiredOn: it.acquiredOn, warrantyUntil: it.warrantyUntil, note: it.note))
|
||||
status = "\(it.uid) zugeordnet. Nächstes Stück scannen."
|
||||
error = nil
|
||||
|
||||
Reference in New Issue
Block a user