-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.java
134 lines (103 loc) · 4.29 KB
/
Item.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
* @author Dino Cajic
*/
public class Item implements Comparable<Item> {
private String location, itemNumber, description, last_sale_date, last_receipt;
private int on_hand_qty, commited_qty, available_qty, yr_to_date_sold, last_year_sold, location_id;
private double wavg_cost, level_0_price;
Item(String location, String itemNumber, String description, String last_sale_date, String last_receipt,
int on_hand_qty, int commited_qty, int available_qty, int yr_to_date_sold, int last_year_sold,
double wavg_cost, double level_0_price)
{
this.setLocation(location);
this.setItemNumber(itemNumber);
this.setDescription(description);
this.setLast_sale_date(last_sale_date);
this.setLast_receipt(last_receipt);
this.setOn_hand_qty(on_hand_qty);
this.setCommited_qty(commited_qty);
this.setAvailable_qty(available_qty);
this.setYr_to_date_sold(yr_to_date_sold);
this.setLast_year_sold(last_year_sold);
this.setWavg_cost(wavg_cost);
this.setLevel_0_price(level_0_price);
}
public String getLocation() { return location; }
public String getItemNumber() { return itemNumber; }
public String getDescription() { return description; }
public String getLast_sale_date() { return last_sale_date; }
public String getLast_receipt() { return last_receipt; }
public int getOn_hand_qty() { return on_hand_qty; }
public int getCommited_qty() { return commited_qty; }
public int getAvailable_qty() { return available_qty; }
public int getYr_to_date_sold() { return yr_to_date_sold; }
public int getLast_year_sold() { return last_year_sold; }
public String getWavg_cost() {
return "$" + String.format("%.2f", wavg_cost);
}
public String getLevel_0_price() {
return "$" + String.format("%.2f", level_0_price);
}
public int getLocation_id() { return location_id; }
public void setAvailable_qty(int available_qty) {
this.available_qty = available_qty;
}
public void setCommited_qty(int commited_qty) {
this.commited_qty = commited_qty;
}
public void setDescription(String description) {
this.description = description;
}
public void setItemNumber(String itemNumber) {
this.itemNumber = itemNumber;
}
public void setLast_receipt(String last_receipt) {
this.last_receipt = last_receipt;
}
public void setLast_sale_date(String last_sale_date) {
this.last_sale_date = last_sale_date;
}
public void setLast_year_sold(int last_year_sold) {
this.last_year_sold = last_year_sold;
}
public void setYr_to_date_sold(int yr_to_date_sold) { this.yr_to_date_sold = yr_to_date_sold; }
public void setLocation(String location) {
this.location = location;
switch( location ) {
case "ATL": this.location_id = 1; break;
case "CHAR": this.location_id = 4; break;
case "NO": this.location_id = 3; break;
}
}
public void setOn_hand_qty(int on_hand_qty) {
this.on_hand_qty = on_hand_qty;
}
public void setLevel_0_price(double level_0_price) {
this.level_0_price = level_0_price;
}
public void setWavg_cost(double wavg_cost) {
this.wavg_cost = wavg_cost;
}
@Override
public String toString() {
return this.getLocation() + "~" +
this.getItemNumber() + "~" +
this.getDescription() + "~" +
this.getOn_hand_qty() + "~" +
this.getCommited_qty() + "~" +
this.getAvailable_qty() + "~" +
this.getYr_to_date_sold() + "~" +
this.getLast_year_sold() + "~" +
this.getLast_sale_date() + "~" +
this.getLast_receipt() + "~" +
this.getWavg_cost() + "~" +
this.getLevel_0_price();
}
private String getCompareToString() {
return this.getItemNumber() + "-" + this.getLocation_id();
}
@Override
public int compareTo(Item newItem) {
return this.getCompareToString().compareTo( newItem.getCompareToString() );
}
}