Subversion Repositories SmartDukaan

Rev

Rev 29571 | Rev 30652 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29571 Rev 30523
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.fofo;
1
package com.spice.profitmandi.dao.entity.fofo;
2
 
2
 
3
import java.time.LocalDateTime;
-
 
4
import java.time.format.DateTimeFormatter;
-
 
5
 
-
 
6
import javax.persistence.Column;
-
 
7
import javax.persistence.Convert;
-
 
8
import javax.persistence.Entity;
-
 
9
import javax.persistence.EnumType;
-
 
10
import javax.persistence.Enumerated;
-
 
11
import javax.persistence.FetchType;
-
 
12
import javax.persistence.GeneratedValue;
-
 
13
import javax.persistence.GenerationType;
-
 
14
import javax.persistence.Id;
-
 
15
import javax.persistence.JoinColumn;
-
 
16
import javax.persistence.NamedQueries;
-
 
17
import javax.persistence.NamedQuery;
-
 
18
import javax.persistence.OneToOne;
-
 
19
import javax.persistence.Table;
-
 
20
import javax.persistence.Transient;
-
 
21
 
-
 
22
import org.hibernate.annotations.UpdateTimestamp;
-
 
23
 
-
 
24
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
3
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
25
import com.spice.profitmandi.dao.entity.catalog.Item;
4
import com.spice.profitmandi.dao.entity.catalog.Item;
26
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
5
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
-
 
6
import org.hibernate.annotations.UpdateTimestamp;
-
 
7
 
-
 
8
import javax.persistence.*;
-
 
9
import java.time.LocalDateTime;
-
 
10
import java.time.format.DateTimeFormatter;
-
 
11
import java.util.Objects;
27
 
12
 
28
@NamedQueries({
13
@NamedQueries({
29
		@NamedQuery(name = "InventoryItem.selectScannedCount", query = "select ii.itemId, sum(ii.initialQuantity) from InventoryItem ii "
14
		@NamedQuery(name = "InventoryItem.selectScannedCount", query = "select ii.itemId, sum(ii.initialQuantity) from InventoryItem ii "
30
				+ "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId") })
15
				+ "where ii.itemId in :itemIds and ii.fofoId = :fofoId and ii.purchaseId = :purchaseId group by ii.itemId") })
31
@Entity
16
@Entity
Line 118... Line 103...
118
	@Transient
103
	@Transient
119
	private String itemDescription;
104
	private String itemDescription;
120
 
105
 
121
	@Transient
106
	@Transient
122
	private LocalDateTime activatedTimestamp;
107
	private LocalDateTime activatedTimestamp;
123
	
108
 
124
	@Transient
109
	@Transient
125
	private boolean priceDropValidated = true;
110
	private boolean priceDropValidated = true;
-
 
111
 
-
 
112
	@Transient
-
 
113
	private String pdValidationFailedReason = null;
-
 
114
 
-
 
115
	@Override
-
 
116
	public boolean equals(Object o) {
-
 
117
		if (this == o) return true;
-
 
118
		if (o == null || getClass() != o.getClass()) return false;
-
 
119
		InventoryItem that = (InventoryItem) o;
-
 
120
		return id == that.id && itemId == that.itemId && fofoId == that.fofoId && initialQuantity == that.initialQuantity && goodQuantity == that.goodQuantity && badQuantity == that.badQuantity && purchaseId == that.purchaseId && Float.compare(that.unitPrice, unitPrice) == 0 && Float.compare(that.priceDropAmount, priceDropAmount) == 0 && buyBack == that.buyBack && Float.compare(that.igstRate, igstRate) == 0 && Float.compare(that.cgstRate, cgstRate) == 0 && Float.compare(that.sgstRate, sgstRate) == 0 && priceDropValidated == that.priceDropValidated && pdValidationFailedReason == that.pdValidationFailedReason && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(activationTimestamp, that.activationTimestamp) && lastScanType == that.lastScanType && Objects.equals(hsnCode, that.hsnCode) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(updateTimestamp, that.updateTimestamp) && Objects.equals(item, that.item) && Objects.equals(purchase, that.purchase) && Objects.equals(itemDescription, that.itemDescription) && Objects.equals(activatedTimestamp, that.activatedTimestamp);
-
 
121
	}
-
 
122
 
-
 
123
	@Override
-
 
124
	public int hashCode() {
126
	
125
		return Objects.hash(id, itemId, fofoId, serialNumber, initialQuantity, goodQuantity, badQuantity, activationTimestamp, lastScanType, purchaseId, unitPrice, priceDropAmount, buyBack, igstRate, cgstRate, sgstRate, hsnCode, createTimestamp, updateTimestamp, item, purchase, itemDescription, activatedTimestamp, priceDropValidated, pdValidationFailedReason);
-
 
126
	}
-
 
127
 
-
 
128
	public String getPdValidationFailedReason() {
-
 
129
		return pdValidationFailedReason;
-
 
130
	}
-
 
131
 
-
 
132
	public void setPdValidationFailedReason(String pdValidationFailedReason) {
-
 
133
		this.pdValidationFailedReason = pdValidationFailedReason;
-
 
134
	}
-
 
135
 
-
 
136
	@Override
-
 
137
	public String toString() {
-
 
138
		return "InventoryItem{" +
-
 
139
				"id=" + id +
-
 
140
				", itemId=" + itemId +
-
 
141
				", fofoId=" + fofoId +
-
 
142
				", serialNumber='" + serialNumber + '\'' +
-
 
143
				", initialQuantity=" + initialQuantity +
-
 
144
				", goodQuantity=" + goodQuantity +
-
 
145
				", badQuantity=" + badQuantity +
-
 
146
				", activationTimestamp=" + activationTimestamp +
-
 
147
				", lastScanType=" + lastScanType +
-
 
148
				", purchaseId=" + purchaseId +
-
 
149
				", unitPrice=" + unitPrice +
-
 
150
				", priceDropAmount=" + priceDropAmount +
-
 
151
				", buyBack=" + buyBack +
-
 
152
				", igstRate=" + igstRate +
-
 
153
				", cgstRate=" + cgstRate +
-
 
154
				", sgstRate=" + sgstRate +
-
 
155
				", hsnCode='" + hsnCode + '\'' +
-
 
156
				", createTimestamp=" + createTimestamp +
-
 
157
				", updateTimestamp=" + updateTimestamp +
-
 
158
				", item=" + item +
-
 
159
				", purchase=" + purchase +
-
 
160
				", itemDescription='" + itemDescription + '\'' +
-
 
161
				", activatedTimestamp=" + activatedTimestamp +
-
 
162
				", priceDropValidated=" + priceDropValidated +
-
 
163
				", pdValidationFailedReason='" + pdValidationFailedReason + '\'' +
-
 
164
				'}';
-
 
165
	}
-
 
166
 
127
	public LocalDateTime getActivatedTimestamp() {
167
	public LocalDateTime getActivatedTimestamp() {
128
		return activatedTimestamp;
168
		return activatedTimestamp;
129
	}
169
	}
130
 
170
 
131
	public void setActivatedTimestamp(LocalDateTime activatedTimestamp) {
171
	public void setActivatedTimestamp(LocalDateTime activatedTimestamp) {
Line 310... Line 350...
310
 
350
 
311
	public void setItemDescription(String itemDescription) {
351
	public void setItemDescription(String itemDescription) {
312
		this.itemDescription = itemDescription;
352
		this.itemDescription = itemDescription;
313
	}
353
	}
314
 
354
 
315
	@Override
-
 
316
	public int hashCode() {
-
 
317
		final int prime = 31;
-
 
318
		int result = 1;
-
 
319
		result = prime * result + id;
-
 
320
		return result;
-
 
321
	}
-
 
322
 
-
 
323
	@Override
-
 
324
	public boolean equals(Object obj) {
-
 
325
		if (this == obj)
-
 
326
			return true;
-
 
327
		if (obj == null)
-
 
328
			return false;
-
 
329
		if (getClass() != obj.getClass())
-
 
330
			return false;
-
 
331
		InventoryItem other = (InventoryItem) obj;
-
 
332
		if (id != other.id)
-
 
333
			return false;
-
 
334
		return true;
-
 
335
	}
-
 
336
 
-
 
337
	public LocalDateTime getActivationTimestamp() {
355
	public LocalDateTime getActivationTimestamp() {
338
		return activationTimestamp;
356
		return activationTimestamp;
339
	}
357
	}
340
 
358
 
341
	public void setActivationTimestamp(LocalDateTime activationTimestamp) {
359
	public void setActivationTimestamp(LocalDateTime activationTimestamp) {
Line 349... Line 367...
349
	public void setPriceDropValidated(boolean priceDropValidated) {
367
	public void setPriceDropValidated(boolean priceDropValidated) {
350
		this.priceDropValidated = priceDropValidated;
368
		this.priceDropValidated = priceDropValidated;
351
	}
369
	}
352
 
370
 
353
	@Override
371
	@Override
354
	public String toString() {
-
 
355
		return "InventoryItem [id=" + id + ", itemId=" + itemId + ", fofoId=" + fofoId + ", serialNumber="
-
 
356
				+ serialNumber + ", initialQuantity=" + initialQuantity + ", goodQuantity=" + goodQuantity
-
 
357
				+ ", badQuantity=" + badQuantity + ", activationTimestamp=" + activationTimestamp + ", lastScanType="
-
 
358
				+ lastScanType + ", purchaseId=" + purchaseId + ", unitPrice=" + unitPrice + ", priceDropAmount="
-
 
359
				+ priceDropAmount + ", buyBack=" + buyBack + ", igstRate=" + igstRate + ", cgstRate=" + cgstRate
-
 
360
				+ ", sgstRate=" + sgstRate + ", hsnCode=" + hsnCode + ", createTimestamp=" + createTimestamp
-
 
361
				+ ", updateTimestamp=" + updateTimestamp + ", item=" + item + ", purchase=" + purchase
-
 
362
				+ ", itemDescription=" + itemDescription + ", activatedTimestamp=" + activatedTimestamp + "]";
-
 
363
	}
-
 
364
 
-
 
365
	@Override
-
 
366
	public int compareTo(Object o) {
372
	public int compareTo(Object o) {
367
		return o.hashCode() - this.hashCode();
373
		return o.hashCode() - this.hashCode();
368
	}
374
	}
369
 
375
 
370
}
376
}