| Line 194... |
Line 194... |
| 194 |
|
194 |
|
| 195 |
List<VendorItemMapping> mappings = snapshotClient.getVendorItemMappings(item.getId());
|
195 |
List<VendorItemMapping> mappings = snapshotClient.getVendorItemMappings(item.getId());
|
| 196 |
if (mappings != null) {
|
196 |
if (mappings != null) {
|
| 197 |
for (VendorItemMapping mapping : mappings) {
|
197 |
for (VendorItemMapping mapping : mappings) {
|
| 198 |
if (mapping.getVendorId() == 1) {
|
198 |
if (mapping.getVendorId() == 1) {
|
| 199 |
try {
|
199 |
PLBDetails plbDetails = currentInventory.get(mapping.getItemKey());
|
| 200 |
if (!item.getItemInventory().getAvailability().get(warehouseId).equals(currentInventory.get(mapping.getItemKey()).getQuantity().longValue())) {
|
200 |
Long currentSnapshotAvailibility = item.getItemInventory().getAvailability().get(warehouseId);
|
| - |
|
201 |
if ((currentSnapshotAvailibility == null || currentSnapshotAvailibility.equals(0)) &&
|
| 201 |
mismatches.put(item, currentInventory.get(mapping.getItemKey()));
|
202 |
(plbDetails == null || plbDetails.getQuantity().equals(0)))
|
| 202 |
}
|
203 |
{
|
| 203 |
} catch (Exception e) {
|
204 |
continue;
|
| - |
|
205 |
}
|
| - |
|
206 |
|
| - |
|
207 |
if (currentSnapshotAvailibility == null || plbDetails == null ||
|
| - |
|
208 |
!currentSnapshotAvailibility.equals(plbDetails.getQuantity().longValue()))
|
| - |
|
209 |
{
|
| 204 |
mismatches.put(item, currentInventory.get(mapping.getItemKey()));
|
210 |
mismatches.put(item, plbDetails);
|
| 205 |
}
|
211 |
}
|
| 206 |
}
|
212 |
}
|
| 207 |
}
|
213 |
}
|
| 208 |
}
|
214 |
}
|
| 209 |
}
|
215 |
}
|
| 210 |
|
216 |
|
| 211 |
String subject = mismatches.size() + " mismatches with PLB sync for warehouse id: " + warehouseId;
|
217 |
String subject = mismatches.size() + " mismatches with PLB sync for warehouse id: " + warehouseId;
|
| 212 |
StringBuilder body = new StringBuilder("");
|
218 |
StringBuilder body = new StringBuilder("Item Id\tBrand\tModel Name\tModel Number\tColor\tSpice Online Retail\tHotspot\n");
|
| 213 |
for (Item item : mismatches.keySet()) {
|
219 |
for (Item item : mismatches.keySet()) {
|
| 214 |
PLBDetails plbDetails = mismatches.get(item);
|
220 |
Long currentSnapshotAvailability = item.getItemInventory().getAvailability().get(warehouseId);
|
| 215 |
if (plbDetails != null) {
|
221 |
String plbQuantity = mismatches.get(item) == null ? "0" : mismatches.get(item).getQuantity().toString();
|
| 216 |
body.append(item.getId() + " " + plbDetails.getItemKey() + " " + item.getItemInventory().getAvailability().get(warehouseId) + " " + plbDetails.getQuantity().longValue() + "\n");
|
222 |
String currentSnapshotQuantity = currentSnapshotAvailability == null ? "0" : currentSnapshotAvailability.toString();
|
| 217 |
}
|
- |
|
| 218 |
else {
|
- |
|
| 219 |
body.append(item.getId() + " " + item.getBrand() + "|" + item.getModelName() + "|" + item.getModelNumber() + "|" + item.getColor() + " " + item.getItemInventory().getAvailability().get(warehouseId) + " 0\n");
|
223 |
body.append(item.getId() + "\t" + item.getBrand() + "\t" + item.getModelName() + "\t" + item.getModelNumber() + "\t" + item.getColor() + "\t" + currentSnapshotQuantity + "\t" + plbQuantity + "\n");
|
| 220 |
}
|
- |
|
| 221 |
}
|
224 |
}
|
| 222 |
|
225 |
|
| 223 |
logger.info(body.toString());
|
226 |
logger.info(body.toString());
|
| 224 |
GmailUtils g = new GmailUtils();
|
227 |
GmailUtils g = new GmailUtils();
|
| 225 |
g.sendSSLMessage(new String[]{ "mandeep.dhir@shop2020.in" }, subject, body.toString(), "cnc.center@shop2020.in", "5hop2o2o", new ArrayList<File>());
|
228 |
g.sendSSLMessage(new String[]{ "mandeep.dhir@shop2020.in" }, subject, body.toString(), "cnc.center@shop2020.in", "5h0p2o2o", new ArrayList<File>());
|
| 226 |
}
|
229 |
}
|
| 227 |
}
|
230 |
}
|
| 228 |
|
231 |
|
| 229 |
public int getErrorCode() {
|
232 |
public int getErrorCode() {
|
| 230 |
return errorCode;
|
233 |
return errorCode;
|