Beispiel #1
0
        void gridViewOperation_AfterAdd(PJ_18gysbpjmx obj) {
            //RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by id desc");
            RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh ");

            if (isWorkflowCall) {
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ModleRecordID = obj.PJ_ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = obj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
                PJ_qxfl qxfj = new PJ_qxfl();
                qxfj.CreateDate = PSObj.CreateDate;
                qxfj.CreateMan = PSObj.CreateMan;
                qxfj.LineID = "";
                qxfj.LineName = "";
                qxfj.OrgCode = PSObj.OrgCode;
                qxfj.OrgName = PSObj.OrgName;
                qxfj.qxlb = obj.qxlb;
                qxfj.qxly = "高压配电设备评级表";
                qxfj.qxnr = obj.qxnr;
                qxfj.xcqx = "";
                qxfj.xcr = "";
                qxfj.xlqd = "";
                qxfj.xsr = "";
                qxfj.xssj = new DateTime(1900, 1, 1);
                MainHelper.PlatformSqlMap.Create<PJ_qxfl>(qxfj);
                LP_Record lpr = new LP_Record();
                lpr.ID = "N" + lpr.CreateID();
                lpr.Kind = "设备缺陷管理流程";
                lpr.CreateTime = DateTime.Now.ToString();
                lpr.OrgName = qxfj.OrgName;

                string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, "设备缺陷管理流程", MainHelper.User.UserID, false);
                if (strtemp[0].IndexOf("未提交至任何人") > -1) {
                    MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
                    return;
                }
                DataTable recordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID);
                if (recordWorkFlowData == null) {
                    MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!");

                }
                LP_Temple ParentTemple = RecordWorkTask.GetWorkTaskTemple(recordWorkFlowData, lpr);
                if (ParentTemple == null)
                    lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, "设备缺陷管理流程");
                else
                    lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, ParentTemple.LPID);
                lpr.Status = recordWorkFlowData.Rows[0]["TaskCaption"].ToString();
                MainHelper.PlatformSqlMap.Create<LP_Record>(lpr);
                currRecord = lpr;
                WorkFlowData = recordWorkFlowData;



                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ID = mrwt.CreateID();
                mrwt.ModleRecordID = qxfj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = qxfj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
        }
        private void btAddfrm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            if (MainHelper.UserOrg == null) return;

            if (!RecordWorkTask.HaveRunNewGZPRole(strKind, MainHelper.User.UserID)) return;

            object obj = RecordWorkTask.GetNewWorkTaskModle(strKind, MainHelper.User.UserID);
            if (obj == null) {
                MsgBox.ShowWarningMessageBox("出错,未找到对应的模块,请检查模板设置!");
                return;
            }
            LP_Record lpr = new LP_Record();
            lpr.ID = "N" + lpr.CreateID();
            lpr.Kind = strKind;
            lpr.CreateTime = DateTime.Now.ToString();
            if (obj is frmLP) {
                frmLP frm = new frmLP();

                frm.Status = "add";
                frm.Kind = strKind;
                string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, strKind, MainHelper.User.UserID, false);

                //frm.ParentTemple = RecordWorkTask.GetNewWorkTaskTemple(strKind, MainHelper.User.UserID);

                //frm.RecordWorkFlowData = RecordWorkTask.GetGZPRecordSartWorkData(ParentObj.FlowCaption, MainHelper.User.UserID);
                frm.RecordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID);
                if (frm.RecordWorkFlowData == null) {
                    MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!");
                }
                frm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(frm.RecordWorkFlowData, lpr);
                if (frm.ParentTemple == null) {
                    MsgBox.ShowWarningMessageBox("出错,未找到该节点关联的表单,请检查模板设置!");
                }
                lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, frm.ParentTemple.LPID);
                lpr.Status = frm.RecordWorkFlowData.Rows[0]["TaskCaption"].ToString();
                //lpr.Status = "填票";
                //frm.RowData = lpr;
                frm.CurrRecord = lpr;
                MainHelper.PlatformSqlMap.Create<LP_Record>(lpr);
                if (frm.ShowDialog() == DialogResult.OK) {
                    InitData(strSQL);
                }
            } else {


                string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, strKind, MainHelper.User.UserID, false);
                if (strtemp[0].IndexOf("未提交至任何人") > -1) {
                    MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
                    return;
                }
                DataTable recordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID);
                if (recordWorkFlowData == null) {
                    MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!");

                }

                lpr.Status = recordWorkFlowData.Rows[0]["TaskCaption"].ToString();
                MainHelper.PlatformSqlMap.Create<LP_Record>(lpr);
                if (obj.GetType().GetProperty("IsWorkflowCall") != null)
                    obj.GetType().GetProperty("IsWorkflowCall").SetValue(obj, true, null);
                else {
                    MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!");
                    return;
                }
                if (obj.GetType().GetProperty("CurrRecord") != null)
                    obj.GetType().GetProperty("CurrRecord").SetValue(obj, lpr, null);
                else {
                    MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!");
                    return;
                }
                if (obj.GetType().GetProperty("RecordWorkFlowData") != null)
                    obj.GetType().GetProperty("RecordWorkFlowData").SetValue(obj, recordWorkFlowData, null);
                else {
                    MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!");
                    return;
                }
                if (obj.GetType().GetProperty("ParentTemple") != null)
                    obj.GetType().GetProperty("ParentTemple").SetValue(obj, RecordWorkTask.GetWorkTaskTemple(recordWorkFlowData, lpr), null);
                else {
                    MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!");
                    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) {
                            PJ_03yxfx 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;

                        } else if (obj is frmsbqxWorkFlowEdit) {
                            PJ_qxfl qxfl = new PJ_qxfl();
                            qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                            qxfl.OrgName = MainHelper.UserOrg.OrgName;

                            ((frmsbqxWorkFlowEdit)obj).RowData = qxfl;

                        }

                        ((Form)obj).ShowDialog();
                    }
                InitData(strSQL);

            }
            //获得编辑按钮的状态
            this.btEditfrm.Caption = lpr.Status;
        }
Beispiel #3
0
        private void btAddfrm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (MainHelper.UserOrg == null) return;

            if (!RecordWorkTask.HaveRunNewGZPRole(strKind, MainHelper.User.UserID)) return;
            DataTable recordWorkFlowData = null;
            object obj = RecordWorkTask.GetNewWorkTaskModle(strKind, MainHelper.User.UserID);
            if (obj == null)
            {
                MsgBox.ShowWarningMessageBox("出错,未找到对应的模块,请检查模板设置!");
                return;
            }
            LP_Record lpr = new LP_Record();
            lpr.ID = "N" + lpr.CreateID();
            lpr.Kind = strKind;
            lpr.CreateTime = DateTime.Now.ToString();
            lpr.OrgName = MainHelper.UserOrg.OrgName;
            if (obj is frmLP)
            {
                frmLP frm = new frmLP();
                frm.strxiestatus = "add";
                frm.Status = "add";
                frm.Kind = strKind;
                string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, strKind, MainHelper.User.UserID, false);

                //frm.ParentTemple = RecordWorkTask.GetNewWorkTaskTemple(strKind, MainHelper.User.UserID);

                //frm.RecordWorkFlowData = RecordWorkTask.GetGZPRecordSartWorkData(ParentObj.FlowCaption, MainHelper.User.UserID);
                frm.RecordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID);
                recordWorkFlowData = frm.RecordWorkFlowData;
                if (frm.RecordWorkFlowData == null)
                {
                    MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!");
                }
                frm.ParentTemple = RecordWorkTask.GetWorkTaskTemple(frm.RecordWorkFlowData, lpr);
                if (frm.ParentTemple == null)
                {
                    MsgBox.ShowWarningMessageBox("出错,未找到该节点关联的表单,请检查模板设置!");
                }
                lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, frm.ParentTemple.LPID, lpr.Kind);
                lpr.Status = frm.RecordWorkFlowData.Rows[0]["TaskCaption"].ToString();
                //lpr.Status = "填票";
                //frm.RowData = lpr;
                frm.CurrRecord = lpr;
                MainHelper.PlatformSqlMap.Create<LP_Record>(lpr);
                frm.ShowDialog();
                InitData(strKind);
            }
            else
            {


                string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, strKind, MainHelper.User.UserID, false);
                if (strtemp[0].IndexOf("未提交至任何人") > -1)
                {
                    MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
                    return;
                }
                recordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID);
                if (recordWorkFlowData == null)
                {
                    MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!");

                }
                LP_Temple ParentTemple = RecordWorkTask.GetWorkTaskTemple(recordWorkFlowData, lpr);
                if (ParentTemple == null)
                    lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, "", strKind);
                else
                    lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, ParentTemple.LPID, strKind);

                lpr.Status = recordWorkFlowData.Rows[0]["TaskCaption"].ToString();
                MainHelper.PlatformSqlMap.Create<LP_Record>(lpr);

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


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

                if (obj.GetType().GetProperty("RecordWorkFlowData") != null)
                    obj.GetType().GetProperty("RecordWorkFlowData").SetValue(obj, recordWorkFlowData, null);
                else
                {
                    MsgBox.ShowWarningMessageBox("模块不支持,请咨询开发人员!");
                    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)
                        {
                            PJ_03yxfx 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;

                        }
                        else if (obj is frmsbqxWorkFlowEdit)
                        {

                            PJ_qxfl qxfl = new PJ_qxfl();
                            qxfl = new PJ_qxfl();
                            qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                            qxfl.OrgName = MainHelper.UserOrg.OrgName;
                            ((frmsbqxWorkFlowEdit)obj).RowData = qxfl;

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


                                qxfl = MainHelper.PlatformSqlMap.GetOne<PJ_06sbxsmx>(" where CONVERT(varchar, CreateDate, 120 ) =  '" + qxfltemp.CreateDate + "'"
                                    + " and LineID='" + qxfltemp.LineID + "'"
                                    + " and OrgCode='" + qxfltemp.OrgCode + "'"
                                     + " and qxlb='" + qxfltemp.qxlb + "'"
                                     + " and xsr='" + qxfltemp.xsr + "'"
                                     + " and xlqd='" + qxfltemp.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='" + lpr.ID + "'"
                             + " and  WorkFlowId='" + recordWorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_qxfl'"
                               + " and  WorkFlowInsId='" + recordWorkFlowData.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='" + lpr.ID + "'"
                               + " and  WorkFlowId='" + recordWorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_08sbtdjx'"
                                 + " and  WorkFlowInsId='" + recordWorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                                if (li.Count > 0)
                                {
                                    qxfl = MainHelper.PlatformSqlMap.GetOneByKey<PJ_08sbtdjx>(li[0].ModleRecordID);
                                }
                                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 = 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_08sbtdjx();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                qxfl.CreateDate = DateTime.Now;
                                string str = " where RecordID='" + lpr.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 = 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);

                            }

                            ((frm08SBTDJXWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmsgzaycWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + lpr.ID + "'"
                             + " and  WorkFlowId='" + recordWorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_08sbtdjx'"
                               + " and  WorkFlowInsId='" + recordWorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "' order by CreatTime desc");
                            PJ_04sgzayc qxfl = new PJ_04sgzayc();
                            if (li.Count > 0)
                            {
                                PJ_08sbtdjx qxfltemp = MainHelper.PlatformSqlMap.GetOneByKey<PJ_08sbtdjx>(li[0].ModleRecordID);
                                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;
                                MainHelper.PlatformSqlMap.Create<PJ_04sgzayc>(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_04sgzayc();
                                qxfl.OrgCode = MainHelper.UserOrg.OrgCode;
                                qxfl.OrgName = MainHelper.UserOrg.OrgName;
                                MainHelper.PlatformSqlMap.Create<PJ_04sgzayc>(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);
                            }

                            ((frmsgzaycWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frmTDJHWorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + lpr.ID + "'"
                             + " and  WorkFlowId='" + recordWorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_tdjh'"
                               + " and  WorkFlowInsId='" + recordWorkFlowData.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='" + lpr.ID + "'"
                             + " and  WorkFlowId='" + recordWorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_qxfl'"
                               + " and  WorkFlowInsId='" + recordWorkFlowData.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 = 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);
                            }

                            ((frmTDJHWorkFlowEdit)obj).RowData = qxfl;

                        }
                        else if (obj is frm24WorkFlowEdit)
                        {
                            IList<WF_ModleRecordWorkTaskIns> li = MainHelper.PlatformSqlMap.GetListByWhere<WF_ModleRecordWorkTaskIns>(" where RecordID='" + lpr.ID + "'"
                             + " and  WorkFlowId='" + recordWorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and ModleTableName='Ebada.Scgl.Model.PJ_24'"
                               + " and  WorkFlowInsId='" + recordWorkFlowData.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='" + lpr.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='" + lpr.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 = 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);
                            }

                            ((frm24WorkFlowEdit)obj).RowData = qxfl;

                        }


                        if (((Form)obj).ShowDialog() == DialogResult.OK)
                        {
                            if (obj is WorkFlowLineSelectForm)
                            {
                                workFlowFormShow(lpr);
                            }
                        }
                    }
                InitData(strKind);
            }
            /*
                        IList wfli = MainHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct tlcid from WF_WorkTastTrans where slcid='" +
                                     recordWorkFlowData.Rows[0]["WorkFlowId"]
                                     + "' and cdfs like '下拉%' ");
                        foreach (string strwf in wfli) {
                            WF_WorkFlow wf = MainHelper.PlatformSqlMap.GetOneByKey<WF_WorkFlow>(strwf);
                            LP_Record lp = new LP_Record();
                            lp.ID = "N" + lp.CreateID();
                            lp.Kind = wf.FlowCaption;
                            lp.CreateTime = DateTime.Now.ToString();
                            lp.OrgName = MainHelper.UserOrg.OrgName;
                            lp.ParentID = lpr.ID;
                            RecordWorkTask.RunNewGZPRecord(lp.ID, lp.Kind, MainHelper.User.UserID, false);
                            DataTable dttemp = RecordWorkTask.GetRecordWorkFlowData(lp.ID, MainHelper.User.UserID);
                            lp.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, "", lp.Kind);
                            lp.Status = dttemp.Rows[0]["TaskCaption"].ToString();
                            MainHelper.PlatformSqlMap.Create<LP_Record>(lp);
                            Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        }*/
            //获得编辑按钮的状态
            this.btEditfrm.Caption = lpr.Status;
        }