Ejemplo n.º 1
0
        private void contextmenu_Click(object sender, EventArgs e)
        {

            int ihand = gridView1.FocusedRowHandle;
            if (ihand < 0)
                return;
            WF_WorkTaskInstance wti = (sender as MenuItem).Tag as WF_WorkTaskInstance;
            string taskid = wti.WorkTaskId;
            string workflowid = wti.WorkFlowId;
            string workflowinsid = wti.WorkFlowInsId;
            string pwfid = null;
            DataRow dr = gridView1.GetDataRow(ihand);
            LP_Record currRecord = new LP_Record();
            currRecord = MainHelper.PlatformSqlMap.GetOneByKey<LP_Record>(dr["ID"].ToString());
            string strwhere = string.Format(" where recordid='{0}'", currRecord.ID);
            IList<WFP_RecordWorkTaskIns> wf = MainHelper.PlatformSqlMap.GetList<WFP_RecordWorkTaskIns>("SelectWFP_RecordWorkTaskInsList", strwhere);
            //if (wf.Count == 0) {

            //    return;
            //} else {
            //    workflowinsid = wf[0].WorkFlowInsId;
            //}

            if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0];
            if (currRecord.SignImg == null) currRecord.SignImg = new byte[0];
            if (currRecord.DocContent == null) currRecord.DocContent = new byte[0];
            //DataTable dtall = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID);
            DataTable dtall = new DataTable();// RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID);
            DataTable dt = new DataTable();


            DataTable dtret = null;

            dtret = RecordWorkTask.SelectedWorkflowTask(MainHelper.User.UserID, workflowid, workflowinsid, taskid, 1);
            if (dtret.Rows.Count == 0)
            {

                pwfid = wf[0].WorkFlowInsId;
                //while (dtret.Rows.Count == 0) 
                {
                    strwhere = string.Format(" where workflowid='{0}' and mainWorkFlowInsId='{1}'", workflowid, pwfid);
                    WF_WorkFlowInstance wfi = MainHelper.PlatformSqlMap.GetOne<WF_WorkFlowInstance>(strwhere);
                    if (wfi == null)
                    {
                        return;
                    }
                    workflowinsid = wfi.WorkFlowInsId;
                    workflowid = wfi.WorkFlowId;
                    dtret = RecordWorkTask.SelectedWorkflowTask(MainHelper.User.UserID, workflowid, workflowinsid, taskid, 1);

                }

            }
            if (dtret == null || dtret.Rows.Count == 0)
            {
                if (dtall.Rows.Count < 1)
                {
                    //if (currRecord.Status == "存档") {
                    //    //frmTemplate fm0 = new frmTemplate();
                    //    //fm0.ParentTemple = RecordWorkTask.GetWorkTaskTemple(dt, currRecord);
                    //    //fm0.CurrRecord = currRecord;
                    //    //fm0.Kind = strKind;
                    //    //fm0.Status = "edit";
                    //    //fm0.ShowDialog();
                    //    MsgBox.ShowAskMessageBox("已结束的流程不能在此处查阅。");
                    //} else
                    {
                        if (wf.Count > 0)
                        {
                            //WF_WorkFlowInstance wfi = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkFlowInstance>(wf[0].WorkFlowInsId);

                            //string struser = RecordWorkTask.GetWorkFlowTaskOperator(wf[0].WorkTaskInsId);
                            MsgBox.ShowTipMessageBox("没有操作此记录的权限,或者此节点没有相关文档 !");
                        }
                    }
                    return;
                }
                if (dtall.Rows.Count == 1 || currRecord.Status.IndexOf("|") == -1)
                {
                    dt = dtall;
                }
                else
                {
                    WorkFlowTaskSelectForm wfts = new WorkFlowTaskSelectForm();
                    wfts.RecordWorkFlowData = dtall;
                    if (wfts.ShowDialog() == DialogResult.OK)
                    {
                        dt = wfts.RetWorkFlowData;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                dt = dtret;
            }
            //if (!RecordWorkTask.HaveRunRecordRole(currRecord.ID, MainHelper.User.UserID)) return;
            object obj = RecordWorkTask.GetWorkTaskModle(dt);
            if (obj == null)
            {
                return;
            }
            if (obj is frmLP)
            {
                frmViewTemplate fm = new frmViewTemplate();

                //DataTable dt = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID);
                fm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(dt, currRecord);
                fm.CurrRecord = currRecord;
                fm.Kind = strKind;
                fm.Status = "edit";
                fm.RecordWorkFlowData = dt;
                fm.ShowDialog();
            }
            else
            {
                if (obj.GetType().GetProperty("IsWorkflowCall") != null)
                    obj.GetType().GetProperty("IsWorkflowCall").SetValue(obj, true, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持IsWorkflowCall,请咨询开发人员!");
                    return;
                }
                if (obj.GetType().GetProperty("CurrRecord") != null)
                    obj.GetType().GetProperty("CurrRecord").SetValue(obj, currRecord, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持CurrRecord,请咨询开发人员!");
                    return;
                }

                if (obj.GetType().GetProperty("ReadOnly") != null)
                    obj.GetType().GetProperty("ReadOnly").SetValue(obj, true, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持ReadOnly只读属性,所以无法查看!");
                    return;
                }

                if (obj.GetType().GetProperty("ParentTemple") != null)
                    obj.GetType().GetProperty("ParentTemple").SetValue(obj, RecordWorkTask.GetWorkTaskTemple(dt, currRecord), null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持ParentTemple,请咨询开发人员!");
                    return;
                }

                if (obj.GetType().GetProperty("RecordWorkFlowData") != null)
                    obj.GetType().GetProperty("RecordWorkFlowData").SetValue(obj, dt, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持RecordWorkFlowData,请咨询开发人员!");
                    return;
                }
                if (obj is UserControl)
                {

                    FormBase dlg = new FormBase();
                    dlg.Text = ((UserControl)obj).Name;
                    dlg.MdiParent = MainHelper.MainForm;
                    dlg.Controls.Add((UserControl)obj);
                    ((UserControl)obj).Dock = DockStyle.Fill;
                    dlg.Show();
                }
                else
                    if (obj is Form)
                    {
                        if (obj is frmyxfxWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_03yxfx'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_03yxfx yxfx = new PJ_03yxfx();
                            if (li.Count > 0)
                            {
                                yxfx = MainHelper.PlatformSqlMap.GetOneByKey<PJ_03yxfx>(li[0].ModleRecordID);

                            }
                            else
                            {
                                yxfx = new PJ_03yxfx();
                                yxfx.OrgCode = MainHelper.UserOrg.OrgCode;
                                yxfx.OrgName = MainHelper.UserOrg.OrgName;
                                if (parentObj.FlowCaption.IndexOf("定期分析") > 0)
                                    yxfx.type = "定期分析";
                                else
                                    if (parentObj.FlowCaption.IndexOf("专题分析") > 0)
                                        yxfx.type = "专题分析";
                                ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0;
                                yxfx.rq = DateTime.Now;
                                ((frmyxfxWorkFlowEdit)obj).RowData = yxfx;
                            }
                            switch (dt.Rows[0]["TaskInsCaption"].ToString())
                            {
                                case "填写":
                                    ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0;
                                    break;
                                case "领导检查":
                                    ((frmyxfxWorkFlowEdit)obj).RecordStatus = 1;
                                    break;
                                case "检查人检查":
                                    ((frmyxfxWorkFlowEdit)obj).RecordStatus = 2;
                                    break;

                            }
                            yxfx.rq = DateTime.Now;
                            ((frmyxfxWorkFlowEdit)obj).RowData = yxfx;

                        }
                        else if (obj is frmsbqxWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and ModleTableName='Ebada.Scgl.Model.PJ_qxfl'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_qxfl qxfl = new PJ_qxfl();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID);

                            }
                            else
                            {
                                qxfl = new PJ_qxfl();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.xssj = DateTime.Today;
                            }

                            ((frmsbqxWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmWorkFlow06sbxsEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                              + "  and (ModleTableName='Ebada.Scgl.Model.PJ_qxfl' or ModleTableName='Ebada.Scgl.Model.PJ_06sbxsmx' )"
                                + "  order by CreatTime desc");
                            PJ_06sbxsmx qxfl = new PJ_06sbxsmx();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_06sbxsmx>(li[0].ModleRecordID);


                                PJ_qxfl qxfltemp = MainHelper.PlatformSqlMap.GetOne<PJ_qxfl>(" where CreateDate =  '" + qxfl.CreateDate + "'"
                                    + " and LineID='" + qxfl.LineID + "'"
                                    + " and OrgCode='" + qxfl.OrgCode + "'"
                                     + " and qxlb='" + qxfl.qxlb + "'"
                                     + " and xsr='" + qxfl.xsr + "'"
                                     + " and xlqd='" + qxfl.xlqd + "'"
                                    );
                                if (qxfl == null)
                                {
                                    qxfl = new PJ_06sbxsmx();
                                    qxfl.CreateDate = qxfltemp.CreateDate;
                                    qxfl.LineID = qxfltemp.LineID;
                                    qxfl.LineName = qxfltemp.LineName;
                                    qxfl.OrgCode = qxfltemp.OrgCode;
                                    qxfl.OrgName = qxfltemp.OrgName;
                                    qxfl.qxlb = qxfltemp.qxlb;
                                    qxfl.qxnr = qxfltemp.qxnr;
                                    qxfl.xssj = qxfltemp.xssj;
                                    qxfl.xsr = qxfltemp.xsr;
                                    qxfl.xcqx = qxfltemp.xcqx;
                                    qxfl.xlqd = qxfltemp.xlqd;
                                    qxfl.CreateDate = DateTime.Now;
                                    qxfl.CreateMan = MainHelper.User.UserName;
                                    //MainHelper.PlatformSqlMap.Create<PJ_06sbxs>(qxfl);

                                    //WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                    //mrwt.ModleRecordID = qxfl.ID;
                                    //mrwt.RecordID = lpr.ID;
                                    //mrwt.WorkFlowId = recordWorkFlowData.Rows[0]["WorkFlowId"].ToString();
                                    //mrwt.WorkFlowInsId = recordWorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                                    //mrwt.WorkTaskId = recordWorkFlowData.Rows[0]["WorkTaskId"].ToString();
                                    //mrwt.ModleTableName = qxfl.GetType().ToString();
                                    //mrwt.WorkTaskInsId = recordWorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                                    //mrwt.CreatTime = DateTime.Now;
                                    //MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                }
                            }
                            else
                            {
                                qxfl = new PJ_06sbxsmx();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.CreateDate = DateTime.Now;
                                qxfl.CreateMan = MainHelper.User.UserName;
                                //MainHelper.PlatformSqlMap.Create<PJ_06sbxs>(qxfl);

                                //WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                //mrwt.ModleRecordID = qxfl.ID;
                                //mrwt.RecordID = lpr.ID;
                                //mrwt.WorkFlowId = recordWorkFlowData.Rows[0]["WorkFlowId"].ToString();
                                //mrwt.WorkFlowInsId = recordWorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                                //mrwt.WorkTaskId = recordWorkFlowData.Rows[0]["WorkTaskId"].ToString();
                                //mrwt.ModleTableName = qxfl.GetType().ToString();
                                //mrwt.WorkTaskInsId = recordWorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                                //mrwt.CreatTime = DateTime.Now;
                                //MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);

                            }


                            ((frmWorkFlow06sbxsEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frm08SBTDJXWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                               + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_08sbtdjx'"
                                 + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_08sbtdjx qxfl = new PJ_08sbtdjx();
                            if (li.Count > 0)
                            {

                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_08sbtdjx>(li[0].ModleRecordID);
                                if (qxfl == null) qxfl = new PJ_08sbtdjx();

                            }
                            else
                            {
                                qxfl = new PJ_08sbtdjx();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.CreateDate = DateTime.Now;
                                string str = " where RecordID='" + currRecord.ID + "'"
                             + " and  FieldName='类别' order by id";
                                WF_TableFieldValue mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str
                                 );
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.tdxz = mrv.ControlValue;
                                }


                            }

                            ((frm08SBTDJXWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmsgzaycWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + "  and ModleTableName='Ebada.Scgl.Model.PJ_04sgzayc'"
                               + "  order by CreatTime desc");
                            PJ_04sgzayc qxfl = new PJ_04sgzayc();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_04sgzayc>(li[0].ModleRecordID);
                                if (qxfl == null) qxfl = new PJ_04sgzayc();

                            }
                            else
                            {
                                qxfl = new PJ_04sgzayc();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;

                            }

                            ((frmsgzaycWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmTDJHWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_tdjh'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_tdjh qxfl = new PJ_tdjh();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_tdjh>(li[0].ModleRecordID);

                            }
                            else
                            {
                                li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_qxfl'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                                qxfl = new PJ_tdjh();
                                if (li.Count > 0)
                                {
                                    PJ_qxfl qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID);
                                    qxfl.OrgCode = qxfltemp.OrgCode;
                                    qxfl.SQOrgname = qxfltemp.OrgName;
                                    qxfl.OrgName = qxfltemp.OrgName;
                                    qxfl.JXNR = qxfltemp.qxnr;
                                    qxfl.S1 = "缺陷管理流程";
                                }
                                else
                                {
                                    qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                    qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                }

                            }

                            ((frmTDJHWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frm24WorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_24'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_24 qxfl = new PJ_24();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_24>(li[0].ModleRecordID);

                            }
                            else
                            {
                                string str = " where RecordID='" + currRecord.ID + "'"
                             + " and  FieldName='申请原因' order by id";
                                WF_TableFieldValue mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.nr = mrv.ControlValue;
                                }
                                str = " where RecordID='" + currRecord.ID + "'"
                              + " and  FieldName='供电所名称' order by id";
                                mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str
                               );
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    mOrg org = MainHelper.PlatformSqlMap.GetOne<mOrg>(" where orgname='" + mrv.ControlValue + "'");
                                    if (org != null)
                                        qxfl.ParentID = org.OrgID;
                                }
                                qxfl.CreateDate = DateTime.Now;
                                qxfl.CreateMan = MainHelper.User.UserName;
                                if (qxfl.BigData == null || qxfl.BigData.Length == 0)
                                {
                                    qxfl.BigData = new byte[0];
                                }

                            }

                            ((frm24WorkFlowEdit)obj).RowData = qxfl;

                        }
                        //年度技改工程计划
                        else if (obj is frmJGGCJHWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and ModleTableName='Ebada.Scgl.Model.PJ_jggcjh'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_jggcjh qxfl = new PJ_jggcjh();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_jggcjh>(li[0].ModleRecordID);

                            }
                            else
                            {
                                qxfl = new PJ_jggcjh();
                                qxfl.OrgName = MainHelper.UserCompany;
                                string str = " where RecordID='" + currRecord.ID + "'"
                                + " and  FieldName='申请单位' order by id";
                                WF_TableFieldValue mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.OrgName = mrv.ControlValue;
                                }
                                str = " where RecordID='" + currRecord.ID + "'"
                                + " and  FieldName='申请改造项目' order by id";
                                mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.ProjectName = mrv.ControlValue;
                                }
                                str = " where RecordID='" + currRecord.ID + "'"
                                + " and  FieldName='主要工程量' order by id";
                                mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.ProjecNR = mrv.ControlValue;
                                }

                            }

                            ((frmJGGCJHWorkFlowEdit)obj).RowData = qxfl;

                        }
                        //26电力线路防护通知书
                        else if (obj is frm26WorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and ModleTableName='Ebada.Scgl.Model.PJ_26'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_26 qxfl = new PJ_26();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_26>(li[0].ModleRecordID);

                            }
                            else
                            {
                                qxfl = new PJ_26();


                            }

                            ((frm26WorkFlowEdit)obj).RowData = qxfl;

                        }
                        if (((Form)obj).ShowDialog() == DialogResult.OK)
                        {
                            if (obj is WorkFlowLineSelectForm)
                            {

                                workFlowFormShow(currRecord, ((WorkFlowLineSelectForm)obj).RetWorkFlowData);
                            }
                        }
                    }
            }
            //Bitmap objBitmap = RecordWorkTask.WorkFlowBitmap(dr["ID"].ToString(), new Size(1024, 768));
            //string tempPath = Path.GetTempPath();
            //string tempfile = tempPath + "~" + Guid.NewGuid().ToString() + ".png";
            //if (objBitmap != null)
            //{


            //    objBitmap.Save(tempfile, System.Drawing.Imaging.ImageFormat.Png);
            //    try
            //    {
            //        //System.Diagnostics.Process.Start("explorer.exe", tempfile);
            //        SelectorHelper.Execute("rundll32.exe %Systemroot%\\System32\\shimgvw.dll,ImageView_Fullscreen " + tempfile);
            //    }
            //    catch
            //    {


            //    }
            //}
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 打开节点窗口
        /// </summary>
        /// <param name="currRecord"></param>
        /// <param name="dtret"></param>
        private void workFlowFormShow(LP_Record currRecord, DataTable dtret)
        {
            DataTable dtall = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID);
            DataTable dt = new DataTable();
            if (dtret == null)
            {
                if (dtall.Rows.Count < 1)
                {
                    if (currRecord.Status == "存档")
                    {
                        frmTemplate fm = new frmTemplate();
                        fm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(dt, currRecord);
                        fm.CurrRecord = currRecord;
                        fm.Kind = strKind;
                        fm.Status = "edit";
                        fm.ShowDialog();
                    }
                    else
                    {
                        IList<WFP_RecordWorkTaskIns> wf = MainHelper.PlatformSqlMap.GetList<WFP_RecordWorkTaskIns>("SelectWFP_RecordWorkTaskInsList", "where RecordID='" + currRecord.ID + "'");
                        if (wf.Count > 0)
                        {
                            WF_WorkFlowInstance wfi = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkFlowInstance>(wf[0].WorkFlowInsId);

                            string struser = RecordWorkTask.GetWorkFlowTaskOperator(wf[0].WorkTaskInsId);
                            MsgBox.ShowTipMessageBox("没有操作此记录的权限,此记录操作者为 " + struser + " !");
                        }
                    }
                    return;
                }
                if (dtall.Rows.Count == 1 || currRecord.Status.IndexOf("|") == -1)
                {
                    dt = dtall;
                }
                else
                {
                    WorkFlowTaskSelectForm wfts = new WorkFlowTaskSelectForm();
                    wfts.RecordWorkFlowData = dtall;
                    if (wfts.ShowDialog() == DialogResult.OK)
                    {
                        dt = wfts.RetWorkFlowData;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                dt = dtret;
            }
            if (!RecordWorkTask.HaveRunRecordRole(currRecord.ID, MainHelper.User.UserID)) return;
            object obj = RecordWorkTask.GetWorkTaskModle(dt);
            if (obj == null)
            {
                return;
            }

            if (obj is frmLP)
            {
                frmLP frm = new frmLP();
                //frm.Status = "edit";
                frm.Status = RecordWorkTask.GetWorkTaskStatus(dt, currRecord);

                frm.CurrRecord = currRecord;
                frm.strxiestatus = "edit";

                frm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(dt, currRecord);
                if (frm.ParentTemple == null)
                {
                    MsgBox.ShowWarningMessageBox("出错,未找到该节点关联的表单,请检查模板设置!");
                    //return;
                }

                frm.Kind = strKind;
                frm.RecordWorkFlowData = dt;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    InitData(strKind);
                }
            }
            else
            {
                LP_Temple lp = RecordWorkTask.GetWorkTaskTemple(dt, currRecord);
                object readObj = null;
                if (obj.GetType().GetProperty("IsWorkflowCall") != null)
                    obj.GetType().GetProperty("IsWorkflowCall").SetValue(obj, true, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持IsWorkflowCall,请咨询开发人员!");
                    return;
                }
                if (obj.GetType().GetProperty("CurrRecord") != null)
                    obj.GetType().GetProperty("CurrRecord").SetValue(obj, currRecord, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持CurrRecord,请咨询开发人员!");
                    return;
                }


                if (obj.GetType().GetProperty("ParentTemple") != null)
                    obj.GetType().GetProperty("ParentTemple").SetValue(obj, RecordWorkTask.GetWorkTaskTemple(dt, currRecord), null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持ParentTemple,请咨询开发人员!");
                    return;
                }

                if (obj.GetType().GetProperty("RecordWorkFlowData") != null)
                    obj.GetType().GetProperty("RecordWorkFlowData").SetValue(obj, dt, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持RecordWorkFlowData,请咨询开发人员!");
                    return;
                }
                if (obj is UserControl)
                {

                    FormBase dlg = new FormBase();
                    dlg.Text = ((UserControl)obj).Name;
                    dlg.MdiParent = MainHelper.MainForm;
                    dlg.Controls.Add((UserControl)obj);
                    ((UserControl)obj).Dock = DockStyle.Fill;
                    dlg.Show();
                }
                else
                    if (obj is Form)
                    {
                        if (obj is frmyxfxWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_03yxfx'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_03yxfx yxfx = new PJ_03yxfx();
                            if (li.Count > 0)
                            {
                                yxfx = MainHelper.PlatformSqlMap.GetOneByKey<PJ_03yxfx>(li[0].ModleRecordID);

                            }
                            else
                            {
                                yxfx = new PJ_03yxfx();
                                yxfx.OrgCode = MainHelper.UserOrg.OrgCode;
                                yxfx.OrgName = MainHelper.UserOrg.OrgName;
                                if (parentObj.FlowCaption.IndexOf("定期分析") > 0)
                                    yxfx.type = "定期分析";
                                else
                                    if (parentObj.FlowCaption.IndexOf("专题分析") > 0)
                                        yxfx.type = "专题分析";
                                ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0;
                                yxfx.rq = DateTime.Now;
                                ((frmyxfxWorkFlowEdit)obj).RowData = yxfx;
                                readObj = yxfx;
                            }
                            switch (dt.Rows[0]["TaskInsCaption"].ToString())
                            {
                                case "填写":
                                    ((frmyxfxWorkFlowEdit)obj).RecordStatus = 0;
                                    break;
                                case "领导检查":
                                    ((frmyxfxWorkFlowEdit)obj).RecordStatus = 1;
                                    break;
                                case "检查人检查":
                                    ((frmyxfxWorkFlowEdit)obj).RecordStatus = 2;
                                    break;

                            }
                            yxfx.rq = DateTime.Now;
                            ((frmyxfxWorkFlowEdit)obj).RowData = yxfx;

                        }
                        else if (obj is frmsbqxWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and (ModleTableName='Ebada.Scgl.Model.PJ_qxfl' or ModleTableName='Ebada.Scgl.Model.PJ_06sbxsmx')"
                               + " order by CreatTime desc");
                            PJ_qxfl qxfl = new PJ_qxfl();
                            if (li.Count > 0)
                            {
                                //qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID);
                                //PJ_06sbxsmx qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_06sbxsmx>(li[0].ModleRecordID);
                                PJ_qxfl qxfltemp2 = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID);
                                if (qxfltemp2 != null) qxfl = qxfltemp2;
                                //qxfl.CreateDate = qxfltemp.CreateDate;
                                //qxfl.LineID = qxfltemp.LineID;
                                //qxfl.LineName = qxfltemp.LineName;
                                //qxfl.OrgCode = qxfltemp.OrgCode;
                                //qxfl.OrgName = qxfltemp.OrgName;
                                //qxfl.qxlb = qxfltemp.qxlb;
                                //qxfl.qxnr = qxfltemp.qxnr;
                                //qxfl.xssj = qxfltemp.xssj;
                                //qxfl.xsr = qxfltemp.xsr;
                                //qxfl.xcqx = qxfltemp.xcqx;
                                //qxfl.xlqd = qxfltemp.xlqd;
                                //qxfl.CreateDate = DateTime.Now;
                                //qxfl.CreateMan = MainHelper.User.UserName;
                            }
                            else
                            {
                                qxfl = new PJ_qxfl();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.xssj = DateTime.Today;
                                qxfl.CreateMan = MainHelper.User.UserName;
                                readObj = qxfl;
                            }

                            ((frmsbqxWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmWorkFlow06sbxsEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                              + "  and (ModleTableName='Ebada.Scgl.Model.PJ_qxfl' or ModleTableName='Ebada.Scgl.Model.PJ_06sbxsmx' )"
                                + "  order by CreatTime desc");
                            PJ_06sbxsmx qxfl = new PJ_06sbxsmx();
                            if (li.Count > 0)
                            {
                                PJ_06sbxsmx qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_06sbxsmx>(li[0].ModleRecordID);
                                if (qxfltemp != null) qxfl = qxfltemp;
                                else
                                {

                                    //qxfl = qxfltemp;
                                    //if (qxfl == null) {
                                    //    qxfl = new PJ_06sbxsmx();
                                    //    qxfl.CreateDate = qxfltemp.CreateDate;
                                    //    qxfl.LineID = qxfltemp.LineID;
                                    //    qxfl.LineName = qxfltemp.LineName;
                                    //    qxfl.OrgCode = qxfltemp.OrgCode;
                                    //    qxfl.OrgName = qxfltemp.OrgName;
                                    //    qxfl.qxlb = qxfltemp.qxlb;
                                    //    qxfl.qxnr = qxfltemp.qxnr;
                                    //    qxfl.xssj = qxfltemp.xssj;
                                    //    qxfl.xsr = qxfltemp.xsr;
                                    //    qxfl.xcqx = qxfltemp.xcqx;
                                    //    qxfl.xlqd = qxfltemp.xlqd;
                                    //    qxfl.CreateDate = DateTime.Now;
                                    //    qxfl.CreateMan = MainHelper.User.UserName;
                                    //MainHelper.PlatformSqlMap.Create<PJ_06sbxs>(qxfl);

                                    //WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                    //mrwt.ModleRecordID = qxfl.ID;
                                    //mrwt.RecordID = lpr.ID;
                                    //mrwt.WorkFlowId = recordWorkFlowData.Rows[0]["WorkFlowId"].ToString();
                                    //mrwt.WorkFlowInsId = recordWorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                                    //mrwt.WorkTaskId = recordWorkFlowData.Rows[0]["WorkTaskId"].ToString();
                                    //mrwt.ModleTableName = qxfl.GetType().ToString();
                                    //mrwt.WorkTaskInsId = recordWorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                                    //mrwt.CreatTime = DateTime.Now;
                                    //MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                    //}
                                }
                            }
                            else
                            {
                                qxfl = new PJ_06sbxsmx();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.CreateDate = DateTime.Now;
                                qxfl.CreateMan = MainHelper.User.UserName;
                                MainHelper.PlatformSqlMap.Create<PJ_06sbxs>(qxfl);

                                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                mrwt.ModleRecordID = qxfl.ID;
                                mrwt.RecordID = currRecord.ID;
                                mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                mrwt.ModleTableName = qxfl.GetType().ToString();
                                mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                mrwt.CreatTime = DateTime.Now;
                                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                readObj = qxfl;
                            }


                            ((frmWorkFlow06sbxsEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frm08SBTDJXWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_qxfl'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_08sbtdjx qxfl = new PJ_08sbtdjx();
                            if (li.Count > 0)
                            {
                                PJ_qxfl qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID);
                                li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                               + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_08sbtdjx'"
                                 + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                                if (li.Count > 0)
                                {
                                    qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_08sbtdjx>(li[0].ModleRecordID);
                                    readObj = qxfl;
                                }
                                else
                                {
                                    qxfl.OrgCode = qxfltemp.OrgCode;
                                    qxfl.OrgName = qxfltemp.OrgName;
                                    qxfl.LineID = qxfltemp.LineID;
                                    qxfl.LineName = qxfltemp.LineName;
                                    qxfl.jxnr = qxfltemp.qxnr;
                                    if (qxfltemp.qxlb == "紧急缺陷")
                                    {
                                        qxfl.tdxz = "事故停电";
                                    }
                                    else
                                        if (qxfltemp.qxlb == "重大缺陷")
                                        {
                                            qxfl.tdxz = "临时停电";
                                        }
                                        else
                                            if (qxfltemp.qxlb == "一般缺陷")
                                            {
                                                qxfl.tdxz = "一般缺陷";
                                            }
                                    qxfl.CreateDate = DateTime.Now;
                                    qxfl.CreateMan = MainHelper.User.UserName;
                                    MainHelper.PlatformSqlMap.Create<PJ_08sbtdjx>(qxfl);

                                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                    mrwt.ModleRecordID = qxfl.ID;
                                    mrwt.RecordID = currRecord.ID;
                                    mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                    mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                    mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                    mrwt.ModleTableName = qxfl.GetType().ToString();
                                    mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                    mrwt.CreatTime = DateTime.Now;
                                    MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                    readObj = qxfl;
                                }

                            }
                            else
                            {
                                qxfl = new PJ_08sbtdjx();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.CreateDate = DateTime.Now;
                                string str = " where RecordID='" + currRecord.ID + "'"
                             + " and  FieldName='类别' order by id";
                                WF_TableFieldValue mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str
                                 );
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.tdxz = mrv.ControlValue;
                                }
                                MainHelper.PlatformSqlMap.Create<PJ_08sbtdjx>(qxfl);

                                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                mrwt.ModleRecordID = qxfl.ID;
                                mrwt.RecordID = currRecord.ID;
                                mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                mrwt.ModleTableName = qxfl.GetType().ToString();
                                mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                mrwt.CreatTime = DateTime.Now;
                                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                readObj = qxfl;
                            }

                            ((frm08SBTDJXWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmsgzaycWorkFlowEdit)
                        {
                            PJ_04sgzayc qxfl = null;
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + "  and ModleTableName='Ebada.Scgl.Model.PJ_04sgzayc'"
                               + "  order by CreatTime desc");

                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_04sgzayc>(li[0].ModleRecordID);
                            }
                            if (qxfl == null)
                            {
                                li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                                 + "  and ModleTableName='Ebada.Scgl.Model.PJ_08sbtdjx'"
                                   + " order by CreatTime desc");
                                qxfl = new PJ_04sgzayc();
                                if (li.Count > 0)
                                {
                                    PJ_08sbtdjx qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_08sbtdjx>(li[0].ModleRecordID);

                                    qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_04sgzayc>(li[0].ModleRecordID);
                                    if (qxfl == null)
                                    {
                                        qxfl = new PJ_04sgzayc();
                                        qxfl.OrgCode = qxfltemp.OrgCode;
                                        qxfl.OrgName = qxfltemp.OrgName;
                                        qxfl.sdsj = qxfltemp.sdsj;
                                        qxfl.tdsj = qxfltemp.tdsj;
                                        qxfl.gtdsj = "";
                                        TimeSpan span = qxfl.sdsj.Subtract(qxfl.tdsj);
                                        if (span.Days > 0)
                                            qxfl.gtdsj += span.Days + "天";
                                        if (span.Hours > 0)
                                            qxfl.gtdsj += span.Hours + "时";
                                        if (span.Minutes > -1)
                                            qxfl.gtdsj += span.Minutes + "分";
                                        qxfl.fsdd = qxfltemp.jxnr;
                                        qxfl.CreateDate = DateTime.Now; qxfl.ID = qxfl.ID;
                                        qxfl.CreateMan = MainHelper.User.UserName;
                                        MainHelper.PlatformSqlMap.Create<PJ_04sgzayc>(qxfl);

                                        WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                        mrwt.ModleRecordID = qxfl.ID;
                                        mrwt.RecordID = currRecord.ID;
                                        mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                        mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                        mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                        mrwt.ModleTableName = qxfl.GetType().ToString();
                                        mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                        mrwt.CreatTime = DateTime.Now;
                                        MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                        readObj = qxfl;
                                    }
                                }
                                else
                                {
                                    qxfl = new PJ_04sgzayc();
                                    qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                    qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                    qxfl.CreateMan = MainHelper.User.UserName;
                                    MainHelper.PlatformSqlMap.Create<PJ_04sgzayc>(qxfl);

                                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                    mrwt.ModleRecordID = qxfl.ID;
                                    mrwt.RecordID = currRecord.ID;
                                    mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                    mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                    mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                    mrwt.ModleTableName = qxfl.GetType().ToString();
                                    mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                    mrwt.CreatTime = DateTime.Now;
                                    MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                    readObj = qxfl;
                                }
                            }
                            ((frmsgzaycWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmTDJHWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_tdjh'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_tdjh qxfl = new PJ_tdjh();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_tdjh>(li[0].ModleRecordID);

                            }
                            else
                            {
                                li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_qxfl'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                                qxfl = new PJ_tdjh();
                                if (li.Count > 0)
                                {
                                    PJ_qxfl qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(li[0].ModleRecordID);
                                    qxfl.OrgCode = qxfltemp.OrgCode;
                                    qxfl.SQOrgname = qxfltemp.OrgName;
                                    qxfl.OrgName = qxfltemp.OrgName;
                                    qxfl.JXNR = qxfltemp.qxnr;
                                    qxfl.S1 = "缺陷管理流程";
                                }
                                else
                                {
                                    qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                    qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                }
                                MainHelper.PlatformSqlMap.Create<PJ_tdjh>(qxfl);

                                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                mrwt.ModleRecordID = qxfl.ID;
                                mrwt.RecordID = currRecord.ID;
                                mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                mrwt.ModleTableName = qxfl.GetType().ToString();
                                mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                mrwt.CreatTime = DateTime.Now;
                                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                readObj = qxfl;
                            }

                            ((frmTDJHWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frm24WorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_24'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_24 qxfl = new PJ_24();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_24>(li[0].ModleRecordID);

                            }
                            else
                            {
                                string str = " where RecordID='" + currRecord.ID + "'"
                             + " and  FieldName='申请原因' order by id";
                                WF_TableFieldValue mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.nr = mrv.ControlValue;
                                }
                                str = " where RecordID='" + currRecord.ID + "'"
                              + " and  FieldName='供电所名称' order by id";
                                mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str
                               );
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    mOrg org = MainHelper.PlatformSqlMap.GetOne<mOrg>(" where orgname='" + mrv.ControlValue + "'");
                                    if (org != null)
                                        qxfl.ParentID = org.OrgID;
                                }
                                qxfl.CreateDate = DateTime.Now;
                                qxfl.CreateMan = MainHelper.User.UserName;
                                if (qxfl.BigData == null || qxfl.BigData.Length == 0)
                                {
                                    qxfl.BigData = new byte[0];
                                }
                                MainHelper.PlatformSqlMap.Create<PJ_24>(qxfl);

                                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                mrwt.ModleRecordID = qxfl.ID;
                                mrwt.RecordID = currRecord.ID;
                                mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                                mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                                mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                                mrwt.ModleTableName = qxfl.GetType().ToString();
                                mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                                mrwt.CreatTime = DateTime.Now;
                                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                                readObj = qxfl;
                            }

                            ((frm24WorkFlowEdit)obj).RowData = qxfl;

                        }
                        //年度技改工程计划
                        else if (obj is frmJGGCJHWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and ModleTableName='Ebada.Scgl.Model.PJ_jggcjh'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_jggcjh qxfl = new PJ_jggcjh();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_jggcjh>(li[0].ModleRecordID);

                            }
                            else
                            {
                                qxfl = new PJ_jggcjh();
                                qxfl.OrgName = MainHelper.UserCompany;
                                string str = " where RecordID='" + currRecord.ID + "'"
                                + " and  FieldName='申请单位' order by id";
                                WF_TableFieldValue mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.OrgName = mrv.ControlValue;
                                }
                                str = " where RecordID='" + currRecord.ID + "'"
                                + " and  FieldName='申请改造项目' order by id";
                                mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.ProjectName = mrv.ControlValue;
                                }
                                str = " where RecordID='" + currRecord.ID + "'"
                                + " and  FieldName='主要工程量' order by id";
                                mrv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(str);
                                //qxfl = new PJ_24();
                                if (mrv != null)
                                {
                                    qxfl.ProjecNR = mrv.ControlValue;
                                }
                                readObj = qxfl;
                            }

                            ((frmJGGCJHWorkFlowEdit)obj).RowData = qxfl;

                        }
                        //26电力线路防护通知书
                        else if (obj is frm26WorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + currRecord.ID + "'"
                             + " and  WorkFlowId='" + dt.Rows[0]["WorkFlowId"].ToString() + "'" + " and ModleTableName='Ebada.Scgl.Model.PJ_26'"
                               + " and  WorkFlowInsId='" + dt.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_26 qxfl = new PJ_26();
                            if (li.Count > 0)
                            {
                                qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_26>(li[0].ModleRecordID);

                            }
                            else
                            {
                                qxfl = new PJ_26();

                                readObj = qxfl;
                            }

                            ((frm26WorkFlowEdit)obj).RowData = qxfl;

                        }
                        if (readObj != null)
                            frmLP.ReadTaskData(readObj, dt, lp, currRecord);
                        if (((Form)obj).ShowDialog() == DialogResult.OK)
                        {
                            if (obj is WorkFlowLineSelectForm)
                            {

                                workFlowFormShow(currRecord, ((WorkFlowLineSelectForm)obj).RetWorkFlowData);
                            }
                        }
                    }
                InitData(strKind);
            }
            //获得编辑按钮的状态
            this.btEditfrm.Caption = currRecord.Status;
        }