<%@ page language="java" import="java.util.*"
|
contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
<%@ include file="dataHead.jsp"%>
|
<%@page import="java.sql.SQLException"%>
|
<%@page import="net.sf.json.JSONObject"%>
|
<%@page import="org.springframework.jdbc.BadSqlGrammarException"%>
|
<%@page import="org.springframework.dao.EmptyResultDataAccessException"%>
|
<%@page import="org.springframework.dao.DataAccessException"%>
|
<%@page import="com.yc.multiData.SpObserver"%>
|
<%@page import="com.google.gson.JsonArray"%>
|
<%@page import="com.google.gson.JsonObject"%>
|
<%@page import="com.yc.sdk.shopping.util.SettingKey"%>
|
<%
|
sql = "";
|
isNewOpen=1;
|
docstatePan=0;
|
tableIs="@zhu@";
|
tableIs2="@minxi@";
|
docMap=new HashMap<String,Object>();
|
listInfo=new ArrayList<Map<String, Object>>();
|
addUrl="";//添加传给grid的条件,需要分离
|
wherePan=@wherePan496@;
|
if((wherePan!=null&&!wherePan.equals(""))||grid!=null){
|
if(wherePan.indexOf("@G@")!=-1){
|
int inds=wherePan.indexOf("@G@");
|
String temp1=wherePan;
|
wherePan=temp1.substring(0,inds);
|
addUrl = " and "+temp1.substring(inds+3);
|
}
|
//多表关联字段条件
|
wherePan=PanelManageBo.getMultiTableWhere(request,wherePan,@FT@,"@FK@","@SeekGroupID@",@equalbol@);
|
request.setAttribute("isMasterFormId","@isMasterFormId@");
|
try{
|
sql="select top 1 @selectColAll@"+(@equalbol@ ? "":online)+" from ";//只能查一条
|
if( doccode!=null && sql.contains("&doccode&")){//by danaus 2011-1-25
|
sql=sql.replaceAll("&doccode&",doccode.replaceAll("'",""));
|
}
|
SpObserver.setDBtoInstance("_"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
|
if(copy!=null){
|
listInfo=PanelManageBo.getFromEnd(sql,tableIs,wherePan.replaceAll("_ycid_","id"),@formType@,copy,request);
|
}else{
|
listInfo=PanelManageBo.getFromEnd(sql,tableIs,(wherePan==null?wherePan:wherePan.replaceAll("_ycid_","id")),@formType@,request);
|
}
|
}catch(Exception e){
|
cpdoc="";//出异常清空该属性值,没权限时格线调用的话会显示格线信息
|
%>
|
<script>
|
$.messager.alert("操作提示", "@errorText@:<%=(e.getCause()!=null?e.getCause().getMessage():e.getMessage())%>", "warning");
|
</script>
|
<%
|
// throw new Exception("@errorText@:"+(e.getCause()!=null?e.getCause().getMessage():e.getMessage()));
|
}finally{
|
SpObserver.setDBtoInstance();
|
}
|
if(listInfo.size()>0){
|
docMap=listInfo.get(0);
|
@mianStatus@
|
if(DBHelper.getValueInt(docMap,"formid")==0){
|
docMap.put("formid",@MultiTableFormId@);
|
}
|
PanelManageBo.getMultiTableList(request,docMap,true);
|
}
|
if((doccode==null||"".equals(doccode))&&listInfo.size()>0){
|
doccode=DBHelper.getValue(docMap,"doccode");
|
}
|
}
|
if((isNew!=null&&isNew.equals("0"))||listInfo.size()>0){
|
isNewOpen=0;//不为新开单
|
docstatePan=DBHelper.getValueInt(docMap,"docstatus");
|
}
|
JSONObject jsonOldPanel = JSONObject.fromObject(docMap);
|
if(@isMaster@&&!"".equalsIgnoreCase(doccode)&©==null){
|
//------------增加取消确认功能,从变量取得状态值(docstatePan),权限值(profile),到后台查询及生成相应的代码 by danaus 2014-5-27
|
String cancelDoc="@canceldocstatus@";//取消确认状态值
|
String excep="@sqlException@";//sql表达式
|
String iscanelproc="mygrid.iscanelProc=true";
|
if(@grid@!=1){
|
iscanelproc="iscanelProc=true";
|
}
|
//生成取消确认的html代码
|
String cancel_html="<a id=\"tpCanel\" href=\"javascript:void(0)\" onclick=\""+iscanelproc+";save(2);\" class=\"easyui-linkbutton\" plain=\"true\" iconCls=\"icon-cancel\">@CancelBtnName@</a>";
|
int iscanel=@iscanel@;//是否设置了取消确认
|
if(iscanel==1){
|
StringBuilder sqlEx= new StringBuilder();
|
sqlEx.append("select case when ");
|
int ex=0;
|
boolean flg=false;
|
//存在sql表达式
|
if(!"".equalsIgnoreCase(excep)){
|
sqlEx.append("("+excep+")");
|
flg=true;
|
}
|
if(!"".equalsIgnoreCase(cancelDoc)){ //存在有状态值
|
if(!"".equalsIgnoreCase(excep)){
|
sqlEx.append(" and (").append(" docstatus in (").append(cancelDoc.replaceAll(";",",")).append("))");
|
}else{
|
sqlEx.append(" docstatus in (").append(cancelDoc.replaceAll(";",",")).append(")");
|
}
|
flg=true;
|
}
|
sqlEx.append((flg?"":" 1=1 ")+" then 1 else 0 end cancelButton from ").append(tableIs);
|
try{
|
ex= PanelManageBo.getCancelButton(DBHelper.getRepAll(sqlEx.toString(),session,docMap,true)+" where doccode='"+doccode.replaceAll("'","")+"'");
|
}catch(DataAccessException ea){//这异常判断单据是否还存在 xin 2018-12-8 17:45:59
|
if(ea instanceof EmptyResultDataAccessException){
|
throw new Exception("该单据不存在!");
|
}else{throw ea;}
|
}catch(Exception e){
|
throw e;
|
}
|
//如果能显示,则用js把html代码写回到top页面。
|
if(ex==1){ %>
|
<script>
|
$("#spcan").html('<%=cancel_html%>');
|
</script>
|
<% }
|
}
|
//------------增加撤回功能,从变量取得状态值(docstatePan),权限值(profile),到后台查询及生成相应的代码 by danaus 2016-11-21
|
String revokeDoc="@RevokeBtnEditStatus@";//状态值
|
String revokeexcep="@RevokeBtnExpression@";//sql表达式
|
String isrevokeproc="mygrid.isrevokeProc=true";
|
if(@grid@!=1){
|
isrevokeproc="isrevokeProc=true";
|
}
|
//生成html代码
|
String revoke_html="<a id=\"tpCanel\" href=\"javascript:void(0)\" onclick=\""+isrevokeproc+";save(2);\" class=\"easyui-linkbutton\" plain=\"true\" iconCls=\"icon-cancel\">撤回</a>";
|
if(!"".equals(revokeProc)){
|
StringBuilder sqlEx_revoke= new StringBuilder();
|
sqlEx_revoke.append("select case when ");
|
int ex=0;
|
boolean flg=false;
|
if(!"".equalsIgnoreCase(revokeexcep)){//存在sql表达式
|
sqlEx_revoke.append("("+revokeexcep+")");
|
flg=true;
|
}
|
if(!"".equalsIgnoreCase(revokeDoc)){ //存在有状态值
|
if(!"".equalsIgnoreCase(revokeexcep)){
|
sqlEx_revoke.append(" and (").append(" docstatus in (").append(revokeDoc.replaceAll(";",",")).append("))");
|
}else{
|
sqlEx_revoke.append(" docstatus in (").append(revokeDoc.replaceAll(";",",")).append(")");
|
}
|
flg=true;
|
}
|
sqlEx_revoke.append((flg?"":" 1=1 ")+" then 1 else 0 end cancelButton from ").append(tableIs);
|
try{
|
ex= PanelManageBo.getCancelButton(DBHelper.getRepAll(sqlEx_revoke.toString(),session,docMap,true)+" where doccode='"+doccode.replaceAll("'","")+"'");
|
}catch(DataAccessException ea){//这异常判断单据是否还存在 xin 2018-12-8 17:45:59
|
if(ea instanceof EmptyResultDataAccessException){
|
throw new Exception("该单据不存在!");
|
}else{throw ea;}
|
}catch(Exception e){
|
throw e;
|
}
|
//如果能显示,则用js把html代码写回到top页面。
|
if(ex==1){ %>
|
<script>
|
$("#sprevoke").html('<%=revoke_html%>');
|
</script>
|
<% }
|
}
|
}
|
//-------------------end
|
SRS =null;
|
outStr="";
|
build=(BuildFuncIfc)FactoryBean.getBean("Build");
|
openDoc="@openDoc@";
|
try{
|
SpObserver.setDBtoInstance("_"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
|
sqlDBHelperIfc.execSql(DBHelper.getProcessAll(openDoc,session,docMap,true));
|
}catch(Exception e){
|
throw e;
|
}finally{
|
SpObserver.setDBtoInstance();
|
}
|
//-------
|
if(@filterFormId@){
|
String userName=session.getAttribute(SessionKey.USERNAME)+"";
|
String dbid=session.getAttribute(SessionKey.DATA_BASE_ID)+"";
|
com.yc.app.v2.controller.APPController appController = (com.yc.app.v2.controller.APPController) FactoryBean.getBean("APPController");
|
appController.execRecentAccessFormid(new com.yc.action.grid.RecentAccessEntity(userCode,userName,formId,formType,com.yc.service.impl.DBHelper.replaceBr(com.yc.utils.EncodeUtil.base64Encode(queryString)),formName,doccode.replaceAll("'",""),dbid));
|
}
|
//----------
|
//下面的调用是执行OA审核按钮 xin 2021-1-30 09:54:54
|
String OADocCode=DBHelper.getValue(docMap, "doccode");
|
if(StringUtils.isBlank(OADocCode)){
|
OADocCode=doccode;
|
}else{
|
OADocCode="'"+OADocCode+"'";
|
}
|
// if(sqlDBHelperIfc.getOAVerifyMethod(docMap,userCode,docstatePan)){ %>
|
<script>
|
$(".OAVerify").html("<a href=\"javascript:OAVerifyMethod("+formId+",<%=docstatePan%>,<%=OADocCode%>);\" id=\"OAVerify\" class=\"easyui-linkbutton\" plain=\"true\" iconCls=\"icon-oasht\" title=\"OA审核\">审核</a>");
|
$(".OAVerify").css("display","none");
|
</script>
|
<%//}%>
|
@linkscript@
|
<script type="text/javascript">
|
<%
|
if(copy!=null&&!"".equals(copy)){
|
%>
|
iscp=1;//是复单
|
<%
|
}
|
if(!"".equals(id_info)){
|
tempJs=id_info.toLowerCase().split(";");//取得各个格线 c|a,b;d|a,b;k|c,d
|
for(int ic=0;ic<tempJs.length;ic++){
|
String[] st=tempJs[ic].split("\\|");//c|aa,bb
|
String[] std=st[1].split(","); //取得自身和外表的关联字段
|
if(std[0].indexOf("#")>0){//多个字段
|
String[] s1=std[0].split("#");
|
String[] s2=std[1].split("#");
|
String str1="";
|
for(int y=0;y<s1.length;y++){
|
if(y>0) str1+="&";
|
str1+=s1[y]+"='"+(docMap.get(s2[y]))+"'";
|
}
|
%>
|
//by danaus 17-11-28 已存在则不需要再写进,之前存在格线有数据也会取不到单号的情况,
|
//子面板没数据,不加判断处理会造成格线取了最后一个子面板时读不到单号。
|
if(js_where["<%=st[0]%>"]==undefined){
|
js_where["<%=st[0]%>"]='<%=com.yc.service.impl.DBHelper.replaceBr(com.yc.utils.EncodeUtil.base64Encode(str1))%>';
|
}
|
<%
|
}else{//只有一个字段
|
if(docMap.get(std[1])!=null && !docMap.get(std[1]).toString().trim().equals("null") && !Objects.equals(DBHelper.getValue(docMap, std[1]),"")){
|
cpdoc=docMap.get(std[1]).toString();
|
}else{
|
if(cpdoc.lastIndexOf("'")!=-1){
|
cpdoc=cpdoc.replace("'","");
|
}
|
}
|
String js_where="if(js_where[\""+st[0]+"\"]==undefined){\r\n"+
|
" js_where[\""+st[0]+"\"]=\""+com.yc.service.impl.DBHelper.replaceBr(com.yc.utils.EncodeUtil.base64Encode(std[0]+"='"+(cpdoc)+"'"))+"\";"+
|
"\r\n }";
|
if((isNew==null||(docMap.get(std[1].toLowerCase())!=null||docMap.get(std[1].toLowerCase())!=""))){ %>
|
<%=js_where%>
|
<% }
|
}
|
}
|
}
|
%>
|
</script>
|
<span onclick="panIndex='@index@'" id="panIndex@index@">
|
<script type="text/javascript">
|
var docstatuPan=<%=docstatePan%>;
|
panIndex="@index@";//需要替换
|
qrCode='<%=DBHelper.getValue(docMap,"qrCode")%>';//单据二维码
|
maxCols[panIndex]="@maxCols@";//面板跨列数
|
panMain[panIndex]=clone(panPar);
|
@uploadEditStatusMap@
|
@panInfo@
|
@panelScript@
|
panMain[panIndex].upDoc='<%=DBHelper.getValue(docMap,"upDoc")%>';
|
panMain[panIndex].nextDoc='<%=DBHelper.getValue(docMap,"nextDoc")%>';
|
panMain[panIndex].controlUrl="panelControl@formId@.jsp";
|
panMain[panIndex].isNew=isNew;//是否是新单
|
</script>
|
<%@ include file="/public/template/0/showPan.txt"%>
|
@isPanelTabs@<%//用来替换主功能号就是页卡 %>
|
<div class="panelControlDiv">
|
@panelHtml@
|
</div>
|
@include@
|
<div class="panelControlDiv">@panelDownHtml@</div>
|
<%
|
if ("1".equals(docMap.get("isshowonlinemsgbtn"))) {
|
//isShowOnlineMsg定义在jsCssHead
|
request.setAttribute("formId", formId + "");
|
request.setAttribute("docCode", doccode);
|
%>
|
<jsp:include page="/general/onlineMessage.jsp" flush="true"/>
|
<%
|
}
|
if ("1".equals(docMap.get("isshowprocesstrackingbtn"))) {//isShowProcessTracking定义在jsCssHead
|
%>
|
<%@ include file="/general/processTrack.jsp" %>
|
<%} %>
|
<script type="text/javascript">
|
panIndex="@index@";//需要替换
|
@pansetInv@
|
panMain[panIndex].loadSet(<%=docstatePan%>);
|
panMain[panIndex].keyDown('123','null');
|
panMain[panIndex].where16_496="@where16_496@";
|
panMain[panIndex].view=@view@;
|
</script>
|
</span>
|