Написали вот так
@Override public void addPaymentAuto(Payment payment, Check check, Printer printer) throws BGException { // обработка автопечатаемых платежей int cid = payment.getContractId(); ContractManager cm = new ContractManager(con) ; Contract ct = cm.getContractById(cid); int fc = ct.getFc(); if(fc == 0) { check.addString("fizik"); check.setCashierName("Администратор"); check.addPayment( payment.getSumma(), "Услуги связи", 0 ); check.addString( payment.getContractTitle() + " " + payment.getContractComment() ); check.setPaymentType(2); //установим тип платежа ККМ Безнал check.setTax(1); } }
Задача печатать чек для физиков - и для них все нормально печатается. Для юриков же мы не хотим печатать чек для автоплатежа в принципе. Когда делаем платеж по юрику, касса подает сигнал, чек не выходит а кэшчек сервер выводит следующую ошибку:
22.03.2019 09:35:30,346 DEBUG [main] CmdTcpServer:197 - server: connection accepted #6: Socket[addr=/89.19.193.10,port=52163,localport=9876] 22.03.2019 09:35:30,346 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- COMMAND 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- 39384204717666554600061837182819 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- check 22.03.2019 09:35:30,405 DEBUG [thread#6] CmdTcpServer:401 - thread#6: try 'check' command… 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- 30 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- 0 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- CHECKTYPE 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- PAYMENT 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- ENDCOMMAND 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:342 - thread#6: -> ECHO 22.03.2019 09:35:30,405 TRACE [thread#6] CmdTcpServer:342 - thread#6: -> 39384204717666554600061837182819 22.03.2019 09:35:30,405 DEBUG [thread#6] Driver:470 - Driver: CHECK TYPE: PAYMENT 22.03.2019 09:35:30,405 DEBUG [thread#6] Driver:429 - Driver: check/checkreturn(clientsumma=0,type=1): 22.03.2019 09:35:30,407 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: send ENQ 22.03.2019 09:35:30,407 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: set timeout 10000 22.03.2019 09:35:30,415 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: getted NAK 22.03.2019 09:35:30,415 TRACE [thread#6] Driver:1652 - shtrih2-driver: try getStatusShort() 22.03.2019 09:35:30,415 TRACE [thread#6] Driver:1652 - shtrih2-driver: SEND (full packet): 02 05 10 1E 00 00 00 0B 22.03.2019 09:35:30,415 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: send ENQ 22.03.2019 09:35:30,415 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: set timeout 10000 22.03.2019 09:35:30,424 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: getted NAK 22.03.2019 09:35:30,424 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: send packet 22.03.2019 09:35:30,424 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: set timeout 1000 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: getted ACK, ok! 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: set timeout 120000 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read STX-byte 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read len=16 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: set timeout 1000 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read body 10 00 1E 92 02 02 00 00 A0 47 19 01 00 61 08 00 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read lrc 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: RECV (full): 02|10|10 00 1E 92 02 02 00 00 A0 47 19 01 00 61 08 00|1A 22.03.2019 09:35:30,487 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: ok, send ACK 22.03.2019 09:35:30,488 TRACE [thread#6] Driver:1652 - shtrih2-driver: RECV (packet body): 10 00 1E 92 02 02 00 00 A0 47 19 01 00 61 08 00 22.03.2019 09:35:30,488 TRACE [thread#6] Driver:1652 - shtrih2-driver: try closeCheck(0,0,0,0,0,"",0,0,0,0) 22.03.2019 09:35:30,488 TRACE [thread#6] Driver:1652 - shtrih2-driver: SEND (full packet): 02 47 85 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 DC 22.03.2019 09:35:30,488 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: send ENQ 22.03.2019 09:35:30,488 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: set timeout 10000 22.03.2019 09:35:30,498 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: getted NAK 22.03.2019 09:35:30,498 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: send packet 22.03.2019 09:35:30,630 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: set timeout 1000 22.03.2019 09:35:30,669 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: getted ACK, ok! 22.03.2019 09:35:30,669 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: set timeout 120000 22.03.2019 09:35:30,669 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read STX-byte 22.03.2019 09:35:30,670 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read len=2 22.03.2019 09:35:30,670 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: set timeout 1000 22.03.2019 09:35:30,670 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read body 85 73 22.03.2019 09:35:30,671 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: ok read lrc 22.03.2019 09:35:30,671 TRACE [thread#6] Driver:1652 - shtrih2-driver: _readSTX: RECV (full): 02|02|85 73|F4 22.03.2019 09:35:30,671 TRACE [thread#6] Driver:1652 - shtrih2-driver: _transferPacket: ok, send ACK 22.03.2019 09:35:30,672 TRACE [thread#6] Driver:1652 - shtrih2-driver: RECV (packet body): 85 73 22.03.2019 09:35:30,675 TRACE [thread#6] CmdTcpServer:342 - thread#6: -> ERROR 22.03.2019 09:35:30,677 DEBUG [thread#6] CmdTcpServer:482 - thread#6: frk error ru.bitel.frk.driver.shtrih2.PrinterShtrihErrorException: #115: Команда не поддерживается в данном режиме (ФР) at ru.bitel.frk.driver.shtrih2.ShtrihFRKPrinter.a(SourceFile:286) at ru.bitel.frk.driver.shtrih2.ShtrihFRKPrinter.closeCheck(SourceFile:1213) at ru.bitel.frk.driver.shtrih2.Driver._check(SourceFile:515) at ru.bitel.frk.driver.shtrih2.Driver.check(SourceFile:535) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at ru.bitel.frk.server.CmdTcpServer.run(SourceFile:453) 22.03.2019 09:35:30,683 WARN [thread#6] CmdTcpServer:492 - thread#6: send error driver: #115: Команда не поддерживается в данном режиме (ФР) 22.03.2019 09:35:30,683 TRACE [thread#6] CmdTcpServer:342 - thread#6: -> #115: Команда не поддерживается в данном режиме (ФР) 22.03.2019 09:35:30,684 TRACE [thread#6] CmdTcpServer:342 - thread#6: -> ENDECHO 22.03.2019 09:35:30,684 DEBUG [thread#6] CmdTcpServer:502 - thread#6: command 'check' processing sucessfull 22.03.2019 09:35:30,686 TRACE [thread#6] CmdTcpServer:329 - thread#6: <- <EOF> 22.03.2019 09:35:30,686 DEBUG [thread#6] CmdTcpServer:504 - thread#6: end all commands 22.03.2019 09:35:30,686 DEBUG [thread#6] CmdTcpServer:530 - thread#6: close socket
Хоть чек и не печатается как мы и хотим, но ошибка это неправильно. Что лучше написать для условия fc==1 ?
|