| 21714 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
| 21552 |
ashik.ali |
2 |
|
|
|
3 |
import java.time.LocalDateTime;
|
|
|
4 |
|
| 21653 |
ashik.ali |
5 |
import javax.persistence.CascadeType;
|
| 21552 |
ashik.ali |
6 |
import javax.persistence.Column;
|
| 21639 |
kshitij.so |
7 |
import javax.persistence.Convert;
|
| 21552 |
ashik.ali |
8 |
import javax.persistence.Entity;
|
|
|
9 |
import javax.persistence.EnumType;
|
|
|
10 |
import javax.persistence.Enumerated;
|
| 21653 |
ashik.ali |
11 |
import javax.persistence.FetchType;
|
| 21552 |
ashik.ali |
12 |
import javax.persistence.GeneratedValue;
|
|
|
13 |
import javax.persistence.GenerationType;
|
|
|
14 |
import javax.persistence.Id;
|
| 21653 |
ashik.ali |
15 |
import javax.persistence.JoinColumn;
|
| 21552 |
ashik.ali |
16 |
import javax.persistence.NamedQueries;
|
|
|
17 |
import javax.persistence.NamedQuery;
|
| 21653 |
ashik.ali |
18 |
import javax.persistence.OneToOne;
|
| 21552 |
ashik.ali |
19 |
import javax.persistence.Table;
|
|
|
20 |
|
| 21639 |
kshitij.so |
21 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
| 21714 |
ashik.ali |
22 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
|
|
23 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 21552 |
ashik.ali |
24 |
|
|
|
25 |
@NamedQueries({
|
|
|
26 |
@NamedQuery(name = "InventoryItem.selectCount", query = "select count(ii) from InventoryItem ii"),
|
|
|
27 |
@NamedQuery(name = "InventoryItem.selectByItemId", query = "select ii from InventoryItem ii where ii.itemId = :itemId"),
|
| 21567 |
ashik.ali |
28 |
@NamedQuery(name = "InventoryItem.selectByFofoId", query = "select ii from InventoryItem ii where ii.fofoId = :fofoId"),
|
| 21580 |
ashik.ali |
29 |
//@NamedQuery(name = "InventoryItem.selectBySerialNumber", query = "select ii from InventoryItem ii join Imei i on ii.imeiId = i.id where i.imei = :serialNumber"),
|
|
|
30 |
//@NamedQuery(name = "InventoryItem.selectQuantitySum", query = "select sum(ii.initialQuantity) as inventoryQuantity from InventoryItem ii where ii.itemId = :itemId and ii.fofoId = :fofoId and ii.purchaseReference = :purchaseReference")
|
| 21585 |
ashik.ali |
31 |
|
|
|
32 |
@NamedQuery(
|
| 21589 |
ashik.ali |
33 |
name = "InventoryItem.selectScannedCount",
|
| 21596 |
ashik.ali |
34 |
query = "select ii.itemId, sum(ii.initialQuantity) from InventoryItem ii "
|
| 21640 |
kshitij.so |
35 |
+ "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId"),
|
| 21633 |
ashik.ali |
36 |
|
|
|
37 |
@NamedQuery(
|
|
|
38 |
name = "InventoryItem.selectBySerialNumbers",
|
| 21640 |
kshitij.so |
39 |
query = "select ii from InventoryItem ii where ii.serialNumber in :serialNumbers"),
|
| 21633 |
ashik.ali |
40 |
|
| 21640 |
kshitij.so |
41 |
@NamedQuery(
|
|
|
42 |
name = "InventoryItem.selectSerialNumberBySerialNumbers",
|
|
|
43 |
query = "select ii.serialNumber from InventoryItem ii where ii.serialNumber in :serialNumbers"),
|
|
|
44 |
|
| 21552 |
ashik.ali |
45 |
})
|
|
|
46 |
@Entity
|
|
|
47 |
@Table(name="fofo.inventory_item", schema = "fofo")
|
|
|
48 |
public class InventoryItem {
|
|
|
49 |
|
| 21984 |
kshitij.so |
50 |
@Override
|
|
|
51 |
public int hashCode() {
|
|
|
52 |
final int prime = 31;
|
|
|
53 |
int result = 1;
|
|
|
54 |
result = prime * result + badQuantity;
|
|
|
55 |
result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
|
|
|
56 |
result = prime * result + fofoId;
|
|
|
57 |
result = prime * result + goodQuantity;
|
|
|
58 |
result = prime * result + id;
|
|
|
59 |
result = prime * result + initialQuantity;
|
|
|
60 |
result = prime * result + ((item == null) ? 0 : item.hashCode());
|
|
|
61 |
result = prime * result + itemId;
|
|
|
62 |
result = prime * result + ((lastScanType == null) ? 0 : lastScanType.hashCode());
|
|
|
63 |
result = prime * result + ((priceDropAmount == null) ? 0 : priceDropAmount.hashCode());
|
|
|
64 |
result = prime * result + purchaseId;
|
|
|
65 |
result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
|
|
|
66 |
result = prime * result + ((unitPrice == null) ? 0 : unitPrice.hashCode());
|
|
|
67 |
result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
|
|
|
68 |
return result;
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
@Override
|
|
|
72 |
public boolean equals(Object obj) {
|
|
|
73 |
if (this == obj)
|
|
|
74 |
return true;
|
|
|
75 |
if (obj == null)
|
|
|
76 |
return false;
|
|
|
77 |
if (getClass() != obj.getClass())
|
|
|
78 |
return false;
|
|
|
79 |
InventoryItem other = (InventoryItem) obj;
|
|
|
80 |
if (badQuantity != other.badQuantity)
|
|
|
81 |
return false;
|
|
|
82 |
if (createTimestamp == null) {
|
|
|
83 |
if (other.createTimestamp != null)
|
|
|
84 |
return false;
|
|
|
85 |
} else if (!createTimestamp.equals(other.createTimestamp))
|
|
|
86 |
return false;
|
|
|
87 |
if (fofoId != other.fofoId)
|
|
|
88 |
return false;
|
|
|
89 |
if (goodQuantity != other.goodQuantity)
|
|
|
90 |
return false;
|
|
|
91 |
if (id != other.id)
|
|
|
92 |
return false;
|
|
|
93 |
if (initialQuantity != other.initialQuantity)
|
|
|
94 |
return false;
|
|
|
95 |
if (item == null) {
|
|
|
96 |
if (other.item != null)
|
|
|
97 |
return false;
|
|
|
98 |
} else if (!item.equals(other.item))
|
|
|
99 |
return false;
|
|
|
100 |
if (itemId != other.itemId)
|
|
|
101 |
return false;
|
|
|
102 |
if (lastScanType != other.lastScanType)
|
|
|
103 |
return false;
|
|
|
104 |
if (priceDropAmount == null) {
|
|
|
105 |
if (other.priceDropAmount != null)
|
|
|
106 |
return false;
|
|
|
107 |
} else if (!priceDropAmount.equals(other.priceDropAmount))
|
|
|
108 |
return false;
|
|
|
109 |
if (purchaseId != other.purchaseId)
|
|
|
110 |
return false;
|
|
|
111 |
if (serialNumber == null) {
|
|
|
112 |
if (other.serialNumber != null)
|
|
|
113 |
return false;
|
|
|
114 |
} else if (!serialNumber.equals(other.serialNumber))
|
|
|
115 |
return false;
|
|
|
116 |
if (unitPrice == null) {
|
|
|
117 |
if (other.unitPrice != null)
|
|
|
118 |
return false;
|
|
|
119 |
} else if (!unitPrice.equals(other.unitPrice))
|
|
|
120 |
return false;
|
|
|
121 |
if (updateTimestamp == null) {
|
|
|
122 |
if (other.updateTimestamp != null)
|
|
|
123 |
return false;
|
|
|
124 |
} else if (!updateTimestamp.equals(other.updateTimestamp))
|
|
|
125 |
return false;
|
|
|
126 |
return true;
|
|
|
127 |
}
|
|
|
128 |
|
| 21552 |
ashik.ali |
129 |
@Id
|
|
|
130 |
@Column(name="id", unique=true, updatable=false)
|
|
|
131 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
132 |
private int id;
|
|
|
133 |
|
|
|
134 |
@Column(name = "item_id")
|
|
|
135 |
private int itemId;
|
|
|
136 |
|
|
|
137 |
@Column(name = "fofo_id")
|
|
|
138 |
private int fofoId;
|
|
|
139 |
|
| 21609 |
ashik.ali |
140 |
@Column(name = "serial_number", length = 100)
|
|
|
141 |
private String serialNumber;
|
| 21552 |
ashik.ali |
142 |
|
| 21613 |
kshitij.so |
143 |
@Column(name = "initial_quantity")
|
| 21552 |
ashik.ali |
144 |
private int initialQuantity;
|
|
|
145 |
|
|
|
146 |
@Column(name = "good_quantity")
|
|
|
147 |
private int goodQuantity;
|
|
|
148 |
|
|
|
149 |
@Column(name = "bad_quantity")
|
|
|
150 |
private int badQuantity;
|
|
|
151 |
|
|
|
152 |
@Column(name = "last_scan_type")
|
|
|
153 |
@Enumerated(EnumType.STRING)
|
|
|
154 |
private ScanType lastScanType;
|
|
|
155 |
|
| 21633 |
ashik.ali |
156 |
@Column(name = "purchase_id")
|
|
|
157 |
private int purchaseId;
|
| 21552 |
ashik.ali |
158 |
|
| 21662 |
kshitij.so |
159 |
@Column(name="unit_price")
|
| 21984 |
kshitij.so |
160 |
private Float unitPrice;
|
| 21662 |
kshitij.so |
161 |
|
| 21710 |
ashik.ali |
162 |
@Column(name = "price_drop_amount")
|
| 21984 |
kshitij.so |
163 |
private Float priceDropAmount;
|
| 21710 |
ashik.ali |
164 |
|
| 21639 |
kshitij.so |
165 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21552 |
ashik.ali |
166 |
@Column(name = "create_timestamp")
|
| 21640 |
kshitij.so |
167 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
| 21653 |
ashik.ali |
168 |
|
| 21710 |
ashik.ali |
169 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
170 |
@Column(name = "update_timestamp")
|
|
|
171 |
private LocalDateTime updateTimestamp = LocalDateTime.now();
|
|
|
172 |
|
| 21653 |
ashik.ali |
173 |
@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
|
|
|
174 |
@JoinColumn(name="item_id",insertable=false,updatable=false,nullable=false, referencedColumnName = "id")
|
|
|
175 |
private Item item;
|
| 21552 |
ashik.ali |
176 |
|
|
|
177 |
public int getId() {
|
|
|
178 |
return id;
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
public void setId(int id) {
|
|
|
182 |
this.id = id;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
public int getItemId() {
|
|
|
186 |
return itemId;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
public void setItemId(int itemId) {
|
|
|
190 |
this.itemId = itemId;
|
|
|
191 |
}
|
| 21984 |
kshitij.so |
192 |
|
|
|
193 |
public void setFofoId(int fofoId) {
|
|
|
194 |
this.fofoId = fofoId;
|
|
|
195 |
}
|
| 21552 |
ashik.ali |
196 |
|
|
|
197 |
public int getFofoId() {
|
|
|
198 |
return fofoId;
|
|
|
199 |
}
|
|
|
200 |
|
| 21609 |
ashik.ali |
201 |
public String getSerialNumber() {
|
|
|
202 |
return serialNumber;
|
| 21552 |
ashik.ali |
203 |
}
|
| 21609 |
ashik.ali |
204 |
public void setSerialNumber(String serialNumber) {
|
|
|
205 |
this.serialNumber = serialNumber;
|
| 21552 |
ashik.ali |
206 |
}
|
| 21567 |
ashik.ali |
207 |
|
| 21552 |
ashik.ali |
208 |
public int getInitialQuantity() {
|
|
|
209 |
return initialQuantity;
|
|
|
210 |
}
|
|
|
211 |
|
| 21984 |
kshitij.so |
212 |
public Float getUnitPrice() {
|
|
|
213 |
return unitPrice;
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
public void setUnitPrice(Float unitPrice) {
|
|
|
217 |
this.unitPrice = unitPrice;
|
|
|
218 |
}
|
|
|
219 |
|
| 21552 |
ashik.ali |
220 |
public void setInitialQuantity(int initialQuantity) {
|
|
|
221 |
this.initialQuantity = initialQuantity;
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
public int getGoodQuantity() {
|
|
|
225 |
return goodQuantity;
|
|
|
226 |
}
|
|
|
227 |
|
|
|
228 |
public void setGoodQuantity(int goodQuantity) {
|
|
|
229 |
this.goodQuantity = goodQuantity;
|
|
|
230 |
}
|
|
|
231 |
|
|
|
232 |
public int getBadQuantity() {
|
|
|
233 |
return badQuantity;
|
|
|
234 |
}
|
|
|
235 |
|
|
|
236 |
public void setBadQuantity(int badQuantity) {
|
|
|
237 |
this.badQuantity = badQuantity;
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
public ScanType getLastScanType() {
|
|
|
241 |
return lastScanType;
|
|
|
242 |
}
|
|
|
243 |
|
|
|
244 |
public void setLastScanType(ScanType lastScanType) {
|
|
|
245 |
this.lastScanType = lastScanType;
|
|
|
246 |
}
|
| 21633 |
ashik.ali |
247 |
|
|
|
248 |
public int getPurchaseId() {
|
|
|
249 |
return purchaseId;
|
| 21552 |
ashik.ali |
250 |
}
|
| 21633 |
ashik.ali |
251 |
public void setPurchaseId(int purchaseId) {
|
|
|
252 |
this.purchaseId = purchaseId;
|
| 21552 |
ashik.ali |
253 |
}
|
| 21710 |
ashik.ali |
254 |
|
| 21984 |
kshitij.so |
255 |
public Float getPriceDropAmount() {
|
| 21710 |
ashik.ali |
256 |
return priceDropAmount;
|
|
|
257 |
}
|
| 21984 |
kshitij.so |
258 |
public void setPriceDropAmount(Float priceDropAmount) {
|
| 21710 |
ashik.ali |
259 |
this.priceDropAmount = priceDropAmount;
|
|
|
260 |
}
|
| 21552 |
ashik.ali |
261 |
|
|
|
262 |
public LocalDateTime getCreateTimestamp() {
|
|
|
263 |
return createTimestamp;
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
267 |
this.createTimestamp = createTimestamp;
|
|
|
268 |
}
|
| 21653 |
ashik.ali |
269 |
|
| 21710 |
ashik.ali |
270 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
271 |
return updateTimestamp;
|
|
|
272 |
}
|
|
|
273 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
274 |
this.updateTimestamp = updateTimestamp;
|
|
|
275 |
}
|
|
|
276 |
|
| 21653 |
ashik.ali |
277 |
public Item getItem() {
|
|
|
278 |
return item;
|
|
|
279 |
}
|
|
|
280 |
public void setItem(Item item) {
|
|
|
281 |
this.item = item;
|
|
|
282 |
}
|
| 21602 |
ashik.ali |
283 |
|
|
|
284 |
@Override
|
|
|
285 |
public String toString() {
|
| 21662 |
kshitij.so |
286 |
return "InventoryItem [id=" + id + ", itemId=" + itemId + ", fofoId=" + fofoId + ", serialNumber="
|
|
|
287 |
+ serialNumber + ", initialQuantity=" + initialQuantity + ", goodQuantity=" + goodQuantity
|
|
|
288 |
+ ", badQuantity=" + badQuantity + ", lastScanType=" + lastScanType + ", purchaseId=" + purchaseId
|
| 21710 |
ashik.ali |
289 |
+ ", unitPrice=" + unitPrice + ", priceDropAmount=" + priceDropAmount + ", createTimestamp="
|
|
|
290 |
+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", item=" + item + "]";
|
| 21602 |
ashik.ali |
291 |
}
|
| 21662 |
kshitij.so |
292 |
|
| 21552 |
ashik.ali |
293 |
|
| 21984 |
kshitij.so |
294 |
|
|
|
295 |
|
|
|
296 |
|
| 21552 |
ashik.ali |
297 |
}
|