|
@@ -180,11 +180,13 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
|
|
|
Page<SyShippingDetailsVo> page = new Page<SyShippingDetailsVo>(1, -1);
|
|
|
if(flourOrGarment.equals("0")){
|
|
|
+ queryWrapper.eq("1",1);
|
|
|
IPage<SyShippingDetailsVo> pageList = syShippingDetailsService.queryShippingDetailsGarment(page, queryWrapper);
|
|
|
result.setSuccess(true);
|
|
|
result.setResult(pageList);
|
|
|
result.setMessage("查询成功");
|
|
|
}else{
|
|
|
+ queryWrapper.eq("1",1);
|
|
|
IPage<SyShippingDetailsVo> pageList = syShippingDetailsService.queryShippingDetails(page, queryWrapper);
|
|
|
result.setSuccess(true);
|
|
|
result.setResult(pageList);
|
|
@@ -442,12 +444,8 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
|
|
|
Result<String> result = new Result<String>();
|
|
|
|
|
|
- IPage<SyShippingDetailsVo> pageList = null;
|
|
|
-
|
|
|
List<SyPreAssembledPackingListVo> syPreList = new ArrayList<>();
|
|
|
|
|
|
- DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-
|
|
|
QueryWrapper<SyShippingDetailsVo> queryWrapper = new QueryWrapper<>();
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
if(oConvertUtils.isNotEmpty(syShippingDetails.getDocumentNo())){
|
|
@@ -492,82 +490,107 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
try {
|
|
|
Page<SyShippingDetailsVo> page = new Page<SyShippingDetailsVo>(1, -1);
|
|
|
if(flourOrGarment.equals("0")){
|
|
|
- pageList = syShippingDetailsService.queryShippingDetailsGarment(page, queryWrapper);
|
|
|
- }else{
|
|
|
- pageList = syShippingDetailsService.queryShippingDetails(page, queryWrapper);
|
|
|
- }
|
|
|
- for(SyShippingDetailsVo li:pageList.getRecords()){
|
|
|
- String pre = sf.format(li.getPreDeliveryDate());
|
|
|
-
|
|
|
- li.setArrivalDate(pre);
|
|
|
- if(oConvertUtils.isNotEmpty(li.getIsTc())){
|
|
|
- if(li.getIsTc().equals("0")){
|
|
|
- li.setIsTc("否");
|
|
|
- }else{
|
|
|
- li.setIsTc("是");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- SyPreAssembledPackingListVo entity = new SyPreAssembledPackingListVo(li);
|
|
|
- syPreList.add(entity);
|
|
|
- }
|
|
|
+ List<SyShippingDetailsVo> itemList = syShippingDetailsMapper.excelItem(queryWrapper);
|
|
|
|
|
|
- String load="D:\\单证模板\\发运明细数据.xlsx";
|
|
|
- int count = syPreList.size();
|
|
|
- File file=new File(load);
|
|
|
- cn.afterturn.easypoi.excel.entity.TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath(),true,"发运明细");
|
|
|
- List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
- Map<Integer, List<Map<String, Object>>> maps = new HashMap<Integer, List<Map<String, Object>>>();
|
|
|
- for (int i = 0; i < count ; i++) {
|
|
|
- List<SyPreAssembledPackingListVo> exportList=new ArrayList<>();
|
|
|
- exportList.add(syPreList.get(i));
|
|
|
- SyPreAssembledPackingListVo exportList2=syPreList.get(i);
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- map.put("entity", exportList2);
|
|
|
- listMap.add(map);
|
|
|
- }
|
|
|
- maps.put(0,listMap);
|
|
|
- templateExcelConstants.setColForEach(true);
|
|
|
- Workbook workbook = cn.afterturn.easypoi.excel.ExcelExportUtil.exportExcelClone(maps,templateExcelConstants);
|
|
|
-
|
|
|
- Iterator sheets=workbook.sheetIterator();
|
|
|
-
|
|
|
- int index = 0;
|
|
|
- while (sheets.hasNext()){
|
|
|
- Sheet sheet=(Sheet) sheets.next();
|
|
|
- workbook.setSheetName(index,"数据源"+(index+1));
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
-
|
|
|
- List<SizeTable> sizeGroup = syPreAssembledPackingListItemMapper.querySize(syPreList.get(index).getId(),syPreList.get(index).getGroupId());
|
|
|
- for(SizeTable si:sizeGroup){
|
|
|
- builder.append(si.getSize());
|
|
|
- builder.append("*");
|
|
|
+ org.jeecgframework.poi.excel.entity.TemplateExportParams params = new org.jeecgframework.poi.excel.entity.TemplateExportParams("D:\\单证模板\\出运面辅料数据.xlsx");
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
|
|
|
+
|
|
|
+
|
|
|
+ for(SyShippingDetailsVo li:itemList){
|
|
|
+ Field[] fieldsList = li.getClass().getDeclaredFields();
|
|
|
+ Map<String, Object> mapList = new HashMap<String, Object>();
|
|
|
+ for (Field field : fieldsList) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ mapList.put(field.getName(), field.get(li));
|
|
|
+ }
|
|
|
+ listMap.add(mapList);
|
|
|
}
|
|
|
-
|
|
|
- String[] params =("账套*成衣工厂*预发货日期*款号*小po*分销点*起始箱号*结束箱号*item NO./SKU NO./UPC NO./PACKS CODE*PREACKSKU*"+builder+"颜色*配码规则*计划尺码数量*计划装箱数量*件数/箱*箱数*总件数*净重/箱*毛重/箱*总毛重*外箱长度*外箱宽度*外箱高度*总体积*净净重*单价*总价*备注*发运明细子表ID*发运明细分组ID*发运明细主表ID*订单号*款号*尺码范围*客户*客户简称*申报要素ID").split("\\*");
|
|
|
- String[] params1 =syPreList.get(index).toString(builder.toString()).split("\\*");
|
|
|
- Row row1 = sheet.createRow(0);
|
|
|
- Row row2 = sheet.createRow(1);
|
|
|
-
|
|
|
- for (int x=0;x<params.length;x++){
|
|
|
- Cell cell = row1.createCell(x);
|
|
|
- cell.setCellValue(params[x]);
|
|
|
-
|
|
|
- if(x > 9 && x < params.length-27){
|
|
|
- Cell cell1 = row2.createCell(x);
|
|
|
- cell1.setCellValue(" ");
|
|
|
- }else{
|
|
|
- Cell cell1 = row2.createCell(x);
|
|
|
- cell1.setCellValue(params1[x]);
|
|
|
+ map.put("item", listMap);
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params,map);
|
|
|
+
|
|
|
+ ServletOutputStream outputStream = req.getOutputStream();
|
|
|
|
|
|
+ workbook.write(outputStream);
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ IPage<SyShippingDetailsVo> pageList = syShippingDetailsService.queryShippingDetails(page, queryWrapper);
|
|
|
+ for(SyShippingDetailsVo li:pageList.getRecords()){
|
|
|
+ String pre = sf.format(li.getPreDeliveryDate());
|
|
|
+
|
|
|
+ li.setArrivalDate(pre);
|
|
|
+ if(oConvertUtils.isNotEmpty(li.getIsTc())){
|
|
|
+ if(li.getIsTc().equals("0")){
|
|
|
+ li.setIsTc("否");
|
|
|
+ }else{
|
|
|
+ li.setIsTc("是");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ SyPreAssembledPackingListVo entity = new SyPreAssembledPackingListVo(li);
|
|
|
+ syPreList.add(entity);
|
|
|
+ }
|
|
|
|
|
|
+ String load="D:\\单证模板\\出运成衣数据.xlsx";
|
|
|
+ int count = syPreList.size();
|
|
|
+ File file=new File(load);
|
|
|
+ cn.afterturn.easypoi.excel.entity.TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath(),true,"发运明细");
|
|
|
+ List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
|
|
+ Map<Integer, List<Map<String, Object>>> maps = new HashMap<Integer, List<Map<String, Object>>>();
|
|
|
+ for (int i = 0; i < count ; i++) {
|
|
|
+ List<SyPreAssembledPackingListVo> exportList=new ArrayList<>();
|
|
|
+ exportList.add(syPreList.get(i));
|
|
|
+ SyPreAssembledPackingListVo exportList2=syPreList.get(i);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("entity", exportList2);
|
|
|
+ listMap.add(map);
|
|
|
+ }
|
|
|
+ maps.put(0,listMap);
|
|
|
+ templateExcelConstants.setColForEach(true);
|
|
|
+ Workbook workbook = cn.afterturn.easypoi.excel.ExcelExportUtil.exportExcelClone(maps,templateExcelConstants);
|
|
|
+
|
|
|
+ Iterator sheets=workbook.sheetIterator();
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ while (sheets.hasNext()){
|
|
|
+ Sheet sheet=(Sheet) sheets.next();
|
|
|
+ workbook.setSheetName(index,"数据源"+(index+1));
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+
|
|
|
+ List<SizeTable> sizeGroup = syPreAssembledPackingListItemMapper.querySize(syPreList.get(index).getId(),syPreList.get(index).getGroupId());
|
|
|
+ for(SizeTable si:sizeGroup){
|
|
|
+ builder.append(si.getSize());
|
|
|
+ builder.append("*");
|
|
|
+ }
|
|
|
+
|
|
|
+ String[] params =("账套*成衣工厂*预发货日期*款号*小po*分销点*起始箱号*结束箱号*item NO./SKU NO./UPC NO./PACKS CODE*PREACKSKU*"+builder+"颜色*配码规则*计划尺码数量*计划装箱数量*件数/箱*箱数*总件数*净重/箱*总净重*毛重/箱*总毛重*外箱长度*外箱宽度*外箱高度*总体积*净净重*单价*总价*备注*发运明细子表ID*发运明细分组ID*发运明细主表ID*订单号*款号*尺码范围*客户*客户简称*申报要素ID").split("\\*");
|
|
|
+ String[] params1 =syPreList.get(index).toString(builder.toString()).split("\\*");
|
|
|
+ Row row1 = sheet.createRow(0);
|
|
|
+ Row row2 = sheet.createRow(1);
|
|
|
+
|
|
|
+ for (int x=0;x<params.length;x++){
|
|
|
+ Cell cell = row1.createCell(x);
|
|
|
+ cell.setCellValue(params[x]);
|
|
|
+
|
|
|
+ if(x > 9 && x < params.length-27){
|
|
|
+ Cell cell1 = row2.createCell(x);
|
|
|
+ cell1.setCellValue(" ");
|
|
|
+ }else{
|
|
|
+ Cell cell1 = row2.createCell(x);
|
|
|
+ cell1.setCellValue(params1[x]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ index++;
|
|
|
}
|
|
|
- index++;
|
|
|
+ ServletOutputStream outputStream = req.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
}
|
|
|
|
|
|
- ServletOutputStream outputStream = req.getOutputStream();
|
|
|
- workbook.write(outputStream);
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
|