/*************************************************************** *
ProName:EdorPrintInput.jsp
*Title:批单打印
*Description:批单打印
*Copyright:Copyright (c) 2012
*Company:Sinosoft
* @author : JingDian * @version : 8.0 * @date : 2014-09-20 ****************************************************************/ var showInfo; var turnPage = new turnPageClass();//系统使用 var turnPage1 = new turnPageClass(); var mOperate = "";//操作状态 var tSQLInfo = new SqlClass(); /** * 提交,保存按钮对应操作 */ function submitForm() { var i = 0; var showStr = i18nMessage("正在保存数据,请您稍候并且不要修改屏幕上的值或链接其他页面", "LIS-04525"); var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(showStr); //showInfo = window.showModelessDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); var name='提示'; //网页名称,可为空; var iWidth=550; //弹出窗口的宽度; var iHeight=250; //弹出窗口的高度; var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置 var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置 showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false); showInfo.focus(); document.all("Operate").value = mOperate; ajaxSubmit2(document.getElementById("fm"),resultAfterSubmit); //提交 } /** * 提交后操作,服务器数据返回后执行的操作 */ function afterSubmit(FlagStr, content, patch) { if (typeof(showInfo)=="object"&& typeof(showInfo)!="unknown") { showInfo.close(); } if (FlagStr == "Fail" ) { var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content); //showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); var name='提示'; //网页名称,可为空; var iWidth=550; //弹出窗口的宽度; var iHeight=250; //弹出窗口的高度; var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置 var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置 showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false); showInfo.focus(); } else { var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content); //showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); var name='提示'; //网页名称,可为空; var iWidth=550; //弹出窗口的宽度; var iHeight=250; //弹出窗口的高度; var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置 var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置 showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false); showInfo.focus(); downFile(patch); } } /** * 提交前的校验、计算 */ function beforeSubmit() { //系统的校验方法 if (!verifyInput2()) { return false; } return true; } /** * 打印 */ function print(obj) { var queryPath; if(!beforeSubmit()){ return false; } var tSelNo = QueryResultGrid.getSelNo()-1; if (tSelNo<0) { i18nAlert("请选中一条保全批单信息", "LIS-02059"); return false; } var tEdorAppNo = QueryResultGrid.getRowColData(tSelNo,2); var tEdorType = QueryResultGrid.getRowColData(tSelNo,9); tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_pos.EdorCommonSql"); tSQLInfo.setModule("grp_pa"); tSQLInfo.setSqlId("EdorCommonSql11"); tSQLInfo.addSubPara(tEdorAppNo); // var arrResult = easyExecSql(tSQLInfo.getString(), 1, 0, 1); // if(arrResult==null){ // alert("请先扫描后在进行打印"); // return false; // } var URLPath = null; if ([0, 2].includes(obj)) { mOperate = "PRINT"; } if([1, 3].includes(obj)){ mOperate = "QDPRINT"; } if (![2, 3].includes(obj)) { if (obj === 0) { queryPath = wrapSql("g_print.EdorPrintSql", "EdorPrintSql2", [tEdorAppNo, tEdorType], "grp_print"); } if (obj === 1) { var mySql = wrapSql("g_pos.EdorCommonSql", "EdorCommonSql14", [tEdorAppNo, tEdorType], "grp_pa"); var strTemp = easyQueryVer3(mySql, 1, 0, 1); if (!strTemp) { alert("该保全项目没有人员清单"); return false; } mOperate = "QDPRINT"; queryPath = wrapSql("g_print.EdorPrintSql", "EdorPrintSql3", [tEdorAppNo, tEdorType+"EdorList"], "grp_print"); } URLPath = easyExecSql(queryPath, 1, 0, 1); } if (URLPath != null && URLPath != "") { var str = URLPath[0][0]; downFile(str); return true; } else { fm.action = "../API/grp_print/g_print/EdorPrintSave/ADD?Operate=" + mOperate + "&EdorAppNo=" + tEdorAppNo + "&EdorType=" + tEdorType; submitForm(); } } /** * 查询 */ function queryClick(o) { tSQLInfo = new SqlClass(); tSQLInfo.setResourceName("g_print.EdorPrintSql"); tSQLInfo.setModule("grp_print"); tSQLInfo.setSqlId("EdorPrintSql1"); tSQLInfo.addSubPara(document.all("EdorAppNo").value); tSQLInfo.addSubPara(document.all("GrpContNo").value); tSQLInfo.addSubPara(document.all("AppntNo").value); tSQLInfo.addSubPara(document.all("ManageCom").value); tSQLInfo.addSubPara(document.all("AcceptDATE").value); tSQLInfo.addSubPara(document.all("GrpName").value); tSQLInfo.addSubPara(""); tSQLInfo.addSubPara(document.all("EdorType").value); turnPage1.queryModal(tSQLInfo.getString(),QueryResultGrid, 1, 1); if(o=='1'){ if (!turnPage1.strQueryResult) { i18nAlert("未查询到符合条件的查询结果!", "LIS-03016"); } } } /** ** 文件下载 **/ function downFile(patch) { try { // 创建 URL 对象 var url = new URL(patch); // 获取路径部分 var path = url.pathname; // 注意:JavaScript 中是 `pathname` 而不是 `getPath()` // 截取文件名 var fileName = path.substring(path.lastIndexOf('/') + 1); // 构造下载链接并跳转 // window.location = "../API/grp_common/jsp/download/DOWNLOAD?FilePath=" + path + "&FileName=" + fileName; showInfo = window.open(patch); showInfo.focus(); } catch (e) { alert("无效的文件路径,请检查输入!"); } } /** * 老核心批单打印 */ function oldprint(obj) { if(!beforeSubmit()){ return false; } var tSelNo = QueryResultGrid.getSelNo()-1; if (tSelNo<0) { i18nAlert("请选中一条保全批单信息", "LIS-02059"); return false; } var tEdorAppNo = QueryResultGrid.getRowColData(tSelNo,2); var tEdorType = QueryResultGrid.getRowColData(tSelNo,9); if(obj === 0){ mOperate = "OLDPRINT"; fm.action = "../API/grp_print/g_print/EdorOldPrintSave/ADD?Operate=" + mOperate + "&EdorAppNo=" + tEdorAppNo + "&EdorType=" + tEdorType; submitFormold(); }else if(obj === 1){ mOperate = "OLDPRINTBILL"; fm.action = "../API/grp_print/g_print/EdorOldPrintSave/ADD?Operate=" + mOperate + "&EdorAppNo=" + tEdorAppNo + "&EdorType=" + tEdorType; submitFormold(); } } function resultAfterSubmit(FlagStr,Content,Result) { afterSubmit(FlagStr,Content,Result.patch); } function submitFormold() { var i = 0; var showStr = i18nMessage("正在保存数据,请您稍候并且不要修改屏幕上的值或链接其他页面", "LIS-04525"); var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(showStr); //showInfo = window.showModelessDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); var name='提示'; //网页名称,可为空; var iWidth=550; //弹出窗口的宽度; var iHeight=250; //弹出窗口的高度; var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置 var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置 showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false); showInfo.focus(); document.all("Operate").value = mOperate; ajaxSubmit2(document.getElementById("fm"),resultAfterSubmitold); //提交 } function resultAfterSubmitold(FlagStr,Content,Result) { afterSubmitold(FlagStr,Content,Result.patch); } /** * 提交后操作,服务器数据返回后执行的操作 */ function afterSubmitold(FlagStr, content, patch) { if (typeof(showInfo)=="object"&& typeof(showInfo)!="unknown") { showInfo.close(); } if (FlagStr == "Fail" ) { var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content); //showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); var name='提示'; //网页名称,可为空; var iWidth=550; //弹出窗口的宽度; var iHeight=250; //弹出窗口的高度; var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置 var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置 showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false); showInfo.focus(); } else { var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content); //showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px"); var name='提示'; //网页名称,可为空; var iWidth=550; //弹出窗口的宽度; var iHeight=250; //弹出窗口的高度; var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置 var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置 showInfo = window.open (urlStr,name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height="+ iHeight+",width="+iWidth+",innerHeight="+iHeight+",innerWidth=" +iWidth+",left="+iLeft+",top="+iTop,false); showInfo.focus(); downFileold(patch); } } /** ** 文件下载 **/ function downFileold(patch) { try { // 创建 URL 对象 // 截取文件名 var fileName = patch.substring(patch.lastIndexOf('/') + 1); // window.location = encodeURI("../API/grp_common/jsp/download/APIDOWNLOAD?FilePath=" + tFilePath + "&FileName=" + tFileName) // window.location = encodeURI("../API/grp_common/jsp/download/DOWNLOAD?FilePath=" + patch + "&FileName=" + fileName) downloadFile(patch,fileName,"../API/grp_common/jsp/download/DOWNLOAD"); } catch (e) { alert("无效的文件路径,请检查输入!"); } }