加载中 src/main/java/net/vtstar/zhongtong/avi/access/job/WheelAlignmentJob.java +76 −63 原始行号 差异行号 差异行 加载中 @@ -63,31 +63,60 @@ public class WheelAlignmentJob extends QuartzJobBean { String dateString = DateUtils.parseDateToString(startOfDay, "yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMMdd", Locale.ENGLISH); String newDateString = sdf.format(new Date()); String dataBaseFileName = "BL_Align"; for (String ipAddress : ipAddressList){ if (!PingIpUtils.ping(ipAddress, pingTimes, timeOut)) { log.error("ping: {}失败, 此次同步底盘四轮定位数据操作结束!", ipAddress); return; } //todo:账户, 密码, 文件位置需要变 String url = "smb://wanteng:wanteng@" + ipAddress + "/AN9637H/" + newDateString + ".mdb"; //todo:账户, 密码, 文件位置需要变 BL_Align(数据库文件) String url; if (ipAddress.equals(ipAddress1)){ url = "smb://wanteng:wanteng@" + ipAddress + "/AN9637H/" + newDateString + ".mdb"; }else { url = "smb://wanteng:wanteng@" + ipAddress + "/Database/" + dataBaseFileName + ".mdb"; } SmbFile file = null; String dateFile = baseUrl + newDateString + "-" + ipAddress + ".mdb"; try { file = new SmbFile(url); if (file.exists()) { SmbFileUtil.smbGet(url, baseUrl + newDateString + ".mdb"); SmbFileUtil.smbGet(url, dateFile); }else { log.error("日期: {} 的底盘车间四轮定位共享数据库文件不存在!", newDateString); log.error("日期: {} 的底盘车间四轮定位共享数据库文件不存在!", url); continue; } Database db; List<WheelAlignment> list = new ArrayList<>();; try { db = DatabaseBuilder.open(new File(baseUrl + newDateString + ".mdb")); db = DatabaseBuilder.open(new File(dateFile)); Set<String> tableNames = db.getTableNames(); for (String tableName : tableNames) { if (!"LEGEND-5214E5AF".equals(tableName)){ if ("LEGEND-5214E5AF".equals(tableName)){ saveData(ipAddress, db, list, tableName); } if (newDateString.equals(tableName)){ saveData(ipAddress, db, list, tableName); } } } catch (IOException e) { log.error("读取日期: {} 的数据库文件失败!ip: {}", dateString, ipAddress); continue; } mapper.delByFilter(new WhereFilter() {{ addFilter("create_time", Operation.GREATER_THAN, dateString); addFilter("ipAddress", Operation.EQUAL, ipAddress); }}, TestLineResult.class); mapper.insertList(list); log.info("更新四轮定位: {} 数据: {}条", ipAddress, list.size()); } catch (Exception e) { log.error("获取底盘车间四轮定位共享文件失败!ip: {}", ipAddress); } } log.info("--------同步底盘车间四轮定位数据结束--------"); } private void saveData(String ipAddress, Database db, List<WheelAlignment> list, String tableName) throws IOException { Table table = db.getTable(tableName); for (Row row : table) { WheelAlignment map = new WheelAlignment(); 加载中 加载中 @@ -146,20 +175,4 @@ public class WheelAlignmentJob extends QuartzJobBean { list.add(map); } } } catch (IOException e) { log.error("读取日期: {} 的数据库文件失败!ip: {}", dateString, ipAddress); continue; } mapper.delByFilter(new WhereFilter() {{ addFilter("create_time", Operation.GREATER_THAN, dateString); addFilter("ipAddress", Operation.EQUAL, ipAddress); }}, TestLineResult.class); mapper.insertList(list); log.info("更新四轮定位: {} 数据: {}条", ipAddress, list.size()); } catch (Exception e) { log.error("获取底盘车间四轮定位共享文件失败!ip: {}", ipAddress); } } log.info("--------同步底盘车间四轮定位数据结束--------"); } } src/main/java/net/vtstar/zhongtong/avi/laboratory/domain/DailyItemModel.java +6 −0 原始行号 差异行号 差异行 加载中 @@ -12,6 +12,7 @@ import lombok.Data; import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.NotNull; import java.util.Date; @ApiModel(value = "涂装日常检测项模板表") 加载中 @@ -22,6 +23,7 @@ public class DailyItemModel { @Id private Long id; @NotNull(message = "检测模板ID为空!") @Column(name = "check_model_id") @ApiModelProperty(notes = "检测模板ID") private Integer checkModelId; 加载中 加载中 @@ -50,6 +52,10 @@ public class DailyItemModel { @ApiModelProperty(notes = "频次") private String frequency; @Column(name = "is_necessary") @ApiModelProperty(notes = "是否为必检项") private Boolean isNecessary; @ApiModelProperty(notes = "创建时间") private Date createTime; 加载中 src/main/java/net/vtstar/zhongtong/avi/laboratory/domain/DailyItemRecord.java +5 −0 原始行号 差异行号 差异行 加载中 @@ -54,6 +54,11 @@ public class DailyItemRecord { @ApiModelProperty(notes = "频次") private String frequency; @Column(name = "is_necessary") @ApiModelProperty(notes = "是否为必检项") private Boolean isNecessary; @Column(name = "create_time") @ApiModelProperty(notes = "取样时间") private Date createTime; 加载中 src/main/java/net/vtstar/zhongtong/avi/laboratory/service/DailyCheckService.java +10 −4 原始行号 差异行号 差异行 加载中 @@ -16,8 +16,6 @@ import net.vtstar.zhongtong.avi.laboratory.mapper.DailyCheckModelMapper; import net.vtstar.zhongtong.avi.laboratory.mapper.DailyCheckRecordMapper; import net.vtstar.zhongtong.avi.laboratory.mapper.DailyItemModelMapper; import net.vtstar.zhongtong.avi.laboratory.mapper.DailyItemRecordMapper; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; 加载中 加载中 @@ -177,8 +175,16 @@ public class DailyCheckService { workbook = new XSSFWorkbook(is); sheet = workbook.getSheetAt(0); if (sheet != null) { XSSFRow row = sheet.getRow(4); XSSFCell cell = row.getCell(1); sheet.getRow(1).getCell(5).setCellValue(recordById.getRev()); sheet.getRow(2).getCell(5).setCellValue(recordById.getSheetNo()); sheet.getRow(3).getCell(5).setCellValue(recordById.getNo()); if ("PICKLING".equals(recordById.getType())){ sheet.getRow(4).getCell(0).setCellValue("酸洗磷化线槽液日常检测报告"); }else if("ELECTROPHORESIS".equals(recordById.getType())){ sheet.getRow(4).getCell(0).setCellValue("电泳槽液日常检测报告"); }else { sheet.getRow(4).getCell(0).setCellValue("前处理槽液日常检测报告"); } } ServletOutputStream outputStream = response.getOutputStream(); String filename = "检测报告"; 加载中 加载中
src/main/java/net/vtstar/zhongtong/avi/access/job/WheelAlignmentJob.java +76 −63 原始行号 差异行号 差异行 加载中 @@ -63,31 +63,60 @@ public class WheelAlignmentJob extends QuartzJobBean { String dateString = DateUtils.parseDateToString(startOfDay, "yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMMdd", Locale.ENGLISH); String newDateString = sdf.format(new Date()); String dataBaseFileName = "BL_Align"; for (String ipAddress : ipAddressList){ if (!PingIpUtils.ping(ipAddress, pingTimes, timeOut)) { log.error("ping: {}失败, 此次同步底盘四轮定位数据操作结束!", ipAddress); return; } //todo:账户, 密码, 文件位置需要变 String url = "smb://wanteng:wanteng@" + ipAddress + "/AN9637H/" + newDateString + ".mdb"; //todo:账户, 密码, 文件位置需要变 BL_Align(数据库文件) String url; if (ipAddress.equals(ipAddress1)){ url = "smb://wanteng:wanteng@" + ipAddress + "/AN9637H/" + newDateString + ".mdb"; }else { url = "smb://wanteng:wanteng@" + ipAddress + "/Database/" + dataBaseFileName + ".mdb"; } SmbFile file = null; String dateFile = baseUrl + newDateString + "-" + ipAddress + ".mdb"; try { file = new SmbFile(url); if (file.exists()) { SmbFileUtil.smbGet(url, baseUrl + newDateString + ".mdb"); SmbFileUtil.smbGet(url, dateFile); }else { log.error("日期: {} 的底盘车间四轮定位共享数据库文件不存在!", newDateString); log.error("日期: {} 的底盘车间四轮定位共享数据库文件不存在!", url); continue; } Database db; List<WheelAlignment> list = new ArrayList<>();; try { db = DatabaseBuilder.open(new File(baseUrl + newDateString + ".mdb")); db = DatabaseBuilder.open(new File(dateFile)); Set<String> tableNames = db.getTableNames(); for (String tableName : tableNames) { if (!"LEGEND-5214E5AF".equals(tableName)){ if ("LEGEND-5214E5AF".equals(tableName)){ saveData(ipAddress, db, list, tableName); } if (newDateString.equals(tableName)){ saveData(ipAddress, db, list, tableName); } } } catch (IOException e) { log.error("读取日期: {} 的数据库文件失败!ip: {}", dateString, ipAddress); continue; } mapper.delByFilter(new WhereFilter() {{ addFilter("create_time", Operation.GREATER_THAN, dateString); addFilter("ipAddress", Operation.EQUAL, ipAddress); }}, TestLineResult.class); mapper.insertList(list); log.info("更新四轮定位: {} 数据: {}条", ipAddress, list.size()); } catch (Exception e) { log.error("获取底盘车间四轮定位共享文件失败!ip: {}", ipAddress); } } log.info("--------同步底盘车间四轮定位数据结束--------"); } private void saveData(String ipAddress, Database db, List<WheelAlignment> list, String tableName) throws IOException { Table table = db.getTable(tableName); for (Row row : table) { WheelAlignment map = new WheelAlignment(); 加载中 加载中 @@ -146,20 +175,4 @@ public class WheelAlignmentJob extends QuartzJobBean { list.add(map); } } } catch (IOException e) { log.error("读取日期: {} 的数据库文件失败!ip: {}", dateString, ipAddress); continue; } mapper.delByFilter(new WhereFilter() {{ addFilter("create_time", Operation.GREATER_THAN, dateString); addFilter("ipAddress", Operation.EQUAL, ipAddress); }}, TestLineResult.class); mapper.insertList(list); log.info("更新四轮定位: {} 数据: {}条", ipAddress, list.size()); } catch (Exception e) { log.error("获取底盘车间四轮定位共享文件失败!ip: {}", ipAddress); } } log.info("--------同步底盘车间四轮定位数据结束--------"); } }
src/main/java/net/vtstar/zhongtong/avi/laboratory/domain/DailyItemModel.java +6 −0 原始行号 差异行号 差异行 加载中 @@ -12,6 +12,7 @@ import lombok.Data; import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.NotNull; import java.util.Date; @ApiModel(value = "涂装日常检测项模板表") 加载中 @@ -22,6 +23,7 @@ public class DailyItemModel { @Id private Long id; @NotNull(message = "检测模板ID为空!") @Column(name = "check_model_id") @ApiModelProperty(notes = "检测模板ID") private Integer checkModelId; 加载中 加载中 @@ -50,6 +52,10 @@ public class DailyItemModel { @ApiModelProperty(notes = "频次") private String frequency; @Column(name = "is_necessary") @ApiModelProperty(notes = "是否为必检项") private Boolean isNecessary; @ApiModelProperty(notes = "创建时间") private Date createTime; 加载中
src/main/java/net/vtstar/zhongtong/avi/laboratory/domain/DailyItemRecord.java +5 −0 原始行号 差异行号 差异行 加载中 @@ -54,6 +54,11 @@ public class DailyItemRecord { @ApiModelProperty(notes = "频次") private String frequency; @Column(name = "is_necessary") @ApiModelProperty(notes = "是否为必检项") private Boolean isNecessary; @Column(name = "create_time") @ApiModelProperty(notes = "取样时间") private Date createTime; 加载中
src/main/java/net/vtstar/zhongtong/avi/laboratory/service/DailyCheckService.java +10 −4 原始行号 差异行号 差异行 加载中 @@ -16,8 +16,6 @@ import net.vtstar.zhongtong.avi.laboratory.mapper.DailyCheckModelMapper; import net.vtstar.zhongtong.avi.laboratory.mapper.DailyCheckRecordMapper; import net.vtstar.zhongtong.avi.laboratory.mapper.DailyItemModelMapper; import net.vtstar.zhongtong.avi.laboratory.mapper.DailyItemRecordMapper; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; 加载中 加载中 @@ -177,8 +175,16 @@ public class DailyCheckService { workbook = new XSSFWorkbook(is); sheet = workbook.getSheetAt(0); if (sheet != null) { XSSFRow row = sheet.getRow(4); XSSFCell cell = row.getCell(1); sheet.getRow(1).getCell(5).setCellValue(recordById.getRev()); sheet.getRow(2).getCell(5).setCellValue(recordById.getSheetNo()); sheet.getRow(3).getCell(5).setCellValue(recordById.getNo()); if ("PICKLING".equals(recordById.getType())){ sheet.getRow(4).getCell(0).setCellValue("酸洗磷化线槽液日常检测报告"); }else if("ELECTROPHORESIS".equals(recordById.getType())){ sheet.getRow(4).getCell(0).setCellValue("电泳槽液日常检测报告"); }else { sheet.getRow(4).getCell(0).setCellValue("前处理槽液日常检测报告"); } } ServletOutputStream outputStream = response.getOutputStream(); String filename = "检测报告"; 加载中