yanyang #25

Merged
yanyang merged 2 commits from yanyang into master 2023-03-21 15:12:14 +08:00
8 changed files with 92 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package com.cnbm.packing.controller;
import com.cnbm.admin.annotation.LogOperation; import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant; import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.utils.ExcelUtils; import com.cnbm.common.utils.ExcelUtils;
import com.cnbm.common.utils.Result; import com.cnbm.common.utils.Result;
import com.cnbm.common.validator.AssertUtils; import com.cnbm.common.validator.AssertUtils;
@ -25,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -119,8 +121,26 @@ public class ChangePackagingBoxHistoryController {
@PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')") @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ChangePackagingBoxHistory> list = changePackagingBoxHistoryService.historyList(params); List<ChangePackagingBoxHistory> list = changePackagingBoxHistoryService.historyList(params);
List<ChangePackagingBoxHistoryDTO> dtoList = ConvertUtils.sourceToTarget(list, ChangePackagingBoxHistoryDTO.class);
if(list.size()>0) { 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);
} }
} }

View File

@ -18,6 +18,7 @@ import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel; import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel;
import com.cnbm.packing.excel.WoPackagingBoxSubstrateManualExcel;
import com.cnbm.packing.mapper.WoPackagingBoxMapper; import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam; import com.cnbm.packing.param.PowerReportQueryParam;
@ -36,6 +37,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -360,7 +362,22 @@ public class WoPackagingBoxSubstrateController {
public void exportPackingInfo(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void exportPackingInfo(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WoPackagingBoxSubstrateDTO> list = woPackagingBoxSubstrateService.substrateList(params); List<WoPackagingBoxSubstrateDTO> list = woPackagingBoxSubstrateService.substrateList(params);
if(list.size()>0) { 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);
}
} }
} }
} }

View File

@ -75,4 +75,10 @@ public class ChangePackagingBoxHistoryDTO implements Serializable {
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
private Integer version; private Integer version;
@ApiModelProperty(value = "操作时间(转)")
private String createTime1;
@ApiModelProperty(value = "操作类型(转)")
private String type1;
} }

View File

@ -179,4 +179,10 @@ public class WoPackagingBoxSubstrateDTO implements Serializable {
@ApiModelProperty(value = "打印时间(最近一次打印时间)") @ApiModelProperty(value = "打印时间(最近一次打印时间)")
private LocalDateTime printTime; private LocalDateTime printTime;
@ApiModelProperty(value = "包装箱创建时间(转)")
private String boxCreateTime1;
@ApiModelProperty(value = "最近打印时间(转)")
private String printTime1;
} }

View File

@ -28,8 +28,8 @@ public class ChangePackagingBoxHistoryExcel {
@Excel(name = "目的位置") @Excel(name = "目的位置")
private Integer targetSlot; private Integer targetSlot;
@Excel(name = "操作类型") @Excel(name = "操作类型")
private Integer type; private String type1;
@Excel(name = "操作时间") @Excel(name = "操作时间")
private LocalDateTime createTime; private String createTime1;
} }

View File

@ -19,26 +19,26 @@ import java.util.Date;
public class WoPackagingBoxSubstrateExcel { public class WoPackagingBoxSubstrateExcel {
@Excel(name = "创建时间") @Excel(name = "创建时间")
private LocalDateTime boxCreateTime; private String boxCreateTime1;
@Excel(name = "模组ID") @Excel(name = "模组ID")
private String woSubstrateId; private String woSubstrateId;
@Excel(name = "BoxID") @Excel(name = "BoxID")
private String packagingBoxId; private String packagingBoxId;
@Excel(name = "模组所在包装箱位置") @Excel(name = "模组所在包装箱位置")
private Integer slot; private Integer slot;
@Excel(name = "订单号")
private String orderName;
@Excel(name = "SAP物料号")
private String sapMaterial;
@Excel(name = "档位功率") @Excel(name = "档位功率")
private String powerLevel; private String powerLevel;
@Excel(name = "补偿功率") @Excel(name = "补偿功率")
private Float pmpp; private Float pmpp;
@Excel(name = "实测功率") @Excel(name = "实测功率")
private Float actualPmpp; private Float actualPmpp;
@Excel(name = "订单")
private String orderName;
@Excel(name = "线体") @Excel(name = "线体")
private Integer lineBody; private Integer lineBody;
@Excel(name = "SAP物料号")
private String sapMaterial;
@Excel(name = "最近打印时间") @Excel(name = "最近打印时间")
private LocalDateTime printTime; private String printTime1;
} }

View File

@ -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;
}

View File

@ -51,6 +51,7 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
if(params.get("startTime")==null && params.get("endTime")==null && params.get("type")==null){ 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.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
} }
wrapper.orderByDesc(ChangePackagingBoxHistory.CREATE_TIME);
return wrapper; return wrapper;
} }