Commit b2454623 LN

盘点导出功能修改

1 个父辈 a43c781e
......@@ -2,12 +2,15 @@ package com.neotel.smfcore.core.selfAudit.rest;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.selfAudit.enums.SELFAUDIT_STATUS;
import com.neotel.smfcore.core.selfAudit.rest.dto.SelfAuditDto;
import com.neotel.smfcore.core.selfAudit.rest.dto.SelfAuditItemDto;
......@@ -21,6 +24,7 @@ import com.neotel.smfcore.core.selfAudit.util.SelfAuditUtil;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
......@@ -32,8 +36,12 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@Slf4j
......@@ -243,4 +251,48 @@ public class SelfAuditController {
dto.setItems(dtos);
return dto;
}
@ApiOperation("下载盘点详情")
@RequestMapping("/detial/download")
@AnonymousAccess
public void detialDownload(@RequestParam(required = false) String id, @RequestParam(required = false) String batchNo, HttpServletResponse response, HttpServletRequest request) throws IOException {
SelfAudit selfAudit =null;
if (!ObjectUtils.isEmpty(id)) {
selfAudit = selfAuditManager.get(id);
} else if (!ObjectUtils.isEmpty(batchNo)) {
selfAudit = selfAuditManager.findByBatchNo(batchNo);
}
if (selfAudit != null) {
List<List<String>> header = new ArrayList<>();
Locale locale = request.getLocale();
header.add(Lists.newArrayList(MessageUtils.getSmfClientMsg("smfclient.Storage.rackCid",locale,"CID")));
header.add(Lists.newArrayList(MessageUtils.getSmfClientMsg("smfclient.storagePos.locationNo",locale,"库位号")));
header.add(Lists.newArrayList(MessageUtils.getSmfClientMsg("smfclient.selfAudit.invenBarcode",locale,"库存条码")));
header.add(Lists.newArrayList(MessageUtils.getSmfClientMsg("smfclient.selfAudit.actualBarcode",locale,"实际条码")));
header.add(Lists.newArrayList(MessageUtils.getSmfClientMsg("smfclient.selfAudit.result",locale,"结果")));
List<List<Object>> dataList = new ArrayList<>();
for (SelfAuditItem item : selfAudit.getItems()) {
List<Object> data = new ArrayList<>();
data.add(item.getCid());
data.add(item.getPosName());
data.add(item.getBarcode());
data.add(item.getActualBarcode());
String result="";
if(item.getItemStatus()==2){
if(item.getBarcode().equals(item.getActualBarcode())){
result="YES";
}else{
result="NO";
}
}
data.add(result);
dataList.add(data);
}
FileUtil.downloadExcel(selfAudit.getBatchNo(), header,dataList,response);
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!