|  | @@ -1,8 +1,10 @@
 | 
	
		
			
				|  |  |  package org.jeecg.modules.spapl.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.io.File;
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  |  import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletResponse;
 | 
	
	
		
			
				|  | @@ -20,6 +22,9 @@ import org.jeecg.modules.spapl.vo.PackingHeaderVo;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.spapl.vo.SyPreAssembledPackingListVo;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.system.util.InterfaceConnUtils;
 | 
	
		
			
				|  |  |  import org.jeecgframework.poi.excel.ExcelImportUtil;
 | 
	
		
			
				|  |  | +import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 | 
	
		
			
				|  |  | +import org.jeecgframework.poi.excel.def.TemplateExcelConstants;
 | 
	
		
			
				|  |  | +import org.jeecgframework.poi.excel.entity.ExportParams;
 | 
	
		
			
				|  |  |  import org.jeecgframework.poi.excel.entity.ImportParams;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import org.jeecg.common.api.vo.Result;
 | 
	
	
		
			
				|  | @@ -30,8 +35,12 @@ import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.spapl.vo.SyPreAssembledPackingListPage;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListService;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListItemService;
 | 
	
		
			
				|  |  | +import org.jeecgframework.poi.excel.entity.TemplateExportParams;
 | 
	
		
			
				|  |  | +import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
 | 
	
		
			
				|  |  | +import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView;
 | 
	
		
			
				|  |  |  import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.util.ResourceUtils;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  import org.springframework.web.servlet.ModelAndView;
 | 
	
		
			
				|  |  |  import org.springframework.web.multipart.MultipartFile;
 | 
	
	
		
			
				|  | @@ -543,11 +552,11 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
 | 
	
		
			
				|  |  |  				 result.setSuccess(false);
 | 
	
		
			
				|  |  |  				 return result;
 | 
	
		
			
				|  |  |  			 }
 | 
	
		
			
				|  |  | -/*			 if(syPreAssembledPackingList2.getPushStatus().equals("1")||syPreAssembledPackingList2.getIsReference()>1){
 | 
	
		
			
				|  |  | +			 if(syPreAssembledPackingList2.getPushStatus().equals("1")||syPreAssembledPackingList2.getIsReference()>1){
 | 
	
		
			
				|  |  |  				 result.setMessage("已推送云工厂或已被下游参照!");
 | 
	
		
			
				|  |  |  				 result.setSuccess(false);
 | 
	
		
			
				|  |  |  				 return result;
 | 
	
		
			
				|  |  | -			 }*/
 | 
	
		
			
				|  |  | +			 }
 | 
	
		
			
				|  |  |  			 syPreAssembledPackingList2.setStatus("0");//修改为取消提交状态
 | 
	
		
			
				|  |  |  			 boolean bool= syPreAssembledPackingListService.updateById(syPreAssembledPackingList2);//修改提交状态
 | 
	
		
			
				|  |  |  			 if(bool==true){
 | 
	
	
		
			
				|  | @@ -724,7 +733,46 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
 | 
	
		
			
				|  |  |  			List<SyPreAssembledPackingListItem> syPreAssembledPackingListItemList = syPreAssembledPackingListItemService.selectByMainId(temp.getId());
 | 
	
		
			
				|  |  |  			temp.setSyPreAssembledPackingListItemList(syPreAssembledPackingListItemList);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		return exportXlsSheet2(request,SyPreAssembledPackingList.class,syPreAssembledPackingListList,"预装箱单",1);
 | 
	
		
			
				|  |  | +		 // return exportXlsSheet2(request,SyPreAssembledPackingList.class,syPreAssembledPackingListList,"预装箱单",1);
 | 
	
		
			
				|  |  | +		  String load="/static/paking.xlsx";//文件名
 | 
	
		
			
				|  |  | +		  double total = syPreAssembledPackingListList.size();//总条数
 | 
	
		
			
				|  |  | +		  int count = (int)Math.ceil(total/1);//每条sheet分几条数据
 | 
	
		
			
				|  |  | +		  File filePath=new File(ResourceUtils.getURL("classpath:").getPath());//获取路径
 | 
	
		
			
				|  |  | +		  File file=new File(filePath,load);
 | 
	
		
			
				|  |  | +		  TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath());
 | 
	
		
			
				|  |  | +		  List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
 | 
	
		
			
				|  |  | +		  Map<String, Object> maps = new HashMap<String, Object>();
 | 
	
		
			
				|  |  | +		  for (int i = 1; i <=count ; i++) {
 | 
	
		
			
				|  |  | +			  List<SyPreAssembledPackingList> exportList = new ArrayList<SyPreAssembledPackingList>();
 | 
	
		
			
				|  |  | +			  //过滤选中数据
 | 
	
		
			
				|  |  | +			  String selections = request.getParameter("selections");
 | 
	
		
			
				|  |  | +			  if (oConvertUtils.isNotEmpty(selections)) {
 | 
	
		
			
				|  |  | +				  List<String> selectionList = Arrays.asList(selections.split(","));
 | 
	
		
			
				|  |  | +				  exportList = syPreAssembledPackingListList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +			  }
 | 
	
		
			
				|  |  | +			  else {
 | 
	
		
			
				|  |  | +				  exportList.add(syPreAssembledPackingListList.get(i-1));
 | 
	
		
			
				|  |  | +			  }
 | 
	
		
			
				|  |  | +			  ExportParams exportParams=new ExportParams("预装箱单报表", "导出人:admin" , "预装箱单"+i,"/opt/upFiles");//sysUser.getRealname()
 | 
	
		
			
				|  |  | +			  System.out.println("ExcelType.XSSF为:\t"+ ExcelType.XSSF);
 | 
	
		
			
				|  |  | +			  exportParams.setType(ExcelType.XSSF);
 | 
	
		
			
				|  |  | +			  Map<String, Object> map = new HashMap<String, Object>();
 | 
	
		
			
				|  |  | +			  map.put("title",exportParams);//表格Title
 | 
	
		
			
				|  |  | +			  map.put(NormalExcelConstants.PARAMS,templateExcelConstants);//表格Title
 | 
	
		
			
				|  |  | +			  map.put(NormalExcelConstants.CLASS,Object.class);//表格对应实体
 | 
	
		
			
				|  |  | +			  map.put(NormalExcelConstants.MAP_LIST, exportList);//数据集合
 | 
	
		
			
				|  |  | +			  System.out.println("NormalExcelConstants.MAP_LIST的值为\n"+NormalExcelConstants.MAP_LIST);
 | 
	
		
			
				|  |  | +			  map.put("orderNumber","订单号");
 | 
	
		
			
				|  |  | +			  map.put("id","主键");
 | 
	
		
			
				|  |  | +			  map.put("styleNo","款号");
 | 
	
		
			
				|  |  | +			  listMap.add(map);
 | 
	
		
			
				|  |  | +		  }
 | 
	
		
			
				|  |  | +		  maps.put("test",listMap);
 | 
	
		
			
				|  |  | +		  ModelAndView mv = new ModelAndView(new JeecgTemplateExcelView());
 | 
	
		
			
				|  |  | +		  maps.put("orderNumber","订单号");
 | 
	
		
			
				|  |  | +		  mv.addObject(TemplateExcelConstants.PARAMS,templateExcelConstants);
 | 
	
		
			
				|  |  | +		  mv.addObject(TemplateExcelConstants.MAP_DATA, maps);
 | 
	
		
			
				|  |  | +		  return mv;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	  /**
 |