cats_core 1.4.19 → 1.4.20
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d78b456ef9b9082680246207509f81b33ba4c9584136bafc00ac1dd9085e77cb
|
4
|
+
data.tar.gz: f1138cb24c4f94d7c42dd84b15916762c1f27c321531b1057f2b9e96a2da5c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74b5f1fc12c9851dd07224c07b6a00912d44012f2347f87b3264cad20882f5950b9d27d9820c3c0b1526e26f32dfb83ee16263d77b4bcf2efdcd8f5ca30aaef9
|
7
|
+
data.tar.gz: 349b6c6a81040bf195ea723e9920f97711be1dce7c4257a5c7f03459d4b0cebd3d59ae650265ed952791c85330891df00d51c621c81c4948c85819f30ce07903
|
@@ -59,7 +59,7 @@ module Cats
|
|
59
59
|
# Commit transactions
|
60
60
|
dispatch_transactions.each(&:commit)
|
61
61
|
self.quantity = total_quantity
|
62
|
-
self.dispatch_status =
|
62
|
+
self.dispatch_status = APPROVED
|
63
63
|
save!
|
64
64
|
end
|
65
65
|
end
|
@@ -67,7 +67,7 @@ module Cats
|
|
67
67
|
def start
|
68
68
|
raise(StandardError, 'Dispatch has to be approved first.') unless dispatch_status == Dispatch::APPROVED
|
69
69
|
|
70
|
-
self.dispatch_status =
|
70
|
+
self.dispatch_status = STARTED
|
71
71
|
save!
|
72
72
|
end
|
73
73
|
|
@@ -83,12 +83,32 @@ module Cats
|
|
83
83
|
end
|
84
84
|
|
85
85
|
Dispatch.transaction do
|
86
|
-
self.dispatch_status =
|
86
|
+
self.dispatch_status = RECEIVED
|
87
87
|
receipts.each { |r| r.status = Receipt::CONFIRMED }
|
88
88
|
save!
|
89
89
|
receipts.each(&:save!)
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
def self.search_commodity(batch_no)
|
94
|
+
commodity = Commodity.find_by(batch_no: batch_no)
|
95
|
+
dispatches = Dispatch.includes(:dispatch_transactions)
|
96
|
+
.joins(:transporter)
|
97
|
+
.where(
|
98
|
+
dispatch_status: [APPROVED, STARTED, ARRIVED, UNLOADED]
|
99
|
+
)
|
100
|
+
dispatches.map do |dispatch|
|
101
|
+
{
|
102
|
+
batch_no: batch_no,
|
103
|
+
commodity_name: commodity.name,
|
104
|
+
quantity: dispatch.total_quantity,
|
105
|
+
unit: commodity.unit_abbreviation,
|
106
|
+
location: dispatch.transporter.name,
|
107
|
+
location_detail: "Plate No.: #{dispatch.plate_no}, Driver: #{dispatch.driver_name}",
|
108
|
+
stack: ''
|
109
|
+
}
|
110
|
+
end
|
111
|
+
end
|
92
112
|
end
|
93
113
|
end
|
94
114
|
end
|
@@ -146,6 +146,25 @@ module Cats
|
|
146
146
|
|
147
147
|
store.save
|
148
148
|
end
|
149
|
+
|
150
|
+
def self.search_commodity(batch_no)
|
151
|
+
commodity = Commodity.find_by(batch_no: batch_no)
|
152
|
+
stacks = Stack.joins(:commodity, store: :warehouse).where(
|
153
|
+
commodity: { batch_no: batch_no },
|
154
|
+
stack_status: Stack::ALLOCATED
|
155
|
+
)
|
156
|
+
stacks.map do |stack|
|
157
|
+
{
|
158
|
+
batch_no: batch_no,
|
159
|
+
commodity_name: commodity.name,
|
160
|
+
quantity: stack.quantity,
|
161
|
+
unit: commodity.unit_abbreviation,
|
162
|
+
location: stack.store.warehouse.name,
|
163
|
+
location_detail: stack.store.name,
|
164
|
+
stack: stack.code
|
165
|
+
}
|
166
|
+
end
|
167
|
+
end
|
149
168
|
end
|
150
169
|
end
|
151
170
|
end
|
data/lib/cats/core/version.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.4.
|
4
|
+
version: 1.4.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|