| 33772 |
amit.gupta |
1 |
package com.spice.profitmandi.dao.entity.catalog;
|
|
|
2 |
|
|
|
3 |
import javax.persistence.*;
|
|
|
4 |
import java.time.LocalDateTime;
|
|
|
5 |
import java.util.Objects;
|
|
|
6 |
|
| 35343 |
ranu |
7 |
|
|
|
8 |
@NamedQueries({
|
|
|
9 |
@NamedQuery(name = "Catalog.findOtherORNullCategoryAndInStock", query = "select i.catalogItemId "
|
|
|
10 |
+ " from WarehouseInventoryItem wi "
|
|
|
11 |
+ " join Item i on i.id = wi.itemId"
|
|
|
12 |
+ " left join CategorisedCatalog cc on cc.catalogId = i.catalogItemId and cc.endDate is null "
|
| 35356 |
ranu |
13 |
+ " where ((cc.status is null OR cc.status = 'OTHER' OR cc.status = 'SLOWMOVING')) and i.categoryId in (10006,10009,10010) and i.brand= :brand group by i.catalogItemId having sum(wi.currentQuantity) > 0"),
|
| 35343 |
ranu |
14 |
|
|
|
15 |
@NamedQuery(name = "Catalog.findOtherORNullCategoryAndPartnerInStock", query = "select i.catalogItemId "
|
|
|
16 |
+ " from CurrentInventorySnapshot cis "
|
|
|
17 |
+ " join Item i on i.id = cis.itemId"
|
|
|
18 |
+ " left join CategorisedCatalog cc on cc.catalogId = i.catalogItemId and cc.endDate is null "
|
| 35356 |
ranu |
19 |
+ " where ((cc.status is null OR cc.status = 'OTHER' OR cc.status = 'SLOWMOVING')) and i.categoryId in (10006,10009,10010) and i.brand= :brand and cis.fofoId = :fofoId group by i.catalogItemId having sum(cis.availability) > 0"),
|
| 35357 |
ranu |
20 |
|
| 35365 |
ranu |
21 |
@NamedQuery(name = "Catalog.findAllWithEOLWithOutStock", query = "select i.catalogItemId "
|
| 35359 |
ranu |
22 |
+ " from Item i "
|
|
|
23 |
+ " left join WarehouseInventoryItem wi on i.id = wi.itemId"
|
| 35357 |
ranu |
24 |
+ " left join CategorisedCatalog cc on cc.catalogId = i.catalogItemId and cc.endDate is null "
|
| 35421 |
ranu |
25 |
+ " where ((cc.status is null OR cc.status = 'OTHER' OR cc.status = 'SLOWMOVING')) and i.categoryId in (10006,10009,10010) and wi.lastScanType not in (:scanTypes) group by i.catalogItemId having (sum(wi.currentQuantity) = 0 OR sum(wi.currentQuantity) IS NULL)"),
|
| 35357 |
ranu |
26 |
|
| 35343 |
ranu |
27 |
})
|
|
|
28 |
|
| 33772 |
amit.gupta |
29 |
@Entity
|
|
|
30 |
@Table(name = "catalog.catalog")
|
|
|
31 |
public class Catalog {
|
|
|
32 |
@Id
|
|
|
33 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
34 |
@Column(name = "id", columnDefinition = "int(11)")
|
|
|
35 |
private int id;
|
|
|
36 |
|
|
|
37 |
@Column(name="brand_id")
|
|
|
38 |
private int brandId;
|
|
|
39 |
|
|
|
40 |
@Column
|
|
|
41 |
private String brand;
|
|
|
42 |
|
|
|
43 |
@Column(name="model_number")
|
|
|
44 |
private String modelNumber;
|
|
|
45 |
|
|
|
46 |
@Column(name="model_name")
|
|
|
47 |
private String modelName;
|
|
|
48 |
|
| 33888 |
ranu |
49 |
@Column(name = "category_id")
|
|
|
50 |
private int categoryId;
|
|
|
51 |
|
| 33772 |
amit.gupta |
52 |
@Column(name="created_by")
|
|
|
53 |
private String createdBy;
|
|
|
54 |
|
|
|
55 |
@Column
|
|
|
56 |
private LocalDateTime created;
|
|
|
57 |
|
|
|
58 |
public int getId() {
|
|
|
59 |
return id;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
public void setId(int id) {
|
|
|
63 |
this.id = id;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public int getBrandId() {
|
|
|
67 |
return brandId;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public void setBrandId(int brandId) {
|
|
|
71 |
this.brandId = brandId;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
public String getBrand() {
|
|
|
75 |
return brand;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void setBrand(String brand) {
|
|
|
79 |
this.brand = brand;
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
public String getModelNumber() {
|
|
|
83 |
return modelNumber;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public void setModelNumber(String modelNumber) {
|
|
|
87 |
this.modelNumber = modelNumber;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public String getModelName() {
|
|
|
91 |
return modelName;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public void setModelName(String modelName) {
|
|
|
95 |
this.modelName = modelName;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public String getCreatedBy() {
|
|
|
99 |
return createdBy;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public void setCreatedBy(String createdBy) {
|
|
|
103 |
this.createdBy = createdBy;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public LocalDateTime getCreated() {
|
|
|
107 |
return created;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public void setCreated(LocalDateTime created) {
|
|
|
111 |
this.created = created;
|
|
|
112 |
}
|
|
|
113 |
|
| 33888 |
ranu |
114 |
public int getCategoryId() {
|
|
|
115 |
return categoryId;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public void setCategoryId(int categoryId) {
|
|
|
119 |
this.categoryId = categoryId;
|
|
|
120 |
}
|
|
|
121 |
|
| 33772 |
amit.gupta |
122 |
@Override
|
|
|
123 |
public boolean equals(Object o) {
|
|
|
124 |
if (this == o) return true;
|
|
|
125 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
126 |
Catalog catalog = (Catalog) o;
|
| 33888 |
ranu |
127 |
return id == catalog.id && brandId == catalog.brandId && categoryId == catalog.categoryId && Objects.equals(brand, catalog.brand) && Objects.equals(modelNumber, catalog.modelNumber) && Objects.equals(modelName, catalog.modelName) && Objects.equals(createdBy, catalog.createdBy) && Objects.equals(created, catalog.created);
|
| 33772 |
amit.gupta |
128 |
}
|
|
|
129 |
|
|
|
130 |
@Override
|
| 33888 |
ranu |
131 |
public int hashCode() {
|
|
|
132 |
return Objects.hash(id, brandId, brand, modelNumber, modelName, categoryId, createdBy, created);
|
|
|
133 |
}
|
|
|
134 |
|
| 33916 |
amit.gupta |
135 |
public String getDescription() {
|
|
|
136 |
StringBuilder itemString = new StringBuilder();
|
|
|
137 |
if (this.getBrand() != null && !this.getBrand().isEmpty()) {
|
|
|
138 |
itemString.append(this.getBrand().trim());
|
|
|
139 |
}
|
|
|
140 |
itemString.append(" ");
|
|
|
141 |
if (this.getModelName() != null && !this.getModelName().isEmpty()) {
|
|
|
142 |
itemString.append(this.getModelName().trim());
|
|
|
143 |
}
|
|
|
144 |
if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {
|
|
|
145 |
itemString.append(" ");
|
|
|
146 |
itemString.append(this.getModelNumber().trim());
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
return itemString.toString().replaceAll("\\s+", " ").trim();
|
|
|
150 |
}
|
|
|
151 |
|
| 35188 |
amit |
152 |
public String getDescriptionNoBrand() {
|
|
|
153 |
StringBuilder itemString = new StringBuilder();
|
|
|
154 |
itemString.append(" ");
|
|
|
155 |
if (this.getModelName() != null && !this.getModelName().isEmpty()) {
|
|
|
156 |
itemString.append(this.getModelName().trim());
|
|
|
157 |
}
|
|
|
158 |
if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {
|
|
|
159 |
itemString.append(" ");
|
|
|
160 |
itemString.append(this.getModelNumber().trim());
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
return itemString.toString().replaceAll("\\s+", " ").trim();
|
|
|
164 |
}
|
|
|
165 |
|
| 33888 |
ranu |
166 |
@Override
|
| 33772 |
amit.gupta |
167 |
public String toString() {
|
|
|
168 |
return "Catalog{" +
|
|
|
169 |
"id=" + id +
|
|
|
170 |
", brandId=" + brandId +
|
|
|
171 |
", brand='" + brand + '\'' +
|
|
|
172 |
", modelNumber='" + modelNumber + '\'' +
|
|
|
173 |
", modelName='" + modelName + '\'' +
|
| 33888 |
ranu |
174 |
", categoryId=" + categoryId +
|
| 33772 |
amit.gupta |
175 |
", createdBy='" + createdBy + '\'' +
|
|
|
176 |
", created=" + created +
|
|
|
177 |
'}';
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
}
|
|
|
181 |
|