tango-app-api-store-builder 1.0.0-beta-17 → 1.0.0-beta-19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1160,7 +1160,7 @@ export async function scanv1( req, res ) {
|
|
|
1160
1160
|
planoComplianceService.count( { date: currentDate, shelfId: shelf.toObject()._id, compliance: 'proper' } ),
|
|
1161
1161
|
] );
|
|
1162
1162
|
return res.sendSuccess( { shelfId: shelf.toObject()._id, shelfNumber: shelf.toObject().shelfNumber,
|
|
1163
|
-
isScanned: shelfCompliance
|
|
1163
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false } );
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
1166
|
if ( !req.body.shelfId ) return res.sendError( 'Shelf id is required', 400 );
|
|
@@ -1193,7 +1193,7 @@ export async function scanv1( req, res ) {
|
|
|
1193
1193
|
planoComplianceService.count( { date: currentDate, shelfId: shelf.toObject()._id, compliance: 'proper' } ),
|
|
1194
1194
|
] );
|
|
1195
1195
|
return res.sendSuccess( { shelfId: shelf.toObject()._id, shelfNumber: shelf.toObject().shelfNumber,
|
|
1196
|
-
isScanned: shelfCompliance
|
|
1196
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false } );
|
|
1197
1197
|
}
|
|
1198
1198
|
|
|
1199
1199
|
const complianceData = { ...misplacedProductMapping.toObject(), planoMappingId: misplacedProductMapping.toObject()._id, compliance: 'misplaced' };
|
|
@@ -1201,8 +1201,10 @@ export async function scanv1( req, res ) {
|
|
|
1201
1201
|
|
|
1202
1202
|
let misplacedProductDetails = await planoProductService.findOne( { _id: misplacedProductMapping.toObject().productId } );
|
|
1203
1203
|
|
|
1204
|
-
await planoComplianceService.
|
|
1205
|
-
|
|
1204
|
+
const isComplianceProper = await planoComplianceService.count( { ...misplacedQuery, date: currentDate, compliance: 'proper' } );
|
|
1205
|
+
if ( !isComplianceProper ) {
|
|
1206
|
+
await planoComplianceService.updateOne( { ...misplacedQuery, date: currentDate, compliance: { $ne: 'proper' } }, complianceData );
|
|
1207
|
+
}
|
|
1206
1208
|
|
|
1207
1209
|
const [ totalProducts, scannedProducts, misplacedProducts, missingProducts, properProducts ] = await Promise.all( [
|
|
1208
1210
|
planoMappingService.count( { fixtureId: fixture.toObject()._id } ),
|
|
@@ -1255,7 +1257,7 @@ export async function scanv1( req, res ) {
|
|
|
1255
1257
|
|
|
1256
1258
|
const shelfMetrics = {
|
|
1257
1259
|
shelfId: productMapping.toObject().shelfId,
|
|
1258
|
-
isScanned: shelfCompliance
|
|
1260
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false };
|
|
1259
1261
|
|
|
1260
1262
|
|
|
1261
1263
|
return res.sendSuccess( { data: { ...productMapping.toObject(), ...( productDetails ? productDetails?.toObject() : {} ) }, fixtureMetrics: fixtureMetrics, shelfMetrics: shelfMetrics, status: 'proper' } );
|
|
@@ -1268,7 +1270,7 @@ export async function scanv1( req, res ) {
|
|
|
1268
1270
|
planoComplianceService.count( { date: currentDate, shelfId: shelf.toObject()._id, compliance: 'proper' } ),
|
|
1269
1271
|
] );
|
|
1270
1272
|
return res.sendSuccess( { shelfId: shelf.toObject()._id, shelfNumber: shelf.toObject().shelfNumber,
|
|
1271
|
-
isScanned: shelfCompliance
|
|
1273
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false } );
|
|
1272
1274
|
}
|
|
1273
1275
|
|
|
1274
1276
|
if ( !req.body.shelfId ) return res.sendError( 'Shelf id is required', 400 );
|
|
@@ -1306,8 +1308,9 @@ export async function scanv1( req, res ) {
|
|
|
1306
1308
|
planoMappingService.count( { shelfId: shelf.toObject()._id } ),
|
|
1307
1309
|
planoComplianceService.count( { date: currentDate, shelfId: shelf.toObject()._id, compliance: 'proper' } ),
|
|
1308
1310
|
] );
|
|
1311
|
+
|
|
1309
1312
|
return res.sendSuccess( { shelfId: shelf.toObject()._id, shelfNumber: shelf.toObject().shelfNumber,
|
|
1310
|
-
isScanned: shelfCompliance
|
|
1313
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false } );
|
|
1311
1314
|
}
|
|
1312
1315
|
|
|
1313
1316
|
|
|
@@ -1338,13 +1341,13 @@ export async function scanv1( req, res ) {
|
|
|
1338
1341
|
proper: properProducts,
|
|
1339
1342
|
};
|
|
1340
1343
|
const [ shelfProducts, shelfCompliance ] = await Promise.all( [
|
|
1341
|
-
planoMappingService.count( { shelfId:
|
|
1342
|
-
planoComplianceService.count( { date: currentDate, shelfId:
|
|
1344
|
+
planoMappingService.count( { shelfId: misplacedProductMapping.toObject().shelfId } ),
|
|
1345
|
+
planoComplianceService.count( { date: currentDate, shelfId: misplacedProductMapping.toObject().shelfId, compliance: 'proper' } ),
|
|
1343
1346
|
] );
|
|
1344
1347
|
|
|
1345
1348
|
const shelfMetrics = {
|
|
1346
|
-
shelfId:
|
|
1347
|
-
isScanned: shelfCompliance
|
|
1349
|
+
shelfId: misplacedProductMapping.toObject().shelfId,
|
|
1350
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false };
|
|
1348
1351
|
|
|
1349
1352
|
return res.sendSuccess( { data: { ...misplacedProductMapping.toObject(), ...( misplacedProductDetails ? misplacedProductDetails?.toObject() : {} ) },
|
|
1350
1353
|
fixtureMetrics: fixtureMetrics, shelfMetrics: shelfMetrics, status: 'proper' } );
|
|
@@ -1384,7 +1387,7 @@ export async function scanv1( req, res ) {
|
|
|
1384
1387
|
|
|
1385
1388
|
const shelfMetrics = {
|
|
1386
1389
|
shelfId: productMapping.toObject().shelfId,
|
|
1387
|
-
isScanned: shelfCompliance
|
|
1390
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false };
|
|
1388
1391
|
|
|
1389
1392
|
return res.sendSuccess( { data: { ...productMapping.toObject(), ...( productDetails ? productDetails?.toObject() : {} ) }, fixtureMetrics: fixtureMetrics, shelfMetrics: shelfMetrics, status: 'proper' } );
|
|
1390
1393
|
} else if ( fixture.productResolutionLevel === 'L4' ) {
|
|
@@ -1396,7 +1399,7 @@ export async function scanv1( req, res ) {
|
|
|
1396
1399
|
planoComplianceService.count( { date: currentDate, shelfId: shelf.toObject()._id, compliance: 'proper' } ),
|
|
1397
1400
|
] );
|
|
1398
1401
|
return res.sendSuccess( { shelfId: shelf.toObject()._id, shelfNumber: shelf.toObject().shelfNumber,
|
|
1399
|
-
isScanned: shelfCompliance
|
|
1402
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false } );
|
|
1400
1403
|
}
|
|
1401
1404
|
|
|
1402
1405
|
if ( !req.body.shelfId ) return res.sendError( 'Shelf id is required', 400 );
|
|
@@ -1414,7 +1417,7 @@ export async function scanv1( req, res ) {
|
|
|
1414
1417
|
const productMapping = await planoMappingService.findOne( mappingQuery );
|
|
1415
1418
|
|
|
1416
1419
|
if ( !productMapping ) {
|
|
1417
|
-
shelf = await fixtureShelfService.findOne(
|
|
1420
|
+
const shelf = await fixtureShelfService.findOne( mappingQuery );
|
|
1418
1421
|
if ( !shelf ) {
|
|
1419
1422
|
return res.sendSuccess( { data: null, status: 'missing' } );
|
|
1420
1423
|
}
|
|
@@ -1423,7 +1426,7 @@ export async function scanv1( req, res ) {
|
|
|
1423
1426
|
planoComplianceService.count( { date: currentDate, shelfId: shelf.toObject()._id, compliance: 'proper' } ),
|
|
1424
1427
|
] );
|
|
1425
1428
|
return res.sendSuccess( { shelfId: shelf.toObject()._id, shelfNumber: shelf.toObject().shelfNumber,
|
|
1426
|
-
isScanned: shelfCompliance
|
|
1429
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false } );
|
|
1427
1430
|
}
|
|
1428
1431
|
|
|
1429
1432
|
if ( productMapping.toObject().rfId !== req.body.rfId ) {
|
|
@@ -1432,7 +1435,12 @@ export async function scanv1( req, res ) {
|
|
|
1432
1435
|
|
|
1433
1436
|
let productDetails = await planoProductService.findOne( { _id: productMapping.toObject().productId } );
|
|
1434
1437
|
|
|
1435
|
-
await planoComplianceService.
|
|
1438
|
+
const isComplianceProper = await planoComplianceService.count( { ...mappingQuery, date: currentDate, compliance: 'proper' } );
|
|
1439
|
+
|
|
1440
|
+
if ( !isComplianceProper ) {
|
|
1441
|
+
await planoComplianceService.updateOne( { ...mappingQuery, date: currentDate }, complianceData );
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1436
1444
|
|
|
1437
1445
|
const [ totalProducts, scannedProducts, misplacedProducts, missingProducts, properProducts ] = await Promise.all( [
|
|
1438
1446
|
planoMappingService.count( { fixtureId: fixture.toObject()._id } ),
|
|
@@ -1440,7 +1448,6 @@ export async function scanv1( req, res ) {
|
|
|
1440
1448
|
planoComplianceService.count( { fixtureId: fixture.toObject()._id, date: currentDate, compliance: 'misplaced' } ),
|
|
1441
1449
|
planoComplianceService.count( { fixtureId: fixture.toObject()._id, date: currentDate, compliance: 'missing' } ),
|
|
1442
1450
|
planoComplianceService.count( { fixtureId: fixture.toObject()._id, date: currentDate, compliance: 'proper' } ),
|
|
1443
|
-
|
|
1444
1451
|
] );
|
|
1445
1452
|
|
|
1446
1453
|
const fixtureMetrics = {
|
|
@@ -1484,7 +1491,7 @@ export async function scanv1( req, res ) {
|
|
|
1484
1491
|
|
|
1485
1492
|
const shelfMetrics = {
|
|
1486
1493
|
shelfId: productMapping.toObject().shelfId,
|
|
1487
|
-
isScanned: shelfCompliance
|
|
1494
|
+
isScanned: shelfCompliance >= shelfProducts/2 ? true : false };
|
|
1488
1495
|
|
|
1489
1496
|
return res.sendSuccess( { data: { ...productMapping.toObject(), ...( productDetails ? productDetails?.toObject() : {} ) }, fixtureMetrics: fixtureMetrics, shelfMetrics: shelfMetrics, status: 'proper' } );
|
|
1490
1497
|
} else {
|