replaysMike / Binner

Open source parts inventory system for makers, electronics hobby, and professional engineers
https://binner.io
GNU General Public License v3.0
268 stars 41 forks source link

Mouser order import #40

Closed funkyflashfive closed 2 years ago

funkyflashfive commented 2 years ago

Running the ubuntu build of v2.0.20, I used the gui to setup the Mouser API keys and then went to import my orders. Import just hangs at a spinning wheel. I checked the appsettings.json and the keys are in the appropriate places. Terminal shows Application Error: Binner.Web.Controllers.PartController.OrderImportAsync (Binner.Web) Exception: InvalidOperationException Mouser Api is not configured!

replaysMike commented 2 years ago

is it possible your appsettings.json is corrupt? Try formatting your config file here or post it here and I can see if that's the issue. There was a bug in a previous version that incorrectly saved the config file if the newer one was larger.

replaysMike commented 2 years ago

if posting here, be sure to replace your actual keys with something fake for privacy reasons ;)

funkyflashfive commented 2 years ago

Here is the contents of appsettings.json, with the strings replaced!

{ "WebHostServiceConfiguration": { "Environment": 1, "Name": "Binner Server", "IP": "*", "PublicUrl": "", "Port": 8090, "MaxCacheItems": 1024, "CacheSlidingExpirationMinutes": 30, "CacheAbsoluteExpirationMinutes": 0, "CorsAllowOrigin": null, "Integrations": { "Octopart": { "ApiKey": "", "ApiUrl": "https://octopart.com" }, "Digikey": { "ClientId": "", "ClientSecret": "", "oAuthPostbackUrl": "http://localhost:8090/Authorization/Authorize", "ApiUrl": "https://sandbox-api.digikey.com" }, "Mouser": { "ApiKeys": { "SearchApiKey": "SearchKeyStringIsHere", "OrderApiKey": "OrderKeyStringIsHere", "CartApiKey": "OrderKeyStringIsHere" }, "ApiUrl": "https://api.mouser.com" }, "AliExpress": { "ApiKey": null, "ApiUrl": "https://api.aliexpress.com" } }, "PrinterConfiguration": { "PrinterName": "DYMO LabelWriter 450 Twin Turbo", "PartLabelName": "30346", "PartLabelSource": 2, "PartLabelTemplate": { "Line1": { "Label": 2, "Content": "{partNumber}", "FontName": "Segoe UI", "AutoSize": true, "UpperCase": true, "LowerCase": false, "FontSize": 16, "Barcode": false, "Rotate": 0, "Position": 2, "Margin": { "Left": 0, "Right": 0, "Top": 0, "Bottom": 0 }, "Color": null }, "Line2": { "Label": 2, "Content": "{description}", "FontName": "Segoe UI", "AutoSize": false, "UpperCase": false, "LowerCase": false, "FontSize": 8, "Barcode": false, "Rotate": 0, "Position": 2, "Margin": { "Left": 0, "Right": 0, "Top": 0, "Bottom": 0 }, "Color": null }, "Line3": { "Label": 2, "Content": "{description}", "FontName": "Segoe UI", "AutoSize": false, "UpperCase": false, "LowerCase": false, "FontSize": 8, "Barcode": false, "Rotate": 0, "Position": 2, "Margin": { "Left": 0, "Right": 0, "Top": 0, "Bottom": 0 }, "Color": null }, "Line4": { "Label": 2, "Content": "{partNumber}", "FontName": "Segoe UI", "AutoSize": false, "UpperCase": false, "LowerCase": false, "FontSize": 8, "Barcode": true, "Rotate": 0, "Position": 2, "Margin": { "Left": 0, "Right": 0, "Top": 0, "Bottom": 0 }, "Color": null }, "Identifier": { "Label": 1, "Content": "{binNumber}", "FontName": "Segoe UI", "AutoSize": false, "UpperCase": true, "LowerCase": false, "FontSize": 10, "Barcode": false, "Rotate": 90, "Position": 0, "Margin": { "Left": 0, "Right": 0, "Top": 25, "Bottom": 0 }, "Color": "#ee0000" }, "Identifier2": { "Label": 1, "Content": "{binNumber2}", "FontName": "Segoe UI", "AutoSize": false, "UpperCase": true, "LowerCase": false, "FontSize": 10, "Barcode": false, "Rotate": 90, "Position": 1, "Margin": { "Left": 20, "Right": 0, "Top": 25, "Bottom": 0 }, "Color": "#ee0000" } }, "LabelDefinitions": [ { "LabelName": "File Folder (2 up)", "MediaSize": { "Width": 82, "Height": 248, "Name": "File Folder (2 up)", "DriverName": "w82h248", "ModelName": "30277", "ExtraData": "" }, "TopMargin": -20, "LeftMargin": 0, "LabelCount": 2, "TotalLines": 2, "ImageDimensions": { "Width": 0, "Height": 0, "IsEmpty": true }, "PrintDimensions": { "Width": 0.0, "Height": 0.0, "IsEmpty": true }, "InvertLabelDimensions": true, "Dpi": 300.0 }, { "LabelName": "1/2 in x 1-7/8 in", "MediaSize": { "Width": 36, "Height": 136, "Name": "1/2 in x 1-7/8 in", "DriverName": "w36h136", "ModelName": "30346", "ExtraData": "" }, "TopMargin": -20, "LeftMargin": 0, "LabelCount": 2, "TotalLines": 2, "ImageDimensions": { "Width": 0, "Height": 0, "IsEmpty": true }, "PrintDimensions": { "Width": 0.0, "Height": 0.0, "IsEmpty": true }, "InvertLabelDimensions": true, "Dpi": 300.0 }, { "LabelName": "Address", "MediaSize": { "Width": 79, "Height": 252, "Name": "Address", "DriverName": "w79h252", "ModelName": "30252", "ExtraData": "" }, "TopMargin": -20, "LeftMargin": 0, "LabelCount": 1, "TotalLines": 4, "ImageDimensions": { "Width": 0, "Height": 0, "IsEmpty": true }, "PrintDimensions": { "Width": 0.0, "Height": 0.0, "IsEmpty": true }, "InvertLabelDimensions": true, "Dpi": 300.0 }, { "LabelName": "File Folder", "MediaSize": { "Width": 57, "Height": 286, "Name": "File Folder", "DriverName": "w57h248", "ModelName": "30327", "ExtraData": "" }, "TopMargin": -20, "LeftMargin": 0, "LabelCount": 1, "TotalLines": 4, "ImageDimensions": { "Width": 0, "Height": 0, "IsEmpty": true }, "PrintDimensions": { "Width": 0.0, "Height": 0.0, "IsEmpty": true }, "InvertLabelDimensions": true, "Dpi": 300.0 } ] } }, "StorageProviderConfiguration": { "Provider": "Binner", "ProviderConfiguration": { "Filename": "./binner.db" } }, "Logging": { "LogLevel": { "Default": "Trace", "Microsoft": "Error" } } }

replaysMike commented 2 years ago

hmm, I don't see any obvious issues with the json configuration, a few minor differences with the latest master version but that shouldn't cause this issue.

I'll test this out and see if I can find out what's going on here.

funkyflashfive commented 2 years ago

Thanks Mike, let me know if there's anything else I can provide to track this down

replaysMike commented 2 years ago

no prob, will try to have this resolved for you by tomorrow

replaysMike commented 2 years ago

so the problem was that the order import page didn't really have any error handling, so if you enter an invalid order number or your api key is invalid it won't give you any feedback. I've fixed this in the source and will push a new release in about 30 minutes.

In the mean time, check when you are importing a mouser order that you are using the Web Order # and not the Sales Order # - it seems the mouser api only understands Web Order #'s.

funkyflashfive commented 2 years ago

After a restart, using Web Order # worked just fine. It would be good to add this to the wiki page about importing, I would do it myself but the wiki doesn't seem to be publicly editable. Thanks!

replaysMike commented 2 years ago

good suggestion, I will update the wiki as well. I'm in the middle of a large set of changes that will be published soon, so there will be some new stuff to see too shortly!