JRT业务开发起步

这是一段充满挑战与奋斗的旅程,自第一行Java代码的写下起,便历经重重险阻。从细微的代码行,逐步汇聚成实用的工具类方法;从工具类方法的积累,逐渐构建起功能强大的工具包;再从工具包的整合,最终搭建起稳健的运行程序体系。这个过程,就像是一场从点到线、从线到面、从面到立体的华丽蜕变。如今,JRT已顺利迈入正常的业务开发阶段,这半年里日夜兼程、不懈努力的加班时光,终于换来了令人欣慰的效果,一切都是值得的。

演示视频

B站视频

目前已经具有以下部分(涉及网站、客户端、打印导出、运维、仪器连接的方方面面):
1.Web框架
2.JRTClient
3.JRTBrowser
4.模板设计器
5.JRTMachine
6.码表
7.代码生成器
8.jrt的linux命令
9.菜单体系
来满足Web业务开发、打印、打印pdf、生成pdf、导出Excel、在线预览、在线得到打印的pdf的Base64串、定制浏览器、模板设计、连设备程序、码表程序、代码生成工具、Linux运维命令、登录菜单和权限。

首先全新设计了登录体系,登录抽象各系统的差异性,提供各登录的共性实现,在保证登录差异性的情况下提供最大的登录共性。张弛有度、设计的首要目标就是在不入侵别人业务的情况下,最大程度为各模块提供公共逻辑,既不过度设计,也不揉成一团。任何使用该登录体系的人只要关注登录接口实现,然后把实现类配置到容器,在登录界面传入配置代码既是该系统的登录界面了。(使用面向接口和IOC)
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

登录接口

package JRT.Login;import java.util.List;import JRT.Login.SelectRoleDto;/*** 作为JRT实现登录的抽象接口,不同系统登录实现该接口,把接口实现类配置到容器里,通过给登录界面URL指定LoginType为配置对象ID实现不同系统的登录,* 从而方便各个依赖JRT开发的系统共享登录和菜单功能部分,可以快速把登录和菜单并入自己系统而又不需要介入太多,自己可以用自己的用户表和用户权限部分。*/
public interface ILogin {/*** 得到登录界面显示的大标题** @return 大标题*/String GetSystemTitle();/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/String GetSystemName();/*** 得到登录界面Url显示的名称** @return URL名称*/String GetUrlTitle();/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/String GetRoleTypeName();/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/String GetSYSPasswordLevel() throws Exception;/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/int GetSYSPasswordLength() throws Exception;/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过*/boolean CheckUser(String userCode, String pass) throws Exception;/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/List<SelectRoleDto> GetSelectRole(String userCode) throws Exception;/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/String ChangePassword(String userCode, String passOld, String passNew) throws Exception;
}

检验登录实现实例

package JRT.Login;import JRT.Core.Dto.HashParam;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.PassWordUtil;
import JRT.DAL.ORM.EntityManager.EntityManagerFactory;
import JRT.DAL.ORM.EntityManager.IEntityManager;
import JRT.Login.SelectRoleDto;
import JRT.Model.Entity.*;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.List;/*** 作为登录到检验工作组的实现类,其他登录科室和试剂组的登录实现参照此类即可,由登录界面通过URL上的LoginType从容器获取登录实现类*/
public class LoginLIS implements JRT.Login.ILogin {/*** 访问数据库*/private IEntityManager entityManager = null;/*** 给业务脚本提供的操作数据库的对象*/public IEntityManager EntityManager() {if (entityManager == null) {entityManager = EntityManagerFactory.CreateEntityManager("");}return entityManager;}/*** 得到登录界面显示的大标题** @return 大标题*/@Overridepublic String GetSystemTitle() {return "检验信息管理系统";}/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/@Overridepublic String GetSystemName() {return "检验系统";}/*** 得到登录界面Url显示的名称** @return URL名称*/@Overridepublic String GetUrlTitle() {return "JRTLIS © 1.0";}/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/@Overridepublic String GetRoleTypeName() {return "工作组";}/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/@Overridepublic String GetSYSPasswordLevel() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLevel");if (dto != null) {return dto.ParaValue;}return "";}/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/@Overridepublic int GetSYSPasswordLength() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLength");if (dto != null) {if (dto.ParaValue != null && !dto.ParaValue.isEmpty()) {return Integer.valueOf(dto.ParaValue);}}return 9;}/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过, 验证不通过的前端都统一返回用户名或密码错误*/@Overridepublic boolean CheckUser(String userCode, String pass) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {LogUtils.WriteDebugLog("用户:" + userCode + "不存在");return false;}//比较密码boolean checkRes = PassWordUtil.PassCompare(pass, user.Password);return checkRes;}/*** 获取用户角色** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/@Overridepublic List<SelectRoleDto> GetSelectRole(String userCode) throws Exception {List<SelectRoleDto> retList = new ArrayList<>();//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return retList;}HashParam para = new HashParam();para.Add("UserDR", user.RowID);List<SYSUserRole> roleList = EntityManager().FindAllSimple(SYSUserRole.class, para);if (roleList != null && roleList.size() > 0) {for (SYSUserRole dto : roleList) {//取工作组数据BTWorkGroup wgDto = EntityManager().DolerGet(BTWorkGroup.class, dto.WorkGroupDR);//得到科室BTDepartment depDto = EntityManager().DolerGet(BTDepartment.class, wgDto.DepartmentDR);//得到医院BTHospital hosDto = EntityManager().DolerGet(BTHospital.class, depDto.HospitalDR);//岗位名称String postName = "";if (dto.PostDR != null) {//取岗位数据SYSPost postDto = EntityManager().DolerGet(SYSPost.class, dto.WorkGroupDR);postName = "[" + postDto.CName + "]";}SelectRoleDto role = new SelectRoleDto();role.RoleDR = dto.RoleDR;role.RoleName = wgDto.CName + postName;//放工作组role.GroupID = String.valueOf(dto.WorkGroupDR);role.UserID = String.valueOf(user.RowID);role.UserCode = user.Code;role.UserName = user.CName;role.SessionStr = user.RowID + "^" + dto.WorkGroupDR + "^" + depDto.RowID + "^" + dto.RoleDR + "^" + hosDto.RowID;retList.add(role);}}return retList;}/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/@Overridepublic String ChangePassword(String userCode, String passOld, String passNew) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return "用户:" + userCode + "不存在!";}//比较密码boolean checkRes = PassWordUtil.PassCompare(passOld, user.Password);if (checkRes == false) {return "用户名或密码不正确!";}//加密密码user.Password = PassWordUtil.PassEntry(passNew);//更新密码List<String> upCol = new ArrayList<>();upCol.add("Password");int ret = EntityManager().Update(user, upCol);if (ret == 1) {return "";} else {return "修改密码发送错误!";}}
}

试剂登录实现

package JRT.Login;import JRT.Core.Dto.HashParam;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.PassWordUtil;
import JRT.DAL.ORM.EntityManager.EntityManagerFactory;
import JRT.DAL.ORM.EntityManager.IEntityManager;
import JRT.Login.SelectRoleDto;
import JRT.Model.Entity.*;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.List;/*** 作为登录到试剂的实现类,其他登录科室和护士站的登录实现参照此类即可,由登录界面通过URL上的LoginType从容器获取登录实现类*/
public class LoginRG implements JRT.Login.ILogin {/*** 访问数据库*/private IEntityManager entityManager = null;/*** 给业务脚本提供的操作数据库的对象*/public IEntityManager EntityManager() {if (entityManager == null) {entityManager = EntityManagerFactory.CreateEntityManager("");}return entityManager;}/*** 得到登录界面显示的大标题** @return 大标题*/@Overridepublic String GetSystemTitle() {return "试剂库存管理系统";}/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/@Overridepublic String GetSystemName() {return "试剂系统";}/*** 得到登录界面Url显示的名称** @return URL名称*/@Overridepublic String GetUrlTitle() {return "JRTRG © 1.0";}/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/@Overridepublic String GetRoleTypeName() {return "试剂组";}/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/@Overridepublic String GetSYSPasswordLevel() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLevel");if (dto != null) {return dto.ParaValue;}return "";}/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/@Overridepublic int GetSYSPasswordLength() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLength");if (dto != null) {if (dto.ParaValue != null && !dto.ParaValue.isEmpty()) {return Integer.valueOf(dto.ParaValue);}}return 9;}/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过, 验证不通过的前端都统一返回用户名或密码错误*/@Overridepublic boolean CheckUser(String userCode, String pass) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {LogUtils.WriteDebugLog("用户:" + userCode + "不存在");return false;}//比较密码boolean checkRes = PassWordUtil.PassCompare(pass, user.Password);return checkRes;}/*** 获取用户角色** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/@Overridepublic List<SelectRoleDto> GetSelectRole(String userCode) throws Exception {List<SelectRoleDto> retList = new ArrayList<>();//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return retList;}HashParam para = new HashParam();para.Add("UserDR", user.RowID);List<SYSUserReagentRole> roleList = EntityManager().FindAllSimple(SYSUserReagentRole.class, para);if (roleList != null && roleList.size() > 0) {for (SYSUserReagentRole dto : roleList) {//取试剂组数据SYSReagentGroup rgDto = EntityManager().DolerGet(SYSReagentGroup.class, dto.ReagentGroupDR);//得到科室BTDepartment depDto = EntityManager().DolerGet(BTDepartment.class, rgDto.DepartmentDR);//得到医院BTHospital hosDto = EntityManager().DolerGet(BTHospital.class, depDto.HospitalDR);SelectRoleDto role = new SelectRoleDto();role.RoleDR = dto.RoleDR;role.RoleName = rgDto.CName;//放工作组role.GroupID = String.valueOf(dto.ReagentGroupDR);role.UserID = String.valueOf(user.RowID);role.UserCode = user.Code;role.UserName = user.CName;role.SessionStr = user.RowID + "^" + dto.ReagentGroupDR + "^" + depDto.RowID + "^" + dto.RoleDR + "^" + hosDto.RowID;retList.add(role);}}return retList;}/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/@Overridepublic String ChangePassword(String userCode, String passOld, String passNew) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return "用户:" + userCode + "不存在!";}//比较密码boolean checkRes = PassWordUtil.PassCompare(passOld, user.Password);if (checkRes == false) {return "用户名或密码不正确!";}//加密密码user.Password = PassWordUtil.PassEntry(passNew);//更新密码List<String> upCol = new ArrayList<>();upCol.add("Password");int ret = EntityManager().Update(user, upCol);if (ret == 1) {return "";} else {return "修改密码发送错误!";}}
}

医生登录实现

package JRT.Login;import JRT.Core.Dto.HashParam;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.PassWordUtil;
import JRT.DAL.ORM.EntityManager.EntityManagerFactory;
import JRT.DAL.ORM.EntityManager.IEntityManager;
import JRT.Login.SelectRoleDto;
import JRT.Model.Entity.*;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.List;/*** 作为登录到医生科室的实现类,其他登录实现参照此类即可,由登录界面通过URL上的LoginType从容器获取登录实现类*/
public class LoginDOC implements JRT.Login.ILogin {/*** 访问数据库*/private IEntityManager entityManager = null;/*** 给业务脚本提供的操作数据库的对象*/public IEntityManager EntityManager() {if (entityManager == null) {entityManager = EntityManagerFactory.CreateEntityManager("");}return entityManager;}/*** 得到登录界面显示的大标题** @return 大标题*/@Overridepublic String GetSystemTitle() {return "医生站系统";}/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/@Overridepublic String GetSystemName() {return "医生站";}/*** 得到登录界面Url显示的名称** @return URL名称*/@Overridepublic String GetUrlTitle() {return "JRTHIS © 1.0";}/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/@Overridepublic String GetRoleTypeName() {return "科室";}/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/@Overridepublic String GetSYSPasswordLevel() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLevel");if (dto != null) {return dto.ParaValue;}return "";}/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/@Overridepublic int GetSYSPasswordLength() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLength");if (dto != null) {if (dto.ParaValue != null && !dto.ParaValue.isEmpty()) {return Integer.valueOf(dto.ParaValue);}}return 9;}/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过, 验证不通过的前端都统一返回用户名或密码错误*/@Overridepublic boolean CheckUser(String userCode, String pass) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {LogUtils.WriteDebugLog("用户:" + userCode + "不存在");return false;}//比较密码boolean checkRes = PassWordUtil.PassCompare(pass, user.Password);return checkRes;}/*** 获取用户角色** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/@Overridepublic List<SelectRoleDto> GetSelectRole(String userCode) throws Exception {List<SelectRoleDto> retList = new ArrayList<>();//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return retList;}HashParam para = new HashParam();para.Add("UserDR", user.RowID);List<SYSUserLocationRole> roleList = EntityManager().FindAllSimple(SYSUserLocationRole.class, para);if (roleList != null && roleList.size() > 0) {for (SYSUserLocationRole dto : roleList) {//取试剂组数据BTLocation locDto = EntityManager().DolerGet(BTLocation.class, dto.LocationDR);//得到医院BTHospital hosDto = EntityManager().DolerGet(BTHospital.class, locDto.HospitalDR);SelectRoleDto role = new SelectRoleDto();role.RoleDR = dto.RoleDR;role.RoleName = locDto.CName;//放工作组role.GroupID = String.valueOf(dto.LocationDR);role.UserID = String.valueOf(user.RowID);role.UserCode = user.Code;role.UserName = user.CName;role.SessionStr = user.RowID + "^" + dto.LocationDR + "^" + dto.LocationDR + "^" + dto.RoleDR + "^" + hosDto.RowID;retList.add(role);}}return retList;}/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/@Overridepublic String ChangePassword(String userCode, String passOld, String passNew) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return "用户:" + userCode + "不存在!";}//比较密码boolean checkRes = PassWordUtil.PassCompare(passOld, user.Password);if (checkRes == false) {return "用户名或密码不正确!";}//加密密码user.Password = PassWordUtil.PassEntry(passNew);//更新密码List<String> upCol = new ArrayList<>();upCol.add("Password");int ret = EntityManager().Update(user, upCol);if (ret == 1) {return "";} else {return "修改密码发送错误!";}}
}

配置登录实现类
在这里插入图片描述

全java化的打印导出支持
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

jrt命令支持
在这里插入图片描述

监听支持
在这里插入图片描述
Windows和Linux下的浏览器支持
在这里插入图片描述

在这里插入图片描述

超低占用资源,在腾讯云2G内存下运行数据库、web、svn服务器的内存占用情况

在这里插入图片描述

在这里插入图片描述

极少开发环境依赖
开发环境只需要idea+jdk,在Windows和Linux都很容易准备好,不需要额外的配置

极低的上手门槛
无需精通Maven管理、无需繁琐配置IDEA插件、无需深入学习Spring框架,更无需掌握MyBatis写SQL与Mapper设置。只需在具备开发环境的基础上,轻松更新代码并一键运行,掌握以下代码知识,即可轻松驾驭JRT。简洁明了的代码设计,实现了打印、导出、上传Excel、生成PDF、文件服务操作以及摄像头调用等诸多功能。JRT的魅力正在于它的去繁就简,让编程回归本真,为您带来高效且愉悦的开发体验。

界面示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>JRTPrintTemplateEle供拷贝代码使用</title><link rel="shortcut icon" href="../../resource/common/images/favicon.ico" /><script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script><script src="../../jrtprint/js/JRTPrint.js" type="text/javascript"></script><script language="javascript" type="text/javascript">SYSPageCommonInfo.Init();var BasePath = '';var ResourcePath = '';var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;var GroupID = SYSPageCommonInfo.Data.Sesssion.GroupID;var SessionStr = SYSPageCommonInfo.Data.SessionStr;</script><script type="text/javascript">//全局变量var me = {actionUrl: '../ashx/ashJRTPrintTemplateEle.ashx'};//jquery入口$(function () {//导出Excel$("#btnExport").click(function () {var para = {};var tempPath = DealExportExcelTMPName("打印元素.xls");JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//导出Excel多模板$("#btnExport1").click(function () {var para = {};var tempPath = DealExportExcelTMPName("打印元素多模板");JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//导出Excel无模板$("#btnExport0").click(function () {var para = {};var tempPath = "";JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//打印预览$("#btnPrintPreview").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintPreview";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//打印表格$("#btnPrintPreviewGrid").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.DrawGrid@GetData";JRTBasePrint(Param);});//打印报告$("#btnPrintReport").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintTemplateTest@GetData";JRTBasePrint(Param);});//集中打印$("#btnCenterPrint").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.CenterPrintTest@GetData";JRTBasePrint(Param);});//在线预览$("#btnPrintPreviewInline").click(function () {showwin("#winPrintPreview", "在线打印预览", '../../facade/form/frmJRTPrintDrawView.aspx?PrintDR=' + 1 + '&PrintClassName=vm.test.PrintBarCodeTest', 950, $(window).height() - 20, true, "10px");});//打印$("#btnPrint").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//PDF$("#btnPDF").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PDF#-1";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//PDF弹窗$("#btnPDFSave").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PDF#0";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//上传文件到文件服务$("#btnUpfile").click(function () {$("#file_upload").click();});//改名文件$("#btnRenamefile").click(function () {//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=ReNameImageFile',success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}alert("成功");}});});//删除文件$("#btnDeletefile").click(function () {//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteImageFile',success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}alert("成功");}});});//Excel得到JSON$("#btnExcelGetJson").click(function () {JRTGetExcelFileJson(function (retJson) {alert(JSON.stringify(retJson));});});//新增数据点击$("#btnAddJRTPrintTemplateEle").click(function () {$("#txtJRTPrintTemplateEleRowID").val(""); $('#winEditJRTPrintTemplateEle').window({title: TranslateDataMTHD('Add Data', '新增数据', ''),modal: true});});//修改数据点击$("#btnUpdateJRTPrintTemplateEle").click(function () {UpdateJRTPrintTemplateEle();});//修改数据function UpdateJRTPrintTemplateEle(row){var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");if(row!=null){selectRow=row;}if (selectRow == null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');return;}$("#formJRTPrintTemplateEle").form('load', selectRow);$('#winEditJRTPrintTemplateEle').window({title: TranslateDataMTHD('Update Data', '修改数据', ''),modal: true});}//删除数据点击$("#btnDeleteJRTPrintTemplateEle").click(function () {var checkRow = $('#dgJRTPrintTemplateEle').datagrid("getChecked");var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');return;}if ((checkRow == null || checkRow.length == 0)) {checkRow=[selectRow];}var RowIDS = "";for (var i = 0; i < checkRow.length; i++) {if (i == 0) {RowIDS = checkRow[i].RowID;}else {RowIDS += "^" + checkRow[i].RowID;}}$.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {if (r) {//开启等待$.messager.progress({ text: TranslateDataMTHD("Deleting data","正在删除数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteJRTPrintTemplateEle',data: { RowIDS: RowIDS },success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QryJRTPrintTemplateEle();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully deleted!", "删除成功!", ""),timeout: 500,showType: 'slide'});}}});}});});//保存数据$("#btnSaveJRTPrintTemplateEle").click(function () {var saveData = jQuery.parseJSON($("#formJRTPrintTemplateEle").serializeObject());//开启等待$.messager.progress({ text: TranslateDataMTHD("Saving data","正在保存数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=SaveJRTPrintTemplateEle',data: saveData,success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QryJRTPrintTemplateEle();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully saveed!", "保存成功!", ""),timeout: 500,showType: 'slide'});$('#winEditJRTPrintTemplateEle').window("close");}}});});//关闭窗口$("#btnCloseJRTPrintTemplateEle").click(function () {$('#winEditJRTPrintTemplateEle').window("close");});//构造查询事件$("#txtFilterJRTPrintTemplateEle").searchbox({searcher: function (value, name) {QryJRTPrintTemplateEle();},prompt: TranslateDataMTHD('Enter query', '回车查询', '')});//模板下拉表格渲染$('#txtJRTPrintTemplateElePrintTemplateDR').combogrid({panelWidth: 350,idField: 'RowID',width: 205,textField: 'CName',url: me.actionUrl + '?Method=CommonQueryView&data='+JSON.stringify({ ModelName: "JRTPrintTemplate", Pram: [], IsDisplayCount: false, Joiner: [], Operators: [] }),columns: [[{ field: 'RowID', title: '主键', width: 60 },{ field: 'CName', title: '名称', width: 260 }]]});$('#txtJRTPrintTemplateElePrintTemplateDR').combogrid("showSelectWin");//JRTPrintTemplateEle表格$('#dgJRTPrintTemplateEle').datagrid({remoteSort:false,singleSelect: true,toolbar: "#dgJRTPrintTemplateEleToolBar",fit: true,onSelect: function (index, row) {//方便拷贝到子表查询用var selectJRTPrintTemplateEle=$('#dgJRTPrintTemplateEle').datagrid("getSelected");},onDblClickRow: function (index, row) {UpdateJRTPrintTemplateEle(row);},columns: [[{ field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },{ field: 'RowID', title: TranslateDataMTHD('RowID', '主键', '') , width: 150, sortable: true },{ field: 'PrintTemplateDRName', title: TranslateDataMTHD('PrintTemplateDRName', '模板', '') , width: 150, sortable: true },{ field: 'PrintType', title: TranslateDataMTHD('PrintType', '元素类型', '') , width: 150, sortable: true },{ field: 'PrintX', title: TranslateDataMTHD('PrintX', 'X坐标', '') , width: 150, sortable: true },{ field: 'PrintY', title: TranslateDataMTHD('PrintY', 'Y坐标', '') , width: 150, sortable: true },{ field: 'PrintFont', title: TranslateDataMTHD('PrintFont', '打印字体', '') , width: 150, sortable: true },{ field: 'PrintFontSize', title: TranslateDataMTHD('PrintFontSize', '打印字体大小', '') , width: 150, sortable: true },{ field: 'PrintFontStyle', title: TranslateDataMTHD('PrintFontStyle', '打印字体样式', '') , width: 150, sortable: true },{ field: 'PrintLength', title: TranslateDataMTHD('PrintLength', '打印长度', '') , width: 150, sortable: true },{ field: 'PrintWidth', title: TranslateDataMTHD('PrintWidth', '元素宽度', '') , width: 150, sortable: true },{ field: 'PrintHeight', title: TranslateDataMTHD('PrintHeight', '元素高度', '') , width: 150, sortable: true },{ field: 'PrintText', title: TranslateDataMTHD('PrintText', '元素文本', '') , width: 150, sortable: true },{ field: 'DataField', title: TranslateDataMTHD('DataField', '绑定属性', '') , width: 150, sortable: true },{ field: 'PrintFlag', title: TranslateDataMTHD('PrintFlag', '特殊标志', '') , width: 150, sortable: true },{ field: 'PrintAlignment', title: TranslateDataMTHD('PrintAlignment', '停靠方向', '') , width: 150, sortable: true },{ field: 'LayOut', title: TranslateDataMTHD('LayOut', '布局方式', '') , width: 150, sortable: true },{ field: 'Angle', title: TranslateDataMTHD('Angle', '旋转角度', '') , width: 150, sortable: true },{ field: 'IsVShow', title: TranslateDataMTHD('IsVShow', '是否垂直显示', '') , width: 150, sortable: true },{ field: 'Color', title: TranslateDataMTHD('Color', '颜色', '') , width: 150, sortable: true },{ field: 'FixedReport', title: TranslateDataMTHD('FixedReport', '固定元素', '') , width: 150, sortable: true }]]});//查询JRTPrintTemplateElefunction QryJRTPrintTemplateEle() {var Filter = $("#txtFilterJRTPrintTemplateEle").searchbox("getValue");//开启等待,默认注释,在单击事件调用的逻辑启用等待会冲掉双击事件,按需要开启//$.messager.progress({ text: TranslateDataMTHD("Querying data","正在查询数据", ""), interval: 500 });//setTimeout(function () {//$.messager.progress('close');//}, 8000);$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=QryJRTPrintTemplateEle',data: { Filter: Filter },success: function (data, status) {//结束等待//$.messager.progress('close');if (!FilterBackData(data)) {return;}$('#dgJRTPrintTemplateEle').datagrid("loadData", data);}});};//执行查询数据QryJRTPrintTemplateEle();});//上传文件function UpFile(a) {var selectFiles = document.getElementById('file_upload').files;if (selectFiles != null && selectFiles.length > 0) {for (var i = 0; i < selectFiles.length; i++) {var data = new FormData();var file = selectFiles[i];data.append("file", file);ajaxLoading();setTimeout(function () {ajaxLoadEnd();}, 4000);var url = me.actionUrl + "?Method=UpImageFile";var callback = function (retData) {retData = JSON.parse(retData);if (retData.IsOk) {showInfo("上传成功!");}else {showError(retData["Message"]);}ajaxLoadEnd();};JRTHttpSys(data, url, callback);}$("#file_upload").val("");}}</script>
</head>
<body><div class="easyui-layout" fit="true" style="border: none;"><div data-options="region:'center',title:''" style="border: none;"><div id="dgJRTPrintTemplateEleToolBar" style="padding: 3px 0px 3px 10px;"><a id="btnAddJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" plain="true" listranslate="html~Add">新增</a><a id="btnUpdateJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-write-order'" plain="true" listranslate="html~Mod">修改</a><a id="btnDeleteJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" plain="true" listranslate="html~Del">删除</a><input id="txtFilterJRTPrintTemplateEle" style="margin-left: 14px; width: 240px;"></input><a id="btnExport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">导出</a><a id="btnExport1" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">多模板</a><a id="btnExport0" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">无模板</a><a id="btnPrintPreview" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">打印预览</a><a id="btnPrintPreviewInline" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">在线预览</a><a id="btnPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~Print">打印</a><a id="btnPDF" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF</a><a id="btnPDFSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF弹</a><a id="btnPrintPreviewGrid" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintGrid">打表格</a><a id="btnPrintReport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintReport">打报告</a><a id="btnCenterPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~CenterPrint">集中打印</a><a id="btnUpfile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">上传文件</a><input type="file" id="file_upload" name="f" onchange="UpFile(this);" accept="image/png,image/gif,image/jp2,image/jpeg,image/bmp" style="display: none" multiple="multiple" /><a id="btnExcelGetJson" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~ExcelJson">ExcelJson</a><a id="btnRenamefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">改名</a><a id="btnDeletefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">删除</a></div><table id="dgJRTPrintTemplateEle" title="" iconcls="icon-paper" listranslate="title~JRTPrintTemplateEle"></table></div><div id="winEditJRTPrintTemplateEle" style="padding: 10px 0px 0px 10px;width:1140px;height:366.6666666666666667px;display: none;"><form id="formJRTPrintTemplateEle" name="edit_form" method="post"><input type="hidden" id="txtJRTPrintTemplateEleRowID" name="RowID" value="0" /><table><tr><td class="lisar" jrttranslate="html~PrintTemplateDR">模板</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintTemplateDR" type="text" name="PrintTemplateDR" style="width:200px;"/></td><td class="lisar" jrttranslate="html~PrintType">元素类型</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintType" type="text" name="PrintType" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintX">X坐标</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintX" type="text" name="PrintX" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintY">Y坐标</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintY" type="text" name="PrintY" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintFont">打印字体</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFont" type="text" name="PrintFont" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintFontSize">打印字体大小</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFontSize" type="text" name="PrintFontSize" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintFontStyle">打印字体样式</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFontStyle" type="text" name="PrintFontStyle" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintLength">打印长度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintLength" type="text" name="PrintLength" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintWidth">元素宽度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintWidth" type="text" name="PrintWidth" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintHeight">元素高度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintHeight" type="text" name="PrintHeight" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintText">元素文本</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintText" type="text" name="PrintText" style="width:200px;" class="easyui-validatebox"  maxlength="2000"/></td><td class="lisar" jrttranslate="html~DataField">绑定属性</td><td class="lisal"><input id="txtJRTPrintTemplateEleDataField" type="text" name="DataField" style="width:200px;" class="easyui-validatebox"  maxlength="500"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintFlag">特殊标志</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFlag" type="text" name="PrintFlag" style="width:200px;" class="easyui-validatebox"  maxlength="50"/></td><td class="lisar" jrttranslate="html~PrintAlignment">停靠方向</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintAlignment" type="text" name="PrintAlignment" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~LayOut">布局方式</td><td class="lisal"><input id="txtJRTPrintTemplateEleLayOut" type="text" name="LayOut" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~Angle">旋转角度</td><td class="lisal"><input id="txtJRTPrintTemplateEleAngle" type="text" name="Angle" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~IsVShow">是否垂直显示</td><td class="lisal"><input id="txtJRTPrintTemplateEleIsVShow" type="text" name="IsVShow" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~Color">颜色</td><td class="lisal"><input id="txtJRTPrintTemplateEleColor" type="text" name="Color" style="width:200px;" class="easyui-validatebox"  maxlength="30"/></td></tr><tr><td class="lisar" jrttranslate="html~FixedReport">固定元素</td><td class="lisal"><input id="txtJRTPrintTemplateEleFixedReport" type="text" name="FixedReport" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></table><div region="south" border="fale" style="text-align: center; padding: 5px 0 0;"><a id="btnSaveJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Save">保存</a><span class="sp6"></span><a id="btnCloseJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Cancel">取消</a></div></form></div><div id="winPrintPreview" style="padding: 10px 0px 0px 10px; width: 1140px; height: 786px; display: none;"></div></div>
</body>
</html>

后台

import JRT.Core.MultiPlatform.FileCollection;
import JRT.Model.Bussiness.Parameters;
import JRTBLLBase.BaseHttpHandler;
import JRTBLLBase.Helper;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.ParamDto;
import JRT.Core.Dto.OutParam;
import JRT.Model.Entity.*;
import JRT.Core.Util.Convert;
import JRT.Core.MultiPlatform.JRTContext;import java.util.ArrayList;
import java.util.List;/**
*由代码生成器生成的后台代码
*/
public class ashJRTPrintTemplateEle extends BaseHttpHandler {/*** 保存数据,前台按表的属性名提交* @return 字符串*/public String SaveJRTPrintTemplateEle() throws Exception{JRTPrintTemplateEle dto=new JRTPrintTemplateEle();//主键dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);//模板dto.PrintTemplateDR=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintTemplateDR"), dto.PrintTemplateDR);//元素类型dto.PrintType=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintType"), dto.PrintType);//X坐标dto.PrintX=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintX"), dto.PrintX);//Y坐标dto.PrintY=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintY"), dto.PrintY);//打印字体dto.PrintFont=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFont"), dto.PrintFont);//打印字体大小dto.PrintFontSize=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFontSize"), dto.PrintFontSize);//打印字体样式dto.PrintFontStyle=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFontStyle"), dto.PrintFontStyle);//打印长度dto.PrintLength=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintLength"), dto.PrintLength);//元素宽度dto.PrintWidth=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintWidth"), dto.PrintWidth);//元素高度dto.PrintHeight=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintHeight"), dto.PrintHeight);//元素文本dto.PrintText=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintText"), dto.PrintText);//绑定属性dto.DataField=Helper.ValidParam(JRTContext.GetRequest(Request, "DataField"), dto.DataField);//特殊标志dto.PrintFlag=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFlag"), dto.PrintFlag);//停靠方向dto.PrintAlignment=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintAlignment"), dto.PrintAlignment);//布局方式dto.LayOut=Helper.ValidParam(JRTContext.GetRequest(Request, "LayOut"), dto.LayOut);//旋转角度dto.Angle=Helper.ValidParam(JRTContext.GetRequest(Request, "Angle"), dto.Angle);//是否垂直显示dto.IsVShow=Helper.ValidParam(JRTContext.GetRequest(Request, "IsVShow"), dto.IsVShow);//颜色dto.Color=Helper.ValidParam(JRTContext.GetRequest(Request, "Color"), dto.Color);//固定元素dto.FixedReport=Helper.ValidParam(JRTContext.GetRequest(Request, "FixedReport"), dto.FixedReport);OutParam out=new OutParam();int ret=0;//更新if(dto.RowID>0){ret=EntityManager().Update(dto,null, out, null, null, null);}//插入数据else{ret=EntityManager().Save(dto,out);}if(ret==1){return Helper.Success();}else{return Helper.Error(out);}}/*** 删除数据,多个RowID以上尖号分割* @return 字符串*/public String DeleteJRTPrintTemplateEle() throws Exception{String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");if(RowIDS.isEmpty()){return Helper.Error("请传入要删除数据的RowID,多个以^分割!");}//分割主键String [] arr=RowIDS.split("^");//out参数OutParam out=new OutParam();//循环删除数据for(int i=0;i<arr.length;i++){int ret=EntityManager().RemoveById(JRTPrintTemplateEle.class,Convert.ToInt32(arr[i]),out);if(ret!=1){return Helper.Error(out);}}return Helper.Success();}/*** 查询数据,前台按表的属性名提交* @return 字符串*/public String QryJRTPrintTemplateEle() throws Exception{//模糊查询String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, "Filter"), "");Parameters para=new Parameters();para.P0=Filter;para.P1="1";//调虚拟M查询数据,和导出共用逻辑return Helper.GetVMData("vm.test.QryPrintTemplateEle","QryPrintEle",para,null,null);}/*** 上传文件到文件服务* @return*/public String UpImageFile() throws Exception{//得到文件List<FileCollection> fileList=JRT.Core.MultiPlatform.JRTWebFile.GetFiles(Request);if(fileList!=null&&fileList.size()>0){JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.Upload("http://localhost:8080/JRTWeb/FileService/",fileList.get(0).GetInputStream(),fileList.get(0).GetFileName(),"/zlz");}return Helper.Success();}/*** 改名文件* @return*/public String ReNameImageFile() throws Exception{JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.ReName("http://localhost:8080/JRTWeb/FileService/","logo.png","logo1.png","zlz/");return Helper.Success();}/*** 删除文件* @return*/public String DeleteImageFile() throws Exception{JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.Delete("http://localhost:8080/JRTWeb/FileService/zlz/logo.png");fileService.Delete("http://localhost:8080/JRTWeb/FileService/zlz/logo1.png");return Helper.Success();}/*** 测试日期时间转JSON* @return* @throws Exception*/public String JsonTest() throws Exception{List<JRTPrintTemplate> list=EntityManager().FindAllSimple(JRTPrintTemplate.class,null);return Helper.Object2Json(list);}}

打印后台

import JRT.Core.Dto.OutParam;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.PrintDrawProtocol;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;import java.awt.*;
import java.util.ArrayList;
import java.util.List;/*** 输出符合打印元素绘制协议的打印元素数据,来供打印执行层打印*/
public class PrintBarCodeTest extends BaseHttpHandlerNoSession {/*** 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制** @param RowID   业务主键* @param P1* @param P2* @param P3* @param P4* @param P5* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return*/public String GetData(String RowID, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {List<PrintElement> retList = new ArrayList<>();//控制打印机//retList.add(PrintDrawProtocol.ControlPrinter("A5", PrintDrawProtocol.PrintLayout.Portrait,"pdf","",0,0));//标志A4打印两个//retList.add(PrintDrawProtocol.A4Double(true));//打印PDF文件//retList.add(PrintDrawProtocol.DrawFile("http://localhost:8080/JRTWeb/FileService/test.pdf"));retList.add(PrintDrawProtocol.DrawPDF("http://localhost:8080/JRTWeb/FileService/test.pdf"));//换页retList.add(PrintDrawProtocol.ChangePage());//换页retList.add(PrintDrawProtocol.ChangePage());//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(720, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "http的logn图", "宋体", 22, "", null, "", "#fda632", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 30, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));retList.add(PrintDrawProtocol.DrawLabel(420, 150, "ftp的logn图", "宋体", 12, "", null, "", "#fda632", "0"));//retList.add(PrintDrawProtocol.DrawGraph(420,180,64,64,"ftp://zlz:zlz@127.0.0.1:21/ftp.png",false,null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(20, 20, "zhanglianzhu", "宋体", 12, "", null, "", "#ff5252", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(20, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(20, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(20, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(20, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(20, 230, "20231118 22:49", "宋体", 12, "", null, "", "", "0"));//画一个点retList.add(PrintDrawProtocol.DrawPoint(20, 270, 10, 10, "o", ""));retList.add(PrintDrawProtocol.DrawPoint(100, 270, 10, 10, "[]", ""));retList.add(PrintDrawProtocol.DrawPoint(200, 270, 10, 10, "<>", ""));//画多边形List<Point> pointList = new ArrayList<>();Point p1 = new Point();p1.x = 10;p1.y = 300;pointList.add(p1);Point p2 = new Point();p2.x = 100;p2.y = 310;pointList.add(p2);Point p3 = new Point();p3.x = 50;p3.y = 360;pointList.add(p3);retList.add(PrintDrawProtocol.DrawPoly(pointList, ""));//画复选框retList.add(PrintDrawProtocol.DrawCheckBox(10, 400, true, 30, 30));//画单选框retList.add(PrintDrawProtocol.DrawRadio(60, 400, true, 30, 30));//画复选框retList.add(PrintDrawProtocol.DrawCheckBox(110, 400, false, 30, 30));//画单选框retList.add(PrintDrawProtocol.DrawRadio(160, 400, false, 30, 30));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(20, 1010, "页尾", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 900, "A4纸张打印", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLine(20, 920, 700, 920, 1, "0", ""));retList.add(PrintDrawProtocol.DrawLine(20, 940, 700, 940, 1, "1", ""));retList.add(PrintDrawProtocol.DrawLine(20, 960, 700, 960, 1, "2", ""));retList.add(PrintDrawProtocol.DrawLine(20, 980, 700, 980, 1, "3", ""));retList.add(PrintDrawProtocol.DrawLine(20, 1000, 700, 1000, 1, "4", ""));//换一根横线retList.add(PrintDrawProtocol.DrawLine(20, 1025, 700, 1025, 1, "", ""));//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第二页", "宋体", 12, "", null, "", "", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231119", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));//画一根横线retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第三页", "宋体", 12, "", null, "", "", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231119", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));//画一根横线retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第四页", "宋体", 12, "", null, "", "", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231206", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));//画一根横线retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));//先包一个打印元素绘制协议数据生成的工具类来解决元素约束问题,工具类实现了调用工具类得到标签,条码,文本等return Helper.Object2Json(retList);}
}

模板打印后台

import JRT.Core.DataGrid.GridDto;
import JRT.Core.DataGrid.IGridChangePage;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.Convert;
import JRT.Core.Util.PrintDrawProtocol;
import JRT.Model.Entity.JRTPrintTemplate;
import JRT.Model.Entity.JRTPrintTemplateEle;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;/*** 调用模板数据来打印,这是一个模拟打印的demo,调用模板数据组装打印数据*/
public class PrintTemplateTest extends BaseHttpHandlerNoSession implements IGridChangePage {/*** 打印元素*/private List<PrintElement> retList = new ArrayList<>();/*** 打印模板数据*/JRTPrintTemplateDto template =null;/*** 存打印的Data数据*/Hashtable<String, String> printDataMap =null;/*** 表格换页之前要执行的逻辑* @param gridKey* @param maxY*/public void PreChangePageDo(String gridKey,int maxY){}/*** 表格换页之后要执行的逻辑* @param gridKey* @param maxY*/public void AfterChangePageDo(String gridKey,int maxY){System.out.println("换页后执行逻辑");//画数据元素PrintData(template, retList, printDataMap);//画标签元素PrintLabel(template, retList);//画线元素PrintLine(template, retList);}/*** 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制** @param RowID   业务主键* @param P1* @param P2* @param P3* @param P4* @param P5* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return*/public String GetData(String RowID, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {//查询模板数据template = GetOneTemplate(null, "JRTReport");//存打印的Data数据printDataMap = new Hashtable<>();printDataMap.put("姓名", "小乌鱼");printDataMap.put("性别", "男");printDataMap.put("年龄", "32岁");printDataMap.put("登记号", "0947809");printDataMap.put("检验号", "24011901");printDataMap.put("科室", "体检科");printDataMap.put("标本", "全血");printDataMap.put("床号", "");printDataMap.put("诊断", "体检");printDataMap.put("采集日期", "2024-01-19");printDataMap.put("采集时间", "16:00");printDataMap.put("医嘱备注", "体检");printDataMap.put("医嘱名称", "血细胞分析五分类");printDataMap.put("申请医生", "乌鱼");printDataMap.put("申请日期", "2024-01-19");printDataMap.put("操作者", "李四");printDataMap.put("审核日期", "2024-01-19");printDataMap.put("审核时间", "17:00");printDataMap.put("审核者", "张三");//存打印的图数据Hashtable<String, String> printImgMap = new Hashtable<>();printImgMap.put("RPC", "http://localhost:8080/JRTWeb/FileService/zlz/logo.png");//存项目结果数据List<Object> repResList = new ArrayList<>();RepResPrintDto oneRes = new RepResPrintDto();oneRes.AbFlag = "*";oneRes.RefRange = "12-34um/ml";oneRes.Result = "50";oneRes.Seq = "1";oneRes.TestCodeName = "白细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "*";oneRes.RefRange = "12-34um/ml";oneRes.Result = "50";oneRes.Seq = "2";oneRes.TestCodeName = "红细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "";oneRes.RefRange = "12-34um/ml";oneRes.Result = "33";oneRes.Seq = "3";oneRes.TestCodeName = "淋巴细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "4";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "5";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "6";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "7";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "8";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);for(int k=9;k<40;k++){oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = String.valueOf(k);oneRes.TestCodeName = "项目"+k;repResList.add(oneRes);}//画图片元素PrintImage(template, retList, printImgMap);//画数据元素PrintData(template, retList, printDataMap);//画标签元素PrintLabel(template, retList);//画线元素PrintLine(template, retList);//画表格元素PrintDataGrid(template, retList, repResList);return Helper.Object2Json(retList);}/*** 输出报告结果** @param template* @param template   模板* @param retList    元素列表* @param repResList 报告结果列表*/private void PrintDataGrid(JRTPrintTemplateDto template, List<PrintElement> retList, List<Object> repResList) throws Exception {for (JRTPrintTemplateEle ele : template.EleList) {//输出表格if (ele.PrintType.equals("DataGrid")) {//得到表格定义GridDto defGrid = (GridDto) Helper.Json2Object(ele.PrintText, GridDto.class);int lastY = PrintDrawProtocol.DrawGrid(retList, defGrid, null, repResList, "ReportRes", this);}}}/*** 输出图片** @param template* @param template     模板* @param retList      元素列表* @param printDataMap 数据哈希*/private void PrintImage(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) {for (JRTPrintTemplateEle ele : template.EleList) {//输出图片if (ele.PrintType.equals("Graph")) {boolean isSign = false;if (ele.PrintFlag.equals("D")) {isSign = true;}String dataField = ele.DataField;if (!ele.DataField.isEmpty() && printDataMap.containsKey(ele.DataField)) {dataField = printDataMap.get(ele.DataField);}PrintElement printEle = PrintDrawProtocol.DrawGraph(ele.PrintX, ele.PrintY, ele.PrintWidth, ele.PrintHeight, dataField, isSign, false);retList.add(printEle);}}}/*** 输出数据** @param template     模板* @param retList      元素列表* @param printDataMap 数据哈希*/private void PrintData(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) {for (JRTPrintTemplateEle ele : template.EleList) {//输出标签if (ele.PrintType.equals("Data")) {String dataFiled = ele.DataField;if (!dataFiled.isEmpty() && printDataMap.containsKey(dataFiled)) {//带字的条码if (ele.PrintFlag.contains("BarCode")) {String BarType = ele.PrintFlag.replace("BarCode", "");PrintElement printEle = PrintDrawProtocol.DrawBarCode(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), true, ele.PrintWidth, ele.PrintHeight, BarType, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, ele.Angle);retList.add(printEle);}//不带字的条码else if (ele.PrintFlag.contains("BarCodeN")) {String BarType = ele.PrintFlag.replace("BarCodeN", "");PrintElement printEle = PrintDrawProtocol.DrawBarCode(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), false, ele.PrintWidth, ele.PrintHeight, BarType, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, ele.Angle);retList.add(printEle);}//画普通数据else {PrintElement printEle = PrintDrawProtocol.DrawLabel(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, "", ele.Angle);retList.add(printEle);}}}}}/*** 输出标签** @param template* @param retList*/private void PrintLabel(JRTPrintTemplateDto template, List<PrintElement> retList) {for (JRTPrintTemplateEle ele : template.EleList) {//输出标签if (ele.PrintType.equals("Label")) {PrintElement printEle = PrintDrawProtocol.DrawLabel(ele.PrintX, ele.PrintY, ele.PrintText, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, "", ele.Angle);retList.add(printEle);}}}/*** 输出线** @param template* @param retList*/private void PrintLine(JRTPrintTemplateDto template, List<PrintElement> retList) {for (JRTPrintTemplateEle ele : template.EleList) {//输出先if (ele.PrintType.equals("ILineN")) {int width = ele.PrintWidth;int height = ele.PrintHeight;int endX = ele.PrintX + width;int endY = ele.PrintY;int lineWidth = height;if (height > width) {endX = ele.PrintX;endY = ele.PrintY;lineWidth = width;}PrintElement printEle = PrintDrawProtocol.DrawLine(ele.PrintX, ele.PrintY, endX, endY, lineWidth, ele.PrintFlag, ele.Color);retList.add(printEle);}}}/*** 通过模板主键或者代码得到模板数据供打印使用** @param rowID* @param code* @return*/private JRTPrintTemplateDto GetOneTemplate(Integer rowID, String code) throws Exception {JRTPrintTemplateDto retDto = null;//按主键取if (rowID != null) {retDto = EntityManager().GetById(JRTPrintTemplateDto.class, rowID);}//按代码取else if (code != null && !code.isEmpty()) {retDto = EntityManager().GetByColVal(JRTPrintTemplateDto.class, "Code", code);}if (retDto != null) {HashParam hs = new HashParam();hs.Add("PrintTemplateDR", retDto.RowID);retDto.EleList = EntityManager().FindAllSimple(JRTPrintTemplateEle.class, hs);}return retDto;}/*** 存获得的一个模板数据*/public static class JRTPrintTemplateDto extends JRTPrintTemplate {/*** 模板元素*/public List<JRTPrintTemplateEle> EleList;}/*** 打印的报告结果实体*/public static class RepResPrintDto {/*** 序号*/public String Seq;/*** 项目名称*/public String TestCodeName;/*** 结果*/public String Result;/*** 标志*/public String AbFlag;/*** 参考范围*/public String RefRange;}
}

摄像头调用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>JRT摄像头测试</title><link rel="shortcut icon" href="../../resource/common/images/favicon.ico" /><script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script><script src="../../jrtprint/js/JRTPrint.js" type="text/javascript"></script><script language="javascript" type="text/javascript">SYSPageCommonInfo.Init();var BasePath = '';var ResourcePath = '';var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;var GroupID = SYSPageCommonInfo.Data.Sesssion.GroupID;var SessionStr = SYSPageCommonInfo.Data.SessionStr;</script><script type="text/javascript">//jquery入口$(function () {//驱动摄像头,弹出CS窗口模式$("#btnCameral").click(function () {//#跟上0就代表截图后不关闭窗口,跟1就代表截图后自动关闭窗口JRTBaseMsg.Subscribe("CameralBase64#0", CameraMsgCallBack, NoConnCallBack, true);});//启动内嵌摄像头$("#btnStartCameral").click(function () {//#跟上0就代表截图后不关闭窗口,跟1就代表截图后自动关闭窗口JRTBaseMsg.StartCameral($("#divCamera"));});//从内嵌摄像头抓图$("#btnCutImg").click(function () {var base64=JRTBaseMsg.GetCameralImg();$("#divImgShow").append('<img src="' + "data:image/png;base64," + base64 + '" alt="截图" style="margin-bottom:10px;width:400px;height: 300px;margin:10px;"/>');});//停止内嵌摄像头$("#btnStopCameral").click(function () {//#跟上0就代表截图后不关闭窗口,跟1就代表截图后自动关闭窗口JRTBaseMsg.Send("StopCameral#0");});});//截图回调,截图后会把图片Base64串回调到此方法function CameraMsgCallBack(base64) {$("#divImgShow").append('<img src="' + "data:image/png;base64," + base64 + '" alt="截图" style="margin-bottom:10px;width:400px;height: 300px;margin:10px;"/>');}//失败回调function NoConnCallBack() {$.messager.alert(TranslateDataMTHD("Info", "提示", ""), TranslateDataMTHD("Unable to connect to the messaging service!", "无法连接消息服务!", ""));}</script>
</head>
<body><div class="easyui-layout" fit="true" style="border: none;"><div data-options="region:'north',title:'',split:true" style="height:48px;padding: 5px 0 0 10px;"><a id="btnCameral" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">驱动CS摄像头</a><span class="lissp6"></span><a id="btnStartCameral" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">启动内嵌摄像头</a><span class="lissp6"></span><a id="btnCutImg" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">抓图</a><span class="lissp6"></span><a id="btnStopCameral" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">停止内嵌摄像头</a><span class="lissp6"></span><span>此界面用来测试JRT驱动摄像头截图的示例,驱动摄像头请参照该界面实现</span></div><div data-options="region:'center',title:''"><div class="easyui-layout" fit="true"><div data-options="region:'east',title:'JRTCameralVedio',split:true" style="width:950px;padding: 10px;"><div id="divCamera" style="width: 900px;height: 700px;background-color:#333333;"></div></div><div data-options="region:'center',title:'CutImage'"><div id="divImgShow" style="padding: 10px;"></div></div></div></div></div>
</body>
</html>

jrtlis业务开发正式提上日程,有没有人支持JRT一样稳步向前推进,直到实现整套检验系统。JRT对开发人员和维护人员优化,不代表框架实现起来很简单,融合了我十年的技术记录和经验探索,有:web技术、画图、打印、tcp、excel、Webservice、码表、代码生成器、c、Linux、shell、gcc、docker、脚本化、ORM、负载、Electron、https、文件服务、bs-cs交互、base64、rsa、缓存等等。半年内在java上释放。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/785252.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

走进标杆企业——成套数字化标杆观摩游学(重庆站)

为了推进工业电气加工与设计的效率提升&#xff0c;加快企业数字化、网络化和智能化管理的步伐&#xff0c;利驰软件(苏州)有限公司&#xff08;下文简称利驰软件&#xff09;在重庆于2024年3月22日举办了一场成套数字化标杆观摩游学。此次为期一天的活动吸引了湘鄂渝地区专家们…

视频素材下载哪个软件好?几个素材库视频免费下载

在浩瀚的创意海洋中&#xff0c;找到完美的无水印视频素材犹如寻宝一般&#xff0c;每一段精彩的视频片段都能为您的作品增色不少。无论您是视频制作新手&#xff0c;还是经验丰富的专业人士&#xff0c;这里有全球各地的精选视频素材网站&#xff0c;旨在激发您的灵感&#xf…

EfficientSAM 项目排坑

EfficientSAM 项目排坑 任务过程记录创建环境运行示例 任务 跑通这个项目代码 过程记录 创建环境 readme里没有说具体怎么配置环境&#xff0c;所以可能对我来说还挺困难的。 现把项目git下来&#xff1a; git clone https://github.com/yformer/EfficientSAM.git cd Effi…

Flask Python:请求上下文和应用上下文

请求上下文和应用上下文详解 一、背景二、什么是上下文2.1、请求上下文2.2、应用上下文2.3、两种上下文的底层逻辑 三、写在最后 一、背景 在如何实现异步发送邮件的时候&#xff0c;遇到过这样一个报错 RuntimeError: Working outside of request context.This typically me…

【机器学习】数据探索---python主要的探索函数

在上一篇博客【机器学习】数据探索(Data Exploration)—数据质量和数据特征分析中&#xff0c;我们深入探讨了数据预处理的重要性&#xff0c;并介绍了诸如插值、数据归一化和主成分分析等关键技术。这些方法有助于我们清理数据中的噪声、消除异常值&#xff0c;以及降低数据的…

C语言内存函数(超详解)

乐观学习&#xff0c;乐观生活&#xff0c;才能不断前进啊&#xff01;&#xff01;&#xff01; 我的主页&#xff1a;optimistic_chen 我的专栏&#xff1a;c语言 点击主页&#xff1a;optimistic_chen和专栏&#xff1a;c语言&#xff0c; 创作不易&#xff0c;大佬们点赞鼓…

KIl5:Stm32L071下载出现flash download faild “cortex-m0+“的解决方法

首先看看有没有芯片&#xff0c;没有芯片下载一下 下载并在device选择对应的芯片 选择调试器 选择flash

C++ 二叉树OJ题

&#x1f493;博主CSDN主页:麻辣韭菜-CSDN博客&#x1f493;   ⏩专栏分类&#xff1a;C知识分享⏪   &#x1f69a;代码仓库:C高阶&#x1f69a;   &#x1f339;关注我&#x1faf5;带你学习更多C知识   &#x1f51d;&#x1f51d; 前言 C二叉搜索树 这篇讲解了搜索二叉…

MySQL经验分享:Shell开发问题

背景 之前整理过Python连接使用MySQL的经验&#xff0c;链接如下&#xff1a; pymysql封装总结_pymysql封装类-CSDN博客 相比高级语言&#xff0c;Shell与MySQL开发使用相对会更麻烦一些&#xff1b;由于 shell是linux命令集的概称&#xff0c;是属于命令行的人机界面。Shel…

1688采集商品信息 马帮 店小秘 芒果采集API接口 java php

1688详情API接口是一种基于开放平台的应用程序接口&#xff0c;它能够实现与1688平台的数据交互&#xff0c;让商家能够更加方便地获取商品详情、库存信息、价格变动等重要数据。通过这一接口&#xff0c;商家可以实时掌握市场动态&#xff0c;快速响应消费者需求&#xff0c;从…

jenkins进行自动化部署

jenkins自动化部署 hello&#xff0c;大家好&#xff0c;前文我们已经下载好我们的jenkins了&#xff0c;下面我们用jenkins来实现自动化部署啦&#xff01; 一、下载插件 我们选择插件管理 一个是Maven Integration plugin&#xff0c;一个是 Publish Over SSH 这里因为作…

【uniapp】uniapp实现免密登录

文章目录 一、概要二、整体架构流程三、技术名词解释四 、技术细节1.存取token有效期&#xff1f;2.使用setStorageSync而不使用setStorage&#xff1f;3.使用onLaunch而不使用全局路由&#xff1f; 一、概要 打开一个网页或小程序的时候&#xff0c;我们有时候会自动进入主页…

嵌入式驱动学习第五周——驱动模块

前言 Linux驱动有两种运行方式&#xff0c;第一种是将驱动编译进Linux内核中&#xff0c;另一种是编译成模块&#xff0c;本篇博客来介绍一下驱动模块。 嵌入式驱动学习专栏将详细记录博主学习驱动的详细过程&#xff0c;未来预计四个月将高强度更新本专栏&#xff0c;喜欢的可…

Oladance、南卡、韶音开放式耳机值得买吗?爆款实测拒绝踩坑!

​在寻找最佳开放式耳机的过程中&#xff0c;我亲自试用并评估了市场上三个备受欢迎的品牌&#xff1a;Oladance、南卡和韶音。通过全面的多维度性能测试&#xff0c;我旨在为大家提供准确的购买指南&#xff0c;避免因选择不当而遭遇音质失真或佩戴不适的问题。 选择正确的耳…

window7 SP2

网上很多window7 SP1的更新教程&#xff0c;很少有sp2的教程 参考博客Windows 7 Service Pack 2 Download and Install (64-bit/32-bit) 即 转到 Microsoft 网站上的 Windows 7 Service Pack 2下载页面 。 选择与 Windows 7 版本相对应的 “下载 ”链接。 也可以 登录官网…

https安全性 带给im 消息加密的启发

大家好&#xff0c;我是蓝胖子&#xff0c;在之前# MYSQL 是如何保证binlog 和redo log同时提交的&#xff1f;这篇文章里&#xff0c;我们可以从mysql的设计中学会如何让两个服务的调用逻辑达到最终一致性&#xff0c;这也是分布式事务实现方式之一。今天来看看我们能够从http…

【Qt 学习笔记】Day3 | 使用两种方式实现helloworld

博客主页&#xff1a;Duck Bro 博客主页系列专栏&#xff1a;Qt 专栏关注博主&#xff0c;后期持续更新系列文章如果有错误感谢请大家批评指出&#xff0c;及时修改感谢大家点赞&#x1f44d;收藏⭐评论✍ Day3 | 使用两种方式实现helloworld 文章编号&#xff1a;Qt 学习笔记…

移动硬盘怎么加密?移动硬盘加密软件有哪些?

移动硬盘是我们在工作中最常用的移动存储设备&#xff0c;为了保护数据安全&#xff0c;需要使用专业的移动硬盘加密软件加密保护。那么&#xff0c;移动硬盘加密软件有哪些&#xff1f; ​BitLocker BitLocker是Windows的磁盘加锁功能&#xff0c;可以用于加密保护移动硬盘中…

MySQL(常用函数、多表查询)

文章目录 1.数据库函数1.count函数案例答案count&#xff08;*&#xff09;与count&#xff08;列&#xff09;的区别 2.sum函数案例答案 3.avg函数案例答案 4.max/min函数案例答案 5.group by 分组统计案例答案 6.字符串相关函数演示练习 7.数学相关函数演示 8.日期相关函数演…