<% if (Request["action"].ToString() != "add")

本文介绍了一个用于管理员工状态的界面实现方案,包括在职、离职等选项,并提供了离职原因及时间的记录方式。此界面适用于添加新员工时使用,默认设置为在职状态。
   <% if (Request["action"].ToString() != "add")
                   {%>
                <tr>
                    <th bgcolor="#FFFFFF" class="r_bg" style="width: 167px">
                        状态:
                    </th>
                    <td colspan="3" bgcolor="#FFFFFF" class="right_bg" style="width: 297px">
                        <asp:DropDownList ID="ddlStatus" runat="server" Width="125px" CssClass="input1">
                            <asp:ListItem Selected="True" Value="在职">在职</asp:ListItem>
                            <asp:ListItem Value="离职:开除">离职:开除</asp:ListItem>
                            <asp:ListItem Value="离职:自愿">离职:自愿</asp:ListItem>
                        </asp:DropDownList><label style="color: Red">添加新员工,默认在职!</label></td>
                </tr>
                <tr>
                    <th bgcolor="#FFFFFF" class="r_bg" style="width: 167px; height: 100px;">
                        离职原因:
                    </th>
                    <td colspan="13" bgcolor="#FFFFFF" class="right_bg" style="height: 100px">
                        <asp:TextBox ID="txtStatusRemark" runat="server" CssClass="input1" Width="368px"
                            Height="100px" TextMode="MultiLine" Rows="5"></asp:TextBox><label style="color: Red">添加新员工,不可修改!</label></td>
                </tr>
                <tr>
                    <th bgcolor="#FFFFFF" class="r_bg" style="width: 167px; height: 24px;">
                        离职时间:
                    </th>
                    <td colspan="13" bgcolor="#FFFFFF" class="right_bg" style="height: 24px">
                        <asp:TextBox ID="txtStatusDate" runat="server" CssClass="input1" Width="368px" onclick="SelectDate(this.name)"></asp:TextBox><label
                            style="color: Red">添加新员工,不可修改!</label></td>
                </tr>
                <%}
                %>

界面如下: <%@ page contentType="text/html;charset=UTF-8" %> <%@ page pageEncoding="UTF-8" %> <%@ page import="java.util.*" %> <%@ page import="qbeanejbs.*"%> <%@ page import="qbeanclasses.*"%> <%@ page import="org.apache.log4j.Logger"%> <%@ include file="../Include/SpcClientIni.jsp"%> <% System.out.println("++++++++++++++++++++++++ OCAP Info Entered ++++++++++++++++++++++++++++++"); String sOCAPNo=request.getParameter("OCAPNo").trim(); String sChartId=request.getParameter("ChartId").trim(); String sDateTime=request.getParameter("DateTime").trim(); String sFabName=""; if (session.getAttribute("FabName")==null){ response.sendRedirect("../RemindLogin.jsp"); }else { sFabName=session.getAttribute("FabName").toString().toUpperCase(); } String sFileURL="http://"+request.getServerName()+":"+request.getServerPort()+"/File/" +sFabName+"/"+sDateTime.substring(0,8)+"/"+sOCAPNo+".xls"; String sFilePath="\\\\"+sOCAPFileSrv+"\\OCAPSystem\\File\\"+sFabName+"\\"+sDateTime.substring(0,8) + "\\"+sOCAPNo+".xls"; File ocapFile=new File(sFilePath); boolean bFileExist=false; if (ocapFile.exists()){ bFileExist=true; } //System.out.println("* sFileURL= "+sFileURL); //System.out.println("* sFilePath= "+sFilePath); //System.out.println("* bFileExist= "+bFileExist); String sDatabaseName=""; if (session.getAttribute("DatabaseName")==null){ response.sendRedirect("../RemindLogin.jsp"); }else { sDatabaseName=session.getAttribute("DatabaseName").toString(); } /** System.out.println("* OCAPNo= "+sOCAPNo); System.out.println("* ChartId= "+sChartId); System.out.println("* OCAPFileURL= "+sOCAPFileURL); System.out.println("* FileExist= "+sFileExist); **/ Vector OCAPDetailVc=null; Vector OCAPHistVc=null; String sOCAPId=""; String sReasonCode=""; String sOCAPHandler=""; try{ QQuery QQueryBean=((QQueryHome)(EJBHook.getEJB("QQueryBean"))).create(); // Query OCAP Detail QQueryBean.reset(); /* Modified by Leon at 2005/4/6 for get OCAP Info from new OCAP table String sSQLOCAPDetail="select * from smic_eocap_detail sed" +" where sed.ocapno='" + sOCAPNo + "'"; */ /*String sSQLOCAPDetail="select * from smic_eocap_transaction" +" where ocapno='" + sOCAPNo + "'"; */ /* Modified by Frank Zhao at 2005/09/12 for sort OCAP history by txntime */ String sSQLOCAPDetail="select /* MES E007017 created on 2005-09-12 */" +" et.activity,et.action,et.txntime," +" et.username,et.usergroup,et.commentadd,et.status" +" from smic_eocap_transaction et" +" where ocapno='" + sOCAPNo + "' order by et.txntime"; QQueryBean.setQueryInfo(sDatabaseName,sSQLOCAPDetail); OCAPDetailVc=QQueryBean.getResultVector(); // Query OCAP History QQueryBean.reset(); /* Modified by Leon at 2005/4/6 for get OCAP Info from new OCAP table String sSQLOCAPHist="select seh.ocapid,seh.reasoncode,seh.ocaphandle" + " from smic_eocap_history seh where seh.datetime='" + sDateTime + "'" + " and seh.ocapno='" + sOCAPNo + "'"; */ String sSQLOCAPHist="select sei.ocapid,sei.reasoncode,sei.ocaphandle" + " from smic_eocap_info sei where sei.datetime='" + sDateTime + "'" + " and sei.ocapno='" + sOCAPNo + "'"; QQueryBean.setQueryInfo(sDatabaseName,sSQLOCAPHist); OCAPHistVc=QQueryBean.getResultVector(); for (int k=1;k<OCAPHistVc.size();k++){ Vector RowOCAPHistVc=(Vector)OCAPHistVc.elementAt(k); sOCAPId=RowOCAPHistVc.elementAt(0).toString(); sReasonCode=RowOCAPHistVc.elementAt(1).toString(); sOCAPHandler=RowOCAPHistVc.elementAt(2).toString(); } //System.out.println(" * OCAPHistory Count= "+(OCAPDetailVc.size()-1)); }catch (Exception e){ System.out.println("Query Error:"+e); } // %> <html> <head> <title>[e-SPC System]-OCAP Detail Info</title> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <link rel='stylesheet' href='../Css/eSPC.css'> </head> <%@ include file="../Include/SpcHead.jsp"%> <body bgcolor="#FFFFFF" text="#000000"> <form name="frm"> <table border="1" cellspacing="1" width="100%" bordercolorlight="#000000" bordercolordark="#000000" bordercolor="#000000" height="30"> <!-- Marked by Leon at 2005/4/6 for new eOCAP <don't show OCAP file again since no excel file> <tr> <td colspan="6"><b> <font face="Times New Roman, Times, serif" size="3"> <%if (bFileExist){%> Click to open OCAP File: <a href="<%=sFileURL%>" target="<%=sFileURL%>"><%=sOCAPNo%></a> <%}else{%> <font color="#FF0000"> This OCAP file <%=sOCAPNo%> does not exist, you can login e-OCAP system to generate it ! </font> <%}%> </font></b> </td> </tr> --> <tr> <!-- Modified by Leon at 2005/4/6 for new eOCAP <show OCAP info from new OCAP table> <td colspan="6"> <b>OCAPId:</b> <%=sOCAPId%> --> <td colspan="7"> <b>OCAP No: </b> <%=sOCAPNo%> ,<b> OCAPId:</b> <%=sOCAPId%> <%if (sReasonCode.compareTo("")!=0){%> , <b>ReasonCode:</b> <%=sReasonCode%> <%}%> <%if (sOCAPHandler.compareTo("")!=0){%> , <b>OCAPHandle:</b> <%=sOCAPHandler%> <%}%> </td> </tr> <%if (OCAPDetailVc.size()>1){ for (int i=0;i<OCAPDetailVc.size();i++){ %> <tr> <%Vector RowOCAPDetailVc=(Vector)OCAPDetailVc.elementAt(i); for (int j=0;j<RowOCAPDetailVc.size();j++){ String sColumnValue=RowOCAPDetailVc.elementAt(j).toString(); // Fomate DateTime // Modified by Leon at 2005/4/6 for get OCAP Info from new OCAP table //if (j==2 & i!=0){ if (j==2 & i!=0){ sColumnValue=sColumnValue.substring(0,4)+"/"+sColumnValue.substring(4,6) + "/"+sColumnValue.substring(6,8)+" "+sColumnValue.substring(9,11)+":" + sColumnValue.substring(11,13)+":"+sColumnValue.substring(13,15); } //if (i==0 & j!=5){ if (i==0){ %> <td class='p1'><%=sColumnValue%></td> <% //}else if (i!=0 & j!=5){ }else if (i!=0){ %> <td class='p11'>.<%=sColumnValue%></td> <%} }%> </tr> <% } }else{%> <!-- Modified by Leon at 2005/4/6 for new eOCAP <show OCAP info from new OCAP table> <tr><td colspan="6">No detail history now</td></tr> --> <tr><td colspan="7">No detail history now</td></tr> <%}%> <tr> <!-- Modified by Leon at 2005/4/6 for new eOCAP <show OCAP info from new OCAP table> <td colspan="5" align="right"> --> <td colspan="6" align="right"> <input type="button" name="cmdClose" value="Close" onclick="closePage()"> </td> <td>.</td> </tr> </table> </form> <SCRIPT type="text/javascript" src="./SpcClient.js"></SCRIPT> </body> </html> <% System.out.println("++++++++++++++++++++++++ OCAP Info Exited ++++++++++++++++++++++++++++++\n"); %>
最新发布
09-09
using System; using System.Collections.Generic; using System.Text; // using System.Linq; using H3; public class D125209slxbfl79prkgnv1suwjy6: H3.SmartForm.SmartFormController { public D125209slxbfl79prkgnv1suwjy6(H3.SmartForm.SmartFormRequest request): base(request) { } protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response) { base.OnLoad(response); } protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response) { try { H3.DataModel.BizObject[] biz = (H3.DataModel.BizObject[]) this.Request.BizObject["D125209szc6ricnlaei6lyminjd"]; if(actionName == "cz") { response.ReturnData = new Dictionary<string, object>(); string sql = "select * from i_D125209slxbfl79prkgnv1suwjy6 where F0000038='" + this.Request["obj"] + "'"; System.Data.DataTable tb = this.Request.Engine.Query.QueryTable(sql, null); System.Data.DataRowCollection t0 = tb.Rows; if(t0 != null && t0.Count > 0) { List < string > objs = new List<string>(); foreach(System.Data.DataRow row in t0) { H3.DataModel.BizObject bi = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Request.Engine, "D125209slxbfl79prkgnv1suwjy6", row["objectid"] + "", false); H3.DataModel.BizObject[] zibs = (H3.DataModel.BizObject[]) bi["D125209szc6ricnlaei6lyminjd"]; foreach(H3.DataModel.BizObject b in zibs) { objs.Add(b["F0000006"] + ""); } } H3.DataModel.BizObject sq = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Request.Engine, "D125209sn8ds0wakikkdmitkfmqf", this.Request["obj"] + "", false); H3.DataModel.BizObject[] bs = (H3.DataModel.BizObject[]) sq["D125209sqnu2kfazeuevfgju438"]; List < string > objid = new List<string>(); foreach(H3.DataModel.BizObject b in bs) { foreach(string o in objs) { if(o.Equals(b.ObjectId + "")) { continue; } objid.Add(b.ObjectId); break; } } response.ReturnData.Add("objid", string.Join(", ", objid)); } } //当最后一个节点同意后,且分解采购单号为空---这段也不一致(这段在248行) if(actionName == "Submit" && this.Request.ActivityCode != null && this.Request.ActivityCode.Equals("Activity15") && (this.Request.BizObject["F0000043"] == null || this.Request.BizObject["F0000043"].Equals(""))) { string SeqNoCode = this.Request.BizObject["SeqNo"].ToString(); string tab = "D125209sn8ds0wakikkdmitkfmqf"; if(this.Request.BizObject["F0000060"].Equals("专用采购")) { tab = "D125209shyx4vc8mtk6hjgdo0"; } string sql = "select * from i_" + tab + " where F0000069='" + this.Request.BizObject["F0000039"] + "'"; System.Data.DataTable tb = this.Request.Engine.Query.QueryTable(sql, null); System.Data.DataRowCollection t0 = tb.Rows; System.Data.DataRow t = t0[0]; H3.DataModel.BizObject dh = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, tab, t["objectid"] + "", false); int num = string.IsNullOrEmpty(dh["F0000053"] + "") ? 0 : Convert.ToInt32(dh["F0000053"]); dh["F0000053"] = num + 1; this.Request.BizObject["F0000043"] = this.Request.BizObject["F0000039"] + "-" + ++num;//赋值给采购分解单号 H3.ErrorCode code = dh.Update(); //生成的分解单号同步到辅助表 //先根据生成的合同编号(无用)设计到业务 这个值去采购分解及合同中查询到该数据 string sqlSeqNo = " select * from i_D125209slxbfl79prkgnv1suwjy6 where SeqNo =@SeqNoCode"; List < H3.Data.Database.Parameter > vall = new List<H3.Data.Database.Parameter>(); vall.Add( new H3.Data.Database.Parameter( "@SeqNoCode", System.Data.DbType.String, SeqNoCode ) ); System.Data.DataTable rows = this.Request.Engine.Query.QueryTable(sqlSeqNo, vall.ToArray()); string ht = rows.Rows[0]["F0000067"].ToString(); //判断供应商类型不为空值 if(rows.Rows[0]["F0000067"].ToString() != null && rows.Rows[0]["F0000067"].ToString() != "") { //如果供应商类型是单次就去单次辅助表把采购分解单号补充上 if(rows.Rows[0]["F0000067"].ToString() == "单次签订合同") { string sqlFJDH = " update i_D125209sag9aurp7m0q5vnuiiztq set F0000001 = @cgfjdh where F0000003 = @lsh"; List < H3.Data.Database.Parameter > list = new List<H3.Data.Database.Parameter>(); list.Add( new H3.Data.Database.Parameter( "@lsh", System.Data.DbType.String, SeqNoCode ) ); list.Add( new H3.Data.Database.Parameter( "@cgfjdh", System.Data.DbType.String, this.Request.BizObject["F0000043"].ToString() ) ); //执行sql语句 System.Data.DataTable dc = this.Request.Engine.Query.QueryTable(sqlFJDH, list.ToArray()); } if(rows.Rows[0]["F0000067"].ToString() == "年度协议") { string sqlFJDH = " update i_D125209sgbfklptbyuq21af1rr9c set F0000001 = @cgfjdh where F0000003 = @lsh"; List < H3.Data.Database.Parameter > list = new List<H3.Data.Database.Parameter>(); list.Add( new H3.Data.Database.Parameter( "@lsh", System.Data.DbType.String, SeqNoCode ) ); list.Add( new H3.Data.Database.Parameter( "@cgfjdh", System.Data.DbType.String, this.Request.BizObject["F0000043"].ToString() ) ); System.Data.DataTable dc = this.Request.Engine.Query.QueryTable(sqlFJDH, list.ToArray()); } if(rows.Rows[0]["F0000067"].ToString() == "批量签订合同") { string sqlFJDH = " update i_D125209sl3afqe5cekkxak5hlivj set F0000001 = @cgfjdh where F0000003 = @lsh"; List < H3.Data.Database.Parameter > list = new List<H3.Data.Database.Parameter>(); list.Add( new H3.Data.Database.Parameter( "@lsh", System.Data.DbType.String, SeqNoCode ) ); list.Add( new H3.Data.Database.Parameter( "@cgfjdh", System.Data.DbType.String, this.Request.BizObject["F0000043"].ToString() ) ); System.Data.DataTable dc = this.Request.Engine.Query.QueryTable(sqlFJDH, list.ToArray()); } } } if(actionName == "Submit" && this.Request.BizObject.Status == H3.DataModel.BizObjectStatus.Effective) // 这段对应的106行 { //根据分解流水号,采购分解单号,关联采购通用申请。关联采购专用申请 string sqlWZRL = "select * from i_D125209skrt4lsjxl0udjuh4651z where F0000114 = @lsh AND F0000097 = @fjdh AND F0000096 = @tysq AND F0000095 = @zysq "; //定义参数集合 List < H3.Data.Database.Parameter > parameters = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameters.Add(new H3.Data.Database.Parameter( "@lsh", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["SeqNo"]//参数值 )); parameters.Add(new H3.Data.Database.Parameter( "@fjdh", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000043"]//参数值 )); parameters.Add(new H3.Data.Database.Parameter( "@tysq", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000038"]//参数值 )); parameters.Add(new H3.Data.Database.Parameter( "@zysq", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000059"]//参数值 )); //传入sql和参数查询结果 System.Data.DataTable dt = this.Request.Engine.Query.QueryTable(sqlWZRL, parameters.ToArray()); //判断是否存在数据 if(dt != null && dt.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = dt.Rows; System.Data.DataRow row = d[0]; //获取物资入库加载的实例对象 D125209skrt4lsjxl0udjuh4651z H3.DataModel.BizObject dz = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209skrt4lsjxl0udjuh4651z", row["objectid"] + "", false); //发货地址,供应商,入库总数量 dz["F0000094"] = this.Request.BizObject["F0000061"]; dz["F0000099"] = this.Request.BizObject["F0000019"]; dz["F0000044"] = this.Request.BizObject["F0000049"]; dz["F0000114"] = this.Request.BizObject["SeqNo"]; dz["F0000097"] = this.Request.BizObject["F0000043"]; dz["F0000096"] = this.Request.BizObject["F0000038"]; dz["F0000095"] = this.Request.BizObject["F0000059"]; //目标子表数据 D125209syosdgo2cpem8fhgkza0 H3.DataModel.BizObject[] mizs = (H3.DataModel.BizObject[]) dz["D125209syosdgo2cpem8fhgkza0"]; //本表单子表数据 D125209sn6jsu01xweigvdpdh9df H3.DataModel.BizObject[] bizs = (H3.DataModel.BizObject[]) this.Request.BizObject["D125209szc6ricnlaei6lyminjd"]; foreach(H3.DataModel.BizObject bo in bizs) { foreach(H3.DataModel.BizObject miz in mizs) { //D125209sxr1jfg40r0sp6yuqpf2g.F0000084 D125209sn6jsu01xweigvdpdh9df.F0000055 if(bo["F0000055"] == miz["F0000084"]) { miz["F0000007"] = bo["F0000007"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000007 物资设备名称 D125209sn6jsu01xweigvdpdh9df.F0000007 miz["F0000008"] = bo["F0000008"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000008 产品编号 D125209sn6jsu01xweigvdpdh9df.F0000008 miz["F0000009"] = bo["F0000009"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000009 材料库分类名称 D125209sn6jsu01xweigvdpdh9df.F0000009 miz["F0000010"] = bo["F0000010"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000010 易耗品分类名称 D125209sn6jsu01xweigvdpdh9df.F0000010 miz["F0000011"] = bo["F0000011"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000011 合金牌号 D125209sn6jsu01xweigvdpdh9df.F0000011 miz["F0000012"] = bo["F0000012"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000012 材料标准 D125209sn6jsu01xweigvdpdh9df.F0000012 miz["F0000013"] = bo["F0000013"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000013 计量单位 D125209sn6jsu01xweigvdpdh9df.F0000013 miz["F0000015"] = bo["F0000015"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000015 规格型号 D125209sn6jsu01xweigvdpdh9df.F0000015 miz["F0000016"] = bo["F0000016"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000016 工作令号 D125209sn6jsu01xweigvdpdh9df.F0000016 miz["F0000017"] = bo["F0000017"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000017 产品图号 D125209sn6jsu01xweigvdpdh9df.F0000017 miz["F0000045"] = bo["F0000069"];// D125209sxr1jfg40r0sp6yuqpf2g.F0000045 采购数量 D125209sn6jsu01xweigvdpdh9df.F0000069 miz["F0000051"] = bo["F0000071"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000051 未入库数量 D125209sn6jsu01xweigvdpdh9df.F0000071 miz["F0000070"] = bo["F0000026"];// D125209sxr1jfg40r0sp6yuqpf2g.F0000070 采购类型 D125209sn6jsu01xweigvdpdh9df.F0000026 miz["F0000069"] = bo["F0000028"];// D125209sxr1jfg40r0sp6yuqpf2g.F0000069 备注 D125209sn6jsu01xweigvdpdh9df.F0000028 miz["F0000049"] = bo["F0000029"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000049 单价 D125209sn6jsu01xweigvdpdh9df.F0000029 miz["F0000064"] = bo["F0000022"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000064 材料编号 D125209sn6jsu01xweigvdpdh9df.F0000022 miz["F0000072"] = bo["F0000031"];// D125209sxr1jfg40r0sp6yuqpf2g.F0000072 数据标题1 物资名称辅助 D125209sn6jsu01xweigvdpdh9df.F0000031 miz["F0000084"] = bo["F0000055"];// D125209sxr1jfg40r0sp6yuqpf2g.F0000084 obj D125209sn6jsu01xweigvdpdh9df.F0000055 miz["F0000087"] = bo["F0000058"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000087 代号 D125209sn6jsu01xweigvdpdh9df.F0000058 miz["F0000100"] = bo["F0000079"];// D125209sxr1jfg40r0sp6yuqpf2g.F0000100 选择材料辅助 D125209sn6jsu01xweigvdpdh9df.F0000079 miz["F0000101"] = bo["F0000080"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000101 选择易耗品辅助 D125209sn6jsu01xweigvdpdh9df.F0000080 miz["F0000102"] = bo["F0000081"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000102 选择设备辅助 D125209sn6jsu01xweigvdpdh9df.F0000081 miz["F0000105"] = bo["F0000083"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000105 板厚 D125209sn6jsu01xweigvdpdh9df.F0000083 miz["F0000106"] = bo["F0000085"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000106 宽幅 D125209sn6jsu01xweigvdpdh9df.F0000085 miz["F0000107"] = bo["F0000084"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000107 长度 D125209sn6jsu01xweigvdpdh9df.F0000084 double dj = Convert.ToDouble(bo["F0000029"]); double sl = Convert.ToDouble(miz["F0000034"]); miz["F0000050"] = dj * sl;//D125209sxr1jfg40r0sp6yuqpf2g.F0000050 公式 单价* 入库数量 D125209sxr1jfg40r0sp6yuqpf2g.F0000034 miz["F0000110"] = bo["F0000019"];//D125209sxr1jfg40r0sp6yuqpf2g.F0000110 供应商名称 F0000019 miz["F0000115"] = bo["F0000067"];// 供应商类型 } } } dz["D125209syosdgo2cpem8fhgkza0"] = mizs; dz.Update(); } } //数据作废时,更新表单---这个是后面添加的 if(this.Request.BizObject.Status == H3.DataModel.BizObjectStatus.Canceled) { foreach(H3.DataModel.BizObject bo in biz) { //更新采购申请清单 根据obj D125209sjwgadx0tgecduldjblnu.F0000055 物资名称 D125209sjwgadx0tgecduldjblnu.F0000031 采购单号 F0000039 判断是否存在,有则修改 string sqlCGFJ = "select * from i_D125209sn4tj5acjuee0gfl87mr where F0000034 = @no AND F0000045 = @obj AND F0000020 = @cgdh"; //定义参数集合 List < H3.Data.Database.Parameter > parameterCGFJ = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameterCGFJ.Add(new H3.Data.Database.Parameter( "@no", //参数名 System.Data.DbType.String, //参数值类型 bo["F0000031"]//参数值 D125209sjwgadx0tgecduldjblnu.F0000031//物资名称 )); parameterCGFJ.Add(new H3.Data.Database.Parameter( "@obj", //参数名 System.Data.DbType.String, //参数值类型 bo["F0000055"]//参数值 )); parameterCGFJ.Add(new H3.Data.Database.Parameter( "@cgdh", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000039"]//参数值 )); //传入sql和参数查询结果 System.Data.DataTable CGFJ = this.Request.Engine.Query.QueryTable(sqlCGFJ, parameterCGFJ.ToArray()); //判断是否存在数据 if(CGFJ != null && CGFJ.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = CGFJ.Rows; System.Data.DataRow row = d[0]; //获取采购申请清单加载的实例对象 H3.DataModel.BizObject sq = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209sn4tj5acjuee0gfl87mr", row["objectid"] + "", false); double bsj = Convert.ToDouble(sq["F0000041"]); double cg = Convert.ToDouble(bo["F0000027"]); bsj = bsj - cg; sq["F0000041"] = bsj;// 本次分解数量 = 本次分解数量 F0000041 - 采购数量 F0000027 double ssl = Convert.ToDouble(sq["F0000042"]); ssl = ssl + cg; sq["F0000042"] = ssl;// 剩余生产数量 = 剩余生产数量 + 采购数量 F0000042 double zsl = Convert.ToDouble(sq["F0000046"]); zsl = zsl + cg; sq["F0000046"] = zsl; //占用数量(辅助) F0000046 + 采购数量 sq.Update(); } } } base.OnSubmit(actionName, postValue, response); if(actionName == "Submit" && (this.Request.BizObject["F0000067"] != null || this.Request.BizObject["F0000067"] != "") && this.Request.ActivityCode == "Activity150") { if(this.Request.BizObject["F0000067"] != null || this.Request.BizObject["F0000067"] != "") { H3.DataModel.BizObjectSchema aSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209sag9aurp7m0q5vnuiiztq"); /**合同编号辅助表 */ H3.DataModel.BizObject kc = new H3.DataModel.BizObject(this.Engine, aSchema, H3.Organization.User.SystemUserId); } else { H3.DataModel.BizObjectSchema aSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209sag9aurp7m0q5vnuiiztq"); /**合同编号辅助表 */ H3.DataModel.BizObject kc = new H3.DataModel.BizObject(this.Engine, aSchema, H3.Organization.User.SystemUserId); } //单次签订合同编号辅助表 D125209sag9aurp7m0q5vnuiiztq if(this.Request.BizObject["F0000067"].ToString() == "单次签订合同") { //获取表单 Schema ,用于新建表单时,获取表单实例 获取表单的结构对象 H3.DataModel.BizObjectSchema aSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209sag9aurp7m0q5vnuiiztq"); /**合同编号辅助表 */ H3.DataModel.BizObject kc = new H3.DataModel.BizObject(this.Engine, aSchema, H3.Organization.User.SystemUserId); kc["OwnerId"] = this.Request.BizObject["OwnerId"]; //拥有者 kc["F0000002"] = this.Request.BizObject["F0000067"]; //供应商类型 kc["F0000003"] = this.Request.BizObject["SeqNo"]; //流水号 F0000003 合同编号(无用) string kcc = kc["F0000003"].ToString(); //this.Request.BizObject["F0000087"]=kc["SeqNo"].ToString(); kc.Status = H3.DataModel.BizObjectStatus.Effective; kc.Create(); try { H3.DataModel.BizObjectSchema ZBaSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209slxbfl79prkgnv1suwjy6"); H3.DataModel.BizObject ZBSL = new H3.DataModel.BizObject(this.Engine, ZBaSchema, H3.Organization.User.SystemUserId); //辅助表生成的合同编号 string zshtbh = kc["SeqNo"].ToString(); ZBSL["F0000087"] = zshtbh; //根据合同编号(无用,但不可删除,涉及业务规则)在年度辅助表中查询该数据 ---辅助表 string year = " select * from i_D125209sag9aurp7m0q5vnuiiztq where F0000003 = @ND"; List < H3.Data.Database.Parameter > lis=new List<H3.Data.Database.Parameter>(); H3.Data.Database.Parameter ss = new H3.Data.Database.Parameter(); ss.Name = "@ND"; ss.DBType = System.Data.DbType.String; ss.Value = this.Request.BizObject["SeqNo"].ToString(); lis.Add(ss); System.Data.DataTable ND = this.Engine.Query.QueryTable(year, lis.ToArray()); string NDval = ND.Rows[0]["SeqNo"].ToString(); //拿到这条数据 //System.Data.DataRow dataRow = ND.Rows[0]; //string ZB = " select * from i_D125209slxbfl79prkgnv1suwjy6 where SeqNo =@code"; //主表 //List < H3.Data.Database.Parameter > lis2=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter ss2 = new H3.Data.Database.Parameter(); //ss2.DBType = System.Data.DbType.String; //ss2.Name = "@code"; //ss2.Value = this.Request.BizObject["SeqNo"].ToString(); //System.Data.DataTable ZBdata = this.Engine.Query.QueryTable(ZB, lis2.ToArray()); //System.Data.DataRow ZBrow = ZBdata.Rows[0]; //主表数据同步,把单次辅助表中的合同编号同步到采购分解及合同签订 string UpdateZB = " Update i_D125209slxbfl79prkgnv1suwjy6 SET F0000087 =@htbh where SeqNo =@htbnwy"; List < H3.Data.Database.Parameter > lis3=new List<H3.Data.Database.Parameter>(); H3.Data.Database.Parameter up = new H3.Data.Database.Parameter(); up.DBType = System.Data.DbType.String; up.Name = "@htbh"; //辅助表中的合同编号 up.Value = zshtbh; H3.Data.Database.Parameter upp = new H3.Data.Database.Parameter(); upp.DBType = System.Data.DbType.String; upp.Name = "@htbnwy"; upp.Value = kcc; lis3.Add(up); lis3.Add(upp); System.Data.DataTable dataUp = this.Engine.Query.QueryTable(UpdateZB, lis3.ToArray()); //辅助表同步 把采购单号同步到辅助表 //string UpdateZB2 = " Update i_D125209sag9aurp7m0q5vnuiiztq SET F0000001 =@fjdh where F0000003 =@kcc"; //List < H3.Data.Database.Parameter > lis4=new List<H3.Data.Database.Parameter>(); // H3.Data.Database.Parameter up2 = new H3.Data.Database.Parameter(); // up2.DBType = System.Data.DbType.String; // up2.Name = "@fjdh"; // up2.Value = this.Request.BizObject["F0000039"].ToString(); // lis4.Add(new H3.Data.Database.Parameter( // "@kcc", //参数名 // System.Data.DbType.String, //参数值类型 // kcc //参数值 //)); // lis4.Add(up2); // System.Data.DataTable dataUp2 = this.Engine.Query.QueryTable(UpdateZB2, lis4.ToArray()); } catch(Exception ex) { } } //年度签订合同编号辅助表 D125209sgbfklptbyuq21af1rr9c if(this.Request.BizObject["F0000067"].ToString() == "年度协议") { //获取表单 Schema ,用于新建表单时,获取表单实例 H3.DataModel.BizObjectSchema aSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209sgbfklptbyuq21af1rr9c"); /**合同编号辅助表 */ H3.DataModel.BizObject kc = new H3.DataModel.BizObject(this.Engine, aSchema, H3.Organization.User.SystemUserId); kc["OwnerId"] = this.Request.BizObject["OwnerId"]; //拥有者 kc["F0000002"] = this.Request.BizObject["F0000067"]; //供应商类型 kc["F0000003"] = this.Request.BizObject["SeqNo"]; //流水号 F0000003 合同编号(无用) string kcc1 = kc["F0000003"].ToString(); kc.Status = H3.DataModel.BizObjectStatus.Effective; kc.Create(); try { H3.DataModel.BizObjectSchema ZBaSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209slxbfl79prkgnv1suwjy6"); H3.DataModel.BizObject ZBSL = new H3.DataModel.BizObject(this.Engine, ZBaSchema, H3.Organization.User.SystemUserId); string zshtbh = kc["SeqNo"].ToString(); ZBSL["F0000087"] = zshtbh; //根据合同编号(无用,但不可删除,涉及业务规则)在年度辅助表中查询该数据 ---年度辅助表 string year = " select * from i_D125209sgbfklptbyuq21af1rr9c where F0000003 = @ND"; List < H3.Data.Database.Parameter > lis=new List<H3.Data.Database.Parameter>(); H3.Data.Database.Parameter ss = new H3.Data.Database.Parameter(); ss.Name = "@ND"; ss.DBType = System.Data.DbType.String; ss.Value = this.Request.BizObject["SeqNo"].ToString(); lis.Add(ss); System.Data.DataTable ND = this.Engine.Query.QueryTable(year, lis.ToArray()); string NDval = ND.Rows[0]["SeqNo"].ToString(); //拿到这条数据 //System.Data.DataRow dataRow = ND.Rows[0]; //string ZB = " select * from i_D125209slxbfl79prkgnv1suwjy6 where SeqNo =@code"; //主表 //List < H3.Data.Database.Parameter > lis2=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter ss2 = new H3.Data.Database.Parameter(); //ss2.DBType = System.Data.DbType.String; //ss2.Name = "@code"; //ss2.Value = this.Request.BizObject["SeqNo"].ToString(); //System.Data.DataTable ZBdata = this.Engine.Query.QueryTable(ZB, lis2.ToArray()); //System.Data.DataRow ZBrow = ZBdata.Rows[0]; //年度辅助表同步 //string UpdateZB2 = " Update i_D125209sgbfklptbyuq21af1rr9c SET F0000003 =@wyht where F0000003 =@lsh"; //List < H3.Data.Database.Parameter > lis4=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter up2 = new H3.Data.Database.Parameter(); //up2.DBType = System.Data.DbType.String; // up2.Name = "@lsh"; //up2.Value = this.Request.BizObject["SeqNo"].ToString(); // lis4.Add(new H3.Data.Database.Parameter( // "@lsh", //参数名 // System.Data.DbType.String, //参数值类型 //参数值 //)); // System.Data.DataTable dataUp2 = this.Engine.Query.QueryTable(UpdateZB2, lis4.ToArray()); //主表数据同步 string UpdateZB = " Update i_D125209slxbfl79prkgnv1suwjy6 SET F0000087 =@htbh where SeqNo =@htbnwy"; List < H3.Data.Database.Parameter > lis3=new List<H3.Data.Database.Parameter>(); H3.Data.Database.Parameter up = new H3.Data.Database.Parameter(); up.DBType = System.Data.DbType.String; up.Name = "@htbh"; up.Value = zshtbh; H3.Data.Database.Parameter upp = new H3.Data.Database.Parameter(); upp.DBType = System.Data.DbType.String; upp.Name = "@htbnwy"; upp.Value = kcc1; lis3.Add(up); lis3.Add(upp); System.Data.DataTable dataUp = this.Engine.Query.QueryTable(UpdateZB, lis3.ToArray()); //辅助表同步 把采购单号同步到辅助表 //string UpdateZB2 = " Update i_D125209sgbfklptbyuq21af1rr9c SET F0000001 =@fjdh where F0000003 =@kcc1"; //List < H3.Data.Database.Parameter > lis4=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter up2 = new H3.Data.Database.Parameter(); //up2.DBType = System.Data.DbType.String; // up2.Name = "@fjdh"; // up2.Value = this.Request.BizObject["F0000039"].ToString(); // lis4.Add(new H3.Data.Database.Parameter( // "@kcc1", //参数名 // System.Data.DbType.String, //参数值类型 // kcc1 //参数值 //)); // lis4.Add(up2); //System.Data.DataTable dataUp2 = this.Engine.Query.QueryTable(UpdateZB2, lis4.ToArray()); } catch(Exception ex) { } } //批量签订合同编号辅助表 D125209sl3afqe5cekkxak5hlivj if(this.Request.BizObject["F0000067"].ToString() == "批量签订合同") { try { //获取表单 Schema ,用于新建表单时,获取表单实例 H3.DataModel.BizObjectSchema aSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209sl3afqe5cekkxak5hlivj"); /**合同编号辅助表 */ H3.DataModel.BizObject kc = new H3.DataModel.BizObject(this.Engine, aSchema, H3.Organization.User.SystemUserId); kc["OwnerId"] = this.Request.BizObject["OwnerId"]; //拥有者 kc["F0000002"] = this.Request.BizObject["F0000067"]; //供应商类型 kc["F0000003"] = this.Request.BizObject["SeqNo"]; //流水号 F0000003 合同编号(无用) string kcc2 = kc["F0000003"].ToString(); kc.Status = H3.DataModel.BizObjectStatus.Effective; kc.Create(); //获取主表的数据结构 H3.DataModel.BizObjectSchema ZBaSchema = this.Engine.BizObjectManager.GetPublishedSchema("D125209slxbfl79prkgnv1suwjy6"); H3.DataModel.BizObject ZBSL = new H3.DataModel.BizObject(this.Engine, ZBaSchema, H3.Organization.User.SystemUserId); //拿到辅助表生成的合同编号 string zshtbh = kc["SeqNo"].ToString(); ZBSL["F0000087"] = zshtbh; //根据合同编号(无用,但不可删除,涉及业务规则)在年度辅助表中查询该数据 ---年度辅助表 string year = " select * from i_D125209sl3afqe5cekkxak5hlivj where F0000003 = @ND"; List < H3.Data.Database.Parameter > lis=new List<H3.Data.Database.Parameter>(); H3.Data.Database.Parameter ss = new H3.Data.Database.Parameter(); ss.Name = "@ND"; ss.DBType = System.Data.DbType.String; ss.Value = this.Request.BizObject["SeqNo"].ToString(); lis.Add(ss); System.Data.DataTable ND = this.Engine.Query.QueryTable(year, lis.ToArray()); string NDval = ND.Rows[0]["SeqNo"].ToString(); //拿到这条数据 //System.Data.DataRow dataRow = ND.Rows[0]; //string ZB = " select * from i_D125209slxbfl79prkgnv1suwjy6 where SeqNo =@code"; //主表 //List < H3.Data.Database.Parameter > lis2=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter ss2 = new H3.Data.Database.Parameter(); //ss2.DBType = System.Data.DbType.String; //ss2.Name = "@code"; //ss2.Value = this.Request.BizObject["SeqNo"].ToString(); //System.Data.DataTable ZBdata = this.Engine.Query.QueryTable(ZB, lis2.ToArray()); //System.Data.DataRow ZBrow = ZBdata.Rows[0]; //年度辅助表同步 //string UpdateZB2 = " Update i_D125209sgbfklptbyuq21af1rr9c SET F0000003 =@wyht where F0000003 =@lsh"; //List < H3.Data.Database.Parameter > lis4=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter up2 = new H3.Data.Database.Parameter(); //up2.DBType = System.Data.DbType.String; // up2.Name = "@lsh"; //up2.Value = this.Request.BizObject["SeqNo"].ToString(); // lis4.Add(new H3.Data.Database.Parameter( // "@lsh", //参数名 // System.Data.DbType.String, //参数值类型 //参数值 //)); // System.Data.DataTable dataUp2 = this.Engine.Query.QueryTable(UpdateZB2, lis4.ToArray()); //主表数据同步 string UpdateZB = " Update i_D125209slxbfl79prkgnv1suwjy6 SET F0000087 =@htbh where SeqNo =@htbnwy"; List < H3.Data.Database.Parameter > lis3=new List<H3.Data.Database.Parameter>(); H3.Data.Database.Parameter up = new H3.Data.Database.Parameter(); up.DBType = System.Data.DbType.String; up.Name = "@htbh"; up.Value = zshtbh; H3.Data.Database.Parameter upp = new H3.Data.Database.Parameter(); upp.DBType = System.Data.DbType.String; upp.Name = "@htbnwy"; upp.Value = kcc2; lis3.Add(up); lis3.Add(upp); System.Data.DataTable dataUp = this.Engine.Query.QueryTable(UpdateZB, lis3.ToArray()); //辅助表同步 把采购单号同步到辅助表 //string UpdateZB2 = " Update i_D125209sl3afqe5cekkxak5hlivj SET F0000001 =@fjdh where F0000003 =@kcc2"; //List < H3.Data.Database.Parameter > lis4=new List<H3.Data.Database.Parameter>(); //H3.Data.Database.Parameter up2 = new H3.Data.Database.Parameter(); //up2.DBType = System.Data.DbType.String; //up2.Name = "@fjdh"; //up2.Value = this.Request.BizObject["F0000039"].ToString(); //lis4.Add(new H3.Data.Database.Parameter( // "@kcc2", //参数名 // System.Data.DbType.String, //参数值类型 // kcc2 //参数值 //)); //lis4.Add(up2); //System.Data.DataTable dataUp2 = this.Engine.Query.QueryTable(UpdateZB2, lis4.ToArray()); } catch(Exception ex) { } } } } catch(Exception ex) { } } protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState oldState, H3.Workflow.Instance.WorkflowInstanceState newState) { if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished) { H3.DataModel.BizObject[] biz = (H3.DataModel.BizObject[]) this.Request.BizObject["D125209szc6ricnlaei6lyminjd"]; //根据objectid更新通用采购申请 D125209sn8ds0wakikkdmitkfmqf string sqlTY = "select * from i_D125209sn8ds0wakikkdmitkfmqf where objectid = @no "; //定义参数集合 List < H3.Data.Database.Parameter > parameterTY = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameterTY.Add(new H3.Data.Database.Parameter( "@no", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000038"]//参数值 选择通用采购单号 )); //传入sql和参数查询结果 System.Data.DataTable TY = this.Request.Engine.Query.QueryTable(sqlTY, parameterTY.ToArray()); //判断是否存在数据 if(TY != null && TY.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = TY.Rows; System.Data.DataRow row = d[0]; //获取更新通用采购申请加载的实例对象 D125209sn8ds0wakikkdmitkfmqf H3.DataModel.BizObject sq = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209sn8ds0wakikkdmitkfmqf", row["objectid"] + "", false); double zsl = Convert.ToDouble(sq["F0000053"]) + 1; sq["F0000053"] = zsl; //占用数量(辅助) F0000046 + 采购数量 sq.Update(); } //根据objectid更新专用采购申请 D125209shyx4vc8mtk6hjgdo0 string sqlZY = "select * from i_D125209shyx4vc8mtk6hjgdo0 where objectid = @no "; //定义参数集合 List < H3.Data.Database.Parameter > parameterZY = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameterZY.Add(new H3.Data.Database.Parameter( "@no", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000038"]//参数值 选择通用采购单号 )); //传入sql和参数查询结果 System.Data.DataTable ZY = this.Request.Engine.Query.QueryTable(sqlZY, parameterTY.ToArray()); //判断是否存在数据 if(ZY != null && ZY.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = ZY.Rows; System.Data.DataRow row = d[0]; //获取专用采购申请加载的实例对象 D125209shyx4vc8mtk6hjgdo0 H3.DataModel.BizObject sq = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209shyx4vc8mtk6hjgdo0", row["objectid"] + "", false); double zsl = Convert.ToDouble(sq["F0000053"]) + 1; sq["F0000053"] = zsl; //占用数量(辅助) F0000046 + 采购数量 sq.Update(); } //更新物资入库 D125209skrt4lsjxl0udjuh4651z //根据采购分解单号 F0000043 , 合同编号无用但不可删 SeqNo 数据状态 不等于 已取消 判断是否存在,有则修改 string sqlWZRL = "select * from i_D125209skrt4lsjxl0udjuh4651z where F0000097 = @no AND F0000019 = @obj "; //定义参数集合 List < H3.Data.Database.Parameter > parameters = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameters.Add(new H3.Data.Database.Parameter( "@no", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000043"]//参数值 )); parameters.Add(new H3.Data.Database.Parameter( "@obj", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["SeqNo"]//参数值 )); //传入sql和参数查询结果 System.Data.DataTable dt = this.Request.Engine.Query.QueryTable(sqlWZRL, parameters.ToArray()); //判断是否存在数据 if(dt != null && dt.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = dt.Rows; System.Data.DataRow row = d[0]; //获取物资入库加载的实例对象 D125209skrt4lsjxl0udjuh4651z H3.DataModel.BizObject dz = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209skrt4lsjxl0udjuh4651z", row["objectid"] + "", true); //目标子表数据 D125209syosdgo2cpem8fhgkza0 H3.DataModel.BizObject[] mizs = (H3.DataModel.BizObject[]) dz["D125209syosdgo2cpem8fhgkza0"]; //本表单子表数据 D125209sn6jsu01xweigvdpdh9df H3.DataModel.BizObject[] bizs = (H3.DataModel.BizObject[]) this.Request.BizObject["D125209szc6ricnlaei6lyminjd"]; //目标表单子表数据不为空时进行更新 if(mizs != null) { foreach(H3.DataModel.BizObject miz in mizs) { foreach(H3.DataModel.BizObject bo in bizs) { //D125209sn6jsu01xweigvdpdh9df.F0000055 根据obj D125209sxr1jfg40r0sp6yuqpf2g.F0000084 if(miz["F0000084"] == bo["F0000055"]) { miz["F0000016"] = bo["F0000016"];//工作令号 D125209sn6jsu01xweigvdpdh9df.F0000016 D125209sxr1jfg40r0sp6yuqpf2g.F0000016 miz["F0000008"] = bo["F0000008"];//产品编号 D125209sn6jsu01xweigvdpdh9df.F0000008 D125209sxr1jfg40r0sp6yuqpf2g.F0000008 miz["F0000017"] = bo["F0000017"];//产品图号 D125209sn6jsu01xweigvdpdh9df.F0000017 D125209sxr1jfg40r0sp6yuqpf2g.F0000017 }; } } dz["D125209syosdgo2cpem8fhgkza0"] = mizs; dz.Update(); } } // 采购申请清单 D125209sn4tj5acjuee0gfl87mr // 更新状态 foreach(H3.DataModel.BizObject bo in biz) { //根据obj F0000055 数据状态 等于 已生效 判断是否存在,有则修改 string sqlCGFJ = "select * from i_D125209sn4tj5acjuee0gfl87mr where F0000045 = @no AND Status = @obj"; //定义参数集合 List < H3.Data.Database.Parameter > parameterCGFJ = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameterCGFJ.Add(new H3.Data.Database.Parameter( "@no", //参数名 System.Data.DbType.String, //参数值类型 bo["F0000055"]//参数值 )); parameterCGFJ.Add(new H3.Data.Database.Parameter( "@obj", //参数名 System.Data.DbType.String, //参数值类型 "1"//参数值 )); //传入sql和参数查询结果 System.Data.DataTable CGFJ = this.Request.Engine.Query.QueryTable(sqlCGFJ, parameterCGFJ.ToArray()); //判断是否存在数据 if(CGFJ != null && CGFJ.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = CGFJ.Rows; System.Data.DataRow row = d[0]; //获取采购申请清单加载的实例对象 H3.DataModel.BizObject sq = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209sn4tj5acjuee0gfl87mr", row["objectid"] + "", false); sq["F0000027"] = "已采购"; //采购状态后期可删除 sq.Update(); } } // 采购申请清单 // 更新状态 foreach(H3.DataModel.BizObject bo in biz) { //根据obj D125209sjwgadx0tgecduldjblnu.F0000055 物资名称 D125209sjwgadx0tgecduldjblnu.F0000031 采购单号 F0000039 判断是否存在,有则修改 string sqlCGFJ = "select * from i_D125209sn4tj5acjuee0gfl87mr where F0000034 = @no AND F0000045 = @obj AND F0000020 = @cgdh"; //定义参数集合 List < H3.Data.Database.Parameter > parameterCGFJ = new List<H3.Data.Database.Parameter>(); //将参数添加到参数集合 parameterCGFJ.Add(new H3.Data.Database.Parameter( "@no", //参数名 System.Data.DbType.String, //参数值类型 bo["F0000031"]//参数值 D125209sjwgadx0tgecduldjblnu.F0000031//物资名称 )); parameterCGFJ.Add(new H3.Data.Database.Parameter( "@obj", //参数名 System.Data.DbType.String, //参数值类型 bo["F0000055"]//参数值 )); parameterCGFJ.Add(new H3.Data.Database.Parameter( "@cgdh", //参数名 System.Data.DbType.String, //参数值类型 this.Request.BizObject["F0000039"]//参数值 )); //传入sql和参数查询结果 System.Data.DataTable CGFJ = this.Request.Engine.Query.QueryTable(sqlCGFJ, parameterCGFJ.ToArray()); //判断是否存在数据 if(CGFJ != null && CGFJ.Rows.Count > 0) { //取第一行数据 System.Data.DataRowCollection d = CGFJ.Rows; System.Data.DataRow row = d[0]; //获取采购申请清单加载的实例对象 H3.DataModel.BizObject sq = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Request.Engine, "D125209sn4tj5acjuee0gfl87mr", row["objectid"] + "", false); sq["F0000026"] = bo["F0000027"];//使用地点 F0000026 D125209sjwgadx0tgecduldjblnu.F0000027 sq["F0000032"] = bo["F0000028"];//备注 F0000032 D125209sjwgadx0tgecduldjblnu.F0000028 sq["F0000041"] = bo["F0000069"];//采购数量 = 本次分解数量 F0000041 D125209sjwgadx0tgecduldjblnu.F0000069 double zl = Convert.ToDouble(sq["F0000042"]); double sl = Convert.ToDouble(bo["F0000069"]); double sum = zl - sl; sq["F0000042"] = sum;// 剩余生产数量 = 剩余生产数量 - 采购数量 F0000042 sq["F0000048"] = this.Request.BizObject["F0000062"]; //需求到货时间 F0000048 F0000062 sq.Update(); } } } base.OnWorkflowInstanceStateChanged(oldState, newState); } public void selectUp() { string sql = "select * from i_D125209slxbfl79prkgnv1suwjy6"; System.Data.DataTable datalIst = this.Engine.Query.QueryTable(sql, null); if(datalIst != null && datalIst.Rows.Count > 0) { foreach(System.Data.DataRow row in datalIst.Rows) { } } } } 帮我检查这个代码
07-13
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; using System.Threading; namespace book_information { public partial class jczl_floor : Form { internal AF AF = new AF(); public menu menu; public jczl_floor(menu fmz) { InitializeComponent(); menu = fmz; } private void floor_Load(object sender, EventArgs e) { selBindw(); init(); } #region 事件区 private void btsel_Click(object sender, EventArgs e) { try { selBindw(); } catch (Exception ec) { MessageBox.Show("错误:" + ec.StackTrace, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } private void btadd_Click(object sender, EventArgs e) { try { jczl_floor_add fma = new jczl_floor_add(this); fma.Text = "新增层数"; fma.ShowDialog(); return; } catch (Exception ec) { MessageBox.Show("错误:" + ec.StackTrace, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } private void btexcel_Click(object sender, EventArgs e) { try { this.Invoke(new Action(() => this.Enabled = false)); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "导出Excel"; saveFileDialog.Filter = "Excel文件(*.xls)|*.xls"; DialogResult dialogResult = saveFileDialog.ShowDialog(this); if (dialogResult == DialogResult.OK) { gridView1.Columns["Operation"].Visible = false; DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions(); gridControl1.ExportToXls(saveFileDialog.FileName); DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Invoke(new Action(() => this.Enabled = true)); } catch (Exception ec) { this.Invoke(new Action(() => this.Enabled = true)); MessageBox.Show("错误:" + ec.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } private void btn_Click(object sender, EventArgs e) { try { SimpleButton btn = sender as SimpleButton; if (btn.Name == "btfirst") { txtpageIndex.Text = "1"; } if (btn.Name == "btprevious") { if (Convert.ToInt32(txtpageIndex.Text.Trim()) - 1 > 0) txtpageIndex.Text = (Convert.ToInt32(txtpageIndex.Text.Trim()) - 1).ToString(); else txtpageIndex.Text = "1"; } if (btn.Name == "btnext") { if (Convert.ToInt32(txtpageIndex.Text.Trim()) + 1 <= Convert.ToInt32(lblpages.Text.Trim())) txtpageIndex.Text = (Convert.ToInt32(txtpageIndex.Text.Trim()) + 1).ToString(); } if (btn.Name == "btlast") { txtpageIndex.Text = lblpages.Text.Trim(); } Thread threads; threads = new Thread(selBindw); threads.IsBackground = true; threads.Start(); } catch (Exception ec) { MessageBox.Show("错误:" + ec.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } private void ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { string sqlcon = AF.sqlcon; int selectedHandle; selectedHandle = this.gridView1.GetSelectedRows()[0]; if (e.Button.Caption == "编辑") { string name, id,status; name = this.gridView1.GetRowCellValue(selectedHandle, "层号").ToString().Trim(); id = this.gridView1.GetRowCellValue(selectedHandle, "编号").ToString().Trim(); status = this.gridView1.GetRowCellValue(selectedHandle, "状态").ToString().Trim(); jczl_floor_edit fmb = new jczl_floor_edit(this); fmb.Text = "信息修改"; fmb.txtname.Text = name; fmb.id.Text = id; fmb.ddlstatus.Text = status; fmb.ShowDialog(); return; } } #endregion #region 函数区 private void init() { ddlpageSize.Properties.Items.Add("10"); ddlpageSize.Properties.Items.Add("20"); ddlpageSize.Properties.Items.Add("50"); ddlpageSize.Properties.Items.Add("80"); ddlpageSize.Properties.Items.Add("100"); ddlpageSize.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; ddlstatus.Properties.Items.Add("在用"); ddlstatus.Properties.Items.Add("停用"); ddlstatus.Properties.Items.Insert(0, "全部"); ddlstatus.SelectedIndex = 0; ddlstatus.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; try { this.Invoke(new Action(() => { DevExpress.XtraGrid.Columns.GridColumn NewColumn = this.gridView1.Columns.AddField("Operation"); NewColumn.VisibleIndex = 0; NewColumn.Width = 100; NewColumn.UnboundType = DevExpress.Data.UnboundColumnType.String; NewColumn.Caption = "操作"; NewColumn.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False; DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit buttonEdit = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); EditorButton editBtn = new EditorButton(ButtonPredefines.Glyph, "编辑"); editBtn.Appearance.ForeColor = Color.Blue; editBtn.Caption = "编辑"; buttonEdit.Buttons.Add(editBtn); buttonEdit.TextEditStyle = TextEditStyles.HideTextEditor; buttonEdit.ButtonClick += ButtonEdit_ButtonClick; this.gridControl1.RepositoryItems.Add(buttonEdit); NewColumn.ColumnEdit = buttonEdit; buttonEdit.Buttons[0].Visible = false; })); } catch (Exception ec) { MessageBox.Show("错误:" + ec.StackTrace, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } public void selBindw() { this.Invoke(new Action(() => this.Enabled = false)); if (!selBind()) { this.Invoke(new Action(() => this.Enabled = true)); MessageBox.Show("查询错误:连接服务器错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Invoke(new Action(() => this.Enabled = true)); return; }//统一处理数据查询失败的情况 public bool selBind() { string sqlcon = AF.sqlcon; string pageSize, pageIndex; pageSize = ddlpageSize.Text.Trim(); pageIndex = txtpageIndex.Text.Trim(); string sql = "SELECT*FROM" + "(" + " SELECT TOP(" + pageSize + "*" + pageIndex + ")" + " floorid 编号,floorname 层号,case when status=1 then '在用' else '停用' end 状态,createman 创建人,createtime 创建时间,maintenanceman 维护人,maintenancetime 维护时间," + " ROW_NUMBER() OVER (ORDER BY xh) rownum,COUNT(1) OVER() AS zcount" + " FROM jczl_floor WITH(NOLOCK) WHERE 1=1"; string str = ""; sql += getWhStr(str); sql += ")temp WHERE temp.rownum>(" + pageSize + "*(" + pageIndex + "-1))"; DataTable dt = new DataTable(); if (!AF.execSql(sql, sqlcon, out dt)) { return false; } if (dt.Rows.Count > 0) getDateRow(Convert.ToInt32(dt.Rows[0]["zcount"].ToString())); else lblpages.Text = "0"; if (dt.Rows.Count == 0 && txtpageIndex.Text != "1") { txtpageIndex.Invoke(new Action(() => txtpageIndex.Text = "1")); selBind(); return true; } int gvRow = gridView1.RowCount; gridControl1.Invoke(new Action(() => gridControl1.DataSource = dt)); if (gvRow == 0)//初始化表格结构 { gridControl1.Invoke(new Action(() => gridView1.Columns[0].Width = 80));//编号 gridControl1.Invoke(new Action(() => gridView1.Columns[1].Width = 100));//层号 gridControl1.Invoke(new Action(() => gridView1.Columns[2].Width = 90));//状态 gridControl1.Invoke(new Action(() => gridView1.Columns[3].Width = 90));//创建人 gridControl1.Invoke(new Action(() => gridView1.Columns[4].Width = 140));//创建时间 gridControl1.Invoke(new Action(() => gridView1.Columns[5].Width = 90));//维护人 gridControl1.Invoke(new Action(() => gridView1.Columns[6].Width = 140));//维护时间 gridControl1.Invoke(new Action(() => gridView1.Columns[7].Visible = false)); gridControl1.Invoke(new Action(() => gridView1.Columns[8].Visible = false)); gridControl1.Invoke(new Action(() => gridView1.Columns[0].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center)); gridControl1.Invoke(new Action(() => gridView1.Columns[1].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near)); gridControl1.Invoke(new Action(() => gridView1.Columns[2].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center)); gridControl1.Invoke(new Action(() => gridView1.Columns[3].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center)); gridControl1.Invoke(new Action(() => gridView1.Columns[4].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far)); gridControl1.Invoke(new Action(() => gridView1.Columns[5].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center)); gridControl1.Invoke(new Action(() => gridView1.Columns[6].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far)); for (int i = 0; i < gridView1.Columns.Count-1; i++) { gridControl1.Invoke(new Action(() => gridView1.Columns[i].OptionsColumn.AllowEdit = false)); } } return true; } private bool getDateRow(int hshl) { if (Convert.ToInt32(txtpageIndex.Text.Trim()) < 1) { txtpageIndex.Invoke(new Action(() => txtpageIndex.Text = "1")); } if (Math.Ceiling(Convert.ToDouble(hshl) / Convert.ToDouble(ddlpageSize.Text.Trim())) < Convert.ToInt32(txtpageIndex.Text.Trim())) { txtpageIndex.Invoke(new Action(() => txtpageIndex.Text = Math.Ceiling(Convert.ToDouble(hshl) / Convert.ToDouble(ddlpageSize.Text.Trim())).ToString())); selBind(); } lblpages.Invoke(new Action(() => lblpages.Text = Math.Ceiling(Convert.ToDouble(hshl) / Convert.ToDouble(ddlpageSize.Text.Trim())).ToString())); btnpageinfobar.Invoke(new Action(() => btnpageinfobar.Text = "(共" + hshl.ToString().Trim() + "条记录,每页" + ddlpageSize.Text.Trim() + "条,共" + lblpages.Text.Trim() + "页)")); return true; }//调整页码 private string getWhStr(string str) { if (txtname.Text.Trim() != "") { str += "AND floorname LIKE '%" + txtname.Text.Trim() + "%'"; } if (txtid.Text.Trim() != "") { str += "AND floorid LIKE '%" + txtid.Text.Trim() + "%'"; } int isuse; if (ddlstatus.Text.Trim() == "在用") isuse = 1; else isuse = 0; if (ddlstatus.Text.Trim() != "全部" && ddlstatus.Text.Trim() != "") { str += "AND status =" + isuse; } return str; } #endregion } } 用Ajax改写以上代码
08-15
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值