|
@@ -4,7 +4,6 @@ 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;
|
|
@@ -21,11 +20,6 @@ import org.jeecg.modules.openApi.service.IDxpDataPlanService;
|
|
|
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;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
@@ -35,6 +29,11 @@ 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.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.jeecgframework.poi.excel.entity.TemplateExportParams;
|
|
|
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
|
|
import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView;
|
|
@@ -583,6 +582,42 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量取消提交
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "预装箱单主表-批量取消提交")
|
|
|
+ @ApiOperation(value="预装箱单主表-批量取消提交", notes="预装箱单主表-批量取消提交")
|
|
|
+ @RequestMapping(value = "/cancelSubmitBatch", method = {RequestMethod.GET})
|
|
|
+ public Result<?> cancelSubmitBatch(@RequestParam(value = "ids",required = true) String[] ids) {
|
|
|
+ Result<String> result=new Result<>();
|
|
|
+ try{
|
|
|
+ if(oConvertUtils.isEmpty(ids)){
|
|
|
+ result.setMessage("请至少选中一条单据!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ String str= syPreAssembledPackingListService.cancelSubmitBatch(ids);//修改提交状态
|
|
|
+ if(str.length()>0){
|
|
|
+ result.setMessage("该数据已被成衣-装箱单参照!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setResult(str);//返回已被参照的id
|
|
|
+ result.setCode(111);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ result.setMessage("成功取消提交!");
|
|
|
+ result.setSuccess(true);
|
|
|
+ return result;
|
|
|
+ }catch (Exception ex){
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.error("取消提交失败:" + ex.getMessage());
|
|
|
+ result.error500("取消提交失败:" + ex.getMessage());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通过id删除
|
|
|
*
|
|
@@ -737,55 +772,63 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
|
|
|
public ModelAndView exportXls(HttpServletRequest request, SyPreAssembledPackingList syPreAssembledPackingList) throws Exception {
|
|
|
|
|
|
// Step.1 组装查询条件
|
|
|
- /*QueryWrapper<SyPreAssembledPackingList> queryWrapper = QueryGenerator.initQueryWrapper(syPreAssembledPackingList, request.getParameterMap());
|
|
|
+ QueryWrapper<SyPreAssembledPackingList> queryWrapper = QueryGenerator.initQueryWrapper(syPreAssembledPackingList, request.getParameterMap());
|
|
|
queryWrapper.eq("del_flag","0");
|
|
|
//Step.2 获取导出数据
|
|
|
List<SyPreAssembledPackingList> syPreAssembledPackingListList = syPreAssembledPackingListService.list(queryWrapper);
|
|
|
for (SyPreAssembledPackingList temp : syPreAssembledPackingListList) {
|
|
|
- List<SyPreAssembledPackingListItem> syPreAssembledPackingListItemList = syPreAssembledPackingListItemService.selectByMainId(temp.getId());
|
|
|
- temp.setSyPreAssembledPackingListItemList(syPreAssembledPackingListItemList);
|
|
|
+ QueryWrapper queryWrapper1=new QueryWrapper();
|
|
|
+ queryWrapper1.eq("sy_Pre_Assembled_Packing_List_Id",temp.getId());//获取主表id
|
|
|
+ queryWrapper1.eq("del_flag","0");//未删除数据
|
|
|
+ List<SyPreAssembledPackingListItem> items = syPreAssembledPackingListItemService.list(queryWrapper1);
|
|
|
+ temp.setSyPreAssembledPackingListItemList(items);
|
|
|
}
|
|
|
// return exportXlsSheet2(request,SyPreAssembledPackingList.class,syPreAssembledPackingListList,"预装箱单",1);
|
|
|
- String load="/static/paking.xlsx";//文件名
|
|
|
+ String load= "/static/test.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());
|
|
|
+ TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath(),true,"测试");
|
|
|
+
|
|
|
+ //templateExcelConstants.setTempParams("true");
|
|
|
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>();
|
|
|
+ System.out.println("循环了"+i+"次");
|
|
|
+ // List<SyPreAssembledPackingList exportList = new ArrayList<SyPreAssembledPackingList>();
|
|
|
+ SyPreAssembledPackingList exportList = new SyPreAssembledPackingList();
|
|
|
+ exportList=syPreAssembledPackingListList.get(i-1);
|
|
|
+
|
|
|
+ //exportList.add(syPreAssembledPackingListList.get(i-1));
|
|
|
//过滤选中数据
|
|
|
- String selections = request.getParameter("selections");
|
|
|
- if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
+ // 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 exportParams=new ExportParams("预装箱单报表", "导出人:admin" , "预装箱单"+i);//sysUser.getRealname()
|
|
|
+ //System.out.println("ExcelType.XSSF为:\t"+ ExcelType.XSSF);
|
|
|
exportParams.setType(ExcelType.XSSF);
|
|
|
+ // map.put("title",exportParams);//表格Title
|
|
|
+ //System.out.println("NormalExcelConstants.MAP_LIST的值为\n"+ NormalExcelConstants.MAP_LIST);
|
|
|
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","款号");
|
|
|
+ map.put(NormalExcelConstants.CLASS,SyPreAssembledPackingList.class);//表格对应实体
|
|
|
+ map.put(NormalExcelConstants.PARAMS,exportParams);//表格Title
|
|
|
+ map.put(NormalExcelConstants.DATA_LIST, exportList);//数据集合
|
|
|
listMap.add(map);
|
|
|
+ //maps.put("main",exportList);
|
|
|
}
|
|
|
- maps.put("test",listMap);
|
|
|
ModelAndView mv = new ModelAndView(new JeecgTemplateExcelView());
|
|
|
- maps.put("orderNumber","订单号");
|
|
|
+ maps.put("orderNumber",listMap);
|
|
|
+ System.out.println("maps的值为:\n"+maps.get("orderNumber"));
|
|
|
+ mv.addObject(TemplateExcelConstants.FILE_NAME,"预装箱单模板导出测试");
|
|
|
mv.addObject(TemplateExcelConstants.PARAMS,templateExcelConstants);
|
|
|
mv.addObject(TemplateExcelConstants.MAP_DATA, maps);
|
|
|
- return mv;*/
|
|
|
- return null;
|
|
|
+ return mv;
|
|
|
}
|
|
|
|
|
|
/**
|