Commit 08d01a59 LN

库位管理增加导出功能

1 个父辈 05cdb741
......@@ -114,96 +114,91 @@ public class StoragePosController {
}
return new PageData(StoragePosDtos, pages.getTotalElements());
}
//
//
// @ApiOperation("导出查找出库列表")
// @GetMapping(value = "/download")
// @PreAuthorize("@el.check('checkOut')")
// public void download(HttpServletResponse response, StoragePosQueryCriteria criteria, Pageable pageable, HttpServletRequest request) throws IOException {
// if (criteria.getStorageIdList() != null && criteria.getStorageIdList().contains("0")) {
// criteria.setStorageIdList(null);
// }
// criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
// String blurry = criteria.getBlurry();
// if(!Strings.isNullOrEmpty(blurry)){
// //去除库位中的SOxxxx
// blurry = blurry.substring(blurry.indexOf("-")+1);
// criteria.setBlurry(blurry);
// }
// Locale locale = request.getLocale();
//
// String enable=MessageUtils.getText("",locale,"是");
// String noEnable= MessageUtils.getText("",locale,"否");
// Query query = QueryHelp.getQuery(criteria);
// FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
// @Override
// public List<List<String>> getHeader() {
// List<List<String>> header = new ArrayList<>();
// Locale locale = request.getLocale();
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.barcode",locale,"设备名称")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.partNumber",locale,"设备")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.proDate",locale,"列")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.expireDate",locale,"模组")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.batch",locale,"层")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.posName",locale,"槽位")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.lockName",locale,"是否可用")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.amount",locale,"条码")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.putInTime",locale,"物料编号")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.putInTime",locale,"料盘尺寸")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.putInTime",locale,"直径")));
// header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.putInTime",locale,"厚度")));
//
// return header;
// }
//
// @Override
// public List<List<Object>> getPageData(Query query, Pageable pageable) {
// List<List<Object>> dataList = new ArrayList<>();
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// List<Map<String, Object>> list = new ArrayList<>();
// PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
// List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
//
// for (int i=0;i<StoragePosDtos.size();i++){
// Storage storage=dataCache.getStorageById(StoragePosDtos.get(i).getStorageId());
// if(storage!=null){
// StoragePosDtos.get(i).setStorageName(storage.getName());
// }
// }
// for (StoragePosDto pos : StoragePosDtos) {
//
// String proDate = pos.getBarcode().getProduceDate() == null ? "" : dateFormat.format(pos.getBarcode().getProduceDate());
// String expireDate = pos.getBarcode().getExpireDate() == null ? "" : dateFormat.format(pos.getBarcode().getExpireDate());
//
// String putInTime = (pos.getBarcode().getPutInTime() == -1) ? "" : dateFormat.format(new Date(pos.getBarcode().getPutInTime()));
// if(ObjectUtil.isNotEmpty(putInTime)){
// putInTime=dateFormat.format(pos.getBarcode().getPutInDate());
// }
//
// List<Object> data = new ArrayList<>();
// data.add(pos.getStorageName());
// data.add(pos.getPosName());
// data.add(pos.getColumn());
// data.add(pos.getMagazine());
// data.add(pos.getLayer());
// data.add(pos.getSlot());
// data.add(pos.isEnabled()?(enable):noEnable);
// data.add(pos.getBarcode().getBarcode());
// data.add(pos.getBarcode().getPartNumber());
// data.add(proDate);
// data.add(expireDate);
// data.add(pos.getBarcode().getBatch());
// data.add(pos.getPosName());
// data.add(pos.getBarcode().getLockName());
// data.add(pos.getBarcode().getAmount());
// data.add(putInTime);
// data.add(dateFormat.format(pos.getBarcode().getPutInDate()));
// dataList.add(data);
// }
// return dataList;
// }
// });
// }
@ApiOperation("导出库位列表")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('storagePos:list')")
public void download(HttpServletResponse response, StoragePosQueryCriteria criteria, Pageable pageable, HttpServletRequest request) throws IOException {
if (criteria.getStorageIdList() != null && criteria.getStorageIdList().contains("0")) {
criteria.setStorageIdList(null);
}
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
String blurry = criteria.getBlurry();
if(!Strings.isNullOrEmpty(blurry)){
//去除库位中的SOxxxx
blurry = blurry.substring(blurry.indexOf("-")+1);
criteria.setBlurry(blurry);
}
Locale locale = request.getLocale();
String enable=MessageUtils.getText("smfcore.storagePos.yes",locale,"是");
String noEnable= MessageUtils.getText("smfcore.storagePos.no",locale,"否");
Query query = QueryHelp.getQuery(criteria);
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
@Override
public List<List<String>> getHeader() {
List<List<String>> header = new ArrayList<>();
Locale locale = request.getLocale();
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.storageName",locale,"设备名称")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.posName",locale,"库位号")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.column",locale,"列")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.magazine",locale,"模组")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.layer",locale,"层")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.slot",locale,"槽位")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.available",locale,"是否可用")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.barcode",locale,"条码")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.partNumber",locale,"料件编号")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.plateSize",locale,"料盘尺寸")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.w",locale,"直径")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.storagePos.h",locale,"厚度")));
return header;
}
@Override
public List<List<Object>> getPageData(Query query, Pageable pageable) {
List<List<Object>> dataList = new ArrayList<>();
List<Map<String, Object>> list = new ArrayList<>();
PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
for (int i=0;i<StoragePosDtos.size();i++){
Storage storage=dataCache.getStorageById(StoragePosDtos.get(i).getStorageId());
if(storage!=null){
StoragePosDtos.get(i).setStorageName(storage.getName());
}
}
for (StoragePosDto pos : StoragePosDtos) {
List<Object> data = new ArrayList<>();
data.add(pos.getStorageName());
data.add(pos.getPosName());
data.add(pos.getColumn());
data.add(pos.getMagazine());
data.add(pos.getLayer());
data.add(pos.getSlot());
data.add(pos.isEnabled()?(enable):noEnable);
if(pos.getBarcode()!=null){
data.add(pos.getBarcode().getBarcode());
data.add(pos.getBarcode().getPartNumber());
data.add(pos.getBarcode().getPlateSize()+"X"+pos.getBarcode().getHeight());
}else{
data.add("");
data.add("");
data.add("");
}
data.add(pos.getW());
data.add(pos.getH());
dataList.add(data);
}
return dataList;
}
});
}
......
......@@ -390,4 +390,12 @@ smfcore.order.finished=\u5DE5\u5355[{0}]\u7684\u4EFB\u52A1\u5DF2\u5168\u90E8\u5B
smfcore.spkanban=SP\u4EEA\u8868\u76D8
smfcore.storagePos.plateSize=\u6599\u76D8\u5C3A\u5BF8
smfcore.storagePos.w=\u76F4\u5F84
smfcore.storagePos.h=\u539A\u5EA6
\ No newline at end of file
smfcore.storagePos.h=\u539A\u5EA6
smfcore.storagePos.storageName=\u8BBE\u5907\u540D\u79F0
smfcore.storagePos.column=\u5217
smfcore.storagePos.magazine=\u6A21\u7EC4
smfcore.storagePos.layer=\u5C42
smfcore.storagePos.slot=\u69FD\u4F4D
smfcore.storagePos.available=\u662F\u5426\u53EF\u7528
smfcore.storagePos.yes=\u662F
smfcore.storagePos.no=\u5426
\ No newline at end of file
......@@ -381,4 +381,12 @@ smfcore.order.finished=workorder[{0}] has completed all of its tasks
smfcore.spkanban=SP Dash Board
smfcore.storagePos.plateSize=Detected Size
smfcore.storagePos.w=Diameter
smfcore.storagePos.h=Thickness
\ No newline at end of file
smfcore.storagePos.h=Thickness
smfcore.storagePos.storageName=Equipment Name
smfcore.storagePos.column=Column
smfcore.storagePos.magazine=Magazine
smfcore.storagePos.layer=Layer
smfcore.storagePos.slot=Slot
smfcore.storagePos.available=Available
smfcore.storagePos.yes=Yes
smfcore.storagePos.no=No
\ No newline at end of file
......@@ -377,4 +377,12 @@ smfcore.order.finished=\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC[{0}]\u306E\u30
smfcore.spkanban=\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9
smfcore.storagePos.plateSize=\u6599\u76D8\u5C3A\u5BF8
smfcore.storagePos.w=\u76F4\u5F84
smfcore.storagePos.h=\u539A\u3055
\ No newline at end of file
smfcore.storagePos.h=\u539A\u3055
smfcore.storagePos.storageName=\u8BBE\u5907\u540D\u79F0
smfcore.storagePos.column=\u5217
smfcore.storagePos.magazine=\u6A21\u7EC4
smfcore.storagePos.layer=\u5C42
smfcore.storagePos.slot=\u69FD\u4F4D
smfcore.storagePos.available=\u5229\u7528\u53EF\u5426
smfcore.storagePos.yes=\u662F
smfcore.storagePos.no=\u5426
\ No newline at end of file
......@@ -377,4 +377,12 @@ smfcore.order.finished=\u5DE5\u5355[{0}]\u7684\u4EFB\u52A1\u5DF2\u5168\u90E8\u5B
smfcore.spkanban=SP\u4EEA\u8868\u76D8
smfcore.storagePos.plateSize=\u6599\u76D8\u5C3A\u5BF8
smfcore.storagePos.w=\u76F4\u5F84
smfcore.storagePos.h=\u539A\u5EA6
\ No newline at end of file
smfcore.storagePos.h=\u539A\u5EA6
smfcore.storagePos.storageName=\u8BBE\u5907\u540D\u79F0
smfcore.storagePos.column=\u5217
smfcore.storagePos.magazine=\u6A21\u7EC4
smfcore.storagePos.layer=\u5C42
smfcore.storagePos.slot=\u69FD\u4F4D
smfcore.storagePos.available=\u662F\u5426\u53EF\u7528
smfcore.storagePos.yes=\u662F
smfcore.storagePos.no=\u5426
\ No newline at end of file
......@@ -377,4 +377,12 @@ smfcore.order.finished=\u5DE5\u55AE[{0}]\u7684\u4EFB\u52D9\u5DF2\u5168\u90E8\u5B
smfcore.spkanban=SP\u5100\u9336\u76E4
smfcore.storagePos.plateSize=\u6599\u76D8\u5C3A\u5BF8
smfcore.storagePos.w=\u76F4\u5F84
smfcore.storagePos.h=\u539A\u5EA6
\ No newline at end of file
smfcore.storagePos.h=\u539A\u5EA6
smfcore.storagePos.storageName=\u8A2D\u5099\u540D\u7A31
smfcore.storagePos.column=\u5217
smfcore.storagePos.magazine=\u6A21\u7D44
smfcore.storagePos.layer=\u5C64
smfcore.storagePos.slot=\u69FD\u4F4D
smfcore.storagePos.available=\u662F\u5426\u53EF\u7528
smfcore.storagePos.yes=\u662F
smfcore.storagePos.no=\u5426
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!