This commit is contained in:
parent
a7c4b93e7c
commit
06470796c2
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -19,6 +20,7 @@ import tech.riemann.ims.dto.response.*;
|
||||
import tech.riemann.ims.entity.material.*;
|
||||
import tech.riemann.ims.enums.*;
|
||||
import tech.riemann.ims.service.material.*;
|
||||
import tech.riemann.ims.utils.ExcelUtil;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@ -62,6 +64,28 @@ public class ApplyFormController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("apply/download-excel")
|
||||
@Operation(summary = "导出申请单列表")
|
||||
public void downloadExcel(@Parameter(description = "申请类型(1入库 3出库 4盘点)") @RequestParam(name = "applyType") Integer applyType,
|
||||
@Parameter(description = "物料类型") @RequestParam(name = "type", required = false) String type,
|
||||
@Parameter(description = "物料编码") @RequestParam(name = "code", required = false) String code,
|
||||
@Parameter(description = "物料名称") @RequestParam(name = "name", required = false) String name,
|
||||
HttpServletResponse response) {
|
||||
IPage<ApplyDTO> applyDTOIPage = searchPage(1, 10000, applyType, type, code, name);
|
||||
List<ApplyDTO> applyDTOList = applyDTOIPage.getRecords();
|
||||
// 导出excel
|
||||
String sheetName = "申请单列表";
|
||||
String excelName = "申请单列表";
|
||||
if(applyType == 1){
|
||||
excelName = "入库申请单列表";
|
||||
sheetName = "入库";
|
||||
}else if(applyType == 3){
|
||||
excelName = "出库申请单列表";
|
||||
sheetName = "出库";
|
||||
}
|
||||
ExcelUtil.exportExcel(response, excelName, sheetName, ApplyDTO.class, applyDTOList);
|
||||
}
|
||||
|
||||
@GetMapping("audit-applies")
|
||||
@Operation(summary = "分页查询盘点列表")
|
||||
public IPage<ApplyForm> searchAuditPage(
|
||||
@ -81,6 +105,23 @@ public class ApplyFormController {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("apply/audit/download-excel")
|
||||
@Operation(summary = "导出盘点申请单列表")
|
||||
public void downloadAuditExcel( @Parameter(description = "盘点类型") @RequestParam(name = "auditType", required = false) AuditTypeEnum auditType,
|
||||
@Parameter(description = "盘点人") @RequestParam(name = "taker", required = false) String taker,
|
||||
@Parameter(description = "创建日期") @RequestParam(name = "createDate", required = false) LocalDateTime createDate,
|
||||
@Parameter(description = "审核状态") @RequestParam(name = "reviewResults", required = false) List<ReviewResultEnum> reviewResults,
|
||||
HttpServletResponse response){
|
||||
IPage<ApplyForm> applyFormIPage = searchAuditPage(1, 10000, auditType, taker, createDate, reviewResults);
|
||||
List<ApplyForm> applyFormList = applyFormIPage.getRecords();
|
||||
// 导出excel
|
||||
String excelName = "盘点申请单列表";
|
||||
String sheetName = "盘点";
|
||||
ExcelUtil.exportExcel(response, excelName, sheetName, ApplyForm.class, applyFormList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("apply/{applyId}")
|
||||
@Operation(summary = "查询申请单详情")
|
||||
public ApplyInfo detail(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Integer applyId) {
|
||||
@ -196,7 +237,7 @@ public class ApplyFormController {
|
||||
if (reviewDTO.getReviewResult() == ReviewResultEnum.PASS) {
|
||||
// 修改物料状态
|
||||
List<String> barcodeList = scrapOutCacheMap.get(reviewDTO.getApplyId());
|
||||
if(barcodeList == null || barcodeList.isEmpty()){
|
||||
if (barcodeList == null || barcodeList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
barcodeList.forEach(barcode -> materialStockDetailService.update(Wrappers.<MaterialStockDetail>lambdaUpdate()
|
||||
|
@ -0,0 +1,22 @@
|
||||
package tech.riemann.ims.converter;
|
||||
|
||||
import club.zhcs.lina.utils.enums.ICodeBook;
|
||||
import cn.idev.excel.converters.Converter;
|
||||
import cn.idev.excel.metadata.GlobalConfiguration;
|
||||
import cn.idev.excel.metadata.data.WriteCellData;
|
||||
import cn.idev.excel.metadata.property.ExcelContentProperty;
|
||||
|
||||
/**
|
||||
* @author mayong
|
||||
* @since 2025/3/15 18:23
|
||||
*/
|
||||
public class ICodeBookConverter implements Converter<ICodeBook> {
|
||||
|
||||
@Override
|
||||
public WriteCellData<?> convertToExcelData(ICodeBook value,
|
||||
ExcelContentProperty contentProperty,
|
||||
GlobalConfiguration globalConfiguration) {
|
||||
|
||||
return new WriteCellData<>(value.getDescription());
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
package tech.riemann.ims.dto.response;
|
||||
|
||||
import club.zhcs.lina.utils.enums.Codebook;
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -8,6 +11,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.json.JsonField;
|
||||
import tech.riemann.ims.converter.ICodeBookConverter;
|
||||
import tech.riemann.ims.enums.ApplyTypeEnum;
|
||||
import tech.riemann.ims.enums.ReviewResultEnum;
|
||||
|
||||
@ -22,48 +26,77 @@ import tech.riemann.ims.enums.ReviewResultEnum;
|
||||
public class ApplyDTO {
|
||||
|
||||
@Schema(description = "申请id")
|
||||
@ExcelIgnore
|
||||
private Long applyId;
|
||||
|
||||
|
||||
@Schema(description = "申请类型")
|
||||
@ExcelProperty(value = "申请类型", converter = ICodeBookConverter.class)
|
||||
@ColumnWidth(40)
|
||||
private ApplyTypeEnum applyType;
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
@ExcelProperty("物料名称")
|
||||
@ColumnWidth(40)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
@ExcelProperty("物料编码")
|
||||
@ColumnWidth(40)
|
||||
private String code;
|
||||
|
||||
@Schema(description = "物料类型")
|
||||
@ExcelIgnore
|
||||
private String type;
|
||||
|
||||
@Schema(description = "类型名称")
|
||||
@ExcelProperty("类型名称")
|
||||
@ColumnWidth(40)
|
||||
private String typeName;
|
||||
|
||||
@Schema(description = "物料规格")
|
||||
@ExcelProperty("物料规格")
|
||||
@ColumnWidth(40)
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "申请人")
|
||||
@ExcelProperty("申请人")
|
||||
@ColumnWidth(40)
|
||||
private String applicant;
|
||||
|
||||
@Schema(description = "审核人")
|
||||
@ExcelProperty("审核人")
|
||||
@ColumnWidth(40)
|
||||
private String reviewer;
|
||||
|
||||
@Schema(description = "申请日期")
|
||||
@ExcelProperty("申请日期")
|
||||
@ColumnWidth(40)
|
||||
private String applyDate;
|
||||
|
||||
@Schema(description = "申请数量")
|
||||
@ExcelProperty("申请数量")
|
||||
@ColumnWidth(40)
|
||||
private String applyNum;
|
||||
|
||||
@Schema(description = "确认数量")
|
||||
@ExcelProperty("确认数量")
|
||||
@ColumnWidth(40)
|
||||
private String confirmNum;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@ExcelProperty("备注")
|
||||
@ColumnWidth(40)
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否确认")
|
||||
@ExcelProperty("是否确认")
|
||||
@ColumnWidth(40)
|
||||
private Boolean confirm;
|
||||
|
||||
@Schema(description = "审核状态")
|
||||
@ExcelProperty(value = "审核状态", converter = ICodeBookConverter.class)
|
||||
@ColumnWidth(40)
|
||||
private ReviewResultEnum reviewResult;
|
||||
|
||||
@JsonGetter
|
||||
|
@ -1,5 +1,8 @@
|
||||
package tech.riemann.ims.entity.material;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@ -11,6 +14,7 @@ import lombok.experimental.Accessors;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import tech.riemann.ims.converter.ICodeBookConverter;
|
||||
import tech.riemann.ims.entity.IdBaseEntity;
|
||||
import tech.riemann.ims.enums.ApplyTypeEnum;
|
||||
import tech.riemann.ims.enums.AuditTypeEnum;
|
||||
@ -45,6 +49,7 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_type")
|
||||
@Comment("类型")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@ExcelIgnore
|
||||
private ApplyTypeEnum type;
|
||||
|
||||
@Schema(description = "盘点类型(1: 扫码 2: 人工)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -52,6 +57,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_audit_type")
|
||||
@Comment("盘点类型")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@ExcelProperty(value = "盘点类型",converter = ICodeBookConverter.class)
|
||||
@ColumnWidth(40)
|
||||
private AuditTypeEnum auditType;
|
||||
|
||||
@Schema(description = "申请人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -59,6 +66,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_applicant")
|
||||
@Comment("申请人")
|
||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||
@ExcelProperty("申请人")
|
||||
@ColumnWidth(40)
|
||||
private String applicant;
|
||||
|
||||
@Schema(description = "盘点审核人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -66,6 +75,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_reviewer")
|
||||
@Comment("盘点审核人")
|
||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||
@ExcelProperty("盘点审核人")
|
||||
@ColumnWidth(40)
|
||||
private String reviewer;
|
||||
|
||||
@Schema(description = "盘点人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -73,6 +84,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_taker")
|
||||
@Comment("盘点人")
|
||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||
@ExcelProperty("盘点人")
|
||||
@ColumnWidth(40)
|
||||
private String taker;
|
||||
|
||||
@Schema(description = "申请日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -80,6 +93,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_apply_date")
|
||||
@Comment("申请日期")
|
||||
@ColDefine(type = ColType.DATETIME, notNull = false, width = 128, precision = 0)
|
||||
@ExcelProperty("申请日期")
|
||||
@ColumnWidth(40)
|
||||
private LocalDateTime applyDate;
|
||||
|
||||
@Schema(description = "是否确认(0: 未确认 1: 已确认)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -87,6 +102,7 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_is_confirm")
|
||||
@Comment("是否确认")
|
||||
@ColDefine(type = ColType.BOOLEAN, notNull = false, width = 128, precision = 0)
|
||||
@ExcelIgnore
|
||||
private Boolean confirm;
|
||||
|
||||
@Schema(description = "审核意见", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -94,6 +110,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_review_remark")
|
||||
@Comment("审核意见")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
@ExcelProperty("审核意见")
|
||||
@ColumnWidth(80)
|
||||
private String reviewRemark;
|
||||
|
||||
@Schema(description = "审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@ -101,6 +119,8 @@ public class ApplyForm extends IdBaseEntity {
|
||||
@Column("af_review_result")
|
||||
@Comment("审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)")
|
||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||
@ExcelProperty(value = "审核结果", converter = ICodeBookConverter.class)
|
||||
@ColumnWidth(40)
|
||||
private ReviewResultEnum reviewResult;
|
||||
|
||||
}
|
||||
|
@ -35,4 +35,5 @@ public class ExcelUtil {
|
||||
throw BizException.create("导出Excel失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user