mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 13:45:25 +08:00
42af732073
* Fix zebra printer switch and optimize zebra library loading [SCI-7430] * Fix zebra enabled [SCI-7430]
41 lines
849 B
Ruby
41 lines
849 B
Ruby
# frozen_string_literal: true
|
|
|
|
class LabelPrinter < ApplicationRecord
|
|
FLUICS_STATUS_MAP = Hash.new(:error).merge(
|
|
{
|
|
'00' => :ready,
|
|
'50' => :busy,
|
|
'60' => :busy,
|
|
'01' => :out_of_labels,
|
|
'02' => :out_of_labels
|
|
}
|
|
).freeze
|
|
|
|
enum type_of: { fluics: 0 }
|
|
enum language_type: { zpl: 0 }
|
|
enum status: { ready: 0, busy: 1, out_of_labels: 2, unreachable: 3, error: 4 }
|
|
|
|
validates :name, presence: true
|
|
validates :type_of, presence: true
|
|
validates :language_type, presence: true
|
|
|
|
def self.zebra_print_enabled?
|
|
RepositoryBase.stock_management_enabled?.present?
|
|
end
|
|
|
|
def done?
|
|
current_print_job_ids.blank? && ready?
|
|
end
|
|
|
|
def printing?
|
|
current_print_job_ids.any? && ready?
|
|
end
|
|
|
|
def printing_status
|
|
return 'printing' if printing?
|
|
|
|
return 'done' if done?
|
|
|
|
status
|
|
end
|
|
end
|