工位参数+路径

master
yangwl 4 years ago
parent bc59c963d7
commit 30df0a1a3b

@ -12,6 +12,9 @@ import com.ruoyi.nanjing.domain.TBdProductinfo;
import com.ruoyi.nanjing.domain.TBdSubstation; import com.ruoyi.nanjing.domain.TBdSubstation;
import com.ruoyi.nanjing.service.ITBdSubstationService; import com.ruoyi.nanjing.service.ITBdSubstationService;
import com.ruoyi.nanjing.service.ITSyTracestateService; import com.ruoyi.nanjing.service.ITSyTracestateService;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@ -23,6 +26,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -36,49 +43,178 @@ public class StationParaInfoController extends BaseController {
private ITSyTracestateService tracestateService; private ITSyTracestateService tracestateService;
@Autowired @Autowired
private ITBdSubstationService substationService; private ITBdSubstationService substationService;
@RequiresPermissions("nanjing:StationPara:view") @RequiresPermissions("nanjing:StationPara:view")
@GetMapping() @GetMapping()
public String ProRpList(ModelMap map) public String ProRpList(ModelMap map) {
{
List<TBdSubstation> substations = substationService.selectTBdSubstationList(new TBdSubstation()); List<TBdSubstation> substations = substationService.selectTBdSubstationList(new TBdSubstation());
map.addAttribute("list",substations); map.addAttribute("list", substations);
return prefix + "/StationParaInfo"; return prefix + "/StationParaInfo";
} }
@RequiresPermissions("nanjing:StationPara:list") @RequiresPermissions("nanjing:StationPara:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(HttpServletRequest request) public TableDataInfo list(HttpServletRequest request) {
{
String stationCode = request.getParameter("stationCode"); String stationCode = request.getParameter("stationCode");
String semiBarcode = request.getParameter("semiBarcode"); String semiBarcode = request.getParameter("semiBarcode");
String beginTime = request.getParameter("beginTime"); String beginTime = request.getParameter("beginTime");
String endTime = request.getParameter("endTime"); String endTime = request.getParameter("endTime");
Map<String, Object> map = new HashMap<String,Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("beginTime",beginTime); map.put("beginTime", beginTime);
map.put("endTime",endTime); map.put("endTime", endTime);
map.put("StationID",stationCode); map.put("StationID", stationCode);
map.put("Barcode",""); map.put("Barcode", "");
map.put("SemiBarcode",semiBarcode); map.put("SemiBarcode", semiBarcode);
map.put("StateID",""); map.put("StateID", "");
List list = tracestateService.selectStationPara(map); List<Map<String, Object>> list = tracestateService.selectStationPara(map);
for (int i = 0; i < list.size(); i++) {
if (list.get(i).containsKey("产品码")) {
continue;
} else {
list.get(i).put("产品码", "-");
}
}
return getDataTable(list); return getDataTable(list);
} }
// @RequiresPermissions("nanjing:StationPara:export") // @RequiresPermissions("nanjing:StationPara:export")
// @Log(title = "产品码查询", businessType = BusinessType.EXPORT) // @Log(title = "产品码查询", businessType = BusinessType.EXPORT)
// @PostMapping("/export") @PostMapping("/export")
// @ResponseBody @ResponseBody
// public AjaxResult export(HttpServletRequest request) public AjaxResult export(HttpServletRequest request,HttpServletResponse response) {
// { String semiBarcode = request.getParameter("semiBarcode");
// String semiBarcode = request.getParameter("semiBarcode"); Map map = new HashMap<String, Object>();
// Map map = new HashMap<String,Object>(); map.put("beginTime", null);
// map.put("beginTime",null); map.put("endTime", null);
// map.put("endTime",null); map.put("semiBarcode", semiBarcode);
// map.put("semiBarcode",semiBarcode); List list = tracestateService.selectStationPara(map);
// List<ParaAllShow> list = tracestateService.selectAllPara(map); HSSFWorkbook wb = listToExcle.getExcle("测试", list, 9);
// ExcelUtil<ParaAllShow> util = new ExcelUtil<ParaAllShow>(ParaAllShow.class); listToExcle.responseExcel(wb,"工位参数",response);
// return util.exportExcel(list, "StationPara"); return null;
//// return null; }
// }
public static class listToExcle{
public static HSSFWorkbook getExcle(String title, List<String> list, int colNums){
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet(title);
HSSFRow row;
HSSFCell cell;
HSSFCellStyle styleTitle = wb.createCellStyle();
//标题
// HSSFCellStyle styleTitle = wb.createCellStyle();
// styleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// HSSFFont fontTitle = wb.createFont();
// fontTitle.setFontHeightInPoints((short) 20);
// styleTitle.setFont(fontTitle);
//表头
HSSFCellStyle styleHead = wb.createCellStyle();
HSSFFont fontHead = wb.createFont();
fontHead.setFontHeightInPoints((short) 11);
styleHead.setFont(fontHead);
//表格
HSSFCellStyle styleBody = wb.createCellStyle();
HSSFFont fontBody = wb.createFont();
fontBody.setFontHeightInPoints((short) 10);
styleBody.setFont(fontBody);
//尾注
HSSFCellStyle styleFoot = wb.createCellStyle();
HSSFFont fontFoot = wb.createFont();
fontFoot.setFontHeightInPoints((short) 12);
fontFoot.setColor(HSSFColor.DARK_GREEN.index);
styleFoot.setFont(fontFoot);
styleFoot.setFillForegroundColor(HSSFColor.YELLOW.index);
//设置标题行
row = sheet.createRow(0);
cell = row.createCell(0);
//行高
row.setHeightInPoints((float) (10.75 * 3));
//内容
cell.setCellValue(title);
//样式
cell.setCellStyle(styleTitle);
// 合并单元格 (始行,终行,始列,终列)
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, colNums - 1));
//设置表头
row = sheet.createRow(1);
//行高
row.setHeightInPoints(15);
//内容
String str = list.get(0);
String[] ary = str.split(",");
for (int j = 0; j < ary.length; j++) {
cell = row.createCell(j);
cell.setCellValue(ary[j]);
cell.setCellStyle(styleHead);
}
//设置表格内容
for (int i = 2; i <= list.size(); i++) {
//序号列
row = sheet.createRow(i);
cell = row.createCell(0);
cell.setCellValue(i - 1);
cell.setCellStyle(styleBody);
//内容列
str = list.get(i - 1);
ary = str.split("");
for (int j = 1; j <= ary.length; j++) {
cell = row.createCell(j);
cell.setCellValue(ary[j - 1]);
cell.setCellStyle(styleBody);
}
}
//设置脚注
int n = sheet.getLastRowNum();
row = sheet.createRow(++n);
row.setHeightInPoints((float) (12.75 * 2));
cell = row.createCell(0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
cell.setCellValue("数据生成时间:" + sdf.format(new Date()));
cell.setCellStyle(styleFoot);
sheet.addMergedRegion(new CellRangeAddress(n, n, 0, colNums - 1));
// 自动调整列宽
for (int k = 0; k < colNums; k++) {
sheet.autoSizeColumn((short) k, true);
}
//手动设置列宽
//sheet.setColumnWidth(列号,宽度);
return wb;
}
//通过浏览器下载
public static void responseExcel(HSSFWorkbook wb, String fileName, HttpServletResponse response) {
OutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
wb.write(out);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
} }

@ -1,138 +1,138 @@
# 项目相关配置 # 项目相关配置
ruoyi: ruoyi:
# 名称 # 名称
name: Nanjing name: Nanjing
# 版本 # 版本
version: 4.3.1 version: 4.3.1
# 版权年份 # 版权年份
copyrightYear: 2021 copyrightYear: 2021
# 实例演示开关 # 实例演示开关
demoEnabled: false demoEnabled: false
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath profile: C:/ruoyi/uploadPath
# profile: /Users/sxile/MyWorkSpase/WorkSpase/uploadPath/RuoYi-SqlServer # profile: /Users/sxile/MyWorkSpase/WorkSpase/uploadPath/RuoYi-SqlServer
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为80 # 服务器的HTTP端口默认为80
port: 4935 port: 4935
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
tomcat: tomcat:
# tomcat的URI编码 # tomcat的URI编码
uri-encoding: UTF-8 uri-encoding: UTF-8
# tomcat最大线程数默认为200 # tomcat最大线程数默认为200
max-threads: 800 max-threads: 800
# Tomcat启动初始化的线程数默认值25 # Tomcat启动初始化的线程数默认值25
min-spare-threads: 30 min-spare-threads: 30
# 日志配置 # 日志配置
logging: logging:
level: level:
com.ruoyi: debug com.ruoyi: debug
org.springframework: warn org.springframework: warn
# 用户配置 # 用户配置
user: user:
password: password:
# 密码错误{maxRetryCount}次锁定10分钟 # 密码错误{maxRetryCount}次锁定10分钟
maxRetryCount: 5 maxRetryCount: 5
# Spring配置 # Spring配置
spring: spring:
# 模板引擎 # 模板引擎
thymeleaf: thymeleaf:
mode: HTML mode: HTML
encoding: utf-8 encoding: utf-8
# 禁用缓存 # 禁用缓存
cache: false cache: false
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: static/i18n/messages basename: static/i18n/messages
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
profiles: profiles:
active: druid active: druid
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 10MB max-file-size: 10MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 20MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
# 热部署开关 # 热部署开关
enabled: true enabled: true
# MyBatis # MyBatis
mybatis: mybatis:
# 搜索指定包别名 # 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件 # 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件 # 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
helperDialect: sqlserver helperDialect: sqlserver
reasonable: true reasonable: true
supportMethodsArguments: true supportMethodsArguments: true
params: count=countSql params: count=countSql
# Shiro # Shiro
shiro: shiro:
user: user:
# 登录地址 # 登录地址
loginUrl: /login loginUrl: /login
# 权限认证失败地址 # 权限认证失败地址
unauthorizedUrl: /unauth unauthorizedUrl: /unauth
# 首页地址 # 首页地址
indexUrl: /index indexUrl: /index
# 验证码开关 # 验证码开关
captchaEnabled: false captchaEnabled: false
# 验证码类型 math 数组计算 char 字符 # 验证码类型 math 数组计算 char 字符
captchaType: math captchaType: math
cookie: cookie:
# 设置Cookie的域名 默认空,即当前访问的域名 # 设置Cookie的域名 默认空,即当前访问的域名
domain: domain:
# 设置cookie的有效访问路径 # 设置cookie的有效访问路径
path: / path: /
# 设置HttpOnly属性 # 设置HttpOnly属性
httpOnly: true httpOnly: true
# 设置Cookie的过期时间天为单位 # 设置Cookie的过期时间天为单位
maxAge: 30 maxAge: 30
# 设置密钥务必保持唯一性生成方式直接拷贝到main运行即可KeyGenerator keygen = KeyGenerator.getInstance("AES"); SecretKey deskey = keygen.generateKey(); System.out.println(Base64.encodeToString(deskey.getEncoded())); # 设置密钥务必保持唯一性生成方式直接拷贝到main运行即可KeyGenerator keygen = KeyGenerator.getInstance("AES"); SecretKey deskey = keygen.generateKey(); System.out.println(Base64.encodeToString(deskey.getEncoded()));
cipherKey: zSyK5Kp6PZAAjlT+eeNMlg== cipherKey: zSyK5Kp6PZAAjlT+eeNMlg==
session: session:
# Session超时时间-1代表永不过期默认30分钟 # Session超时时间-1代表永不过期默认30分钟
expireTime: 30 expireTime: 30
# 同步session到数据库的周期默认1分钟 # 同步session到数据库的周期默认1分钟
dbSyncPeriod: 1 dbSyncPeriod: 1
# 相隔多久检查一次session的有效性默认就是10分钟 # 相隔多久检查一次session的有效性默认就是10分钟
validationInterval: 10 validationInterval: 10
# 同一个用户最大会话数比如2的意思是同一个账号允许最多同时两个人登录默认-1不限制 # 同一个用户最大会话数比如2的意思是同一个账号允许最多同时两个人登录默认-1不限制
maxSession: -1 maxSession: -1
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
kickoutAfter: false kickoutAfter: false
# 防止XSS攻击 # 防止XSS攻击
xss: xss:
# 过滤开关 # 过滤开关
enabled: true enabled: true
# 排除链接(多个用逗号分隔) # 排除链接(多个用逗号分隔)
excludes: /system/notice/* excludes: /system/notice/*
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
# Swagger配置 # Swagger配置
swagger: swagger:
# 是否开启swagger # 是否开启swagger
enabled: true enabled: true

@ -28,8 +28,8 @@
</li> </li>
<li> <li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="searc()"><i class="fa fa-search"></i>&nbsp;搜索</a> <a class="btn btn-primary btn-rounded btn-sm" onclick="searc()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;查询全部</a> <!-- <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;查询全部</a>-->
<a class="btn btn-info btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="nanjing:WorkTrayHistoryInfo:export"><i class="fa fa-download"></i> 导出</a> <!-- <a class="btn btn-info btn-rounded btn-sm" onclick="expro()" ><i class="fa fa-download"></i> 导出</a>-->
</li> </li>
</ul> </ul>
</div> </div>
@ -64,27 +64,80 @@
modalName: "工位参数查询", modalName: "工位参数查询",
success: function (json) { success: function (json) {
console.log(json); console.log(json);
var columnsArray1 = []; var columnsArray1 = [];
columnsArray1.push({field : "系统条码",title : "系统条码",colspan: 1,rowspan: 1}); for (var i = 0; i < (Object.keys(json.rows[0])).length; i++) {//Object.keys(obj) 获取key名称
columnsArray1.push({field : "semiBarcode" ,title : "产品码",colspan: 1,rowspan: 1}); var property = (Object.keys(json.rows[0]))[i];
columnsArray1.push({field : "机种类型",title : "机种类型",colspan: 1,rowspan: 1}); columnsArray1.push({
columnsArray1.push({field : "返修Y/N",title : "返修Y/N",colspan: 1,rowspan: 1}); "title": property,
columnsArray1.push({field : "合格状态",title : "合格状态",colspan: 1,rowspan: 1}); "field": property,
columnsArray1.push({field : "完成状态",title : "完成状态",colspan: 1,rowspan: 1}); switchable: true
columnsArray1.push({field : "当前工位",title : "当前工位",colspan: 1,rowspan: 1});
columnsArray1.push({field : "NG工位",title : "NG工位",colspan: 1,rowspan: 1}); });
columnsArray1.push({field : "标签Y/N",title : "标签Y/N",colspan: 1,rowspan: 1}); }
columnsArray1.push({field : "开始时间",title : "开始时间",colspan: 1,rowspan: 1});
columnsArray1.push({field : "结束时间",title : "结束时间",colspan: 1,rowspan: 1}); // console.log(json);
// var arrlength=[];
// json.rows.forEach(function (value) {
// var mapsize=Object.keys(value).length;
// arrlength.push(mapsize);
// })
// console.log(arrlength)
// var bigValue=arrlength[0];
// for (var i in arrlength){
// if (arrlength[i]>bigValue){
// bigValue=i;
// }
// }
// console.log(bigValue)
// console.log(json.rows[bigValue])
//
// var columnsArray1 = [];
// for (var p in json.rows[bigValue])
// {
// columnsArray1.push({field : "p",title : p,colspan: 1,rowspan: 1});
// }
// json.rows[bigValue].forEach(function (item,index,arr) {
// console.log(item,index,arr)
// })
// for(var i = 0; i < json.rows.length; i++)
// {
// // columnsArray1.push({field : x,title : x,colspan: 1,rowspan: 1});
// for (x in json.rows[i]) {
// // columnsArray1.push({field : x,title : x,colspan: 1,rowspan: 1});
// // console.log(x + "=" + json.rows[i][x]);
// }
// }
// if (json.rows.length>0){
// for (var i=0;i<=json.rows.length;i++){
// console.log(json.rows[i]);
// }
// }
$('#bootstrap-table1').bootstrapTable('destroy').bootstrapTable({
id: "bootstrap-table1",
data:json.rows[1], // var columnsArray1 = [];
// columnsArray1.push({field : "系统条码",title : "系统条码",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "semiBarcode" ,title : "产品码",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "机种类型",title : "机种类型",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "返修Y/N",title : "返修Y/N",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "合格状态",title : "合格状态",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "完成状态",title : "完成状态",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "当前工位",title : "当前工位",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "NG工位",title : "NG工位",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "标签Y/N",title : "标签Y/N",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "开始时间",title : "开始时间",colspan: 1,rowspan: 1});
// columnsArray1.push({field : "结束时间",title : "结束时间",colspan: 1,rowspan: 1});
$('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({
id: "bootstrap-table",
data:json.rows,
toolbar: "#toolbar", toolbar: "#toolbar",
singleSelect: false, singleSelect: false,
clickToSelect: true, clickToSelect: true,
sortName: "recordTime", sortName: "记录时间",
sortOrder: "desc", sortOrder: "desc",
pageSize: 50, pageSize: 50,
pageNumber: 1, pageNumber: 1,
@ -104,6 +157,14 @@
} }
}); });
} }
function expro() {
$.modal.confirm("确定导出所有" + "工位参数" + "吗?", function() {
$.modal.loading("正在导出数据,请稍后...");
$.post(prefix+"/export", function(result) {
})
})
}
</script> </script>
</body> </body>

Loading…
Cancel
Save