示例#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
            //    {


            //    }
            //}
        }
示例#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;
        }
示例#3
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(PJ_tdjh newobj) {
     if (parentID == null) return;
     IList<PJ_tdjh> list = gridControl1.DataSource as IList<PJ_tdjh>;
     newobj.S1 = (list.Count + 1).ToString();
     newobj.OrgCode = parentID;
     newobj.OrgName = parentObj.OrgName;
     newobj.CreateDate = DateTime.Now;
     newobj.TDtime = newobj.CreateDate;
     newobj.SDtime = newobj.CreateDate;
     try { frmLP.ReadTaskData(newobj, RecordWorkFlowData, ParentTemple, CurrRecord); } catch { }
 }
示例#4
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;
        }
示例#5
0
        void gridViewOperation_AfterDelete(PJ_tdjh obj) {

            //if (isWorkflowCall)
            //{

            //    MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + obj.ID + "' and RecordID='" + currRecord.ID + "'"
            //        + " and  WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "'"
            //        + " and  WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "'"
            //        + " and  WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"
            //        + " and  WorkTaskInsId='" + WorkFlowData.Rows[0]["WorkTaskInsId"].ToString() + "'");
            //}

            //if (isWorkflowCall)
            //{

            //    slqwhere = slqwhere + " and id in (select ModleRecordID from WF_ModleRecordWorkTaskIns where RecordID='" + CurrRecord.ID + "'";
            //    slqwhere = slqwhere + " and  WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "'"
            //       + " and  WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "'"
            //       + " and  WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"
            //       + " and  WorkTaskInsId='" + WorkFlowData.Rows[0]["WorkTaskInsId"].ToString() + "')";
            //}

            //RefreshData(" where OrgCode='" + parentID + "' and IsSelect='false' or IsSelect is null ");
            RefreshData(" where OrgCode='" + parentID + "' ");
        }