Commit b9f95030 zshaohui

汇总报表提交

1 个父辈 cf84d876
......@@ -335,7 +335,10 @@ public class DataInitManager {
addNewFunctionMenu(145,meInnerMenuReport,"meInnerProLimitReport","禁限用","meInnerProLimitReport","report/inner/proLimitReport/index","proLimit",functionMenuMap);
addNewFunctionMenu(136,meMenuReport,"meInventory","汇总库存","meInventory","report/inventory/index","inventory",functionMenuMap);
addNewFunctionMenu(136,meMenuReport,"meInventory","库存","meInventory","report/inventory/index","inventory",functionMenuMap);
addNewFunctionMenu(137,meMenuReport,"meExpiredReport","过期","meExpiredReport","report/meExpireReport/index","oDReport",functionMenuMap);
addNewFunctionMenu(138,meMenuReport,"meChangeReport","事务","meChangeReport","report/meChangeReport/index","chageReport",functionMenuMap);
addNewFunctionMenu(139,meMenuReport,"meprohibitedReport","禁限用","meprohibitedReport","report/meprohibitedReport/index","proLimit",functionMenuMap);
return functionMenuMap;
}
......
......@@ -376,7 +376,9 @@ public class BCReportController {
BeanUtils.copyProperties(barcode, expire);
expire.setPlant(BCPlant);
expire.setFactory(BCFactory);
expire.setExpireDays(ExpireDateUtil.getExpireDays(expire.getExpireDate()));
if (expire.getExpireDate() != null) {
expire.setExpireDays(ExpireDateUtil.getExpireDays(expire.getExpireDate()));
}
expire.setReelAmount(1);
expire.setPosName(dataCache.getStorageById(storagePos.getStorageId()).getName() + "[" + storagePos.getPosName() + "]");
expireList.add(expire);
......
package com.neotel.smfcore.custom.lizhen.report.merge;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto;
import com.neotel.smfcore.core.order.rest.bean.dto.OrderItemDto;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.core.storage.rest.dto.StorageDto;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosDto;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.InventoryData;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.enums.InventoryStatus;
import com.neotel.smfcore.custom.lizhen.report.bean.dto.InventoryDto;
import com.neotel.smfcore.custom.lizhen.report.bean.dto.MergeInventoryDto;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.custom.lizhen.report.bacheng.bean.dto.BCChange;
import com.neotel.smfcore.custom.lizhen.report.bacheng.bean.dto.BCExpire;
import com.neotel.smfcore.custom.lizhen.report.bacheng.bean.dto.BCInventory;
import com.neotel.smfcore.custom.lizhen.report.bean.query.ReportQueryCondition;
import com.neotel.smfcore.custom.lizhen.report.merge.utils.FloorUtils;
import com.neotel.smfcore.custom.lizhen.report.merge.bean.query.MergeBcQuery;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 报表合并
......@@ -44,1027 +34,370 @@ import java.util.stream.Collectors;
@RequestMapping("/reportMerge")
public class ReportMergeController {
@Autowired
private FloorUtils floorUtils;
@Value("${forward.f4.url}")
private String f4Url;
/**
* 获取到所有楼层
* 库存
*
* @param query
* @return
*/
@RequestMapping("/getAllFloor")
@RequestMapping("/getInventory")
@AnonymousAccess
public ResultBean getAllFloor(int type) {
Map<String, String> allFloor = floorUtils.getAllFloor(type);
return ResultBean.newOkResult(allFloor);
}
public PageData getInventory(MergeBcQuery query) {
String url = f4Url + "/bcReport/getInventory";
url = url + getQueryStr(query);
String result = HttpHelper.sendGet(url);
PageData pageData = JSON.parseObject(result, PageData.class);
/**
* 库存
*
* @param queryCondition
* @return
*/
@RequestMapping("/inventory")
@AnonymousAccess
public PageData inventory(ReportQueryCondition queryCondition) {
PageData<MergeInventoryDto> pageData = new PageData();
pageData.setContent(new ArrayList());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
List<MergeInventoryDto> dtoList = new ArrayList<>();
//判断是外仓还是内仓
if (floorUtils.isB15(floor)) {
url = url + "/outer/report/inventory" + getQueryStr(queryCondition);
String result = HttpUtil.get(url);
PageData data = JSONObject.parseObject(result, PageData.class);
if (data.getContent() != null && !data.getContent().isEmpty()) {
List<InventoryDto> inventoryDtoList = JSONArray.parseArray(JSONObject.toJSONString(data.getContent()), InventoryDto.class);
dtoList = inventoryDtoList.stream().map(item -> {
MergeInventoryDto dto = new MergeInventoryDto();
BeanUtils.copyProperties(item, dto);
dto.setFloor(floor);
return dto;
}).collect(Collectors.toList());
pageData.setTotalElements(data.getTotalElements());
}
} else {
url = url + "/inner/report/inventory"+getQueryStr(queryCondition);
String result = HttpUtil.get(url);
PageData data = JSONObject.parseObject(result, PageData.class);
if (data.getContent() != null && !data.getContent().isEmpty()) {
List<StoragePosDto> storageDtoList = JSONArray.parseArray(JSONObject.toJSONString(data.getContent()), StoragePosDto.class);
dtoList = storageDtoList.stream().map(item -> {
MergeInventoryDto dto = new MergeInventoryDto();
dto.setStoragePosName(item.getPosName());
BarcodeDto barcode = item.getBarcode();
if (barcode != null) {
dto.setPartNumber(barcode.getPartNumber());
dto.setReelCount(1);
dto.setAmount(barcode.getAmount());
dto.setProvider(barcode.getProvider());
dto.setProviderNumber(barcode.getProviderNumber());
dto.setBarcode(barcode.getBarcode());
dto.setBatch(barcode.getBatch());
dto.setDateCode(barcode.getDateCode());
dto.setPutInDate(barcode.getPutInDate());
dto.setFirstPutInDate(barcode.getFirstPutInDate());
dto.setDisableMsg(barcode.getDisableMsg());
}
dto.setSource(item.getSource());
dto.setFloor(floor);
dto.setFactory("A5");
dto.setPlant("W337");
return dto;
}).collect(Collectors.toList());
pageData.setTotalElements(data.getTotalElements());
}
}
pageData.setContent(dtoList);
}
}
return pageData;
PageData resultPageDate = new PageData();
resultPageDate.setTotalElements(pageData.getTotalElements());
List content = pageData.getContent();
String contentStr = JSON.toJSONString(content);
List<BCInventory> bcInventoryList = JSON.parseArray(contentStr, BCInventory.class);
resultPageDate.setContent(bcInventoryList);
return resultPageDate;
}
/**
* 库存导出
*
* @param queryCondition
* @return
* @param bcQuery
* @param response
* @throws IOException
*/
@RequestMapping("/inventory/download")
@RequestMapping("/getInventory/download")
@AnonymousAccess
public void inventoryDownload(ReportQueryCondition queryCondition, HttpServletResponse response) {
List<MergeInventoryDto> dtoList = new ArrayList<>();
public void getInventoryDownload(MergeBcQuery bcQuery, HttpServletResponse response) throws IOException {
List<List<String>> headerList = new ArrayList<>();
headerList.add(Lists.newArrayList("厂别"));
headerList.add(Lists.newArrayList("厂区"));
headerList.add(Lists.newArrayList("库别"));
headerList.add(Lists.newArrayList("料号"));
headerList.add(Lists.newArrayList("物料描述"));
headerList.add(Lists.newArrayList("ID NO"));
headerList.add(Lists.newArrayList("储位"));
headerList.add(Lists.newArrayList("数量"));
headerList.add(Lists.newArrayList("卷数"));
headerList.add(Lists.newArrayList("厂商"));
headerList.add(Lists.newArrayList("LOT"));
headerList.add(Lists.newArrayList("D/C"));
headerList.add(Lists.newArrayList("keeper"));
headerList.add(Lists.newArrayList("禁用信息"));
headerList.add(Lists.newArrayList("入库时间"));
headerList.add(Lists.newArrayList("工号"));
List<List<Object>> dataList = new ArrayList<>();
int page = 0;
int size = 20000;
while (true) {
log.info(page +"");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData data = inventory(queryCondition);
if (data.getTotalElements() == 0) {
bcQuery.setPage(page);
bcQuery.setSize(size);
PageData pageData = getInventory(bcQuery);
List<BCInventory> inventoryList = pageData.getContent();
if (inventoryList == null || inventoryList.isEmpty()) {
break;
}
dtoList.addAll(data.getContent());
page++;
}
if (dtoList != null && !dtoList.isEmpty()) {
//List<Map<String, Object>> dataList, List<String> titles, HttpServletResponse response
List<Map<String, Object>> dataList = new ArrayList<>();
for (MergeInventoryDto dto : dtoList) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("厂别",dto.getPlant());
map.put("厂区",dto.getFactory());
map.put("库别", dto.getWarehouseCode());
map.put("楼层",dto.getFloor());
map.put("隔口码",dto.getPosName());
map.put("唯一码",dto.getBarcode());
map.put("料号",dto.getPartNumber());
map.put("物料描述","");
map.put("隔口数量",dto.getPosNameCount());
map.put("卷数",dto.getReelCount());
map.put("每卷数量",dto.getAmount());
map.put("厂商",dto.getProvider());
map.put("厂商代码",dto.getProviderNumber());
map.put("LOT",dto.getBatch());
map.put("D/C",dto.getDateCode());
//map.put("批次代码"));
map.put("keeper",dto.getKeeperCode());
map.put("储位",dto.getStoragePosName());
map.put("禁用信息",dto.getDisableMsg());
map.put("首次入库时间",dto.getFirstPutInDate());
map.put("当前入库时间",dto.getPutInDate());
map.put("工号",dto.getCreator());
map.put("姓名","");
map.put("来源",dto.getSource());
dataList.add(map);
}
try {
FileUtil.downloadExcel(dataList, response);
} catch (IOException e) {
e.printStackTrace();
for (BCInventory bcInventory : inventoryList) {
List<Object> result = new ArrayList<>();
result.add(bcInventory.getPlant());
result.add(bcInventory.getFactory());
result.add(bcInventory.getWarehouseCode());
result.add(bcInventory.getPartNumber());
result.add(bcInventory.getDescribe());
result.add(bcInventory.getBarcode());
result.add(bcInventory.getPosName());
result.add(bcInventory.getAmount());
result.add(bcInventory.getReelAmount());
result.add(bcInventory.getProvider());
result.add(bcInventory.getBatch());
result.add(bcInventory.getDateCode());
result.add(bcInventory.getKeeperCode());
result.add(bcInventory.getDisableMsg());
result.add(bcInventory.getPutInDate());
result.add(bcInventory.getCreator());
dataList.add(result);
}
page++;
}
FileUtil.downloadExcel(headerList, dataList, response);
}
/**
* 库存导出全部
* 过期报表
*
* @param queryCondition
* @param query
* @return
*/
@RequestMapping("/inventoryAll/download")
@RequestMapping("/getExpire")
@AnonymousAccess
public void inventoryAllDownload(ReportQueryCondition queryCondition, HttpServletResponse response) {
List<MergeInventoryDto> dtoList = new ArrayList<>();
for (String floor : floorUtils.getAllFloor(0).values()) {
int page = 0;
queryCondition = new ReportQueryCondition();
queryCondition.setFloor(floor);
while (true) {
log.info(page+"");
queryCondition.setPage(page);
queryCondition.setSize(10000);
PageData data = inventory(queryCondition);
if (data.getTotalElements() == 0) {
break;
}
dtoList.addAll(data.getContent());
page++;
}
}
if (dtoList != null && !dtoList.isEmpty()) {
//List<Map<String, Object>> dataList, List<String> titles, HttpServletResponse response
List<Map<String, Object>> dataList = new ArrayList<>();
for (MergeInventoryDto dto : dtoList) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("厂别", dto.getPlant());
map.put("厂区", dto.getFactory());
map.put("库别", dto.getWarehouseCode());
map.put("楼层", dto.getFloor());
map.put("隔口码", dto.getPosName());
map.put("唯一码", dto.getBarcode());
map.put("料号", dto.getPartNumber());
map.put("物料描述", "");
map.put("隔口数量", dto.getPosNameCount());
map.put("卷数", dto.getReelCount());
map.put("每卷数量", dto.getAmount());
map.put("厂商", dto.getProvider());
map.put("厂商代码", dto.getProviderNumber());
map.put("LOT", dto.getBatch());
map.put("D/C", dto.getDateCode());
//map.put("批次代码"));
map.put("keeper", dto.getKeeperCode());
map.put("储位", dto.getStoragePosName());
map.put("禁用信息", dto.getDisableMsg());
map.put("首次入库时间", dto.getFirstPutInDate());
map.put("当前入库时间", dto.getPutInDate());
map.put("工号",dto.getCreator());
map.put("姓名","");
map.put("来源", dto.getSource());
dataList.add(map);
}
public PageData getExpire(MergeBcQuery query) {
String url = f4Url + "/bcReport/getExpire";
url = url + getQueryStr(query);
String result = HttpHelper.sendGet(url);
try {
FileUtil.downloadExcel(dataList, response);
} catch (IOException e) {
e.printStackTrace();
}
}
}
PageData pageData = JSON.parseObject(result, PageData.class);
PageData resultPageDate = new PageData();
resultPageDate.setTotalElements(pageData.getTotalElements());
/**
* 外仓发料
*
* @param queryCondition
* @return
*/
@RequestMapping("/pickingDetail")
@AnonymousAccess
public PageData pickingDetail(ReportQueryCondition queryCondition) {
PageData<DataLog> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/pickingDetail"+getQueryStr(queryCondition);
String result = HttpUtil.get(url);
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
}
private String getQueryStr(ReportQueryCondition queryCondition) {
String str = "";
String queryStr = JSONObject.toJSONString(queryCondition);
JSONObject queryJson = JSONObject.parseObject(queryStr);
for (Map.Entry<String, Object> entry : queryJson.entrySet()) {
Object value = entry.getValue();
if (value != null) {
if ("updateDate".equals(entry.getKey()) || "updateDateHHmm".equals(entry.getKey())) {
List<Date> updateList = JSONArray.parseArray(value.toString(), Date.class);
for (Date update : updateList) {
String updateStr = "";
if ("updateDate".equals(entry.getKey())) {
updateStr = DateUtil.toDateString(update, "yyyy-MM-dd");
} else if ("updateDateHHmm".equals(entry.getKey())){
updateStr = DateUtil.toDateString(update, "yyyy-MM-dd HH:mm");
}
if (StringUtils.isNotBlank(str)) {
str = str + "&" + entry.getKey() + "=" + updateStr;
} else {
str = "?" + entry.getKey() + "=" + updateStr;
}
}
} else {
if (StringUtils.isNotBlank(str)) {
str = str + "&" + entry.getKey() + "=" + entry.getValue();
} else {
str = "?" + entry.getKey() + "=" + entry.getValue();
}
}
}
}
return str;
List content = pageData.getContent();
String contentStr = JSON.toJSONString(content);
List<BCExpire> bcInventoryList = JSON.parseArray(contentStr, BCExpire.class);
resultPageDate.setContent(bcInventoryList);
return resultPageDate;
}
/**
* 外仓发料导出
* 过期导出
*
* @param queryCondition
* @return
* @param bcQuery
* @param response
* @throws IOException
*/
@RequestMapping("/pickingDetail/download")
@RequestMapping("/getExpire/download")
@AnonymousAccess
public void pickingDetailDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<DataLog> dataLogList = new ArrayList<>();
public void getExpireDownload(MergeBcQuery bcQuery, HttpServletResponse response) throws IOException {
List<List<String>> headerList = new ArrayList<>();
headerList.add(Lists.newArrayList("厂别"));
headerList.add(Lists.newArrayList("厂区"));
headerList.add(Lists.newArrayList("库别"));
headerList.add(Lists.newArrayList("料号"));
headerList.add(Lists.newArrayList("物料描述"));
headerList.add(Lists.newArrayList("数量"));
headerList.add(Lists.newArrayList("储位"));
headerList.add(Lists.newArrayList("keeper"));
headerList.add(Lists.newArrayList("ID NO"));
headerList.add(Lists.newArrayList("LOT"));
headerList.add(Lists.newArrayList("D/C"));
headerList.add(Lists.newArrayList("增加物料保质期"));
headerList.add(Lists.newArrayList("过期天数"));
headerList.add(Lists.newArrayList("过期日期"));
headerList.add(Lists.newArrayList("备注"));
List<List<Object>> dataList = new ArrayList<>();
int page = 0;
int size = 20000;
while (true) {
log.info(page+"");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData<DataLog> pageData = pickingDetail(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()){
bcQuery.setPage(page);
bcQuery.setSize(size);
PageData pageData = getExpire(bcQuery);
List<BCExpire> bcExpireList = pageData.getContent();
if (bcExpireList == null || bcExpireList.isEmpty()) {
break;
}
List<DataLog> dataLogs = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), DataLog.class);
dataLogList.addAll(dataLogs);
page ++;
}
if (dataLogList != null && !dataLogList.isEmpty()) {
List results = new ArrayList();
for (DataLog dataLog : dataLogList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("厂别", getData(dataLog.getPlantCode()));
resultMap.put("厂区", getData(dataLog.getFactory()));
resultMap.put("库别", getData(dataLog.getWarehouseCode()));
resultMap.put("楼层", getData(dataLog.getLine()));
resultMap.put("挑料单号", getData(dataLog.getOrderNo()));
resultMap.put("工单号", getData(dataLog.getMo()));
resultMap.put("料号", getData(dataLog.getPartNumber()));
resultMap.put("物料描述", getData(null));
resultMap.put("储位", getData(dataLog.getPosName()));
resultMap.put("段别", getData(dataLog.getSide()));
resultMap.put("数量", getData(dataLog.getNum()));
resultMap.put("异动类型", getData(dataLog.getChangeType()));
resultMap.put("工号", getData(dataLog.getOperator()));
resultMap.put("姓名", getData(null));
resultMap.put("时间", getData(dataLog.getCreateDate()));
resultMap.put("ID NO.", getData(dataLog.getBarcode()));
resultMap.put("LOT", getData(dataLog.getBatchInfo()));
resultMap.put("D/C", getData(dataLog.getDateCode()));
resultMap.put("厂商", getData(dataLog.getProvider()));
resultMap.put("厂商代码", getData(dataLog.getProviderNumber()));
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("发料明细导出失败--" + e.getMessage());
}
}
}
/**
* 禁限用
*
* @param queryCondition
* @return
*/
@RequestMapping("/disable")
@AnonymousAccess
public PageData disable(ReportQueryCondition queryCondition) {
PageData<BarcodeDto> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/disable";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
}
/**
* 外仓禁限用导出
*
* @param queryCondition
* @return
*/
@RequestMapping("/disable/download")
@AnonymousAccess
public void disableDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<BarcodeDto> barcodeDtoList = new ArrayList<>();
int page = 0;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(200000);
PageData<BarcodeDto> pageData = disable(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
break;
for (BCExpire expire : bcExpireList) {
List<Object> result = new ArrayList<>();
result.add(expire.getPlant());
result.add(expire.getFactory());
result.add(expire.getWarehouseCode());
result.add(expire.getPartNumber());
result.add(expire.getDescribe());
result.add(expire.getAmount());
result.add(expire.getPosName());
result.add(expire.getKeeperCode());
result.add(expire.getBarcode());
result.add(expire.getBatch());
result.add(expire.getDateCode());
result.add(expire.getExpireYear());
result.add(expire.getExpireDays());
result.add(expire.getExpireDate());
result.add(expire.getRemark());
dataList.add(result);
}
List<BarcodeDto> barcodeDtos = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), BarcodeDto.class);
barcodeDtoList.addAll(barcodeDtos);
page++;
}
if (barcodeDtoList != null && !barcodeDtoList.isEmpty()) {
List results = new ArrayList();
for (BarcodeDto dto : barcodeDtoList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("厂别", getData(dto.getPlant()));
resultMap.put("厂区", getData(dto.getFactory()));
resultMap.put("库别", getData(dto.getWarehouseCode()));
resultMap.put("料号", getData(dto.getPartNumber()));
resultMap.put("物料描述", getData(null));
resultMap.put("隔口码", getData(dto.getPosName()));
resultMap.put("储位", getData(dto.getStoragePosName()));
resultMap.put("Keeper", getData(dto.getKeeperCode()));
resultMap.put("数量", getData(dto.getAmount()));
resultMap.put("LOT", getData(dto.getBatch()));
resultMap.put("D/C", getData(dto.getDateCode()));
resultMap.put("厂商", getData(dto.getProvider()));
resultMap.put("厂商代码", getData(dto.getProviderNumber()));
resultMap.put("禁用信息", getData(dto.getDisableMsg()));
resultMap.put("入库时间", getData(dto.getPutInDate()));
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("禁限用导出失败--" + e.getMessage());
}
}
}
/**
* 备料
*
* @param queryCondition
* @return
*/
@RequestMapping("/preparePicking")
@AnonymousAccess
public PageData preparePicking(ReportQueryCondition queryCondition) {
PageData<OrderItemDto> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/preparePicking";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
FileUtil.downloadExcel(headerList, dataList, response);
}
/**
* 外仓备料导出
* 事务
*
* @param queryCondition
* @param query
* @return
*/
@RequestMapping("/preparePicking/download")
@RequestMapping("/change")
@AnonymousAccess
public void preparePickingDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<OrderItemDto> orderItemDtoList = new ArrayList<>();
int page = 0;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData<BarcodeDto> pageData = preparePicking(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
break;
}
List<OrderItemDto> orderItemDtos = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), OrderItemDto.class);
orderItemDtoList.addAll(orderItemDtos);
page++;
}
public PageData change(MergeBcQuery query) {
String url = f4Url + "/bcReport/change";
url = url + getQueryStr(query);
String result = HttpHelper.sendGet(url);
if (orderItemDtoList != null && !orderItemDtoList.isEmpty()) {
List results = new ArrayList();
for (OrderItemDto dto : orderItemDtoList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("厂别", getData(dto.getPlantCode()));
resultMap.put("厂区", getData(dto.getFactory()));
resultMap.put("库别", getData(dto.getWarehouseCode()));
resultMap.put("楼层", getData(dto.getLine()));
resultMap.put("挑料单号", getData(dto.getOrderNo()));
resultMap.put("工单号", getData(dto.getMo()));
resultMap.put("料号", getData(dto.getPn()));
resultMap.put("物料描述", getData(null));
resultMap.put("需求数", getData(dto.getNeedNum()));
resultMap.put("需求卷", getData(dto.getNeedReelCount()));
resultMap.put("实发数", getData(dto.getTotalOutNum()));
resultMap.put("实发卷", getData(dto.getTotalOutReelCount()));
resultMap.put("段别", getData(dto.getSide()));
resultMap.put("超发数量", getData(dto.getExcessOutNum()));
resultMap.put("超发卷数", getData(dto.getExcessOutReel()));
resultMap.put("是否超发", getData(dto.isExcess() ? "是" : "否"));
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("备料导出失败--" + e.getMessage());
}
}
}
PageData pageData = JSON.parseObject(result, PageData.class);
PageData resultPageDate = new PageData();
resultPageDate.setTotalElements(pageData.getTotalElements());
/**
* 外仓异动
*
* @param queryCondition
* @return
*/
@RequestMapping("/change")
@AnonymousAccess
public PageData change(ReportQueryCondition queryCondition) {
PageData<DataLog> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/change";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
List content = pageData.getContent();
String contentStr = JSON.toJSONString(content);
List<BCChange> bcChangeList = JSON.parseArray(contentStr, BCChange.class);
resultPageDate.setContent(bcChangeList);
return resultPageDate;
}
/**
* 外仓异动导出
* 事务导出
*
* @param queryCondition
* @return
* @param bcQuery
* @param response
* @throws IOException
*/
@RequestMapping("/change/download")
@AnonymousAccess
public void changeDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<DataLog> dataLogList = new ArrayList<>();
public void changeDownload(MergeBcQuery bcQuery, HttpServletResponse response) throws IOException {
List<List<String>> headerList = new ArrayList<>();
headerList.add(Lists.newArrayList("厂别"));
headerList.add(Lists.newArrayList("厂区"));
headerList.add(Lists.newArrayList("库别"));
headerList.add(Lists.newArrayList("料号"));
headerList.add(Lists.newArrayList("物料描述"));
headerList.add(Lists.newArrayList("异动数量"));
headerList.add(Lists.newArrayList("卷数"));
headerList.add(Lists.newArrayList("储位"));
headerList.add(Lists.newArrayList("异动类型"));
headerList.add(Lists.newArrayList("ID NO"));
headerList.add(Lists.newArrayList("LOT"));
headerList.add(Lists.newArrayList("D/C"));
headerList.add(Lists.newArrayList("厂商"));
headerList.add(Lists.newArrayList("厂商代码"));
headerList.add(Lists.newArrayList("keeper"));
headerList.add(Lists.newArrayList("事务日期"));
headerList.add(Lists.newArrayList("工号"));
List<List<Object>> dataList = new ArrayList<>();
int page = 0;
int size = 20000;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData<DataLog> pageData = change(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
bcQuery.setPage(page);
bcQuery.setSize(size);
PageData pageData = change(bcQuery);
List<BCChange> bcChangeList = pageData.getContent();
if (bcChangeList == null || bcChangeList.isEmpty()) {
break;
}
List<DataLog> dataLogs = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), DataLog.class);
dataLogList.addAll(dataLogs);
page++;
}
if (dataLogList != null && !dataLogList.isEmpty()) {
List results = new ArrayList();
for (DataLog dataLog : dataLogList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("厂别", getData(dataLog.getPlantCode()));
resultMap.put("厂区", getData(dataLog.getFactory()));
resultMap.put("料号", getData(dataLog.getPartNumber()));
resultMap.put("物料描述", getData(null));
resultMap.put("隔口码", getData(dataLog.getPosName()));
resultMap.put("异动数量", getData(dataLog.getNum()));
resultMap.put("储位", getData(dataLog.getStoragePosName()));
resultMap.put("异动类型", getData(dataLog.getChangeType()));
resultMap.put("ID NO", getData(dataLog.getBarcode()));
resultMap.put("LOT", getData(dataLog.getBatchInfo()));
resultMap.put("D/C", getData(dataLog.getDateCode()));
resultMap.put("厂商", getData(dataLog.getProvider()));
resultMap.put("厂商代码", getData(dataLog.getProviderNumber()));
resultMap.put("Keeper", getData(dataLog.getKeeperCode()));
resultMap.put("原始库别", getData(dataLog.getWarehouseCode()));
resultMap.put("目的库别", getData(null));
resultMap.put("事务日期", getData(dataLog.getCreator()));
resultMap.put("工号", getData(dataLog.getOperator()));
resultMap.put("姓名", getData(null));
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("异动导出失败--" + e.getMessage());
for (BCChange bcChange : bcChangeList) {
List<Object> result = new ArrayList<>();
result.add(bcChange.getPlant());
result.add(bcChange.getFactory());
result.add(bcChange.getWarehouseCode());
result.add(bcChange.getPartNumber());
result.add(bcChange.getDescribe());
result.add(bcChange.getNum());
result.add(bcChange.getReelAmount());
result.add(bcChange.getPosName());
result.add(bcChange.getType());
result.add(bcChange.getBarcode());
result.add(bcChange.getBatch());
result.add(bcChange.getDateCode());
result.add(bcChange.getProvider());
result.add(bcChange.getProviderNumber());
result.add(bcChange.getKeeperCode());
result.add(bcChange.getCreateDate());
result.add(bcChange.getCreator());
dataList.add(result);
}
}
}
/**
* 外仓缺料
*
* @param queryCondition
* @return
*/
@RequestMapping("/lackPicking")
@AnonymousAccess
public PageData lackPicking(ReportQueryCondition queryCondition) {
PageData<OrderItemDto> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/lackPicking";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
}
/**
* 外仓缺料导出
*
* @param queryCondition
* @return
*/
@RequestMapping("/lackPicking/download")
@AnonymousAccess
public void lackPickingDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<OrderItemDto> orderItemDtoList = new ArrayList<>();
PageData<DataLog> pageData = lackPicking(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
return;
}
List<OrderItemDto> orderItemDtos = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), OrderItemDto.class);
orderItemDtoList.addAll(orderItemDtos);
if (orderItemDtoList != null && !orderItemDtoList.isEmpty()) {
List results = new ArrayList();
for (OrderItemDto dto : orderItemDtoList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("厂别", getData(dto.getPlantCode()));
resultMap.put("厂区", getData(dto.getFactory()));
resultMap.put("库别", getData(dto.getWarehouseCode()));
resultMap.put("楼层", getData(dto.getLine()));
resultMap.put("Picking ID", getData(dto.getOrderNo()));
resultMap.put("工单号", getData(dto.getMo()));
resultMap.put("55料号", getData(null));
resultMap.put("工单套数", getData(null));
resultMap.put("料号", getData(dto.getPn()));
resultMap.put("描述", getData(null));
resultMap.put("需求站别", getData(dto.getSide()));
resultMap.put("需求数量", getData(dto.getNeedNum()));
resultMap.put("需求卷数", getData(dto.getNeedReelCount()));
resultMap.put("发料数量", getData(dto.getTotalOutNum()));
resultMap.put("发料卷数", getData(dto.getTotalOutReelCount()));
resultMap.put("缺料数量", getData(dto.getLackNum()));
resultMap.put("缺料卷数", getData(dto.getLackReel()));
resultMap.put("是否超发", dto.isExcess() ? "是" : "否");
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("缺料导出失败--" + e.getMessage());
}
}
}
/**
* 外仓PK查询
*
* @param queryCondition
* @return
*/
@RequestMapping("/pickingSearch")
@AnonymousAccess
public PageData pickingSearch(ReportQueryCondition queryCondition) {
PageData<OrderItemDto> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/pickingSearch";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
}
/**
* 外仓pk查询
*
* @param queryCondition
* @return
*/
@RequestMapping("/pickingSearch/download")
@AnonymousAccess
public void pickingSearchDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<OrderItemDto> orderItemDtoList = new ArrayList<>();
int page = 0;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData<OrderItemDto> pageData = pickingSearch(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
break;
}
List<OrderItemDto> orderItemDtos = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), OrderItemDto.class);
orderItemDtoList.addAll(orderItemDtos);
page++;
}
if (orderItemDtoList != null && !orderItemDtoList.isEmpty()) {
List results = new ArrayList();
for (OrderItemDto orderItemDto : orderItemDtoList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("厂别", getData(orderItemDto.getPlantCode()));
resultMap.put("厂区", getData(orderItemDto.getFactory()));
resultMap.put("库别", getData(orderItemDto.getWarehouseCode()));
resultMap.put("楼层", getData(orderItemDto.getLine()));
resultMap.put("PK ID", getData(orderItemDto.getOrderNo()));
resultMap.put("工单号", getData(orderItemDto.getMo()));
resultMap.put("板子料号", getData(null));
resultMap.put("套数", getData(null));
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("PK查询导出失败--" + e.getMessage());
}
}
FileUtil.downloadExcel(headerList, dataList, response);
}
/**
* 盘点
*
* @param queryCondition
* @return
*/
@RequestMapping("/inventoryData")
@ApiOperation("禁限用")
@RequestMapping("/disable")
@AnonymousAccess
public PageData inventoryData(ReportQueryCondition queryCondition) {
PageData<InventoryData> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/outer/report/inventoryData";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
}
public PageData disable(ReportQueryCondition queryCondition) {
String url = f4Url + "/inner/report/disable";
url = url + getQueryStr(queryCondition);
String result = HttpHelper.sendGet(url);
/**
* 外仓盘点导出
*
* @param queryCondition
* @return
*/
@RequestMapping("/inventoryData/download")
@AnonymousAccess
public void inventoryDataDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<InventoryData> inventoryDataList = new ArrayList<>();
int page = 0;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData<InventoryData> pageData = inventoryData(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
break;
}
List<InventoryData> inventoryDatas = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), InventoryData.class);
inventoryDataList.addAll(inventoryDatas);
page++;
}
PageData pageData = JSON.parseObject(result, PageData.class);
if (inventoryDataList != null && !inventoryDataList.isEmpty()) {
List results = new ArrayList();
for (InventoryData data : inventoryDataList) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("料箱", data.getBox());
map.put("隔口", data.getBoxPartition());
map.put("料号", data.getPartNumber());
map.put("描述", "");
//map.put("原储位",data.getOriPosName());
map.put("储位", data.getPosName());
map.put("卷数", data.getReelCount());
map.put("数量", data.getAmout());
map.put("已盘点卷数", data.getInventoryReelCount());
map.put("已盘点数量", data.getInventoryAmout());
map.put("是否匹配", data.isMatch() ? "是" : "否");
map.put("盘点人", data.getCreator());
map.put("盘点状态", InventoryStatus.getValue(data.getStatus()));
map.put("盘点批次", data.getInventoryBatch());
map.put("人工是否确认", data.isNeedInventory() ? "是" : "否");
map.put("创建时间",data.getCreateDate());
results.add(map);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("PK查询导出失败--" + e.getMessage());
}
}
}
PageData resultPageDate = new PageData();
resultPageDate.setTotalElements(pageData.getTotalElements());
/**
* 内仓异动
*
* @param queryCondition
* @return
*/
@RequestMapping("/innerChange")
@AnonymousAccess
public PageData innerChange(ReportQueryCondition queryCondition) {
PageData<DataLog> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/inner/report/change";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
List content = pageData.getContent();
String contentStr = JSON.toJSONString(content);
List<Barcode> bcBarcodeList = JSON.parseArray(contentStr, Barcode.class);
resultPageDate.setContent(bcBarcodeList);
return resultPageDate;
}
/**
* 内仓异动导出
* 禁限用
*
* @param queryCondition
* @return
* @param bcQuery
* @param response
* @throws IOException
*/
@RequestMapping("/innerChange/download")
@RequestMapping("/disable/download")
@AnonymousAccess
public void innerChangeDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<DataLog> dataLogList = new ArrayList<>();
public void disableDownload(ReportQueryCondition bcQuery, HttpServletResponse response) throws IOException {
List<List<String>> headerList = new ArrayList<>();
headerList.add(Lists.newArrayList("ID NO"));
headerList.add(Lists.newArrayList("料号"));
headerList.add(Lists.newArrayList("D/C"));
headerList.add(Lists.newArrayList("L/C"));
headerList.add(Lists.newArrayList("厂商代码"));
headerList.add(Lists.newArrayList("厂商"));
headerList.add(Lists.newArrayList("数量"));
headerList.add(Lists.newArrayList("禁用信息"));
List<List<Object>> dataList = new ArrayList<>();
int page = 0;
int size = 20000;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(20000);
PageData<DataLog> pageData = innerChange(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
bcQuery.setPage(page);
bcQuery.setSize(size);
PageData pageData = disable(bcQuery);
List<Barcode> bcBarcodeList = pageData.getContent();
if (bcBarcodeList == null || bcBarcodeList.isEmpty()) {
break;
}
List<DataLog> dataLogs = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), DataLog.class);
dataLogList.addAll(dataLogs);
page++;
}
if (dataLogList != null && !dataLogList.isEmpty()) {
List results = new ArrayList();
for (DataLog dataLog : dataLogList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("线别", getData(dataLog.getLine()));
resultMap.put("机器", getData(dataLog.getMachineName()));
resultMap.put("站点", getData(dataLog.getTableNo()));
resultMap.put("站位", getData(dataLog.getSlot()));
resultMap.put("点位", getData(dataLog.getSubSlot()));
resultMap.put("面别", getData(dataLog.getSide()));
resultMap.put("工单号", getData(dataLog.getSourceName()));
resultMap.put("类型", getData(dataLog.getType()));
resultMap.put("料号", getData(dataLog.getPartNumber()));
resultMap.put("储位", getData(dataLog.getPosName()));
resultMap.put("数量", getData(dataLog.getNum()));
resultMap.put("时间", getData(dataLog.getCreateDate()));
resultMap.put("ID NO", getData(dataLog.getBarcode()));
resultMap.put("D/C", getData(dataLog.getDateCode()));
resultMap.put("L/C", getData(dataLog.getBatchInfo()));
resultMap.put("厂商代码", getData(dataLog.getProviderNumber()));
resultMap.put("厂商", getData(dataLog.getProvider()));
resultMap.put("状态", getData(dataLog.getStatus()));
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("PK查询导出失败--" + e.getMessage());
}
}
}
/**
* 内仓缺料
*
* @param queryCondition
* @return
*/
@RequestMapping("/innerLackPicking")
@AnonymousAccess
public PageData innerLackPicking(ReportQueryCondition queryCondition) {
PageData<OrderItemDto> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/inner/report/lackPicking";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
}
}
return pageData;
}
/**
* 内仓缺料导出
*
* @param queryCondition
* @return
*/
@RequestMapping("/innerLackPicking/download")
@AnonymousAccess
public void innerLackPickingDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<OrderItemDto> orderItemDtoList = new ArrayList<>();
PageData<OrderItemDto> pageData = innerLackPicking(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
return;
}
List<OrderItemDto> orderItemDtos = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), OrderItemDto.class);
orderItemDtoList.addAll(orderItemDtos);
if (orderItemDtoList != null && !orderItemDtoList.isEmpty()) {
List results = new ArrayList();
for (OrderItemDto dto : orderItemDtoList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("线别", dto.getLine());
resultMap.put("工单号", dto.getOrderNo());
resultMap.put("料号", dto.getPn());
resultMap.put("机器", dto.getMachineName());
resultMap.put("站点", dto.getTableNo());
resultMap.put("站位", dto.getSlot());
resultMap.put("点位", dto.getSubSlot());
resultMap.put("面别", dto.getSide());
resultMap.put("需求卷", dto.getNeedReelCount());
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("缺料导出失败--" + e.getMessage());
}
}
}
/**
* 禁限用
*
* @param queryCondition
* @return
*/
@RequestMapping("/innerDisable")
@AnonymousAccess
public PageData innerDisable(ReportQueryCondition queryCondition) {
PageData<BarcodeDto> pageData = new PageData<>();
pageData.setContent(new ArrayList<>());
String floor = queryCondition.getFloor();
if (StringUtils.isNotBlank(floor)) {
String url = floorUtils.getUrlByFloor(floor);
if (StringUtils.isNotBlank(url)) {
url = url + "/inner/report/disable";
String result = HttpUtil.get(url+getQueryStr(queryCondition));
pageData = JSONObject.parseObject(result, PageData.class);
for (Barcode barcode : bcBarcodeList) {
List<Object> result = new ArrayList<>();
result.add(barcode.getBarcode());
result.add(barcode.getPartNumber());
result.add(barcode.getDateCode());
result.add(barcode.getBatch());
result.add(barcode.getProviderNumber());
result.add(barcode.getProvider());
result.add(barcode.getAmount());
result.add(barcode.getDisableMsg());
dataList.add(result);
}
page++;
}
return pageData;
FileUtil.downloadExcel(headerList, dataList, response);
}
/**
* 内仓禁限用导出
*
* @param queryCondition
* @return
*/
@RequestMapping("/innerDisable/download")
@AnonymousAccess
public void innerDisableDownload(ReportQueryCondition queryCondition,HttpServletResponse response) {
List<BarcodeDto> barcodeDtoList = new ArrayList<>();
int page = 0;
while (true) {
log.info(page + "");
queryCondition.setPage(page);
queryCondition.setSize(200000);
PageData<BarcodeDto> pageData = innerDisable(queryCondition);
if (pageData.getContent() == null || pageData.getContent().isEmpty()) {
break;
}
List<BarcodeDto> barcodeDtos = JSONArray.parseArray(JSONObject.toJSONString(pageData.getContent()), BarcodeDto.class);
barcodeDtoList.addAll(barcodeDtos);
page++;
}
if (barcodeDtoList != null && !barcodeDtoList.isEmpty()) {
List results = new ArrayList();
for (BarcodeDto dto : barcodeDtoList) {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("ID NO", dto.getBarcode());
resultMap.put("料号", dto.getPartNumber());
resultMap.put("D/C", dto.getDateCode());
resultMap.put("L/C", dto.getBatch());
resultMap.put("厂商代码", dto.getProviderNumber());
resultMap.put("厂商", dto.getProvider());
resultMap.put("数量", dto.getAmount());
resultMap.put("禁用信息", dto.getDisableMsg());
results.add(resultMap);
}
try {
FileUtil.downloadExcel(results, response);
} catch (IOException e) {
e.printStackTrace();
log.info("禁限用导出失败--" + e.getMessage());
private String getQueryStr(Object obj) {
String str = "";
String queryStr = JSONObject.toJSONString(obj);
JSONObject queryJson = JSONObject.parseObject(queryStr);
for (Map.Entry<String, Object> entry : queryJson.entrySet()) {
Object value = entry.getValue();
if (value != null) {
if (StringUtils.isNotBlank(str)) {
str = str + "&" + entry.getKey() + "=" + entry.getValue();
} else {
str = "?" + entry.getKey() + "=" + entry.getValue();
}
}
}
}
private Object getData(Object data) {
return data == null ? "" : data;
return str;
}
}
package com.neotel.smfcore.custom.lizhen.report.merge.bean.query;
import com.neotel.smfcore.custom.lizhen.report.bacheng.bean.query.BcQuery;
import lombok.Data;
@Data
public class MergeBcQuery extends BcQuery {
private int page;
private int size;
private String sort;
}
......@@ -58,6 +58,9 @@ forward:
b15:
name: B15
url: http://10.42.176.209:8001/smf-core
f4:
name: 4F
url: http://127.0.0.1:8800
#手动出库料箱
manualcheckout:
......@@ -99,6 +102,6 @@ app:
type: ""
menu:
show:
show: meInventory,meExpiredReport,meChangeReport,meprohibitedReport
hide:
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!