报表导出格式
This commit is contained in:
		| @@ -3,6 +3,7 @@ package com.cnbm.packing.controller; | ||||
| import com.cnbm.admin.annotation.LogOperation; | ||||
| import com.cnbm.common.constant.Constant; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.utils.ConvertUtils; | ||||
| import com.cnbm.common.utils.ExcelUtils; | ||||
| import com.cnbm.common.utils.Result; | ||||
| import com.cnbm.common.validator.AssertUtils; | ||||
| @@ -25,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.time.LocalDateTime; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| @@ -119,8 +121,26 @@ public class ChangePackagingBoxHistoryController { | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<ChangePackagingBoxHistory> list = changePackagingBoxHistoryService.historyList(params); | ||||
|         List<ChangePackagingBoxHistoryDTO> dtoList = ConvertUtils.sourceToTarget(list, ChangePackagingBoxHistoryDTO.class); | ||||
|         if(list.size()>0) { | ||||
|             ExcelUtils.exportExcelToTarget(response, "包装箱模组操作记录", list, ChangePackagingBoxHistoryExcel.class); | ||||
|             for(ChangePackagingBoxHistoryDTO dto:dtoList){ | ||||
|                 //操作时间 转化 | ||||
|                 DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | ||||
|                 if(dto.getCreateTime()!=null){ | ||||
|                     dto.setCreateTime1(df.format(dto.getCreateTime())); | ||||
|                 } | ||||
|                 //操作类型 1=模组加入包装箱;2=模组移出包装箱;3=模组换箱 | ||||
|                 if(dto.getType()==1){ | ||||
|                     dto.setType1("模组加入包装箱"); | ||||
|                 } | ||||
|                 if(dto.getType()==2){ | ||||
|                     dto.setType1("模组移出包装箱"); | ||||
|                 } | ||||
|                 if(dto.getType()==3){ | ||||
|                     dto.setType1("模组换箱"); | ||||
|                 } | ||||
|             } | ||||
|             ExcelUtils.exportExcelToTarget(response, "包装箱模组操作记录", dtoList, ChangePackagingBoxHistoryExcel.class); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -18,6 +18,7 @@ import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
| import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel; | ||||
| import com.cnbm.packing.excel.WoPackagingBoxSubstrateManualExcel; | ||||
| import com.cnbm.packing.mapper.WoPackagingBoxMapper; | ||||
| import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; | ||||
| import com.cnbm.packing.param.PowerReportQueryParam; | ||||
| @@ -36,6 +37,7 @@ import springfox.documentation.annotations.ApiIgnore; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.text.DecimalFormat; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.ArrayList; | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.List; | ||||
| @@ -360,7 +362,22 @@ public class WoPackagingBoxSubstrateController { | ||||
|     public void exportPackingInfo(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<WoPackagingBoxSubstrateDTO> list = woPackagingBoxSubstrateService.substrateList(params); | ||||
|         if(list.size()>0) { | ||||
|             ExcelUtils.exportExcelToTarget(response, "装箱单信息", list, WoPackagingBoxSubstrateExcel.class); | ||||
|             //包装箱创建时间 最近打印时间 转化 | ||||
|             for(WoPackagingBoxSubstrateDTO dto:list){ | ||||
|                 DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | ||||
|                 if(dto.getBoxCreateTime()!=null){ | ||||
|                     dto.setBoxCreateTime1(df.format(dto.getBoxCreateTime())); | ||||
|                 } | ||||
|                 if(dto.getPrintTime()!=null){ | ||||
|                     dto.setPrintTime1(df.format(dto.getPrintTime())); | ||||
|                 } | ||||
|             } | ||||
|             if(Integer.parseInt(params.get("model").toString())==1){ | ||||
|                 ExcelUtils.exportExcelToTarget(response, "手动装箱单信息", list, WoPackagingBoxSubstrateManualExcel.class); | ||||
|             } | ||||
|             else { | ||||
|                 ExcelUtils.exportExcelToTarget(response, "自动装箱单信息", list, WoPackagingBoxSubstrateExcel.class); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -75,4 +75,10 @@ public class ChangePackagingBoxHistoryDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "版本号") | ||||
| 	private Integer version; | ||||
|  | ||||
| 	@ApiModelProperty(value = "操作时间(转)") | ||||
| 	private String createTime1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "操作类型(转)") | ||||
| 	private String type1; | ||||
|  | ||||
| } | ||||
| @@ -179,4 +179,10 @@ public class WoPackagingBoxSubstrateDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "打印时间(最近一次打印时间)") | ||||
| 	private LocalDateTime printTime; | ||||
|  | ||||
| 	@ApiModelProperty(value = "包装箱创建时间(转)") | ||||
| 	private String boxCreateTime1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "最近打印时间(转)") | ||||
| 	private String printTime1; | ||||
|  | ||||
| } | ||||
| @@ -28,8 +28,8 @@ public class ChangePackagingBoxHistoryExcel { | ||||
|     @Excel(name = "目的位置") | ||||
|     private Integer targetSlot; | ||||
|     @Excel(name = "操作类型") | ||||
|     private Integer type; | ||||
|     private String type1; | ||||
|     @Excel(name = "操作时间") | ||||
|     private LocalDateTime createTime; | ||||
|     private String createTime1; | ||||
|  | ||||
| } | ||||
| @@ -19,26 +19,26 @@ import java.util.Date; | ||||
| public class WoPackagingBoxSubstrateExcel { | ||||
|  | ||||
|     @Excel(name = "创建时间") | ||||
|     private LocalDateTime boxCreateTime; | ||||
|     private String boxCreateTime1; | ||||
|     @Excel(name = "模组ID") | ||||
|     private String woSubstrateId; | ||||
|     @Excel(name = "BoxID") | ||||
|     private String packagingBoxId; | ||||
|     @Excel(name = "模组所在包装箱位置") | ||||
|     private Integer slot; | ||||
|     @Excel(name = "订单号") | ||||
|     private String orderName; | ||||
|     @Excel(name = "SAP物料号") | ||||
|     private String sapMaterial; | ||||
|     @Excel(name = "档位功率") | ||||
|     private String powerLevel; | ||||
|     @Excel(name = "补偿功率") | ||||
|     private Float pmpp; | ||||
|     @Excel(name = "实测功率") | ||||
|     private Float actualPmpp; | ||||
|     @Excel(name = "订单") | ||||
|     private String orderName; | ||||
|     @Excel(name = "线体") | ||||
|     private Integer lineBody; | ||||
|     @Excel(name = "SAP物料号") | ||||
|     private String sapMaterial; | ||||
|     @Excel(name = "最近打印时间") | ||||
|     private LocalDateTime printTime; | ||||
|     private String printTime1; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,32 @@ | ||||
| package com.cnbm.packing.excel; | ||||
|  | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * 包装箱基板关联表 ( 基板表 ) | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-21 | ||||
|  */ | ||||
| @Data | ||||
| public class WoPackagingBoxSubstrateManualExcel { | ||||
|  | ||||
|     @Excel(name = "创建时间") | ||||
|     private String boxCreateTime1; | ||||
|     @Excel(name = "模组ID") | ||||
|     private String woSubstrateId; | ||||
|     @Excel(name = "BoxID") | ||||
|     private String packagingBoxId; | ||||
|     @Excel(name = "模组所在包装箱位置") | ||||
|     private Integer slot; | ||||
|     @Excel(name = "SAP物料号") | ||||
|     private String sapMaterial; | ||||
|     @Excel(name = "功率等级") | ||||
|     private String powerLevel; | ||||
|     @Excel(name = "线体") | ||||
|     private Integer lineBody; | ||||
|     @Excel(name = "最近打印时间") | ||||
|     private String printTime1; | ||||
|  | ||||
| } | ||||
| @@ -51,6 +51,7 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha | ||||
|         if(params.get("startTime")==null && params.get("endTime")==null && params.get("type")==null){ | ||||
|             wrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0"); | ||||
|         } | ||||
|         wrapper.orderByDesc(ChangePackagingBoxHistory.CREATE_TIME); | ||||
|  | ||||
|         return wrapper; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user