?? jcy_zb_submit.jsp
字號:
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*,com.vstsoft.std.*" errorPage="" %>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<html>
<%vststd std = new vststd();%>
<%
String zbdm_id = std.getValue(request,"ID"); // 街道代碼
String szt = std.getValue(request,"zt"); // 按鈕類別
String imager = "";
String lrsj = ""; //錄入時間
int ixy = 0;
%>
<jsp:useBean id="jcypurview" class="com.vstsoft.jcypurview" scope = "session" />
<%
if (jcypurview.checkLogin() == false)
{
%>
<Script Language=javascript>
alert("用戶已斷線或未正常登錄,請重新登錄!")
window.open("../index.htm","_top")
</Script>
<% return;
}
if (szt.equals("del"))
{
if (jcypurview.purviewVerdict("B0500030") == false) //判斷是否有刪除權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("modify"))
{
if (jcypurview.purviewVerdict("B0500029") == false) //判斷是否有修改權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("new"))
{
if (jcypurview.purviewVerdict("B0500028") == false) //判斷是否有新增權限
{
%>
<Script Language=javascript>
alert("您沒有操作此頁權限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
%>
<%
String nowuserid = jcypurview.getUserid(); //取當前用戶編號
String nowusername = jcypurview.getUserName(); //取當前用戶名稱
String nowuserszqx = jcypurview.getUserSzqx(); //取當前用戶所在區縣
String nowuserszdw = jcypurview.getUserSzdw(); //取當前用戶所在單位
%>
<%
//新增組別
if ( szt.equals("new"))
{
String zbmc= std.getValue(request,"zbmc").trim(); //街道名稱
String dwdm= std.getValue(request,"dwdm").trim(); //單位代碼
String lxdh= std.getValue(request,"lxdh").trim(); //聯系電話
String bz= std.getValue(request,"bz").trim(); //備注
String blrq= std.getValue(request,"rq").trim(); //錄入時間
String qxxx= std.getValue(request,"qxxx").trim(); //單位所在區縣
if (zbmc.length() > 80)
{
imager = "組別名稱長度不能超過80位!";
ixy = 1;
}
if (ixy != 1)
{
if (lxdh.length() > 40)
{
imager = "聯系電話長度不能超過40位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (bz.length() > 200)
{
imager = "備注度不能超過200位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dwdm.equals(""))
{
imager = "請查看是否連接數據庫!";
ixy = 1;
}
}
if (ixy != 1)
{
if (zbmc.equals(""))
{
imager = "組別名稱不能為空!";
ixy = 1;
}
}
String suserid = "";
String suseris = "";
String qsqx = "";
String qbym = "";
String dqrq = "";
if (ixy == 0)
{
//取數據庫時間
String lrrq = std.getDateStr("YYYY.MM.DD");
//查詢人員表
String jcy_zbname = "select count(*) from jcy_zb where zbmc = '"+zbmc+"'";
sun.jdbc.rowset.CachedRowSet jcy_zb = std.getResultBySelect(jcy_zbname);
jcy_zb.next();
String zbname = jcy_zb.getString(1);
if (zbname.equals("0"))
{
//單位序號
String ymd = "select to_char(sysdate, 'yyyy') from dual";
sun.jdbc.rowset.CachedRowSet jcy_ymd = std.getResultBySelect(ymd);
jcy_ymd.next();
String yemoda = jcy_ymd.getString(1);
//判斷是否有前三位
String sl = "select count(*) from jcy_zb where substr(zbdm,1,3)='"+qxxx+"'";
sun.jdbc.rowset.CachedRowSet jcy_sl = std.getResultBySelect(sl);
jcy_sl.next();
String slmc = jcy_sl.getString(1);
if (!slmc.equals("0"))
{
String scxh = "select max(substr(zbdm,1,3)),substr(max(zbdm),4,4),max(substr(zbdm,4,6)),to_char(sysdate,'yyyy') from jcy_zb where substr(zbdm,1,3)= '"+qxxx+"'";
sun.jdbc.rowset.CachedRowSet jcy_scxh = std.getResultBySelect(scxh);
jcy_scxh.next();
suseris = jcy_scxh.getString(3);
qsqx = jcy_scxh.getString(1);
qbym = jcy_scxh.getString(2);
dqrq = jcy_scxh.getString(4);
//判斷是否有當天
out.print(qbym);
out.print("qq"+dqrq);
if (qbym.equals(dqrq))
{
int a = Integer.parseInt(suseris.substring(suseris.length()-2,suseris.length()))+1;
/* if (a>90)
{//imager = "已經達到今日輸入最大值!請改明日再加入。";
//ixy =1;
suserid = "99";
}*/
if (a<10)
{
suserid = String.valueOf(a);
suserid = 0+suserid;
}
else
{
suserid = String.valueOf(a);
}
}
if (!qbym.equals(dqrq))
{
suserid = "01";
}
}
if (slmc.equals("0"))
{
suserid = "01";
}
String lxd = qxxx+yemoda+suserid; //生成組別ID
String zbid = "select count(*) from jcy_zb where zbdm = '"+lxd+"'";
sun.jdbc.rowset.CachedRowSet jcy_zbid = std.getResultBySelect(zbid);
jcy_zbid.next();
String zbids = jcy_zbid.getString(1);
//out.print (zbids);
String sql_insert = "insert into jcy_zb (zbdm) values ('"+lxd+"')";
int isi = std.getResultByUpdate(sql_insert);
if (isi == 1 )
{
String sql_update = "update jcy_zb set zbmc='"+zbmc+"', blrq=to_date('"+blrq+"','YYYY.MM.DD'), lxdh='"+lxdh+"',bz='"+bz+"',dwdm='"+dwdm+"'where zbdm = '"+lxd+"'";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "保存成功!";
}else
{
ixy = 1;
imager = "新增失敗!";
}
}
else
{
imager = "已經有此組名ID,請明日再錄入!";
ixy = 1;
}
}
else
{
imager = "已經有此組名,請更換!";
ixy = 1;
}
}
}
//修改組別
if ( szt.equals("modify"))
{
String zbmc= std.getValue(request,"zbmc").trim(); //街道名稱
String qx= std.getValue(request,"qx").trim(); //單位代碼
String dwdm =std.getValue(request,"dwdm").trim();
String lxdh= std.getValue(request,"lxdh").trim(); //聯系電話
String bz= std.getValue(request,"bz").trim(); //備注
String blrq= std.getValue(request,"rq").trim(); //錄入時間
if (zbmc.length() > 80)
{
imager = "街道名稱長度不能超過80位!";
ixy = 1;
}
if (ixy != 1)
{
if (lxdh.length() > 40)
{
imager = "聯系電話長度不能超過40位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (bz.length() > 200)
{
imager = "備注度不能超過200位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dwdm.equals(""))
{
imager = "請查看是否連接數據庫!";
ixy = 1;
}
}
if (ixy != 1)
{
if (zbmc.equals(""))
{
imager = "組別名稱不能為空!";
ixy = 1;
}
}
if (ixy == 0)
{
String jcy_yuanname = "select zbmc from jcy_zb where zbdm = '"+zbdm_id+"'";
sun.jdbc.rowset.CachedRowSet jcy_zbyuanname = std.getResultBySelect(jcy_yuanname);
jcy_zbyuanname.next();
String zbyuanname = jcy_zbyuanname.getString(1);
if (!zbyuanname.equals(zbmc))
{
String jcy_zbmodifyname = "select count(*) from jcy_zb where zbmc = '"+zbmc+"'";
sun.jdbc.rowset.CachedRowSet jcy_zbmodify = std.getResultBySelect(jcy_zbmodifyname);
jcy_zbmodify.next();
String zbmodifyname = jcy_zbmodify.getString(1);
out.print(zbyuanname);
if (!zbmodifyname.equals("0"))
{
imager = "已經有此組名";
ixy = 1;
}else
{
//修改組別信息
String sql_update = "update jcy_zb set zbmc='"+zbmc+"', blrq=to_date('"+blrq+"','YYYY.MM.DD'), lxdh='"+lxdh+"',bz='"+bz+"',dwdm='"+dwdm+"'where zbdm = '"+zbdm_id+"'";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "修改成功!";
}
else
{
ixy = 1;
imager = "修改失敗!";
}
}
}
else
{
//修改組別信息
String sql_update = "update jcy_zb set zbmc='"+zbmc+"', blrq=to_date('"+blrq+"','YYYY.MM.DD'), lxdh='"+lxdh+"',bz='"+bz+"',dwdm='"+dwdm+"'where zbdm = '"+zbdm_id+"'";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "修改成功!";
}
else
{
ixy = 1;
imager = "修改失敗!";
}
}
}
}
//刪除組別
if ( szt.equals("del"))
{
if (ixy == 0)
{
String zbdmry = "";
String sql_rs = "select count(*) from jcy_ry where zbdm = '"+zbdm_id+"'";
sun.jdbc.rowset.CachedRowSet ii = std.getResultBySelect(sql_rs);
ii.next();
zbdmry = ii.getString(1);
if (zbdmry.equals("0"))
{
String sql_del = "delete from jcy_zb where zbdm = '"+zbdm_id+"' ";
int idel = std.getResultByUpdate(sql_del);
if (idel == 1)
{
imager = "刪除成功!";
}
else
{
ixy = 1;
imager = "刪除失敗!";
}
}
else
{
imager = "請先刪除此組成員!";
ixy = 1;
}
}
}
%>
<head>
<title>
</title>
</head>
<body onLoad="parent.f_imager('<%=imager%>','<%=ixy%>')">
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -