Python flat bill-of-material program based on Excel files - GitHub
文章推薦指數: 80 %
A Python program for flattening a layered bill-of-material (BOM) based on Excel files. Part quantities are combined and a total quantity or minimum-required- ... Skiptocontent {{message}} robsiegwart / python-BOM Public Notifications Fork 7 Star 9 Pythonflatbill-of-materialprogrambasedonExcelfiles License MITlicense 9 stars 7 forks Star Notifications Code Issues 0 Pullrequests 0 Actions Projects 0 Security Insights More Code Issues Pullrequests Actions Projects Security Insights robsiegwart/python-BOM Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository. master Branches Tags Couldnotloadbranches Nothingtoshow {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default 1 branch 0 tags Code Clone HTTPS GitHubCLI UseGitorcheckoutwithSVNusingthewebURL. WorkfastwithourofficialCLI. Learnmore. OpenwithGitHubDesktop DownloadZIP LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingXcode Ifnothinghappens,downloadXcodeandtryagain. LaunchingVisualStudioCode Yourcodespacewillopenonceready. Therewasaproblempreparingyourcodespace,pleasetryagain. Latestcommit RobSiegwart UpdateREADME … 987a69e Aug31,2021 UpdateREADME 987a69e Gitstats 58 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime Example doc pyBOM .gitignore LICENSE README.md setup.py Viewcode pyBOM Motivation Structure Usage CommandLine Dependencies README.md pyBOM APythonprogramforflatteningalayeredbill-of-material(BOM)basedonExcel files.Partquantitiesarecombinedandatotalquantityor minimum-required-package-to-buyamountiscalculated,inadditiontoextended costs.AtreestructureoftheBOMhierarchycanalsobecreatedandconverted toDOTsyntaxforfurthergraphicsgeneration. Motivation Themainproblemsolvedistocombineidenticalpartsfromvarious sub-assembliesandlocationsinyourproductBOM.Additionally,itistobeused withExcelsinceExceliscommon,easy,anddoesnotrequireaseparateprogram orservertorun.FlatteningtellsyouthetotalQTYofapartwhenitmaybe usedinmanysub-assembliesandlevelsinyourproductstructure.Thisis necessarytocalculatethetotalQTYofapartandthereforedeterminethe mininumpackagesoftheproducttobuy,sincemanypartscomeinpacksgreater thanQTY1. Structure BOMsarecreatedbystoringpartsandassembliesinExcelfiles. Inaseparatedirectory,putanExcelfilenamedPartslist.xlsxtoserveas themasterpartslist"database".Then,eachadditionalassemblyisdescribed byaseparate.xlsxfile.Thusyoumighthave: my_project/ Partslist.xlsx>>print(bom.parts) [PartSK1002-01,PartSK1005-01,PartSK1007-01] BOM.assemblies :Getalistofalldirect-childassemblies >>>print(bom.assemblies) [WH-01,TR-01] BOM.quantities :Getthequantityofeachdirect-childpartintheBOM >>>print(bom.quantities) {PartSK1002-01:1,PartSK1005-01:1,PartSK1007-01:3,PartSK1006-01:1, PartSK1001-01:1,PartSK1003-01:1,PartSK1004-01:1} BOM.aggregate :Gettheaggregatedquantityofeachpart/assemblyfromthecurrent BOMleveldown >>>print(bom.aggregate) {PartSK1002-01:1,PartSK1005-01:8,PartSK1007-01:14,PartSK1006-01:8, PartSK1001-01:4,PartSK1003-01:2,PartSK1004-01:2} BOM.summary :GetasummaryintheformofaDataFramecontainingthemasterparts listwitheachitem'saggregatedquantityandtherequiredpackages tobuyifthePkgQTYfieldisnot1. >>>print(bom.summary) PNNameDescription...TotalQTYPurchaseQTYSubtotal 0SK1001-01BearingWheelbearing...4411.96 1SK1002-01BoardStandardtype...1113.42 2SK1003-01TruckhalfTruckfixed...2219.74 3SK1004-01TruckhalfTruckmovable...2224.50 4SK1005-01Truckscrew1/4-20SHCS...8112.86 5SK1006-01WheelHardclearurethane...8219.74 6SK1007-01Nut1/4-20Hexnut...1414.88 BOM.tree :ReturnastringrepresentationoftheBOMtreehierarchy >>>print(bom.tree) SKA-100 ├──PartSK1002-01 ├──WH-01 │├──PartSK1006-01 │├──PartSK1001-01 │└──PartSK1007-01 ├──TR-01 │├──PartSK1003-01 │├──PartSK1004-01 │└──PartSK1007-01 ├──PartSK1005-01 └──PartSK1007-01 Callingthisonchildassembliesshowsthetreefromthatreferencepoint: >>>sa=bom.assemblies[0] >>>sa WH-01 >>>print(sa.tree) WH-01 ├──PartSK1006-01 ├──PartSK1001-01 └──PartSK1007-01 CommandLine Somequickfunctionalityisextendedtothecommandlineviapythonmodulemode: >python-mpyBOMFOLDERACTION WhereACTIONiswhattodoandisjustapropertycallontheresulting top-levelBOM: >python-mpyBOMExampletree SKA-100 ├──PartSK1002-01 ├──WH-01 │├──PartSK1006-01 │├──PartSK1001-01 │└──PartSK1007-01 ├──TR-01 │├──PartSK1003-01 │├──PartSK1004-01 │└──PartSK1007-01 ├──PartSK1005-01 └──PartSK1007-01 Dependencies pandas anytree About Pythonflatbill-of-materialprogrambasedonExcelfiles Resources Readme License MITlicense Stars 9 stars Watchers 1 watching Forks 7 forks Releases Noreleasespublished Packages0 Nopackagespublished Languages Python 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.
延伸文章資訊
- 1Convert UTF-8 with BOM to UTF-8 with no BOM in Python
Is there a solution that can take any known Python encoding and output as UTF-8 without BOM? edit...
- 2cyclonedx-bom - PyPI
CycloneDX Python SBOM Generation Tool ... This project provides a runnable Python-based applicati...
- 3python 讀取帶BOM的utf-8格式檔案 - 程式人生
微軟在UTF-8中使用BOM(Byte order mark)是因為這樣可以將UTF-8和ASCII等 ... 比如很多現代指令碼語言,例如python,其直譯器本身是能處理BOM的, ...
- 4BOM 的去除方式:分別使用vim, Python, 及bash - Kirin
BOM 的去除方式:分別使用vim, Python, 及bash. 0. Kirin written 10 個月ago. 最後更新日期:2022 年01 月3 日. BOM 是Byte Orde...
- 5在Python中將帶BOM的UTF - 程式人生
我想將它們(理想情況下)轉換為沒有BOM的UTF-8。似乎 codecs.StreamRecoder(stream, encode, decode, Reader, Writer, errors...