-
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -44,6 +44,7 @@ gem 'bcrypt', '~> 3.1.7'
|
|||||||
gem 'simple_form'
|
gem 'simple_form'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'to_csv-rails'
|
gem 'to_csv-rails'
|
||||||
|
gem 'barby'
|
||||||
# gem 'bootstrap-multiselect-rails'
|
# gem 'bootstrap-multiselect-rails'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ GEM
|
|||||||
airbrussh (1.3.0)
|
airbrussh (1.3.0)
|
||||||
sshkit (>= 1.6.1, != 1.7.0)
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
arel (7.1.4)
|
arel (7.1.4)
|
||||||
|
barby (0.6.5)
|
||||||
bcrypt (3.1.12)
|
bcrypt (3.1.12)
|
||||||
bindex (0.5.0)
|
bindex (0.5.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
@@ -223,6 +224,7 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
barby
|
||||||
bcrypt (~> 3.1.7)
|
bcrypt (~> 3.1.7)
|
||||||
byebug
|
byebug
|
||||||
capistrano
|
capistrano
|
||||||
|
|||||||
@@ -81,9 +81,6 @@ class Api::BatchLineItemsController < ApplicationController
|
|||||||
client_id=""
|
client_id=""
|
||||||
qty = params[:qty]
|
qty = params[:qty]
|
||||||
total_count=0
|
total_count=0
|
||||||
puts batch_id
|
|
||||||
puts 'ello'
|
|
||||||
puts params[:id]
|
|
||||||
# check_member= Member.authenticate_session_token(session_token)
|
# check_member= Member.authenticate_session_token(session_token)
|
||||||
# if !check_member.nil?
|
# if !check_member.nil?
|
||||||
encrypt_key=""
|
encrypt_key=""
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ class BatchLineItemsController < ApplicationController
|
|||||||
skip_before_filter :verify_authenticity_token
|
skip_before_filter :verify_authenticity_token
|
||||||
before_action :authenticate_member!
|
before_action :authenticate_member!
|
||||||
require 'digest/md5'
|
require 'digest/md5'
|
||||||
|
require 'barby'
|
||||||
|
require 'barby/barcode/code_128'
|
||||||
|
require 'barby/outputter/ascii_outputter'
|
||||||
|
require 'barby/outputter/svg_outputter'
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# user_id=current_member.user_id
|
# user_id=current_member.user_id
|
||||||
@@ -129,6 +134,9 @@ class BatchLineItemsController < ApplicationController
|
|||||||
client_id=""
|
client_id=""
|
||||||
qty = params[:qty]
|
qty = params[:qty]
|
||||||
total_count=0
|
total_count=0
|
||||||
|
check = params[:barcode]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# check_member= Member.authenticate_session_token(session_token)
|
# check_member= Member.authenticate_session_token(session_token)
|
||||||
# if !check_member.nil?
|
# if !check_member.nil?
|
||||||
@@ -137,7 +145,6 @@ class BatchLineItemsController < ApplicationController
|
|||||||
|
|
||||||
find_batch = Batch.find_by_id(batch_id)
|
find_batch = Batch.find_by_id(batch_id)
|
||||||
if !find_batch.nil?
|
if !find_batch.nil?
|
||||||
puts 'hkjfklasj'
|
|
||||||
card_type=find_batch.adult_or_child.upcase
|
card_type=find_batch.adult_or_child.upcase
|
||||||
product_category_id=find_batch.product_category_id
|
product_category_id=find_batch.product_category_id
|
||||||
find_product_category=ProductCategory.find_by_id(product_category_id)
|
find_product_category=ProductCategory.find_by_id(product_category_id)
|
||||||
@@ -159,6 +166,14 @@ class BatchLineItemsController < ApplicationController
|
|||||||
asset_identity=BatchLineItem.generate_account_no(location_code)
|
asset_identity=BatchLineItem.generate_account_no(location_code)
|
||||||
security_code=BatchLineItem.generate_security_code
|
security_code=BatchLineItem.generate_security_code
|
||||||
out=BatchLineItem.create_product(asset_identity,serial_no,batch_id,"","",security_code)
|
out=BatchLineItem.create_product(asset_identity,serial_no,batch_id,"","",security_code)
|
||||||
|
if check.present?
|
||||||
|
barcode = BatchLineItem.generate_barcode
|
||||||
|
update_barcode = BatchLineItem.find_by_asset_identity(out[2])
|
||||||
|
update_barcode.barcode = barcode
|
||||||
|
barcode_128 = Barby::Code128.new(barcode)
|
||||||
|
update_barcode.barcode_format = barcode_128
|
||||||
|
update_barcode.save
|
||||||
|
end
|
||||||
total_count+=1
|
total_count+=1
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -39,6 +39,17 @@ class BatchLineItem < ApplicationRecord
|
|||||||
end
|
end
|
||||||
return security_code
|
return security_code
|
||||||
end
|
end
|
||||||
|
def self.generate_barcode
|
||||||
|
|
||||||
|
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
||||||
|
barcode = (0...10).map { o[rand(o.length)] }.join
|
||||||
|
find_account_no = BatchLineItem.find_by_barcode(barcode)
|
||||||
|
if !find_account_no.nil?
|
||||||
|
o = [('0'..'9')].map { |i| i.to_a }.flatten
|
||||||
|
barcode = (0...10).map { o[rand(o.length)] }.join
|
||||||
|
end
|
||||||
|
return barcode
|
||||||
|
end
|
||||||
def self.generate_serial_no(client_id)
|
def self.generate_serial_no(client_id)
|
||||||
find_lookup=Lookup.find_by_name('generate_serial_no')
|
find_lookup=Lookup.find_by_name('generate_serial_no')
|
||||||
if !find_lookup.nil?
|
if !find_lookup.nil?
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
<%= hidden_field_tag 'id', params[:id] %>
|
<%= hidden_field_tag 'id', params[:id] %>
|
||||||
<%= label_tag(:qty, "Qty:") %>
|
<%= label_tag(:qty, "Qty:") %>
|
||||||
<%= text_field_tag :qty, "", class: 'adjust_height' %>
|
<%= text_field_tag :qty, "", class: 'adjust_height' %>
|
||||||
|
<br/>
|
||||||
|
<input type="checkbox" name="barcode" value="true" class="">Barcode
|
||||||
|
<br/>
|
||||||
<%= submit_tag("Generate", :class=>"btn btn-primary btn_height") %>
|
<%= submit_tag("Generate", :class=>"btn btn-primary btn_height") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
<th>Manufacture UID</th>
|
<th>Manufacture UID</th>
|
||||||
<th>Batch No</th>
|
<th>Batch No</th>
|
||||||
<th>Asset Type</th>
|
<th>Asset Type</th>
|
||||||
|
<th>Barcode </th>
|
||||||
<th>Created At </th>
|
<th>Created At </th>
|
||||||
<th>Updated At </th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -79,8 +79,8 @@
|
|||||||
<td><%= item.manufacture_uid rescue '' %></td>
|
<td><%= item.manufacture_uid rescue '' %></td>
|
||||||
<td><%= item.batch_name rescue '' %></td>
|
<td><%= item.batch_name rescue '' %></td>
|
||||||
<td><%= item.asset_type rescue '' %></td>
|
<td><%= item.asset_type rescue '' %></td>
|
||||||
|
<td><%= item.barcode rescue '' %></td>
|
||||||
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
<td><%= item.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
||||||
<td><%= item.updated_at.strftime("%e,%b %Y %I:%M %p") rescue '' %></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
21
app/views/users/Find Results
Normal file
21
app/views/users/Find Results
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Searching 838 files for "page_no"
|
||||||
|
|
||||||
|
0 matches
|
||||||
|
|
||||||
|
Searching 838 files for "check_box"
|
||||||
|
|
||||||
|
/Users/nda/Documents/projectX/nemo_encoder/app/views/devise/sessions/new.html.erb:
|
||||||
|
15 <% if devise_mapping.rememberable? -%>
|
||||||
|
16 <div class ="form-group" >
|
||||||
|
17: <%= f.check_box :remember_me %>
|
||||||
|
18 <%= f.label :remember_me %>
|
||||||
|
19 </div>
|
||||||
|
|
||||||
|
/Users/nda/Documents/projectX/nemo_encoder/app/views/users/_form.html.erb:
|
||||||
|
58 <div class ="form-group" >
|
||||||
|
59 <label for="is_active" class="string optional control-label">Active:</label>
|
||||||
|
60: <%= check_box "Monday", "yes" %>
|
||||||
|
61 </div>
|
||||||
|
62 <% end %>
|
||||||
|
|
||||||
|
2 matches across 2 files
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddBarcode128InBatchLineItems < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
add_column :batch_line_items, :barcode_format, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20180724072431) do
|
ActiveRecord::Schema.define(version: 20180726080303) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -30,6 +30,7 @@ ActiveRecord::Schema.define(version: 20180724072431) do
|
|||||||
t.string "barcode"
|
t.string "barcode"
|
||||||
t.boolean "is_activated", default: false
|
t.boolean "is_activated", default: false
|
||||||
t.datetime "activated_date"
|
t.datetime "activated_date"
|
||||||
|
t.string "barcode_format"
|
||||||
t.index ["batch_id"], name: "index_batch_line_items_on_batch_id", using: :btree
|
t.index ["batch_id"], name: "index_batch_line_items_on_batch_id", using: :btree
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user