cats_core 1.1.7 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cats/core/dispatch_transactions_controller.rb +5 -0
- data/app/controllers/cats/core/locations_controller.rb +5 -0
- data/app/controllers/cats/core/receipt_transactions_controller.rb +5 -0
- data/app/controllers/cats/core/receipts_controller.rb +2 -2
- data/app/models/cats/core/rhn_request.rb +2 -1
- data/app/services/cats/core/receipt_service.rb +1 -1
- data/config/routes.rb +7 -3
- data/db/migrate/20210718042755_create_cats_core_rhn_requests.rb +1 -0
- data/lib/cats/core/version.rb +1 -1
- data/lib/cats_core.rb +1 -0
- data/spec/factories/cats/core/rhn_requests.rb +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc34455b593fd71880ccf827b6d2e3c9aea723471d877780d4f44b18297cb92
|
4
|
+
data.tar.gz: f2867e4a074fe84990e005a845844f06a3433e6fed52d9e56f12eb5943c061ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13a7abd31cdaa640da8486fb394b7896e919c79229233fdee4f8fd5ebae5498f55987ba72f30189486812a9273be8efe4e246cd2bd9d410f32996bee1deff037
|
7
|
+
data.tar.gz: e9dafd860e39d9751a6ddade1adf4d6df4373c37c38f4e267ed2056b1eef7e756a1a29b4b44d62907329348e1a8d8e8d7998e4bd92d78baf2564e6ffc0daf7a6
|
@@ -3,6 +3,11 @@ module Cats
|
|
3
3
|
class DispatchTransactionsController < ApplicationController
|
4
4
|
include Common
|
5
5
|
|
6
|
+
def index
|
7
|
+
transactions = Cats::Core::DispatchTransaction.where(destination_id: params[:id])
|
8
|
+
render json: { success: true, data: serialize(transactions) }
|
9
|
+
end
|
10
|
+
|
6
11
|
private
|
7
12
|
|
8
13
|
def model_params
|
@@ -13,6 +13,11 @@ module Cats
|
|
13
13
|
render json: { success: true, data: serialize(parent.children) }
|
14
14
|
end
|
15
15
|
|
16
|
+
def filter
|
17
|
+
query = Cats::Core::Location.ransack(params[:q])
|
18
|
+
render json: { success: true, data: serialize(query.result) }
|
19
|
+
end
|
20
|
+
|
16
21
|
private
|
17
22
|
|
18
23
|
def model_params
|
@@ -3,6 +3,11 @@ module Cats
|
|
3
3
|
class ReceiptTransactionsController < ApplicationController
|
4
4
|
include Common
|
5
5
|
|
6
|
+
def index
|
7
|
+
transactions = Cats::Core::ReceiptTransaction.where(source_id: params[:id])
|
8
|
+
render json: { success: true, data: serialize(transactions) }
|
9
|
+
end
|
10
|
+
|
6
11
|
private
|
7
12
|
|
8
13
|
def model_params
|
@@ -17,10 +17,10 @@ module Cats
|
|
17
17
|
render json: { success: false, error: e.message }
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def finish_stacking
|
21
21
|
receipt = Cats::Core::Receipt.find(params[:id])
|
22
22
|
service = ReceiptService.new
|
23
|
-
result = service.
|
23
|
+
result = service.finish_stacking(receipt)
|
24
24
|
render json: { success: true, data: serialize(result) }
|
25
25
|
rescue StandardError => e
|
26
26
|
render json: { success: false, error: e.message }
|
@@ -3,8 +3,9 @@ module Cats
|
|
3
3
|
class RhnRequest < ApplicationRecord
|
4
4
|
belongs_to :commodity
|
5
5
|
|
6
|
-
validates :reference_no, :request_date, presence: true
|
6
|
+
validates :reference_no, :request_date, :quantity, presence: true
|
7
7
|
validates :reference_no, uniqueness: true
|
8
|
+
validates :quantity, numericality: { greater_than: 0 }
|
8
9
|
|
9
10
|
delegate(:batch_no, to: :commodity, prefix: true)
|
10
11
|
end
|
data/config/routes.rb
CHANGED
@@ -23,6 +23,8 @@ Cats::Core::Engine.routes.draw do
|
|
23
23
|
get 'warehouses', controller: :users, action: :warehouses
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
post '/locations/filter', controller: :locations, action: :filter
|
26
28
|
resources :locations, except: %i[destroy] do
|
27
29
|
member do
|
28
30
|
get 'children'
|
@@ -59,6 +61,7 @@ Cats::Core::Engine.routes.draw do
|
|
59
61
|
get '/dispatches/search', controller: :dispatches, action: :search, as: :search_dispatches
|
60
62
|
resources :dispatches, except: %i[index destroy] do
|
61
63
|
member do
|
64
|
+
get 'transactions', controller: :dispatch_transactions, action: :index
|
62
65
|
get 'receipts', controller: :receipts, action: :index
|
63
66
|
get 'commodity'
|
64
67
|
post 'approve'
|
@@ -66,12 +69,13 @@ Cats::Core::Engine.routes.draw do
|
|
66
69
|
post 'confirm'
|
67
70
|
end
|
68
71
|
end
|
69
|
-
resources :dispatch_transactions, except: %i[new edit destroy]
|
72
|
+
resources :dispatch_transactions, except: %i[index new edit destroy]
|
70
73
|
resources :receipts, except: %i[index new edit destroy] do
|
71
74
|
member do
|
75
|
+
get 'transactions', controller: :receipt_transactions, action: :index
|
72
76
|
post 'start_stacking'
|
73
|
-
post '
|
77
|
+
post 'finish_stacking'
|
74
78
|
end
|
75
79
|
end
|
76
|
-
resources :receipt_transactions, except: %i[new edit destroy]
|
80
|
+
resources :receipt_transactions, except: %i[index new edit destroy]
|
77
81
|
end
|
@@ -6,6 +6,7 @@ class CreateCatsCoreRhnRequests < ActiveRecord::Migration[6.1]
|
|
6
6
|
null: false,
|
7
7
|
index: { name: 'commodity_on_rhn_indx' },
|
8
8
|
foreign_key: { to_table: :cats_core_commodities }
|
9
|
+
t.float :quantity, null: false
|
9
10
|
t.date :request_date, null: false
|
10
11
|
t.string :requested_by
|
11
12
|
|
data/lib/cats/core/version.rb
CHANGED
data/lib/cats_core.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 6.1.4
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ransack
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.4.2
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.4.2
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rolify
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|