feat: KKT dto_device_id — multiple KKTs per DTO instance
- EquipmentPage: added "ID устройства в ДТО" field (config.dto_device_id), shown on device card as #1 - api.ts: typed config.dto_device_id in WorkstationDevice Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1006,7 +1006,7 @@ export interface WorkstationDevice {
|
||||
networkPort?: number
|
||||
comPort?: string
|
||||
purpose: 'fiscal' | 'kitchen' | 'bar' | 'receipt' | 'other'
|
||||
config: Record<string, unknown>
|
||||
config: Record<string, unknown> & { dto_user?: string; dto_pass?: string; dto_device_id?: string }
|
||||
fiscalMode?: boolean
|
||||
dtoPort?: number
|
||||
}
|
||||
|
||||
@@ -203,6 +203,7 @@ function DeviceForm({
|
||||
const [dtoPort, setDtoPort] = useState(String(initial?.dtoPort ?? 16732))
|
||||
const [dtoUser, setDtoUser] = useState(String(initial?.config?.dto_user ?? '30'))
|
||||
const [dtoPass, setDtoPass] = useState(String(initial?.config?.dto_pass ?? '30'))
|
||||
const [dtoDeviceId, setDtoDeviceId] = useState(String(initial?.config?.dto_device_id ?? ''))
|
||||
const [saving, setSaving] = useState(false)
|
||||
const [availablePorts, setAvailablePorts] = useState<{ port: string; description?: string }[] | null>(null)
|
||||
const [portsLoading, setPortsLoading] = useState(false)
|
||||
@@ -230,7 +231,7 @@ function DeviceForm({
|
||||
purpose: purpose as WorkstationDevice['purpose'],
|
||||
fiscalMode: type === 'kkt' ? fiscalMode : undefined,
|
||||
dtoPort: type === 'kkt' && fiscalMode ? Number(dtoPort) : undefined,
|
||||
config: type === 'kkt' && fiscalMode ? { dto_user: dtoUser, dto_pass: dtoPass } : undefined,
|
||||
config: type === 'kkt' && fiscalMode ? { dto_user: dtoUser, dto_pass: dtoPass, dto_device_id: dtoDeviceId.trim() || undefined } : undefined,
|
||||
})
|
||||
setSaving(false)
|
||||
}
|
||||
@@ -295,15 +296,27 @@ function DeviceForm({
|
||||
</div>
|
||||
{fiscalMode && (
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-slate-500 mb-1">Порт АТОЛ ДТО</label>
|
||||
<input
|
||||
value={dtoPort}
|
||||
onChange={e => setDtoPort(e.target.value)}
|
||||
className="w-32 input text-sm font-mono"
|
||||
placeholder="16732"
|
||||
/>
|
||||
<p className="text-xs text-slate-400 mt-1">По умолчанию 16732. Для нескольких касс — разные порты.</p>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-slate-500 mb-1">Порт АТОЛ ДТО</label>
|
||||
<input
|
||||
value={dtoPort}
|
||||
onChange={e => setDtoPort(e.target.value)}
|
||||
className="w-full input text-sm font-mono"
|
||||
placeholder="16732"
|
||||
/>
|
||||
<p className="text-xs text-slate-400 mt-1">По умолчанию 16732</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-slate-500 mb-1">ID устройства в ДТО</label>
|
||||
<input
|
||||
value={dtoDeviceId}
|
||||
onChange={e => setDtoDeviceId(e.target.value)}
|
||||
className="w-full input text-sm font-mono"
|
||||
placeholder="1"
|
||||
/>
|
||||
<p className="text-xs text-slate-400 mt-1">Из /api/v2/devices</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
@@ -694,6 +707,9 @@ function WorkstationCard({
|
||||
{device.type === 'kkt' && device.fiscalMode !== false && device.dtoPort && device.dtoPort !== 16732 && (
|
||||
<span className="text-xs text-slate-400 font-mono">DTO:{device.dtoPort}</span>
|
||||
)}
|
||||
{device.type === 'kkt' && device.fiscalMode !== false && device.config?.dto_device_id && (
|
||||
<span className="text-xs text-slate-400 font-mono">#{device.config.dto_device_id}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user