Skip to content

Instantly share code, notes, and snippets.

@sleemanj
Last active September 5, 2022 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sleemanj/003276202ed0e96f497e099ed32536dc to your computer and use it in GitHub Desktop.
Save sleemanj/003276202ed0e96f497e099ed32536dc to your computer and use it in GitHub Desktop.
Load LCSC Cart Export Into Superbuy Forwarding Order
/** Kludgy script for fillling out a Superbuy Forwarding Order
* From LCSC Cart export
*
* Add stuff to your LCSC cart, export the cart (don't purchase yet)
* open the export in spreadsheet, add column 1 for type
* in column one record, for example "Capacitors", "Diodes",
* "Inductors"...
*
* Ensure that all parts have Customer # from BOM
* (set it to LCSC if none)
*
* Export spreadsheet as CSV, with ALL FIELDS QUOTED paste below
*
* Load up the Superbuy forwarding order page
* https://www.superbuy.com/en/page/transport/
*
* Select the warehouse.
*
* Open console
* CTRL-A this file, CTRL-V it into the console, hit enter.
*/
(function(csv){
var items = [];
csv.split(/\r?\n/).forEach(function(line){
var cols = line.split(/","/);
// Skip non-numeric quantity, probably header line, blank line etc
if(cols.length < 9 || isNaN(parseInt(cols[8].replace(/"/, '')))) return;
console.log(items.push({
name: cols[1].replace(/"/, '') + ' ' + cols[0].replace(/"/, '') + ' (Bag Of ' + cols[8].replace(/"/, '')+')',
quantity: 1,
type: 'Other',
price: cols[11].replace(/"/, '') * 6.93,
comment: cols[6].replace(/"/, '')
}));
});
console.log('Parsed ' + items.length + ' item(s)');
function setit3(element, value)
{
element.select();
document.execCommand('insertText', false, value);
}
function nextItem()
{
if(items.length)
{
i = items.pop();
i.price = Math.max(1,i.price.toFixed(2));
console.log(i);
setit3(document.querySelector('.transbox-li input[type=text]'), i.name);
setit3(document.querySelector('.transport-tools .transport-price input[type=text]'), i.price);
setit3(document.querySelector('.transport-tools input.pronumb'),i.quantity);
// setit3(document.querySelector('.transport-tools .warehouse-row+li input[type=text]'), i.comment);
setit3(document.querySelector('.transport-tools .remark input[type=text]'), i.comment);
// Find "Other" node for type
document.querySelectorAll('.transport-classification_list li').forEach(function(li, x)
{
if(li.innerHTML.match(i.type))
{
li.click();
}
});
// Guangdong Warehouse
// document.querySelector('.ant-select-dropdown-menu-item:nth-child(2)').click();
document.querySelector('.transport-tools button.submit-add').click();
}
window.setTimeout(nextItem,500);
}
nextItem();
})(`
"Type","LCSC Part Number","Manufacture Part Number","Manufacturer","Package","Customer #","Description","RoHS","Order Qty.","Min\Mult Order Qty.","Unit Price","Order Price","Product Link"
"Inductors","C439289","GCDA0650-220MC","GLE","SMD","C439289","3A 22uH ±20% 105mΩ SMD Power Inductors ROHS","yes","10","1","0.1661","1.66","https://assets.lcsc.com/images/lcsc/96x96/20191219_GLE-GCDA0650-220MC_C439289_front.jpg"
"Chip Resistors","C4310","0805W8F1501T5E","UNI-ROYAL(Uniroyal Elec)","0805","C4310","125mW Thick Film Resistors 150V ±100ppm/℃ ±1% -55℃~+155℃ 1.5kΩ 0805 Chip Resistor - Surface Mount ROHS","yes","100","100","0.002","0.2","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-0805W8F1501T5E_C4310_front.jpg"
"Chip Resistors","C17398","0805W8F1801T5E","UNI-ROYAL(Uniroyal Elec)","0805","C17398","125mW Thick Film Resistors 150V ±100ppm/℃ ±1% -55℃~+155℃ 1.8kΩ 0805 Chip Resistor - Surface Mount ROHS","yes","100","100","0.002","0.2","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-0805W8F1801T5E_C17398_front.jpg"
"Ring Inductors","C2909799","PDMTAT044125-220MWU","PROD Tech","Plugin","C2909799","8A AEC-Q200 22uH Magnetic ring inductance ±20% 15mΩ Plugin Color Ring Inductors/Through Hole Inductors ROHS","yes","10","1","0.1756","1.76","https://assets.lcsc.com/images/lcsc/96x96/20211117_PROD-Tech-PDMTAT044125-220MWU_C2909799_front.jpg"
"Chip Resistors","C473031","1206W3F100MT5E","UNI-ROYAL(Uniroyal Elec)","1206","C473031","250mW Thick Film Resistors 200V ±1% -55℃~+155℃ 10mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0201","2.01","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W3F100MT5E_C473031_front.jpg"
"Chip Resistors","C25334","1206W4F100LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25334","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 100mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0098","0.98","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F100LT5E_C25334_front.jpg"
"Chip Resistors","C37936","1206W4F150LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C37936","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 150mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0132","1.32","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W4F150LT5E_C37936_front.jpg"
"Chip Resistors","C24436","1206W4F180LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C24436","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 180mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0112","1.12","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W4F180LT5E_C24436_front.jpg"
"Chip Resistors","C25335","1206W4F200LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25335","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 200mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0092","0.92","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F200LT5E_C25335_front.jpg"
"Chip Resistors","C25336","1206W4F220LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25336","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 220mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0115","1.15","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F220LT5E_C25336_front.jpg"
"Chip Resistors","C50842","1206W4F270LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C50842","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 270mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0087","0.87","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W4F270LT5E_C50842_front.jpg"
"Chip Resistors","C59882","1206W4F300LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C59882","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 300mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0089","0.89","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W4F300LT5E_C59882_front.jpg"
"Chip Resistors","C25337","1206W4F330LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25337","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 330mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0083","0.83","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F330LT5E_C25337_front.jpg"
"Chip Resistors","C25338","1206W4F360LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25338","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 360mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0116","1.16","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F360LT5E_C25338_front.jpg"
"Chip Resistors","C25339","1206W4F390LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25339","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 390mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0095","0.95","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F390LT5E_C25339_front.jpg"
"Chip Resistors","C28320","1206W4F470LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C28320","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 470mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0094","0.94","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W4F470LT5E_C28320_front.jpg"
"Chip Resistors","C25340","1206W4F500LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C25340","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 500mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.0083","0.83","https://assets.lcsc.com/images/lcsc/96x96/20220531_UNI-ROYAL-Uniroyal-Elec-1206W4F500LT5E_C25340_front.jpg"
"Chip Resistors","C34068","1206W4F510LT5E","UNI-ROYAL(Uniroyal Elec)","1206","C34068","250mW Thick Film Resistors 200V ±800ppm/℃ ±1% -55℃~+155℃ 510mΩ 1206 Chip Resistor - Surface Mount ROHS","yes","100","50","0.008","0.8","https://assets.lcsc.com/images/lcsc/96x96/20220601_UNI-ROYAL-Uniroyal-Elec-1206W4F510LT5E_C34068_front.jpg"
"Chip Resettable Fuses","C2760292","SMD1812-200C-16V","BNstar","1812","C2760292","16V 2A 100A 800mW -40℃~+85℃ 4A 20mΩ 1s 120mΩ 1812 Resettable Fuses ROHS","yes","10","10","0.065","0.65","https://assets.lcsc.com/images/lcsc/96x96/20210714_BNstar-SMD1812-200C-16V_C2760292_front.jpg"
"Chip Resettable Fuses","C2760295","SMD1812-300C-16V","BNstar","1812","C2760295","16V 3A 100A 800mW -40℃~+85℃ 6A 10mΩ 4s 40mΩ 1812 Resettable Fuses ROHS","yes","10","5","0.0969","0.97","https://assets.lcsc.com/images/lcsc/96x96/20210718_BNstar-SMD1812-300C-16V_C2760295_front.jpg"
"Resettable Fuses","C262057","TRA160","TLC Electronic","Radial Leaded,P=5.1mm","C262057","16V 1.6A 40A 540mW -40℃~+85℃ 3.2A 4.5s Radial Leaded,P=5.1mm Resettable Fuses ROHS","yes","10","10","0.0636","0.64","https://assets.lcsc.com/images/lcsc/96x96/20180914_TLC-Electronic-TRA160_C262057_front.jpg"
"Resettable Fuses","C262058","TRA185","TLC Electronic","Radial Leaded,P=5.1mm","C262058","16V 1.85A 40A 540mW -40℃~+85℃ 3.7A 4.5s Radial Leaded,P=5.1mm Resettable Fuses ROHS","yes","10","10","0.0608","0.61","https://assets.lcsc.com/images/lcsc/96x96/20180914_TLC-Electronic-TRA185_C262058_front.jpg"
"N-Channel TO-220 Mosfets","C81146","STP110N8F6","STMicroelectronics","TO-220(TO-220-3)","C81146","80V 110A 6.5mΩ@10V,55A 200W 4.5V@250uA N Channel TO-220(TO-220-3) MOSFETs ROHS","yes","3","1","0.44","1.32","https://assets.lcsc.com/images/lcsc/96x96/20200723_STMicroelectronics-STP110N8F6_C81146_front.jpg"
"N-Channel TO-220 Mosfets","C2568","IRF640NPBF","Infineon Technologies","TO-220(TO-220-3)","C2568","200V 18A 150W 150mΩ@10V,11A 4V@250uA N Channel TO-220(TO-220-3) MOSFETs ROHS","yes","3","1","0.505","1.52","https://assets.lcsc.com/images/lcsc/96x96/20190509_Infineon-Technologies-IRF640NPBF_C2568_front.jpg"
"N-Channel TO-220 Mosfets","C691685","TTP115N68A","WUXI UNIGROUP MICRO","TO-220","C691685","68V 105A 5.4mΩ@10V,30A 158W 3V@250uA 282pF@30V N Channel 5.094nF@30V 87nC@10V -55℃~+175℃@(Tj) TO-220 MOSFETs ROHS","yes","3","1","0.3391","1.02","https://assets.lcsc.com/images/lcsc/96x96/20200724_WUXI-UNIGROUP-MICRO-TTP115N68A_C691685_front.jpg"
"Ring Inductors","C325995","SLT038125T220MUB","Sunltech Tech","Plugin","C325995","3A 22uH Magnetic ring inductance ±20% 32mΩ Plugin Color Ring Inductors/Through Hole Inductors ROHS","yes","5","1","0.2364","1.18","https://assets.lcsc.com/images/lcsc/96x96/20181109_Sunltech-Tech-SLT038125T220MUB_C325995_front.jpg"
"Chip Resistors","C247550","1206W3F360MT5E","UNI-ROYAL(Uniroyal Elec)","1206","C247550","333.333mW 36mΩ ±800ppm/℃ ±1% 1206 Current Sense Resistors/Shunt Resistors ROHS","yes","100","50","0.0158","3.16","https://assets.lcsc.com/images/lcsc/96x96/20180914_UNI-ROYAL-Uniroyal-Elec-1206W3F360MT5E_C247550_front.jpg"
"Chip Resettable Fuses","C262033","TLC-MSMD250/16","TLC Electronic","1812","C262033","16V 2.5A 100A 1.2W -40℃~+85℃ 5A 5s 1812 Resettable Fuses ROHS","yes","10","5","0.0822","0.82","https://assets.lcsc.com/images/lcsc/96x96/20180914_TLC-Electronic-TLC-MSMD250-16_C262033_front.jpg"
`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment