tango-app-api-store-builder 1.0.43 → 1.0.45

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/items.xlsx ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-store-builder",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "path": "^0.12.7",
34
34
  "selenium-webdriver": "^4.31.0",
35
35
  "sharp": "^0.34.1",
36
- "tango-api-schema": "^2.5.26",
36
+ "tango-api-schema": "^2.5.34",
37
37
  "tango-app-api-middleware": "3.1.48",
38
38
  "url": "^0.11.4",
39
39
  "winston": "^3.17.0",
@@ -940,74 +940,74 @@ export async function getVmLibList( req, res ) {
940
940
 
941
941
  const query = [
942
942
  { $match: matchStage },
943
- {
944
- $lookup: {
945
- from: 'fixtureconfigs',
946
- let: { libraryId: '$_id' },
947
- pipeline: [
948
- {
949
- $match: {
950
- $expr: {
951
- $in: [ '$$libraryId', { $ifNull: [ '$vmConfig.vmId', [] ] } ],
952
- },
953
- },
954
- },
955
- {
956
- $group: {
957
- _id: null,
958
- templateIds: { $addToSet: '$_id' },
959
- },
960
- },
961
- ],
962
- as: 'fixtureTemplate',
963
- },
964
- },
965
- {
966
- $set: {
967
- templateId: { $ifNull: [ { $arrayElemAt: [ '$fixtureTemplate.templateIds', 0 ] }, [] ] },
968
- },
969
- },
970
- {
971
- $lookup: {
972
- from: 'storefixtures',
973
- localField: 'templateId',
974
- foreignField: 'fixtureConfigId',
975
- as: 'storeFixtureDetails',
976
- },
977
- },
978
- {
979
- $set: {
980
- planoId: {
981
- $setUnion: [
982
- { $map: { input: '$storeFixtureDetails', as: 'sf', in: '$$sf.planoId' } },
983
- [],
984
- ],
985
- },
986
- templateCount: { $size: '$templateId' },
987
- },
988
- },
989
- {
990
- $lookup: {
991
- from: 'planograms',
992
- let: { planoIds: '$planoId' },
993
- pipeline: [
994
- {
995
- $match: {
996
- $expr: {
997
- $in: [ '$_id', { $ifNull: [ '$$planoIds', [] ] } ],
998
- },
999
- },
1000
- },
1001
- {
1002
- $group: {
1003
- _id: null,
1004
- statusList: { $push: '$status' },
1005
- },
1006
- },
1007
- ],
1008
- as: 'planoStatus',
1009
- },
1010
- },
943
+ // {
944
+ // $lookup: {
945
+ // from: 'fixtureconfigs',
946
+ // let: { libraryId: '$_id' },
947
+ // pipeline: [
948
+ // {
949
+ // $match: {
950
+ // $expr: {
951
+ // $in: [ '$$libraryId', { $ifNull: [ '$vmConfig.vmId', [] ] } ],
952
+ // },
953
+ // },
954
+ // },
955
+ // {
956
+ // $group: {
957
+ // _id: null,
958
+ // templateIds: { $addToSet: '$_id' },
959
+ // },
960
+ // },
961
+ // ],
962
+ // as: 'fixtureTemplate',
963
+ // },
964
+ // },
965
+ // {
966
+ // $set: {
967
+ // templateId: { $ifNull: [ { $arrayElemAt: [ '$fixtureTemplate.templateIds', 0 ] }, [] ] },
968
+ // },
969
+ // },
970
+ // {
971
+ // $lookup: {
972
+ // from: 'storefixtures',
973
+ // localField: 'templateId',
974
+ // foreignField: 'fixtureConfigId',
975
+ // as: 'storeFixtureDetails',
976
+ // },
977
+ // },
978
+ // {
979
+ // $set: {
980
+ // planoId: {
981
+ // $setUnion: [
982
+ // { $map: { input: '$storeFixtureDetails', as: 'sf', in: '$$sf.planoId' } },
983
+ // [],
984
+ // ],
985
+ // },
986
+ // templateCount: { $size: '$templateId' },
987
+ // },
988
+ // },
989
+ // {
990
+ // $lookup: {
991
+ // from: 'planograms',
992
+ // let: { planoIds: '$planoId' },
993
+ // pipeline: [
994
+ // {
995
+ // $match: {
996
+ // $expr: {
997
+ // $in: [ '$_id', { $ifNull: [ '$$planoIds', [] ] } ],
998
+ // },
999
+ // },
1000
+ // },
1001
+ // {
1002
+ // $group: {
1003
+ // _id: null,
1004
+ // statusList: { $push: '$status' },
1005
+ // },
1006
+ // },
1007
+ // ],
1008
+ // as: 'planoStatus',
1009
+ // },
1010
+ // },
1011
1011
  {
1012
1012
  $project: {
1013
1013
  vmName: 1,
@@ -1020,29 +1020,31 @@ export async function getVmLibList( req, res ) {
1020
1020
  vmWidth: 1,
1021
1021
  vmImageUrl: 1,
1022
1022
  isDoubleSided: 1,
1023
- templateId: 1,
1024
- planoId: 1,
1025
1023
  vmLibCode: 1,
1026
1024
  vmSubCategory: 1,
1027
- planoStatus: { $ifNull: [ { $arrayElemAt: [ '$planoStatus.statusList', 0 ] }, [] ] },
1028
- templateCount: 1,
1029
- status: {
1030
- $cond: {
1031
- if: { $and: [ { $in: [ 'completed', { $ifNull: [ { $arrayElemAt: [ '$planoStatus.statusList', 0 ] }, [] ] } ] }, { $gt: [ { $size: '$templateId' }, 0 ] } ] },
1032
- then: 'active',
1033
- else: {
1034
- $cond: {
1035
- if: {
1036
- $eq: [
1037
- '$status', 'draft',
1038
- ],
1039
- },
1040
- then: 'draft',
1041
- else: 'inactive',
1042
- },
1043
- },
1044
- },
1045
- },
1025
+ // templateId: 1,
1026
+ // planoId: 1,
1027
+ // vmLibCode: 1,
1028
+ // vmSubCategory: 1,
1029
+ // planoStatus: { $ifNull: [ { $arrayElemAt: [ '$planoStatus.statusList', 0 ] }, [] ] },
1030
+ // templateCount: 1,
1031
+ // status: {
1032
+ // $cond: {
1033
+ // if: { $and: [ { $in: [ 'completed', { $ifNull: [ { $arrayElemAt: [ '$planoStatus.statusList', 0 ] }, [] ] } ] }, { $gt: [ { $size: '$templateId' }, 0 ] } ] },
1034
+ // then: 'active',
1035
+ // else: {
1036
+ // $cond: {
1037
+ // if: {
1038
+ // $eq: [
1039
+ // '$status', 'draft',
1040
+ // ],
1041
+ // },
1042
+ // then: 'draft',
1043
+ // else: 'inactive',
1044
+ // },
1045
+ // },
1046
+ // },
1047
+ // },
1046
1048
  },
1047
1049
  },
1048
1050
  ];
@@ -1081,6 +1083,21 @@ export async function getVmLibList( req, res ) {
1081
1083
  if ( !req.body.export && !fixtureDetails[0]?.fixtureData.length ) {
1082
1084
  return res.sendError( 'No data found', 204 );
1083
1085
  }
1086
+ fixtureDetails[0].fixtureData = await Promise.all( fixtureDetails[0].fixtureData.map( async ( vm ) => {
1087
+ let getMappedTemplates = await fixtureTemplateService.find( { 'vmConfig.vmId': vm._id } );
1088
+ let getMapppedFixtureDetails = await storeFixtureService.find( { fixtureConfigId: { $in: getMappedTemplates.map( ( temp ) => temp._id ) } } );
1089
+
1090
+ let data = {
1091
+
1092
+ templateId: getMappedTemplates.map( ( temp ) => ele?._id ),
1093
+ planoId: getMapppedFixtureDetails.map( ( plano ) => plano.planoId ),
1094
+ planoStatus: 'incomplete',
1095
+ status: 'inactive',
1096
+
1097
+ };
1098
+
1099
+ return { ...vm, ...data };
1100
+ } ) );
1084
1101
  let result = {
1085
1102
  count: fixtureDetails[0].count[0].total,
1086
1103
  data: fixtureDetails[0].fixtureData,
@@ -15445,7 +15445,7 @@ export async function insertAntennaMappingData( req, res ) {
15445
15445
  const antennaMapingData = [
15446
15446
  {
15447
15447
  "fixtureNumber": 14,
15448
- "readerId": "a4:e8:a3:91:7f:01",
15448
+ "readerId": "A4-E8-A3-91-7F-01",
15449
15449
  "storageBoxAntennaNo": [ 1, 2, 3, 6, 7 ],
15450
15450
  "shelfConfig": [
15451
15451
  { "shelfNumber": 1, "antennaNo": [ 18 ] },
@@ -15460,7 +15460,7 @@ export async function insertAntennaMappingData( req, res ) {
15460
15460
  },
15461
15461
  {
15462
15462
  "fixtureNumber": 15,
15463
- "readerId": "a4:e8:a3:91:7f:01",
15463
+ "readerId": "A4-E8-A3-91-7F-01",
15464
15464
  "storageBoxAntennaNo": [ 8, 9, 11, 13, 14 ],
15465
15465
  "shelfConfig": [
15466
15466
  { "shelfNumber": 1, "antennaNo": [ 26 ] },
@@ -15476,7 +15476,7 @@ export async function insertAntennaMappingData( req, res ) {
15476
15476
  {
15477
15477
  "fixtureNumber": 3,
15478
15478
  "wallNumber": 1,
15479
- "readerId": "a4:e8:a3:91:7f:01",
15479
+ "readerId": "A4-E8-A3-91-7E-FD",
15480
15480
  "storageBoxAntennaNo": [ 25, 26, 27, 28, 29 ],
15481
15481
  "shelfConfig": [
15482
15482
  { "shelfNumber": 1, "antennaNo": [ 15 ] },
@@ -15490,7 +15490,7 @@ export async function insertAntennaMappingData( req, res ) {
15490
15490
  {
15491
15491
  "fixtureNumber": 4,
15492
15492
  "wallNumber": 1,
15493
- "readerId": "a4:e8:a3:91:7f:01",
15493
+ "readerId": "A4-E8-A3-91-7E-FD",
15494
15494
  "storageBoxAntennaNo": [ 5, 6, 9, 13 ],
15495
15495
  "shelfConfig": [
15496
15496
  { "shelfNumber": 1, "antennaNo": [ 4 ] },
@@ -15503,12 +15503,12 @@ export async function insertAntennaMappingData( req, res ) {
15503
15503
  },
15504
15504
  {
15505
15505
  "fixtureNumber": 5,
15506
- "readerId": "a4:e8:a3:91:7f:03",
15506
+ "readerId": "A4-E8-A3-91-7F-03",
15507
15507
  "storageBoxAntennaNo": [ 2, 5, 6, 7, 3 ],
15508
15508
  "shelfConfig": [
15509
15509
  { "shelfNumber": 1, "antennaNo": [ 10 ] },
15510
15510
  { "shelfNumber": 2, "antennaNo": [ 11 ] },
15511
- { "shelfNumber": 3, "antennaNo": [ 9, 16 ] },
15511
+ { "shelfNumber": 3, "antennaNo": [ 22, 23 ] },
15512
15512
  { "shelfNumber": 4, "antennaNo": [ 20, 21 ] },
15513
15513
  { "shelfNumber": 5, "antennaNo": [ 18, 19 ] },
15514
15514
  { "shelfNumber": 6, "antennaNo": [ 25, 30 ] },
@@ -15516,12 +15516,12 @@ export async function insertAntennaMappingData( req, res ) {
15516
15516
  },
15517
15517
  {
15518
15518
  "fixtureNumber": 6,
15519
- "readerId": "a4:e8:a3:91:7f:03",
15519
+ "readerId": "A4-E8-A3-91-7F-03",
15520
15520
  "storageBoxAntennaNo": [ 26, 27, 28, 29, 31 ],
15521
15521
  "shelfConfig": [
15522
15522
  { "shelfNumber": 1, "antennaNo": [ 24 ] },
15523
15523
  { "shelfNumber": 2, "antennaNo": [ 17 ] },
15524
- { "shelfNumber": 3, "antennaNo": [ 22, 23 ] },
15524
+ { "shelfNumber": 3, "antennaNo": [ 9, 16 ] },
15525
15525
  { "shelfNumber": 4, "antennaNo": [ 12, 13 ] },
15526
15526
  { "shelfNumber": 5, "antennaNo": [ 14, 15 ] },
15527
15527
  { "shelfNumber": 6, "antennaNo": [ 1, 4 ] },
@@ -15529,7 +15529,7 @@ export async function insertAntennaMappingData( req, res ) {
15529
15529
  },
15530
15530
  {
15531
15531
  "fixtureNumber": 1,
15532
- "readerId": "a4:e8:a3:91:7f:00",
15532
+ "readerId": "A4-E8-A3-91-7F-00",
15533
15533
  "storageBoxAntennaNo": [ 18, 19, 20, 21, 22 ],
15534
15534
  "shelfConfig": [
15535
15535
  { "shelfNumber": 1, "antennaNo": [ 28 ] },
@@ -15543,7 +15543,7 @@ export async function insertAntennaMappingData( req, res ) {
15543
15543
  {
15544
15544
  "fixtureNumber": 2,
15545
15545
  "wallNumber": 1,
15546
- "readerId": "a4:e8:a3:91:7f:00",
15546
+ "readerId": "A4-E8-A3-91-7F-00",
15547
15547
  "storageBoxAntennaNo": [ 7, 8, 9, 10, 11 ],
15548
15548
  "shelfConfig": [
15549
15549
  { "shelfNumber": 1, "antennaNo": [ 3 ] },
@@ -15557,7 +15557,7 @@ export async function insertAntennaMappingData( req, res ) {
15557
15557
  {
15558
15558
  "fixtureNumber": 11,
15559
15559
  "wallNumber": 3,
15560
- "readerId": "a4:e8:a3:91:7f:02",
15560
+ "readerId": "A4-E8-A3-91-7F-02",
15561
15561
  "storageBoxAntennaNo": [ 8, 9, 12, 13, 14 ],
15562
15562
  "shelfConfig": [
15563
15563
  { "shelfNumber": 1, "antennaNo": [ 15 ] },
@@ -15573,7 +15573,7 @@ export async function insertAntennaMappingData( req, res ) {
15573
15573
  {
15574
15574
  "fixtureNumber": 9,
15575
15575
  "wallNumber": 3,
15576
- "readerId": "a4:e8:a3:91:7f:04",
15576
+ "readerId": "A4-E8-A3-91-7F-04",
15577
15577
  "storageBoxAntennaNo": [ 17, 18, 19, 20, 21 ],
15578
15578
  "shelfConfig": [
15579
15579
  { "shelfNumber": 1, "antennaNo": [ 13 ] },
@@ -15588,7 +15588,7 @@ export async function insertAntennaMappingData( req, res ) {
15588
15588
  },
15589
15589
  {
15590
15590
  "fixtureNumber": 10,
15591
- "readerId": "a4:e8:a3:91:7f:04",
15591
+ "readerId": "A4-E8-A3-91-7F-04",
15592
15592
  "storageBoxAntennaNo": [ 1, 2, 3, 4, 5 ],
15593
15593
  "shelfConfig": [
15594
15594
  { "shelfNumber": 1, "antennaNo": [ 26 ] },
@@ -15604,7 +15604,7 @@ export async function insertAntennaMappingData( req, res ) {
15604
15604
  {
15605
15605
  "fixtureNumber": 12,
15606
15606
  "wallNumber": 3,
15607
- "readerId": "a4:e8:a3:91:7f:04",
15607
+ "readerId": "A4-E8-A3-91-7E-FE",
15608
15608
  "storageBoxAntennaNo": [ 14, 15, 16, 17, 18 ],
15609
15609
  "shelfConfig": [
15610
15610
  { "shelfNumber": 1, "antennaNo": [ 13 ] },
@@ -15612,15 +15612,15 @@ export async function insertAntennaMappingData( req, res ) {
15612
15612
  { "shelfNumber": 3, "antennaNo": [ 10 ] },
15613
15613
  { "shelfNumber": 4, "antennaNo": [ 8 ] },
15614
15614
  { "shelfNumber": 5, "antennaNo": [ 12 ] },
15615
- { "shelfNumber": 6, "antennaNo": [ 9 ] },
15616
- { "shelfNumber": 7, "antennaNo": [ 4 ] },
15615
+ { "shelfNumber": 6, "antennaNo": [ 4 ] },
15616
+ { "shelfNumber": 7, "antennaNo": [ 9 ] },
15617
15617
  { "shelfNumber": 8, "antennaNo": [ 3 ] },
15618
15618
  ],
15619
15619
  },
15620
15620
  {
15621
15621
  "fixtureNumber": 13,
15622
15622
  "wallNumber": 3,
15623
- "readerId": "a4:e8:a3:91:7f:04",
15623
+ "readerId": "A4-E8-A3-91-7E-FE",
15624
15624
  "storageBoxAntennaNo": [ 1, 2, 5, 6, 7 ],
15625
15625
  "shelfConfig": [
15626
15626
  { "shelfNumber": 1, "antennaNo": [ 25 ] },
@@ -15636,7 +15636,7 @@ export async function insertAntennaMappingData( req, res ) {
15636
15636
  {
15637
15637
  "fixtureNumber": 7,
15638
15638
  "wallNumber": 2,
15639
- "readerId": "a4:e8:a3:8e:85:43",
15639
+ "readerId": "A4-E8-A3-8E-85-43",
15640
15640
  "storageBoxAntennaNo": [ 7 ],
15641
15641
  "shelfConfig": [
15642
15642
  { "shelfNumber": 1, "antennaNo": [ 6 ] },
@@ -15651,7 +15651,7 @@ export async function insertAntennaMappingData( req, res ) {
15651
15651
  {
15652
15652
  "fixtureNumber": 8,
15653
15653
  "wallNumber": 2,
15654
- "readerId": "a4:e8:a3:8e:85:43",
15654
+ "readerId": "A4-E8-A3-8E-85-43",
15655
15655
  "storageBoxAntennaNo": [ 9, 10, 11, 12, 13 ],
15656
15656
  "shelfConfig": [
15657
15657
  { "shelfNumber": 1, "antennaNo": [ 21 ] },
@@ -15779,11 +15779,14 @@ export async function insertAntennaMappingData( req, res ) {
15779
15779
  shelfNumber: shelfNumber,
15780
15780
  } );
15781
15781
 
15782
+ console.log( shelf );
15783
+
15782
15784
  if ( shelf ) {
15783
- await fixtureShelfService.updateOne(
15785
+ let data = await fixtureShelfService.updateOne(
15784
15786
  { _id: shelf._id },
15785
15787
  { antennaNo: antennaNo },
15786
15788
  );
15789
+ console.log( data );
15787
15790
  console.log( `Updated fixture ${fixtureNumber}, shelf ${shelfNumber} with antennaNo:`, antennaNo );
15788
15791
  } else {
15789
15792
  const errorMsg = `Shelf not found for fixture ${fixtureNumber}, shelfNumber: ${shelfNumber}`;
@@ -15865,3 +15868,69 @@ export async function get4487FixtureDetails( req, res ) {
15865
15868
  return res.sendError( e, 500 );
15866
15869
  }
15867
15870
  }
15871
+
15872
+ export async function getstoreMBQFixtureExcel( req, res ) {
15873
+ try {
15874
+ if ( !req.body?.storeName ) {
15875
+ return res.sendError( 'storeName is required', 400 );
15876
+ }
15877
+ let getStoreDetails = await storeService.find( { storeName: { $in: req.body.storeName }, status: 'active', clientId: '11' }, { storeProfile: 1, storeName: 1 } );
15878
+ if ( !getStoreDetails.length ) {
15879
+ return res.sendError( 'No data found', 204 );
15880
+ }
15881
+ let data = [];
15882
+ let sortOrder = [ 5, 1, 2, 3, 4 ];
15883
+ await Promise.all( getStoreDetails.map( async ( store ) => {
15884
+ let storeFixturesList = await storeFixtureService.findAndSort( { storeName: store.storeName }, {}, { fixtureNumber: 1, associatedElementNumber: 1, associatedElementFixtureNumber: 1 } );
15885
+ storeFixturesList.sort( ( a, b ) => {
15886
+ const floorDiff = b.floorId.toString().localeCompare( a.floorId.toString() );
15887
+ if ( floorDiff !== 0 ) return floorDiff;
15888
+
15889
+ if ( a.fixtureType !== b.fixtureType ) {
15890
+ return a.fixtureType === "wall" ? -1 : 1;
15891
+ }
15892
+
15893
+ if ( a.fixtureType === "wall" ) {
15894
+ const orderDiff =
15895
+ sortOrder.indexOf( a.associatedElementNumber ) -
15896
+ sortOrder.indexOf( b.associatedElementNumber );
15897
+
15898
+ if ( orderDiff !== 0 ) return orderDiff;
15899
+
15900
+ return (
15901
+ ( a.associatedElementFixtureNumber || 0 ) -
15902
+ ( b.associatedElementFixtureNumber || 0 )
15903
+ );
15904
+ }
15905
+
15906
+ return 0;
15907
+ } );
15908
+
15909
+
15910
+ let storeFixtureDetails = [];
15911
+ for ( let ele of storeFixturesList ) {
15912
+ let shelfDetails = await fixtureShelfService.findAndSort( { fixtureId: ele._id }, {}, { shelfNumber: 1 } );
15913
+
15914
+ storeFixtureDetails.push( {
15915
+ "Store Code": ele.storeName,
15916
+ "Wall": ele?.associatedElementNumber ?? 'floor',
15917
+ "Unique Fixture Number": 'FX - ' + ele.fixtureNumber,
15918
+ "Brand-Category": ele.header?.label,
15919
+ "Fixture Type": ele.fixtureCategory,
15920
+ "Fixture Size": ele.fixtureWidth.value +' '+ ele.fixtureWidth.unit,
15921
+ "Shelves/ Rods/ Space per Fixture": shelfDetails.length,
15922
+ 'Display per Shelf/ Rod/ Space': shelfDetails?.[0]?.productPerShelf,
15923
+ 'Fixture Capacity': ele?.fixtureCapacity,
15924
+ },
15925
+ );
15926
+ }
15927
+ data.push( ...storeFixtureDetails );
15928
+ } ) );
15929
+ // for ( let store of getStoreDetails ) {
15930
+ // }
15931
+ await download( data, res );
15932
+ } catch ( e ) {
15933
+ console.log( e );
15934
+ return res.sendError( e, 500 );
15935
+ }
15936
+ }
@@ -27,8 +27,8 @@ import * as fixtureConfigDuplicateService from '../service/fixtureConfigDuplicat
27
27
  import * as planoVmDuplicateService from '../service/planoVmDuplicate.service.js';
28
28
  import advancedFormat from 'dayjs/plugin/advancedFormat.js';
29
29
  import * as planoRevisionService from '../service/planoRevision.service.js';
30
- // import xlsx from 'xlsx';
31
- // import fs from 'fs';
30
+ import xlsx from 'xlsx';
31
+ import fs from 'fs';
32
32
 
33
33
  dayjs.extend( advancedFormat );
34
34
  dayjs.extend( utc );
@@ -3617,9 +3617,19 @@ export async function shelfProduct( req, res ) {
3617
3617
 
3618
3618
  let fixtureCompliance = Math.floor( ( properCount / fixture.fixtureCapacity ) * 100 );
3619
3619
 
3620
+ fixtureCompliance = fixtureCompliance > 100 ? 100 : fixtureCompliance;
3621
+
3622
+ let notProperCount = shelfProducts.flatMap( ( ele ) => ele?.products.map( ( prod ) => prod?.status ) )?.filter( ( ele ) => ele != 'proper' )?.length;
3623
+
3624
+ if ( fixtureCompliance == 100 && notProperCount ) {
3625
+ nonProperpercentage = ( notProperCount /fixtureCompliance ) * 100;
3626
+
3627
+ fixtureCompliance = fixtureCompliance - nonProperpercentage;
3628
+ }
3629
+
3620
3630
  let storageProducts = await planoMappingService.find( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), type: 'storageBox' } );
3621
3631
  storageProducts = await getProducts( storageProducts );
3622
- return res.sendSuccess( { ...fixture, shelves: shelfProducts, vmConfig: vmDetails, productCount: productCount, storageProducts: storageProducts, fixtureImage: fixtureImage, fixtureCompliance } );
3632
+ return res.sendSuccess( { ...fixture, shelves: shelfProducts, vmConfig: vmDetails, productCount: productCount, storageProducts: storageProducts, fixtureImage: fixtureImage, fixtureCompliance: fixtureCompliance > 100 ? 100 : fixtureCompliance } );
3623
3633
  }
3624
3634
 
3625
3635
  return res.sendError( 'Incorrect resolution level', 400 );
@@ -8047,6 +8057,9 @@ export async function updateProductMapping( req, res ) {
8047
8057
  } else {
8048
8058
  fixtureShelfDetails = fixtureDetails.find( ( fixt ) => fixt._id.toString() == getShelfDetails.fixtureId.toString() );
8049
8059
  }
8060
+ if ( macDetails?.MAC == 'A4-E8-A3-91-7F-05' ) {
8061
+ console.log( ele?.data?.antenna, fixtureShelfDetails?._id );
8062
+ }
8050
8063
  logger.error( { data: fixtureShelfDetails, antennaNo: ele.data.antenna, macId: ele?.data?.MAC } );
8051
8064
  if ( getShelfDetails && fixtureShelfDetails ) {
8052
8065
  let productDetails = await planoProductService.findOne( { productId: ele.data.idText } );
@@ -8132,6 +8145,7 @@ export async function updateProductMapping( req, res ) {
8132
8145
 
8133
8146
  export async function calculateCompliance( req, res ) {
8134
8147
  try {
8148
+ let clFixtures = await storeFixtureService.findOne( { 'header.label': 'CL' }, { _id: 1 } );
8135
8149
  let query = [
8136
8150
  {
8137
8151
  $match: {
@@ -8140,6 +8154,7 @@ export async function calculateCompliance( req, res ) {
8140
8154
  storeName: req.body.storeName,
8141
8155
  compliance: 'proper',
8142
8156
  date: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
8157
+ fixtureId: { $ne: clFixtures._id },
8143
8158
  },
8144
8159
  },
8145
8160
  {
@@ -9233,6 +9248,9 @@ export async function getShelfDetails( req, res ) {
9233
9248
  {
9234
9249
  $project: {
9235
9250
  _id: 1,
9251
+ associatedElementNumber: 1,
9252
+ associatedElementFixtureNumber: 1,
9253
+ label: '$header.label',
9236
9254
  },
9237
9255
  },
9238
9256
  ];
@@ -9245,7 +9263,8 @@ export async function getShelfDetails( req, res ) {
9245
9263
  if ( !shelfDetails ) {
9246
9264
  return res.sendError( 'No antenna found', 204 );
9247
9265
  }
9248
- return res.sendSuccess( shelfDetails );
9266
+ fixtureDetails = fixtureDetails.find( ( ele ) => ele._id.toString() == shelfDetails.fixtureId.toString() );
9267
+ return res.sendSuccess( { ...shelfDetails.toObject(), associatedElementNumber: fixtureDetails?.associatedElementNumber, associatedElementFixtureNumber: fixtureDetails?.associatedElementFixtureNumber, isCl: fixtureDetails.label == 'CL' } );
9249
9268
  } catch ( e ) {
9250
9269
  logger.error( { functionName: 'getShelfDetails', error: e } );
9251
9270
  return res.sendError( e, 500 );
@@ -51,4 +51,5 @@ scriptRouter
51
51
  .post( '/getFixtureDetails', isAllowedInternalAPIHandler, scriptController.getFixtureDetails )
52
52
  .post( '/update4487Inventory', scriptController.update4487Inventory )
53
53
  .get( '/4487FixtureDetails', scriptController.get4487FixtureDetails )
54
+ .post( '/getstoreMBQFixtureExcel', scriptController.getstoreMBQFixtureExcel )
54
55
  ;