Skip to content

Commit

Permalink
Made the Material Group ID nullable on Reject Bin Scale FreshPack config
Browse files Browse the repository at this point in the history
  • Loading branch information
ashneilson committed Apr 6, 2024
1 parent 7de0381 commit 4b99a8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Controllers/Packhouse/Site/RejectBinScaleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default RejectBinScaleController;
* @typedef {Object} RejectBinScaleController.FreshPackBinScaleIntegration
* @property {Object} points The Points used by this FreshPack Bin Scale Integration
* @property {boolean} enabled Whether this FreshPack Bin Scale Integration is Enabled
* @property {number} materialGroupId The FreshPack Material Group ID to be used for Multi-Grower Bins from this Reject Bin Scale
* @property {?number} materialGroupId The FreshPack Material Group ID to be used for Multi-Grower Bins from this Reject Bin Scale
* @property {number} binTypeId The FreshPack Bin Type ID to be used for Multi-Grower Bins from this Reject Bin Scale
* @property {?number} printerGroupId The FreshPack Printer Group ID to be used when Printing Multi-Grower Bin Cards for this Reject Bin Scale
* @property {boolean} binCardPrintingEnabled Whether Bin Card Printing is Enabled
Expand Down
9 changes: 7 additions & 2 deletions src/Models/Packhouse/Site/RejectBinScaleModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class RejectBinScaleModel extends BaseModel
/**
* The FreshPack Integration Configuration for this Reject Bin Scale
*
* @type {?{points: Object, enabled: boolean, materialGroupId: number, binTypeId: number, printerGroupId: ?number, binCardPrintingEnabled: boolean, useWindowsDriverApi: boolean}}
* @type {?{points: Object, enabled: boolean, materialGroupId: ?number, binTypeId: number, printerGroupId: ?number, binCardPrintingEnabled: boolean, useWindowsDriverApi: boolean}}
* @public
*/
this.freshPackIntegration = null;
Expand Down Expand Up @@ -1303,6 +1303,11 @@ class RejectBinScaleModel extends BaseModel
if(typeof jsonObject['freshPackIntegration'] === 'object' && 'materialGroupId' in jsonObject['freshPackIntegration'])
{
freshPackIntegrationObject.materialGroupId = (function(){
if(jsonObject['freshPackIntegration'].materialGroupId === null)
{
return null;
}

if(typeof jsonObject['freshPackIntegration'].materialGroupId !== 'number')
{
return Number.isInteger(Number(jsonObject['freshPackIntegration'].materialGroupId)) ? Number(jsonObject['freshPackIntegration'].materialGroupId) : Math.floor(Number(jsonObject['freshPackIntegration'].materialGroupId));
Expand All @@ -1313,7 +1318,7 @@ class RejectBinScaleModel extends BaseModel
}
else
{
freshPackIntegrationObject.materialGroupId = 0;
freshPackIntegrationObject.materialGroupId = null;
}

if(typeof jsonObject['freshPackIntegration'] === 'object' && 'binTypeId' in jsonObject['freshPackIntegration'])
Expand Down

0 comments on commit 4b99a8a

Please sign in to comment.