Part/BOM的导入
程序员文章站
2022-07-14 20:05:55
...
/**
* 根据路径读取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中的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);
}
}
}