rev:半成品库存导出修改
This commit is contained in:
@@ -78,10 +78,11 @@ public class StIvtStructivtBcpController {
|
||||
//("半成品库存查询")
|
||||
public ResponseEntity<Object> download(StructIvtBcpQuery query, PageQuery page, HttpServletResponse response) {
|
||||
List<Map> maps = bcpService.queryAll(query);
|
||||
String s = JSON.toJSONString(maps);
|
||||
List<StIvtStructivtBcpVo> bcpVos = JSONArray.parseArray(s, StIvtStructivtBcpVo.class);
|
||||
columnInfoService.exportFile(bcpVos,response, ListOf.of("is_pick","ivt_level","is_active","qty_unit_id","stor_id","ivt_level","struct_id","material_id","quality_scode"),
|
||||
MapOf.of("stor_name","仓库名称","material_name","物料名称","material_spec","物料规格","material_code","物料编号","storagevehicle_code","载具编号","vehicle_weight","载具单重(g)"));
|
||||
columnInfoService.exportFile("st_ivt_structivt_bcp",maps,response,
|
||||
ListOf.of("struct_code","bill_type","unit_weight","is_pick","ivt_level","is_active","qty_unit_id","stor_id","ivt_level","struct_id","material_id","quality_scode","canuse_qty"),
|
||||
MapOf.of("stor_name","仓库名称","material_name","物料名称","material_spec","物料规格",
|
||||
"material_code","物料编号","storagevehicle_code","载具编号","vehicle_weight2","载具单重(kg)"
|
||||
,"canuse_qty2","可用重量(kg)","m_qty","物料数量","unit_weight","物料单重(g)"));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,10 @@
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
attr.storagevehicle_code,
|
||||
vehicle.vehicle_weight
|
||||
vehicle.vehicle_weight,
|
||||
format(vehicle.vehicle_weight/1000,3) as vehicle_weight2,
|
||||
format(ivt.canuse_qty/1000,3) as canuse_qty2,
|
||||
convert(convert(ivt.canuse_qty/ivt.unit_weight,decimal(9,0)),char) as m_qty
|
||||
FROM
|
||||
st_ivt_structivt_bcp ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
|
||||
@@ -99,5 +99,8 @@ public class StIvtStructivtBcpVo {
|
||||
private String stor_name;
|
||||
private String storagevehicle_code;
|
||||
private String vehicle_weight;
|
||||
private String vehicle_weight2;
|
||||
private String canuse_qty2;
|
||||
private String m_qty;
|
||||
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ public class StIvtStructivtHrBcpController {
|
||||
//("半成品库存查询")
|
||||
public ResponseEntity<Object> download(StructIvtHrBcpQuery query, PageQuery page, HttpServletResponse response) {
|
||||
List<Map> maps = bcpService.queryAll(query);
|
||||
String s = JSON.toJSONString(maps);
|
||||
List<StIvtStructivtBcpVo> bcpVos = JSONArray.parseArray(s, StIvtStructivtBcpVo.class);
|
||||
columnInfoService.exportFile(bcpVos,response,
|
||||
columnInfoService.exportFile("st_ivt_structivt_bcp",maps,response,
|
||||
ListOf.of(""),
|
||||
MapOf.of("stor_name","仓库名称","material_name","物料名称","material_spec","物料规格"));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -43,21 +43,16 @@ public class ColumnInfoService {
|
||||
};
|
||||
|
||||
@SneakyThrows
|
||||
public <T> void exportFile(List<T> data, HttpServletResponse response,List passParam, Map<String,String> customizMap) {
|
||||
public <T> void exportFile(String tableName,List<Map> data, HttpServletResponse response,List passParam, Map<String,String> customizMap) {
|
||||
if (CollectionUtils.isEmpty(data)){
|
||||
throw new BindException("导出失败,没有导出数据"+data.size());
|
||||
}
|
||||
List<Map<String, Object>> excel_lst = new ArrayList<>();
|
||||
T t = data.get(0);
|
||||
Class<?> tClass = t.getClass();
|
||||
TableName tableName = tClass.getDeclaredAnnotation(TableName.class);
|
||||
Map t = data.get(0);
|
||||
if (tableName == null){
|
||||
tableName = t.getClass().getSuperclass().getDeclaredAnnotation(TableName.class);
|
||||
if (tableName == null){
|
||||
throw new BindException("导出失败,未获取到表名");
|
||||
}
|
||||
throw new BindException("导出失败,未获取到表名");
|
||||
}
|
||||
Map<String,String> map = this.TableColumn(tableName.value());
|
||||
Map<String,String> map = this.TableColumn(tableName);
|
||||
if (!CollectionUtils.isEmpty(passParam)){
|
||||
for (Object s : passParam) {
|
||||
map.remove(s);
|
||||
@@ -65,16 +60,12 @@ public class ColumnInfoService {
|
||||
}
|
||||
map.putAll(customizMap);
|
||||
if (CollectionUtils.isEmpty(map)){
|
||||
throw new BindException("导出失败,表结构信息失败"+tableName.value());
|
||||
throw new BindException("导出失败,表结构信息失败"+tableName);
|
||||
}
|
||||
for (T item : data) {
|
||||
for (Map item : data) {
|
||||
Map<String, Object> excelMap = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
try {
|
||||
Field field = tClass.getDeclaredField(entry.getKey());
|
||||
field.setAccessible(true);
|
||||
excelMap.put(entry.getValue(),field.get(item));
|
||||
}catch (NoSuchFieldException ex){}
|
||||
excelMap.put(entry.getValue(),item.get(entry.getKey()));
|
||||
}
|
||||
excel_lst.add(excelMap);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="unit_weight" label="物料单重(g)" />
|
||||
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="vehicle_weight" label="载具单重(g)" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="canuse_qty" label="可用重量(g)" :formatter="crud.formatNum3" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="canuse_qty" label="可用重量(g)" />
|
||||
<!-- <el-table-column show-overflow-tooltip prop="unit_name" label="单位" />-->
|
||||
<el-table-column show-overflow-tooltip prop="instorage_time" label="入库时间" min-width="150" />
|
||||
</el-table>
|
||||
|
||||
Reference in New Issue
Block a user