起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3256|回复: 3

[处理中3] 关于excel导入导出的几个问题

[复制链接]

767

主题

1914

帖子

3831

积分

论坛元老

Rank: 8Rank: 8

积分
3831
QQ
发表于 2020-3-7 16:10:12 | 显示全部楼层 |阅读模式
1、请问如何设置导出后的excel列显示顺序。导出后的和grid中的列的顺序不一样。不想通过每次导出自定义选择顺序,能不能设置默认顺序。
2、导入的时候能不能从第二行导入
3、导入如果重复的话如何跳过重复?

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
36069
发表于 2020-3-9 09:33:35 | 显示全部楼层
1..w中组件提供的有relations属性选择要导出的列然后切换到源码修改列的顺序,或者js中设置
http://docs.wex5.com/bex5-ui-question-list-10204/
2.mapping文件中就有设置行从第几行导入到第几行啊
3.http://bbs.wex5.com/forum.php?mo ... 7&pid=165008000
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

767

主题

1914

帖子

3831

积分

论坛元老

Rank: 8Rank: 8

积分
3831
QQ
 楼主| 发表于 2020-3-13 14:38:12 | 显示全部楼层
jishuang 发表于 2020-3-9 09:33
1..w中组件提供的有relations属性选择要导出的列然后切换到源码修改列的顺序,或者js中设置
http://docs.we ...


        public static void workOrderProcessAfterImportExcelBeforeAction() {
                System.out.println("导入前");
                Workbook workBook = (Workbook)ModelUtils.getRequestContext().getActionContext().getParameter("excel");
                Sheet sheet=workBook.getSheetAt(0); //获得sheet1表
                List<String> list=new ArrayList<String>();//存放excel鉴别列的数据
                for(int i=0;i<=sheet.getLastRowNum();i++){
                         Row row=sheet.getRow(i);
                         Cell cell=row.getCell(1);//根据excel表中第一列数据进行校验
                         cell.setCellType(Cell.CELL_TYPE_STRING);
                         if(cell.getRowIndex()==0){
                                 row.removeCell(cell);//如果list存在和鉴别列相同的数据就删除       
                                         }else{
                                                 
                                 list.add(cell.getStringCellValue());//如果不存在就添加到list
                         }

       
                }

        }

导入excel提示如下错误

导入前
2020-03-13 14:37:05 excute stream action, params:{"accept":"application/json","action":"importExcel","actionFlag":"__action_0__","activity":"newActivity","contentType":"json","executeContext":"","executor":"","parameters":{"config":{"@type":"xml","xml":"<config use-default=\"false\" to=\"UI\" excel-file=\"E:\\BeX5_V3.8\\apache-tomcat\\temp\\072c1df2-cde3-462b-9f24-80d5fb76c327.excel.tmp\" mapping-file=\"E:\\BeX5_V3.8\\apache-tomcat\\temp\\a866f371-7778-4104-aadf-c8d302541a82.excel.tmp\"><sheet all=\"true\" start=\"1\" end=\"1\"/><row all=\"true\" start=\"1\" end=\"1\"/><data><concept name=\"NP_workOrderD\"><relation name=\"NP_workOrderD\" type=\"String\"/><relation name=\"fBrandModel\" type=\"String\"/><relation name=\"fConstructionUnit\" type=\"String\"/><relation name=\"fDailyOverhaul\" type=\"String\"/><relation name=\"fDefetClass\" type=\"String\"/><relation name=\"fEngQuantities\" type=\"String\"/><relation name=\"fMasterID\" type=\"String\"/><relation name=\"fNumber\" type=\"Decimal\"/><relation name=\"fOrderContent\" type=\"String\"/><relation name=\"fOrderFinishDate\" type=\"Date\"/><relation name=\"fOrderID\" type=\"Decimal\"/><relation name=\"fOrderPerson\" type=\"String\"/><relation name=\"fOrderReDate\" type=\"Date\"/><relation name=\"fOrderStartDate\" type=\"Date\"/><relation name=\"fOwerPerson\" type=\"String\"/><relation name=\"fPlantCode\" type=\"String\"/><relation name=\"fPosition\" type=\"String\"/><relation name=\"fRemarks\" type=\"String\"/><relation name=\"fTeamNum\" type=\"String\"/><relation name=\"fUseMaterial\" type=\"String\"/><relation name=\"fUseTools\" type=\"String\"/><relation name=\"fWork\" type=\"String\"/><relation name=\"fWorkHour\" type=\"String\"/><relation name=\"sCreateTime\" type=\"DateTime\"/><relation name=\"version\" type=\"Integer\"/></concept></data></config>"},"createActionParam":{"action":"createNP_workOrderDAction","activity":"newActivity","parameters":{"defaultValues":{"fMasterID":"'34AE2D1493A4471D9533F5491D4485A1'"},"table":{"@type":"table","rows":[],"userdata":{"idColumnDefine":"NP_workOrderD","idColumnName":"NP_workOrderD","idColumnType":"String","model":"/NPOMIS/engMgt/data","relationAlias":"fBrandModel,fConstructionUnit,fDailyOverhaul,fDefetClass,fEngQuantities,fMasterID,fNumber,fOrderContent,fOrderFinishDate,fOrderID,fOrderPerson,fOrderReDate,fOrderStartDate,fOwerPerson,fPlantCode,fPosition,fRemarks,fTeamNum,fUseMaterial,fUseTools,fWork,fWorkHour,sCreateTime,version","relationTypes":"String,String,String,String,String,String,Decimal,String,Date,Decimal,String,Date,Date,String,String,String,String,String,String,String,String,String,DateTime,Integer","relations":"NP_workOrderD.fBrandModel,NP_workOrderD.fConstructionUnit,NP_workOrderD.fDailyOverhaul,NP_workOrderD.fDefetClass,NP_workOrderD.fEngQuantities,NP_workOrderD.fMasterID,NP_workOrderD.fNumber,NP_workOrderD.fOrderContent,NP_workOrderD.fOrderFinishDate,NP_workOrderD.fOrderID,NP_workOrderD.fOrderPerson,NP_workOrderD.fOrderReDate,NP_workOrderD.fOrderStartDate,NP_workOrderD.fOwerPerson,NP_workOrderD.fPlantCode,NP_workOrderD.fPosition,NP_workOrderD.fRemarks,NP_workOrderD.fTeamNum,NP_workOrderD.fUseMaterial,NP_workOrderD.fUseTools,NP_workOrderD.fWork,NP_workOrderD.fWorkHour,NP_workOrderD.sCreateTime,NP_workOrderD.version","updateMode":"whereVersion"}}},"process":"/NPOMIS/engMgt/process/workOrder/workOrderProcess"}},"process":"/NPOMIS/engMgt/process/workOrder/workOrderProcess"}
java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor262.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.justep.system.action.Engine.invokeActions(Native Method)
        at com.justep.system.action.Engine.invokeActions(Unknown Source)
        at com.justep.business.server.BusinessServer.doAction(Unknown Source)
        at com.justep.business.server.BusinessServer.doExcute(Unknown Source)
        at com.justep.business.server.BusinessServer.excute(Unknown Source)
        at com.justep.business.server.BusinessServer.excute(Unknown Source)
        at com.justep.business.server.BusinessServerServlet.execService(Unknown Source)
        at com.justep.business.server.BusinessServerServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at com.justep.x.bs.BusinessServerServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.justep.micro.service.MicroServiceFilter.doFilter(Unknown Source)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.justep.excel.ExcelException: 编码: JUSTEP170010; 提示:
        at com.justep.excel.ExcelException.create(ExcelException.java:32)
        at com.justep.excel.ImportGenerator.getValue(ImportGenerator.java:315)
        at com.justep.excel.ImportGenerator.setCellsValue(ImportGenerator.java:238)
        at com.justep.excel.ImportGenerator.generateRecord(ImportGenerator.java:203)
        at com.justep.excel.ImportGenerator.generateSheet(ImportGenerator.java:198)
        at com.justep.excel.ImportGenerator.generate(ImportGenerator.java:131)
        at Excel.importExcel(Excel.java:91)
        ... 29 more
Caused by: java.lang.NumberFormatException
        at java.math.BigDecimal.<init>(BigDecimal.java:494)
        at java.math.BigDecimal.<init>(BigDecimal.java:383)
        at java.math.BigDecimal.<init>(BigDecimal.java:806)
        at com.justep.system.transform.SimpleTransform.a(Unknown Source)
        at com.justep.system.transform.SimpleTransform.transToObj(Unknown Source)
        at com.justep.excel.ImportGenerator.getValue(ImportGenerator.java:313)
        ... 34 more
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
36069
发表于 2020-3-13 16:16:39 | 显示全部楼层
确认mapping文件中概念名、以及从第几行开始导入都设置的正确吗?
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-11-27 09:32 , Processed in 0.064104 second(s), 28 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表