open-ship 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +1 -0
- data/lib/open-ship/sscc.rb +1 -4
- data/open-ship.gemspec +1 -1
- data/spec/open-ship/carton_spec.rb +3 -3
- data/spec/open-ship/sscc_spec.rb +3 -3
- data/tmp/test_carton_label.pdf +9 -9
- data/tmp/test_text_label.pdf +8 -8
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/lib/open-ship/sscc.rb
CHANGED
@@ -3,16 +3,13 @@ module OpenShip
|
|
3
3
|
class Sscc
|
4
4
|
|
5
5
|
@company_prefix
|
6
|
-
@extension_digit = "
|
6
|
+
@extension_digit = "0"
|
7
7
|
|
8
8
|
def self.company_prefix
|
9
9
|
@company_prefix
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.company_prefix=(prefix)
|
13
|
-
if !prefix.start_with? "0"
|
14
|
-
raise "Company prefix should have a leading zero."
|
15
|
-
end
|
16
13
|
@company_prefix=prefix
|
17
14
|
end
|
18
15
|
|
data/open-ship.gemspec
CHANGED
@@ -112,9 +112,9 @@ require 'spec_helper'
|
|
112
112
|
population = []
|
113
113
|
boxes_to_stores = {}
|
114
114
|
i = 0
|
115
|
-
|
115
|
+
2.times {
|
116
116
|
boxes_to_stores[i.to_s] = []
|
117
|
-
|
117
|
+
10.times {
|
118
118
|
box = OpenShip::Box.new
|
119
119
|
box.length = ((rand * 9) + 1).to_i
|
120
120
|
box.width = ((rand * 19) + 1).to_i
|
@@ -125,7 +125,7 @@ require 'spec_helper'
|
|
125
125
|
}
|
126
126
|
ship = OpenShip::Shipment.new(:logger => log)
|
127
127
|
ship.boxes_to_stores = boxes_to_stores
|
128
|
-
best_fit = ship.run_ga(
|
128
|
+
best_fit = ship.run_ga(3, 3)
|
129
129
|
|
130
130
|
best_fit.cartons_to_stores.each { |k, v|
|
131
131
|
puts "Test"
|
data/spec/open-ship/sscc_spec.rb
CHANGED
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe OpenShip::Sscc do
|
4
4
|
|
5
5
|
it "Should persist a company prefix on the model" do
|
6
|
-
OpenShip::Sscc.company_prefix = "
|
7
|
-
OpenShip::Sscc.company_prefix.should == "
|
6
|
+
OpenShip::Sscc.company_prefix = "8012345"
|
7
|
+
OpenShip::Sscc.company_prefix.should == "8012345"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should generate a valid check digit for a given sscc id" do
|
@@ -23,7 +23,7 @@ describe OpenShip::Sscc do
|
|
23
23
|
serial_reference = "192837465"
|
24
24
|
OpenShip::Sscc.company_prefix = company_prefix
|
25
25
|
sscc = OpenShip::Sscc.generate_sscc_id(serial_reference)
|
26
|
-
sscc.should == "
|
26
|
+
sscc.should == "006141411928374650"
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should fill in leading zeros in serial_reference if serial_reference + company_prefix + extension_digit adds up to less than 17" do
|
data/tmp/test_carton_label.pdf
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
%PDF-1.3
|
2
2
|
%����
|
3
3
|
1 0 obj
|
4
|
-
<< /
|
5
|
-
/
|
4
|
+
<< /Creator <feff0050007200610077006e>
|
5
|
+
/Producer <feff0050007200610077006e>
|
6
6
|
>>
|
7
7
|
endobj
|
8
8
|
2 0 obj
|
@@ -12,8 +12,8 @@ endobj
|
|
12
12
|
endobj
|
13
13
|
3 0 obj
|
14
14
|
<< /Count 1
|
15
|
-
/Type /Pages
|
16
15
|
/Kids [5 0 R]
|
16
|
+
/Type /Pages
|
17
17
|
>>
|
18
18
|
endobj
|
19
19
|
4 0 obj
|
@@ -353,29 +353,29 @@ Q
|
|
353
353
|
endstream
|
354
354
|
endobj
|
355
355
|
5 0 obj
|
356
|
-
<< /
|
357
|
-
/
|
358
|
-
/Resources << /Font << /F1.0 6 0 R
|
356
|
+
<< /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
357
|
+
/Font << /F1.0 6 0 R
|
359
358
|
/F2.0 7 0 R
|
360
359
|
>>
|
361
|
-
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
362
360
|
>>
|
363
361
|
/Parent 3 0 R
|
364
362
|
/Contents 4 0 R
|
363
|
+
/MediaBox [0 0 311.811023622047 189.92125984252]
|
364
|
+
/Type /Page
|
365
365
|
>>
|
366
366
|
endobj
|
367
367
|
6 0 obj
|
368
368
|
<< /Encoding /WinAnsiEncoding
|
369
369
|
/Subtype /Type1
|
370
|
-
/Type /Font
|
371
370
|
/BaseFont /Helvetica
|
371
|
+
/Type /Font
|
372
372
|
>>
|
373
373
|
endobj
|
374
374
|
7 0 obj
|
375
375
|
<< /Encoding /WinAnsiEncoding
|
376
376
|
/Subtype /Type1
|
377
|
-
/Type /Font
|
378
377
|
/BaseFont /Courier
|
378
|
+
/Type /Font
|
379
379
|
>>
|
380
380
|
endobj
|
381
381
|
xref
|
data/tmp/test_text_label.pdf
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
%PDF-1.3
|
2
2
|
%����
|
3
3
|
1 0 obj
|
4
|
-
<< /
|
5
|
-
/
|
4
|
+
<< /Creator <feff0050007200610077006e>
|
5
|
+
/Producer <feff0050007200610077006e>
|
6
6
|
>>
|
7
7
|
endobj
|
8
8
|
2 0 obj
|
@@ -12,8 +12,8 @@ endobj
|
|
12
12
|
endobj
|
13
13
|
3 0 obj
|
14
14
|
<< /Count 1
|
15
|
-
/Type /Pages
|
16
15
|
/Kids [5 0 R]
|
16
|
+
/Type /Pages
|
17
17
|
>>
|
18
18
|
endobj
|
19
19
|
4 0 obj
|
@@ -103,21 +103,21 @@ Q
|
|
103
103
|
endstream
|
104
104
|
endobj
|
105
105
|
5 0 obj
|
106
|
-
<< /
|
107
|
-
/
|
108
|
-
/Resources << /Font << /F1.0 6 0 R
|
106
|
+
<< /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
107
|
+
/Font << /F1.0 6 0 R
|
109
108
|
>>
|
110
|
-
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
111
109
|
>>
|
112
110
|
/Parent 3 0 R
|
113
111
|
/Contents 4 0 R
|
112
|
+
/MediaBox [0 0 566.929133858268 425.196850393701]
|
113
|
+
/Type /Page
|
114
114
|
>>
|
115
115
|
endobj
|
116
116
|
6 0 obj
|
117
117
|
<< /Encoding /WinAnsiEncoding
|
118
118
|
/Subtype /Type1
|
119
|
-
/Type /Font
|
120
119
|
/BaseFont /Helvetica
|
120
|
+
/Type /Font
|
121
121
|
>>
|
122
122
|
endobj
|
123
123
|
xref
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|