代码更新
This commit is contained in:
@@ -13,9 +13,13 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
@@ -63,4 +67,11 @@ public class SubpackagerelationController {
|
||||
subpackagerelationService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(@RequestParam Map map,HttpServletResponse response) throws IOException {
|
||||
subpackagerelationService.download(map, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,4 +62,13 @@ public interface SubpackagerelationService {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param map 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(Map map, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.pdm.bi.service.SubpackagerelationService;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
@@ -13,6 +14,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -27,6 +32,8 @@ import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
@@ -151,4 +158,82 @@ public class SubpackagerelationServiceImpl implements SubpackagerelationService
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
String material_name = MapUtil.getStr(whereJson, "material_name");
|
||||
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name");
|
||||
String customer_name = MapUtil.getStr(whereJson, "customer_name");
|
||||
String customer_description = MapUtil.getStr(whereJson, "customer_description");
|
||||
String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn");
|
||||
|
||||
String container_name = MapUtil.getStr(whereJson, "container_name");
|
||||
String is_un_plan_production = MapUtil.getStr(whereJson, "is_un_plan_production");
|
||||
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
|
||||
String date_of_production = MapUtil.getStr(whereJson, "date_of_production");
|
||||
String date_of_FG_inbound = MapUtil.getStr(whereJson, "date_of_FG_inbound");
|
||||
String status = MapUtil.getStr(whereJson, "status");
|
||||
|
||||
// 子卷号 是否计划外子卷 sap批次 制造完成日期 入库日期 状态
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code","%"+material_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(package_box_sn)) map.put("package_box_sn","%"+package_box_sn+"%");
|
||||
if (ObjectUtil.isNotEmpty(material_name)) map.put("material_name","%"+material_name+"%");
|
||||
if (ObjectUtil.isNotEmpty(sale_order_name)) map.put("sale_order_name","%"+sale_order_name+"%");
|
||||
if (ObjectUtil.isNotEmpty(customer_name)) map.put("customer_name","%"+customer_name+"%");
|
||||
if (ObjectUtil.isNotEmpty(customer_description)) map.put("customer_description","%"+customer_description+"%");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(container_name)) map.put("container_name","%"+container_name+"%");
|
||||
if (ObjectUtil.isNotEmpty(sap_pcsn)) map.put("sap_pcsn","%"+sap_pcsn+"%");
|
||||
map.put("is_un_plan_production",is_un_plan_production);
|
||||
map.put("date_of_production",date_of_production);
|
||||
map.put("date_of_FG_inbound",date_of_FG_inbound);
|
||||
map.put("status",status);
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("PDM_BI_SUBPACKAGER01").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
JSONObject json = resultJSONArray.getJSONObject(i);
|
||||
Map<String, Object> mp = new LinkedHashMap<>();
|
||||
|
||||
mp.put("木箱码", json.getString("package_box_sn"));
|
||||
mp.put("箱内子卷数量", json.getString("quanlity_in_box"));
|
||||
mp.put("客户编码", json.getString("customer_name"));
|
||||
mp.put("客户名称", json.getString("customer_description"));
|
||||
mp.put("销售订单及行号", json.getString("sale_order_name"));
|
||||
mp.put("子卷号", json.getString("container_name"));
|
||||
mp.put("产品编码", json.getString("product_name"));
|
||||
mp.put("产品描述", json.getString("product_description"));
|
||||
mp.put("sap批次", json.getString("sap_pcsn"));
|
||||
mp.put("产品规格(幅宽)", json.getString("width"));
|
||||
mp.put("产品厚度", json.getString("thickness"));
|
||||
mp.put("单位面积质量", json.getString("mass_per_unit_area"));
|
||||
mp.put("净重", json.getString("net_weight"));
|
||||
mp.put("长度", json.getString("length"));
|
||||
mp.put("制造完成日期", json.getString("date_of_production"));
|
||||
mp.put("入库日期", json.getString("date_of_fg_inbound"));
|
||||
mp.put("木箱自身重量", json.getString("box_weight"));
|
||||
mp.put("保质期", json.getString("quality_guaran_period"));
|
||||
mp.put("子卷的物性值1", json.getString("un_plan_product_property1"));
|
||||
mp.put("子卷的物性值2", json.getString("un_plan_product_property2"));
|
||||
mp.put("子卷的物性值3", json.getString("un_plan_product_property3"));
|
||||
mp.put("木箱料号", json.getString("box_type"));
|
||||
mp.put("长", json.getString("box_length"));
|
||||
mp.put("宽", json.getString("box_width"));
|
||||
mp.put("高", json.getString("box_high"));
|
||||
mp.put("备注", json.getString("remark"));
|
||||
mp.put("来源交货单", json.getString("vbeln"));
|
||||
mp.put("来源交货单行", json.getString("posnr"));
|
||||
mp.put("销售订单描述", json.getString("sale_order_description"));
|
||||
mp.put("创建人", json.getString("create_name"));
|
||||
mp.put("创建时间", json.getString("create_time"));
|
||||
list.add(mp);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,18 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission">
|
||||
<!-- <el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="downdtl"
|
||||
>
|
||||
导出Excel
|
||||
</el-button>-->
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="1000px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="160px">
|
||||
@@ -439,6 +450,8 @@ import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
const defaultForm = { workorder_id: null, package_box_sn: null, quanlity_in_box: null, box_weight: null, quality_guaran_period: null, sale_order_name: null, customer_name: null, customer_description: null, product_name: null, product_description: null, date_of_fg_inbound: null, container_name: null, width: null, thickness: null, mass_per_unit_area: null, net_weight: null, length: null, date_of_production: null, is_un_plan_production: null, un_plan_product_property1: null, un_plan_product_property2: null, un_plan_product_property3: null, box_type: null, sap_pcsn: null, remark: null, create_id: null, create_name: null, create_time: null, status: null, isreprintpackageboxlabel: null, isunpackbox: null, thickness_request: null, width_standard: null }
|
||||
export default {
|
||||
@@ -506,8 +519,19 @@ export default {
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
downdtl() {
|
||||
if (this.currentRow !== null) {
|
||||
crud.downloadLoading = true
|
||||
download('/api/subpackagerelation/download', this.crud.query).then(result => {
|
||||
debugger
|
||||
downloadFile(result, '子卷包装', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user