extface 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/extface/handler_controller.rb +1 -1
- data/app/models/extface/device.rb +1 -1
- data/app/models/extface/driver/base/print.rb +70 -0
- data/app/models/extface/driver/daisy_fx1200.rb +10 -0
- data/app/models/extface/driver/generic_esc_pos.rb +8 -0
- data/app/models/extface/job.rb +21 -1
- data/app/views/extface/driver/generic_esc_pos/_settings.html.erb +1 -0
- data/db/migrate/20160103154233_add_started_at_to_extface_job.rb +5 -0
- data/lib/extface/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6649c38c68097bd3139b52d76cd71fb9e6c5aa8
|
4
|
+
data.tar.gz: d990d58d8584459b9b8f6c412f8419c69f579c44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5f8c0ee1ef326ca941f7c6f9e69a97ed514262ad706ebf6921c2d8dead109aea6799472ff45a16ed07a672c4c5221965944051eefecab1157508b45614116c
|
7
|
+
data.tar.gz: b62354f3c6bbfe8a0e2602134dc75438cc381febf81706f17de82f13d4a70720587b27ecae55d4f5896c058e2fb662a920efc6a6d6905268edf296e9bdf9e1a1
|
@@ -34,7 +34,7 @@ module Extface
|
|
34
34
|
r.append device.uuid, request.body.read
|
35
35
|
@full_buffer = r.get device.uuid
|
36
36
|
end
|
37
|
-
while @full_buffer.b.present? && bytes_porcessed = device.driver.pre_handle(@full_buffer.b) #handle more than one valid packet in the buffer
|
37
|
+
while @full_buffer.try(:b).present? && bytes_porcessed = device.driver.pre_handle(@full_buffer.b) #handle more than one valid packet in the buffer
|
38
38
|
Extface.redis_block do |r|
|
39
39
|
r.set device.uuid, @full_buffer.b[bytes_porcessed..-1]
|
40
40
|
@full_buffer = r.get device.uuid
|
@@ -32,7 +32,7 @@ module Extface
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def session(description = nil)
|
35
|
-
job = jobs.create!(description: description)
|
35
|
+
job = jobs.create!(description: description, started_at: Time.now)
|
36
36
|
job.thread = Thread.new do
|
37
37
|
Thread.current[:extface_job] = job.id
|
38
38
|
ActiveRecord::Base.establish_connection unless ActiveRecord::Base.connection.active?
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Extface
|
2
|
+
class Driver::Base::Print < Extface::Driver
|
3
|
+
self.abstract_class = true
|
4
|
+
|
5
|
+
NAME = 'Print Device Name'.freeze
|
6
|
+
GROUP = Extface::PRINT_DRIVER
|
7
|
+
|
8
|
+
DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
|
9
|
+
|
10
|
+
# Select driver features
|
11
|
+
RAW = true #responds to #push(data) and #pull
|
12
|
+
PRINT = true #POS, slip printers
|
13
|
+
FISCAL = false #cash registers, fiscal printers
|
14
|
+
REPORT = false #only transmit data that must be parsed by handler, CDR, report devices
|
15
|
+
|
16
|
+
alias_method :print, :push
|
17
|
+
|
18
|
+
def print_test_page(times = 1)
|
19
|
+
device.session("Print Test Page") do |s|
|
20
|
+
times.times do |t|
|
21
|
+
s.notify "Printing Test Page #{t}"
|
22
|
+
s.print "******************************\r\n*"
|
23
|
+
s.print "Extface Print Test #{t}".center(28)
|
24
|
+
s.print "*\r\n******************************\r\n"
|
25
|
+
|
26
|
+
s.notify "Printing driver information"
|
27
|
+
s.print "\r\nDriver:\r\n"
|
28
|
+
s.print "------------------------------\r\n"
|
29
|
+
s.print "#{self.class::NAME}".truncate(30)
|
30
|
+
s.print "\r\n"
|
31
|
+
|
32
|
+
if try(:serial?)
|
33
|
+
s.notify "Printing serial settings"
|
34
|
+
s.print "\r\nSerial Port Settings:\r\n"
|
35
|
+
s.print "------------------------------\r\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
s.print "\r\n"
|
39
|
+
s.print "------------------------------\r\n"
|
40
|
+
s.print Time.now.strftime("Printed on %m/%d/%Y %T\r\n").rjust(32)
|
41
|
+
s.print "\r\n\r\n"
|
42
|
+
s.notify "Printing finished"
|
43
|
+
|
44
|
+
s.try :autocut
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def check_status
|
50
|
+
return true #just pass
|
51
|
+
end
|
52
|
+
|
53
|
+
def printize(bill, detailed = false, payments = true)
|
54
|
+
if detailed
|
55
|
+
device.session("Fiscal Doc") do |s|
|
56
|
+
s.notify "Print Doc Start"
|
57
|
+
s.print "******************************\r\n*"
|
58
|
+
s.print "Extface Print Bill".center(28)
|
59
|
+
s.print "*\r\n******************************\r\n"
|
60
|
+
s.notify "Print Sale"
|
61
|
+
bill.charges.each do |charge|
|
62
|
+
end
|
63
|
+
end
|
64
|
+
else
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -150,6 +150,16 @@ module Extface
|
|
150
150
|
fsend(Sales::TOTAL, "\t")
|
151
151
|
end
|
152
152
|
|
153
|
+
def payed_recv_account(value = 0.00, payment_type_num = 0)
|
154
|
+
raise "Incorrect Amount Value" if value.zero?
|
155
|
+
device.session("Payed Out / Received on Account (#{value.to_s})") do |s|
|
156
|
+
s.notify "Payed / Received Start"
|
157
|
+
fsend Other::ADD_SUB_SUMS, "" << ("%.2f" % value)
|
158
|
+
status = get_printer_status
|
159
|
+
s.notify "Payed / Received End"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
153
163
|
#basket
|
154
164
|
def sale_and_pay_items_session(items = [], operator = "1", password = "1")
|
155
165
|
device.session("Fiscal Doc") do |s|
|
data/app/models/extface/job.rb
CHANGED
@@ -4,10 +4,30 @@ module Extface
|
|
4
4
|
|
5
5
|
belongs_to :device, inverse_of: :jobs
|
6
6
|
|
7
|
-
scope :active, ->{ where(arel_table[:completed_at].eq(nil).and(arel_table[:failed_at].eq(nil))) }
|
7
|
+
scope :active, ->{ where(arel_table[:completed_at].eq(nil).and(arel_table[:failed_at].eq(nil)).and(arel_table[:started_at].not_eq(nil))) }
|
8
8
|
scope :completed, ->{ where(arel_table[:completed_at].not_eq(nil)) }
|
9
9
|
scope :failed, ->{ where(arel_table[:failed_at].not_eq(nil)) }
|
10
10
|
|
11
|
+
def runtime(description = nil)
|
12
|
+
update!(description: description, started_at: Time.now)
|
13
|
+
begin
|
14
|
+
raise 'No device assigned' unless device.present?
|
15
|
+
raise 'No driver configured' unless device.driver.present?
|
16
|
+
if device.driver.set_job(self)
|
17
|
+
yield device.driver
|
18
|
+
complete!
|
19
|
+
else
|
20
|
+
raise device.driver.errors.full_messages.join(', ')
|
21
|
+
end
|
22
|
+
rescue => e
|
23
|
+
STDERR.puts e.message
|
24
|
+
e.backtrace.each do |line|
|
25
|
+
p line
|
26
|
+
end
|
27
|
+
failed! e.message
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
11
31
|
def complete!
|
12
32
|
self.completed_at = Time.now
|
13
33
|
save!
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= __FILE__.gsub(Rails.root.to_s, "") %>
|
data/lib/extface/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Vangelov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- app/models/extface/device.rb
|
100
100
|
- app/models/extface/driver.rb
|
101
101
|
- app/models/extface/driver/base/fiscal.rb
|
102
|
+
- app/models/extface/driver/base/print.rb
|
102
103
|
- app/models/extface/driver/clock/pms.rb
|
103
104
|
- app/models/extface/driver/daisy/commands_fx1200.rb
|
104
105
|
- app/models/extface/driver/daisy_fx1200.rb
|
@@ -107,6 +108,7 @@ files:
|
|
107
108
|
- app/models/extface/driver/eltrade/commands_fp4.rb
|
108
109
|
- app/models/extface/driver/eltrade_tm_u220.rb
|
109
110
|
- app/models/extface/driver/fidelio/fias.rb
|
111
|
+
- app/models/extface/driver/generic_esc_pos.rb
|
110
112
|
- app/models/extface/driver/generic_pos.rb
|
111
113
|
- app/models/extface/driver/star_scp700.rb
|
112
114
|
- app/models/extface/driver/star_tsp200.rb
|
@@ -127,6 +129,7 @@ files:
|
|
127
129
|
- app/views/extface/driver/eltrade_tm_u220/_settings.html.erb
|
128
130
|
- app/views/extface/driver/fidelio/fias/_control.html.erb
|
129
131
|
- app/views/extface/driver/fidelio/fias/_settings.html.erb
|
132
|
+
- app/views/extface/driver/generic_esc_pos/_settings.html.erb
|
130
133
|
- app/views/extface/driver/generic_pos/_settings.html.erb
|
131
134
|
- app/views/extface/driver/star_scp700/_settings.html.erb
|
132
135
|
- app/views/extface/driver/star_tsp200/_settings.html.erb
|
@@ -145,6 +148,7 @@ files:
|
|
145
148
|
- db/migrate/20140303112124_create_extface_drivers.rb
|
146
149
|
- db/migrate/20140303122506_change_driver_polymorphic_to_belongs_to_extface_devices.rb
|
147
150
|
- db/migrate/20140303123022_change_polymorphic_to_has_one_to_extface_serial_configs.rb
|
151
|
+
- db/migrate/20160103154233_add_started_at_to_extface_job.rb
|
148
152
|
- lib/extface.rb
|
149
153
|
- lib/extface/engine.rb
|
150
154
|
- lib/extface/extfaceable.rb
|