欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Part/BOM的导入

程序员文章站 2022-07-14 20:12:01
...
/**
* 根据路径读取excel中的part信息并创建part
* @param filepath
* @throws Exception
*/
public static void uploadfile(String filepath) throws Exception{

List list = readExcel(new FileInputStream(filepath));
StringBuffer parts = new StringBuffer();
if(list != null){
HashMap map = new HashMap();
map = (HashMap) list.get(0);
Set tempset = map.keySet();
for (Object o : tempset) {
parts.append(o.toString()).append(",");
}
parts.append("------------");
for (int i = 0; i < list.size(); i++) {
map = (HashMap) list.get(i);
Set set = map.keySet();
String name = map.get("名称").toString();
String number = map.get("编号").toString();
String state = map.get("状态").toString();
String creator = map.get("创建者").toString();
String createtime = map.get("创建时间").toString();
String modifytime = map.get("修改时间").toString();
String productname = map.get("产品名称").toString();
for (Object so : set) {
parts.append(map.get(so.toString()).toString()).append(",");
}
HashMap needmap = new HashMap();

needmap.put("name", name);
needmap.put("number", number);
needmap.put("state", state);
needmap.put("creator", creator);
needmap.put("createtime", createtime);
needmap.put("modifytime", modifytime);
needmap.put("productname", productname);
createPart(needmap, thispartcontainer);

}



}

}
相关标签: Excel J#