该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public String spStockInFile(){
// 获取一个UUID
String uuid=UUID.randomUUID().toString();
//存储路径
System.out.println("---------"+beRead);
String filePath=ServletActionContext.getServletContext().getRealPath("/returnFile/");
String oFile = uuid + ".xls";//(this.fileName.lastIndexOf(".")==-1?"": "." + this.fileName.substring(this.fileName.lastIndexOf(".")+1));
System.out.println(oFile);
String oFileName = filePath + "/" + oFile;
try {
FileInputStream fis = new FileInputStream(getBeRead());
FileOutputStream fos = new FileOutputStream(oFileName);
ExcelBook book=new ExcelBook(fis,oFileName);
ExcelSheet sheet= book.getSheet();
for(int i=1; i
System.out.println(sheet.getRowCount());
TbSpStockIn ssin=new TbSpStockIn();
ssin.setBillNo(billNo);
TbSpStockInDetail ssi=new TbSpStockInDetail();
ExcelRow row=sheet.getRow(i);
ssi.setId(-1);
ssi.setTbSpStockIn(ssin);
ssi.setSpareCode(row.getCellValue(1));
System.out.println("---------------------"+row.getCellValue(1));
ssi.setQuantity(Integer.parseInt(row.getCellValue(2)));
ssi.setRemark(row.getCellValue(3));
int result=tbSpStockInSerice.saveOrUpdateSpStockInDetail(ssi);
if(result>-1){
successCount++;
}else{
failCount++;
}
fis.close();
book.write(fos);
}
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
this.downloadFile=oFile;
return SUCCESS;
}