fs-danaus
2021-03-05 a6a76f98715a5539c8fd77676d0ea1af5c9c5a4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%> 
    <%@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.yc.utils.SessionKey"%>
<%@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);
        }                  
      try{
         sql="select top 1 @selectColAll@ from ";//只能查一条
         if(sql.contains("&doccode&")){//by danaus 2011-1-25
         if(doccode!=null)
         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){
          throw e;
  //         try{
  //         listInfo=PanelManageBo.getFromEnd(sql,tableIs2,wherePan,@formType@,request);
   //       }catch(Exception ex){
  //         listInfo=new ArrayList<Map<String, Object>>();
  //         //数据库乱设置时不显示页面,直接清空信息,或者不是乱设置,却不能用来查询,也清空信息
  //         }
       }finally{
           SpObserver.setDBtoInstance();
       }
       if(listInfo.size()>0){
       docMap=listInfo.get(0);}
       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)&&copy==null){//@isMaster@标记为只有主面板才需要执行
//------------增加取消确认功能,从变量取得状态值(docstatePan),权限值(profile),到后台查询及生成相应的代码 by danaus 2014-5-27
 String cancelDoc="@canceldocstatus@";//取消确认状态值
 String excep="@sqlException@";//sql表达式
 String cancel_html="<a id=\"tpCanel\" href=\"javascript:void(0)\" onclick=\"mygrid.iscanelProc=true;save(2);\" class=\"easyui-linkbutton\" plain=\"true\" iconCls=\"icon-cancel\">@CancelBtnName@</a>";//生成取消确认的html代码
  int iscanel=@iscanel@;//是否设置了取消确认
 if(iscanel==1){
 StringBuilder sqlEx= new StringBuilder();
 sqlEx.append("select case when  ");
  int ex=0;
boolean flg=false;
 if(!"".equalsIgnoreCase(excep)){//存在sql表达式
     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;
 }
 if(ex==1){ //如果能显示,则用js把html代码写回到top页面。
 
 %>
<script>
$("#spcan").html('<%=cancel_html%>');    
</script> 
 <%
 }
 }
//-------------------end
//------------增加撤回功能,从变量取得状态值(docstatePan),权限值(profile),到后台查询及生成相应的代码 by danaus 2016-11-21
 String revokeDoc="@RevokeBtnEditStatus@";//状态值
 String revokeexcep="@RevokeBtnExpression@";//sql表达式
 String revoke_html="<a id=\"tpCanel\" href=\"javascript:void(0)\" onclick=\"mygrid.isrevokeProc=true;save(2);\" class=\"easyui-linkbutton\" plain=\"true\" iconCls=\"icon-cancel\">撤回</a>";//生成html代码
 int isrevoke=@isrevoke@;//是否设置了取消确认
 if(isrevoke==1){
 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;
 }
 if(ex==1){ //如果能显示,则用js把html代码写回到top页面。
 
 %>
<script>
$("#sprevoke").html('<%=revoke_html%>');    
</script> 
 <%
 }
 }
//-------------------end
}
 
    SqlRowSet SRS =null;
    String outStr=""; 
    BuildFuncIfc  build=(BuildFuncIfc)FactoryBean.getBean("Build"); 
    try{
    String openDoc="@openDoc@";
    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();
}
%>  
@linkscript@
<style type="text/css">
<!--
.posPan {
    border: 0px solid #000000;
    position: absolute;
    height: @rowHei@px;
    width: @kongJian@px;
    font-size: 13px;
    z-index:0;
}
.miaoshu_pan {    
    height: auto;
    @maoshuF@
    padding-top:5px;
    width: @miaoShuo@px;    
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    padding-right:6px;
    margin-top: -3px;
}
.control_div{
   float: left;
}
 
.mustThree_show {
    border:1px solid #ffcf5a;
    background: #fff url(/images/ppp.gif) no-repeat right;
}
.Three_show {
    border:1px solid #a5a6ad;    
.input35{
   height:14px;
.main_talbe {
    font-family: Verdana, Arial, Vrinda, Tahoma;
    line-height: 24px;
    font-size: 12px;
    color: #666;
}
.text {
    border:1px solid #a5a6ad;    
}
-->
</style>
<span onclick="panIndex='@index@'" id="panIndex@index@">
<script type="text/javascript">
<!--
var docstatuPan=<%=docstatePan%>;
panIndex="@index@";//需要替换
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" %>
<div>
    @panelHtml@
</div>
@include@
<div>
    @panelDownHtml@
</div>
 
<script type="text/javascript">
@pansetInv@
panMain[panIndex].loadSet(<%=docstatePan%>);
panMain[panIndex].keyDown('123','null');
</script>
</span>