fs-danaus
2024-03-16 a2ecbf17d6ba1c7b135fe10bb4cdfefa05b75add
提交 | 用户 | age
a6a76f 1 <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
F 2     pageEncoding="UTF-8"%> 
3 <%@page import="java.text.SimpleDateFormat"%>
4 <%@page import="com.yc.service.impl.EnvHelper"%>
5 <%@page import="com.yc.service.impl.DBHelper"%>
6 <%@page import="com.yc.service.build.BuildFuncIfc"%>
7 <%@page import="org.springframework.jdbc.support.rowset.SqlRowSet"%>
8 <%@page import="com.yc.factory.FactoryBean"%>
9 <%@page import="com.yc.service.panel.TypeControlDao"%>
10 <%@page import="com.yc.service.panel.time.PanelTimeDao"%>
11 <%@page import="com.yc.service.panel.PanelManageDao"%>
12 <%@page import="com.yc.service.panel.GfieldApprovedButtonIfc"%>
13 <%@page import="com.yc.service.panel.SqlDBHelperIfc"%>
14 <%@page import="com.yc.service.upload.AttachmentIfc"%>
15 <%@page import="com.yc.entity.attachment.AttachmentEntity"%>
16 <%@page import="com.yc.utils.DefaultSet" %>
17 <%@page import="java.sql.SQLException"%>
18 <%@page import="net.sf.json.JSONObject"%>
19 <%@page import="org.springframework.jdbc.BadSqlGrammarException"%>
20 <%@page import="org.springframework.dao.EmptyResultDataAccessException"%>
21 <%@page import="org.springframework.dao.DataAccessException"%>
22 <%@page import="com.yc.multiData.SpObserver"%>
23 <%@page import="com.yc.utils.SessionKey"%>
24 <%@page import="com.google.gson.JsonArray"%>
25 <%@page import="com.google.gson.JsonObject"%>
26 <%@page import="com.yc.sdk.shopping.util.SettingKey"%>
ca30ee 27 <%@ include file="dataHead.jsp" %>
a6a76f 28 <%
F 29 //
30 SqlDBHelperIfc  sqlDBHelperIfc=(SqlDBHelperIfc)FactoryBean.getBean("SqlDBHelper");
31 //
32 GfieldApprovedButtonIfc gButtonIfc=(GfieldApprovedButtonIfc)FactoryBean.getBean("GfieldApprovedButton");
33 //
34 PanelTimeDao PanelTimeBo=(PanelTimeDao)FactoryBean.getBean("PanelTime");
35 //
36 PanelManageDao PanelManageBo=(PanelManageDao)FactoryBean.getBean("PanelManage");
37 //
38 TypeControlDao TypeControlBo=(TypeControlDao)FactoryBean.getBean("TypeControl");
39 //pengbei
40 request.setCharacterEncoding("UTF-8");
41 response.setCharacterEncoding("UTF-8");
42 String sql = "";
43 String path = request.getContextPath();
44 String basePath = SettingKey.getHostUrl(request)
45             + path + "/";
46 Date now=new Date();
47 SimpleDateFormat formatDate=new SimpleDateFormat("yyyy-MM-dd");
48    String date=String.valueOf(now.getDate());
49    int isNewOpen=1;
50    int docstatePan=0;
51    String tableIs="@zhu@";
52    String tableIs2="@minxi@";
53    Map<String,Object> docMap=new HashMap<String,Object>();
54    List<Map<String, Object>> listInfo=new ArrayList<Map<String, Object>>();
a2ecbf 55     String addUrl = "";//添加传给grid的条件,需要分离
F 56     if ((wherePan != null && !wherePan.equals("")) || grid != null) {
57         //wherePan=java.net.URLDecoder.decode(wherePan,"utf-8");
58         if (wherePan.indexOf("@G@") != -1) {
59             int inds = wherePan.indexOf("@G@");
60             String temp1 = wherePan;
61             wherePan = temp1.substring(0, inds);
62             addUrl = " and " + temp1.substring(inds + 3);
63         }
64         try {
65             sql = "select top 1 @selectColAll@" + online + " from ";//只能查一条
66             if (sql.contains("&doccode&")) {//by danaus 2011-1-25
67                 if (doccode != null)
68                     sql = sql.replaceAll("&doccode&", doccode.replaceAll("'", ""));
69             }
70             SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
71             if (copy != null) {
72                 listInfo = PanelManageBo.getFromEnd(sql, tableIs, wherePan.replaceAll("_ycid_", "id"), @formType @,
73                 copy, request);
74             } else {
75                 listInfo = PanelManageBo.getFromEnd(sql, tableIs, (wherePan == null ? wherePan : wherePan.replaceAll("_ycid_", "id")),
76                 @formType @,request);
77             }
a6a76f 78        }catch(Exception e){
F 79            throw e;
80 //        try{
81   //       listInfo=PanelManageBo.getFromEnd(sql,tableIs2,wherePan,@formType@,request);
82   //        }catch(Exception ex){
83    //        listInfo=new ArrayList<Map<String, Object>>();
84   //         //数据库乱设置时不显示页面,直接清空信息,或者不是乱设置,却不能用来查询,也清空信息
85   //         }
86        }finally{
87            SpObserver.setDBtoInstance();
88        }
89        if(listInfo.size()>0){
90        docMap=listInfo.get(0);}
91        if((doccode==null||"".equals(doccode))&&listInfo.size()>0){
92          doccode=DBHelper.getValue(docMap,"doccode");
93        }
94        
95     }
96 if((isNew!=null&&isNew.equals("0"))||listInfo.size()>0){
97   isNewOpen=0;//不为新开单      
98   docstatePan=DBHelper.getValueInt(docMap,"docstatus");
99 }
100 JSONObject jsonOldPanel = JSONObject.fromObject(docMap);
101 if(!"".equalsIgnoreCase(doccode)&&copy==null){
102 //------------增加取消确认功能,从变量取得状态值(docstatePan),权限值(profile),到后台查询及生成相应的代码 by danaus 2014-5-27
103  String cancelDoc="@canceldocstatus@";//取消确认状态值
104  String excep="@sqlException@";//sql表达式
105  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代码
106   int iscanel=@iscanel@;//是否设置了取消确认
107  if(iscanel==1){
108  StringBuilder sqlEx= new StringBuilder();
109  sqlEx.append("select case when  ");
110   int ex=0;
111 boolean flg=false;
112  if(!"".equalsIgnoreCase(excep)){//存在sql表达式
113      sqlEx.append("("+excep+")");
114      flg=true;
115   }
116  if(!"".equalsIgnoreCase(cancelDoc)){ //存在有状态值
117    
118      if(!"".equalsIgnoreCase(excep))
119       sqlEx.append(" and (").append(" docstatus in (").append(cancelDoc.replaceAll(";",",")).append("))");
120      else
121              sqlEx.append(" docstatus in (").append(cancelDoc.replaceAll(";",",")).append(")");
122    
123      flg=true;
124    }
125    
126  sqlEx.append((flg?"":" 1=1 ")+" then 1 else 0 end cancelButton from ").append(tableIs);
127  try{
128  ex= PanelManageBo.getCancelButton(DBHelper.getRepAll(sqlEx.toString(),session,docMap,true)+" where doccode='"+doccode.replaceAll("'","")+"'");
129  }catch(DataAccessException ea){//这异常判断单据是否还存在 xin 2018-12-8 17:45:59
130         if(ea instanceof EmptyResultDataAccessException){
131             throw new Exception("该单据不存在!");
132      }else{throw ea;}         
133  }catch(Exception e){
134        throw e;
135  }
136  if(ex==1){ //如果能显示,则用js把html代码写回到top页面。
137
138  %>
139 <script>
140 $("#spcan").html('<%=cancel_html%>');    
141 </script> 
142  <%
143  }
144  }
145 //-------------------end
146 //------------增加撤回功能,从变量取得状态值(docstatePan),权限值(profile),到后台查询及生成相应的代码 by danaus 2016-11-21
147  String revokeDoc="@RevokeBtnEditStatus@";//状态值
148  String revokeexcep="@RevokeBtnExpression@";//sql表达式
149  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代码
150  int isrevoke=@isrevoke@;//是否设置了取消确认
151  if(isrevoke==1){
152  StringBuilder sqlEx_revoke= new StringBuilder();
153  sqlEx_revoke.append("select case when  ");
154   int ex=0;
155 boolean flg=false;
156  if(!"".equalsIgnoreCase(revokeexcep)){//存在sql表达式
157      sqlEx_revoke.append("("+revokeexcep+")");
158      flg=true;
159   }
160  if(!"".equalsIgnoreCase(revokeDoc)){ //存在有状态值
161    
162     if(!"".equalsIgnoreCase(revokeexcep))
163       sqlEx_revoke.append(" and (").append(" docstatus in (").append(revokeDoc.replaceAll(";",",")).append("))");
164      else
165              sqlEx_revoke.append(" docstatus in (").append(revokeDoc.replaceAll(";",",")).append(")");
166    
167      flg=true;
168    }
169    
170  sqlEx_revoke.append((flg?"":" 1=1 ")+" then 1 else 0 end cancelButton from ").append(tableIs);
171  try{
172  ex= PanelManageBo.getCancelButton(DBHelper.getRepAll(sqlEx_revoke.toString(),session,docMap,true)+" where doccode='"+doccode.replaceAll("'","")+"'");
173  }catch(DataAccessException ea){//这异常判断单据是否还存在 xin 2018-12-8 17:45:59
174         if(ea instanceof EmptyResultDataAccessException){
175             throw new Exception("该单据不存在!");
176      }else{throw ea;}         
177  }catch(Exception e){
178        throw e;
179  }
180  if(ex==1){ //如果能显示,则用js把html代码写回到top页面。
181
182  %>
183 <script>
184 $("#sprevoke").html('<%=revoke_html%>');    
185 </script> 
186  <%
187  }
188  }
189 //-------------------end
190 }    
191
192     SqlRowSet SRS =null;
193     String outStr=""; 
194     BuildFuncIfc  build=(BuildFuncIfc)FactoryBean.getBean("Build"); 
195     try{
196     String openDoc="@openDoc@";
197     SpObserver.setDBtoInstance("_"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
198     sqlDBHelperIfc.execSql(DBHelper.getProcessAll(openDoc,session,docMap,true));
199 }catch(Exception e){
200     throw e;
201 }finally{
202      SpObserver.setDBtoInstance();
203 }
d09c0b 204      //-------
F 205      String userName=session.getAttribute(SessionKey.USERNAME)+"";
206      String dbid=session.getAttribute(SessionKey.DATA_BASE_ID)+"";
207      com.yc.app.v2.controller.APPController appController = (com.yc.app.v2.controller.APPController) FactoryBean.getBean("APPController");
208      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));
209      //----------
a6a76f 210     //下面的调用是执行OA审核按钮  xin 2021-1-30 09:54:54
c58f97 211     //if(sqlDBHelperIfc.getOAVerifyMethod(docMap,userCode,docstatePan)){ %>
a6a76f 212      <script>
4b7d30 213         $(".OAVerify").html("<a href=\"javascript:OAVerifyMethod("+formId+",<%=docstatePan%>,'<%=DBHelper.getValue(docMap, "doccode")%>');\" id=\"OAVerify\" class=\"easyui-linkbutton\" plain=\"true\" iconCls=\"icon-oasht\" title=\"OA审核\">审核</a>");
c58f97 214         $(".OAVerify").css("display","none");
a6a76f 215      </script>
c58f97 216   <%//}%>
a6a76f 217 @linkscript@
F 218 <style type="text/css">
219 .posPan {
220     border: 0px solid #000000;
221     position: absolute;
222     height: @rowHei@px;
223     width: @kongJian@px;
224     font-size: 13px;
225     z-index:0;
226 }
227 .miaoshu_pan {    
228     height: auto;
229     @maoshuF@
230     padding-top:5px;
231     width: @miaoShuo@px;    
232     white-space:nowrap;
233     overflow:hidden;
234     text-overflow:ellipsis;
235     padding-right:6px;
236     margin-top: -3px;
237 }
238 .control_div{
239    float: left;
240 }
241 .mustThree_show {
242     border:1px solid #ffcf5a;
243     background: #fff url(/images/ppp.gif) no-repeat right;
244 }
245 .Three_show {
246     border:1px solid #a5a6ad;    
247
248 .input35{
249    height:14px;
250
251 .main_talbe {
252     font-family: Verdana, Arial, Vrinda, Tahoma;
253     line-height: 24px;
254     font-size: 12px;
255     color: #666;
256 }
257 .text {
258     border:1px solid #a5a6ad;    
259 }
260 </style>
261 <span onclick="panIndex='@index@'" id="panIndex@index@">
262 <script type="text/javascript">
263 var docstatuPan=<%=docstatePan%>;
264 panIndex="@index@";//需要替换
265 qrCode='<%=DBHelper.getValue(docMap,"qrCode")%>';//单据二维码
266 maxCols[panIndex]="@maxCols@";//面板跨列数
267 panMain[panIndex]=clone(panPar);
268 @uploadEditStatusMap@
269 @panInfo@
270 @panelScript@
271 panMain[panIndex].upDoc='<%=DBHelper.getValue(docMap,"upDoc")%>';
272 panMain[panIndex].nextDoc='<%=DBHelper.getValue(docMap,"nextDoc")%>';
273 panMain[panIndex].controlUrl="panelControl@formId@.jsp";
274 panMain[panIndex].isNew=isNew;//是否是新单
275 </script>
276 <%@ include file="/public/template/0/showPan.txt" %>
176200 277 <div class="panelControlDiv">
a6a76f 278     @panelHtml@
F 279 </div>
280 <div id="tplt-grid">
ca30ee 281             <%@ include file="@formId@_@customGrid@grid.jsp" %>
a6a76f 282 </div>
176200 283 <div class="panelControlDiv">
a6a76f 284     @panelDownHtml@
F 285 </div>
a2ecbf 286     <%
F 287         if ("1".equals(docMap.get("isshowonlinemsgbtn"))) {
288             //isShowOnlineMsg定义在jsCssHead
289             request.setAttribute("formId", formId + "");
290             request.setAttribute("docCode", doccode);
291     %>
292         <jsp:include page="/general/onlineMessage.jsp" flush="true"/>
293         <%
294             }
295             if ("1".equals(docMap.get("isshowprocesstrackingbtn"))) {//isShowProcessTracking定义在jsCssHead
296         %>
297         <%@ include file="/general/processTrack.jsp" %>
298         <%} %>
a6a76f 299 <script type="text/javascript">
a2ecbf 300 @pansetInv @
F 301     panMain
302 [panIndex].loadSet(<%=docstatePan%>);
303 panMain[panIndex].keyDown('123', 'null');
a6a76f 304 </script>
F 305 </span>