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:
@@ -92,7 +92,7 @@ struct ItemEditView: View {
|
||||
@State private var locations: [StorageLocation] = []
|
||||
@State private var shops: [ShopItem] = []
|
||||
@State private var photo: Data?
|
||||
@State private var locationId: Int?
|
||||
@State private var locationId: String?
|
||||
@State private var shopId: Int?
|
||||
@State private var hasAcquired = false
|
||||
@State private var acquired = Date()
|
||||
@@ -138,8 +138,8 @@ struct ItemEditView: View {
|
||||
|
||||
Section {
|
||||
Picker("Lagerort", selection: $locationId) {
|
||||
Text("– ohne –").tag(Int?.none)
|
||||
ForEach(locations) { l in Text(l.name).tag(Int?.some(l.id)) }
|
||||
Text("– ohne –").tag(String?.none)
|
||||
ForEach(locations) { l in Text(l.name).tag(String?.some(l.id)) }
|
||||
}
|
||||
Picker("Gekauft bei", selection: $shopId) {
|
||||
Text("– unbekannt –").tag(Int?.none)
|
||||
@@ -406,7 +406,7 @@ struct ItemAddSheet: View {
|
||||
@State private var count = 1
|
||||
@State private var locations: [StorageLocation] = []
|
||||
@State private var shops: [ShopItem] = []
|
||||
@State private var locationId: Int?
|
||||
@State private var locationId: String?
|
||||
@State private var shopId: Int?
|
||||
@State private var hasAcquired = false
|
||||
@State private var acquired = Date()
|
||||
@@ -430,8 +430,8 @@ struct ItemAddSheet: View {
|
||||
Section {
|
||||
Stepper("Anzahl: \(count)", value: $count, in: 1...200)
|
||||
Picker("Lagerort", selection: $locationId) {
|
||||
Text("– ohne –").tag(Int?.none)
|
||||
ForEach(locations) { l in Text(l.name).tag(Int?.some(l.id)) }
|
||||
Text("– ohne –").tag(String?.none)
|
||||
ForEach(locations) { l in Text(l.name).tag(String?.some(l.id)) }
|
||||
}
|
||||
Picker("Gekauft bei", selection: $shopId) {
|
||||
Text("– unbekannt –").tag(Int?.none)
|
||||
|
||||
Reference in New Issue
Block a user