示例#1
0
        void gridViewOperation_AfterAdd(PJ_qcxqjh newobj)
        {
            if (isWorkflowCall)
            {
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ModleRecordID = newobj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = newobj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                //currRecord.DocContent = newobj.BigData;
                MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
            }
            if (newobj.xqlr != "")
            {
                PJ_qxfl qxfj = new PJ_qxfl();
                qxfj.ID = newobj.ID;
                qxfj.CreateDate = DateTime.Now;
                qxfj.CreateMan = MainHelper.User.UserName;
                qxfj.OrgCode = newobj.OrgCode;
                qxfj.OrgName = newobj.OrgName;
                qxfj.qxlb = newobj.qxlb;
                qxfj.qxly = "秋检消缺计划";
                qxfj.qxnr = newobj.xqlr;
                MainHelper.PlatformSqlMap.Create<PJ_qxfl>(qxfj);
                //LP_Record lpr = new LP_Record();
                //lpr.ID = "N" + lpr.CreateID();
                //lpr.Kind = "设备缺陷管理流程";
                //lpr.CreateTime = DateTime.Now.ToString();
                //lpr.OrgName = qxfj.OrgName;

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

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




                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ID = mrwt.CreateID();
                mrwt.ModleRecordID = qxfj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = qxfj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
        }
示例#2
0
        private void barxqjh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //请求确认
            if (MsgBox.ShowAskMessageBox("是否确认此节点结束,生成消缺计划并进入下一流程?") != DialogResult.OK)
            {
                //SendMessage(this.Handle, 0x0010, (IntPtr)0, (IntPtr)0);
                return;
            }
            string slqwhere = "where OrgCode='" + parentID + "' ";
            slqwhere = slqwhere + " and id not 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() + "')"
             + " and DATEDIFF(day,cast('1900-1-1'  as datetime ) ,cast(xcrq  as datetime) )<1 ";
            slqwhere += " order by id desc";
            dalist = MainHelper.PlatformSqlMap.GetListByWhere<PJ_06sbxs>(slqwhere);
            string strmes = "";

            if (RecordWorkTask.CheckOnRiZhi(WorkFlowData))
            {

                RecordWorkTask.CreatRiZhi(WorkFlowData, null, currRecord.ID, new object[] { currRecord });

            }

            WF_WorkTaskCommands wt = (WF_WorkTaskCommands)MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskCommandsList", " where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "' and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'");
            if (wt != null)
            {
                strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), wt.CommandName);
            }
            else
            {
                strmes = RecordWorkTask.RunWorkFlow(MainHelper.User.UserID, WorkFlowData.Rows[0]["OperatorInsId"].ToString(), WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(), "提交");
            }
            if (strmes.IndexOf("未提交至任何人") > -1)
            {
                MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
                return;
            }
            else
                MsgBox.ShowTipMessageBox(strmes);
            if (fjly == null) fjly = new frmModleFjly();
            fjly.btn_Submit_Click(sender, e);
            strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
            if (strmes == "结束节点1")
            {
                currRecord.Status = "存档";
            }
            else
            {
                currRecord.Status = strmes;
            }
            currRecord.LastChangeTime = DateTime.Now.ToString();
            if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0];
            if (currRecord.SignImg == null) currRecord.SignImg = new byte[0];
            MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord);

            DataTable dt = RecordWorkTask.GetRecordWorkFlowData(currRecord.ID, MainHelper.User.UserID);
            slqwhere = "where OrgCode='" + parentID + "' ";
            slqwhere = slqwhere + " and (id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where 1=1 ";
            slqwhere = slqwhere + " and  WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "'"

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

            slqwhere += " order by id desc";
            dalist = MainHelper.PlatformSqlMap.GetListByWhere<PJ_06sbxs>(slqwhere);
            foreach (PJ_06sbxs sbxs in dalist)
            {
                if (sbxs.qxlb == "") continue;
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                PJ_qxfl qxfj = new PJ_qxfl();
                if (WorkFlowData.Rows[0]["flowcaption"].ToString() == "春查消缺外查")
                {
                    PJ_ccxqjh ccxqjh = new PJ_ccxqjh();
                    ccxqjh.ID = sbxs.ID;
                    ccxqjh.OrgCode = sbxs.OrgCode;
                    ccxqjh.OrgName = sbxs.OrgName;
                    ccxqjh.qxlb = sbxs.qxlb;
                    ccxqjh.xqlr = sbxs.qxnr;
                    Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                    try
                    {
                        MainHelper.PlatformSqlMap.Create<PJ_ccxqjh>(ccxqjh);
                    }
                    catch { }
                    qxfj.ID = ccxqjh.ID;

                    mrwt.ID = mrwt.CreateID();
                    mrwt.ModleRecordID = ccxqjh.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 = ccxqjh.GetType().ToString();
                    mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                    mrwt.CreatTime = DateTime.Now;
                    Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                }
                else
                    if (WorkFlowData.Rows[0]["flowcaption"].ToString() == "秋查消缺外查")
                    {

                        PJ_qcxqjh qcxqjh = new PJ_qcxqjh();
                        qcxqjh.ID = sbxs.ID;
                        qcxqjh.OrgCode = sbxs.OrgCode;
                        qcxqjh.OrgName = sbxs.OrgName;
                        qcxqjh.qxlb = sbxs.qxlb;
                        qcxqjh.xqlr = sbxs.qxnr;
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        try
                        {
                            MainHelper.PlatformSqlMap.Create<PJ_qcxqjh>(qcxqjh);
                        }
                        catch { }
                        qxfj.ID = qcxqjh.ID;


                        mrwt.ID = mrwt.CreateID();
                        mrwt.ModleRecordID = qcxqjh.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 = qcxqjh.GetType().ToString();
                        mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                        mrwt.CreatTime = DateTime.Now;
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                    }

                qxfj.CreateDate = sbxs.CreateDate;
                qxfj.CreateMan = sbxs.CreateMan;
                qxfj.LineID = sbxs.LineID;
                qxfj.LineName = sbxs.LineName;
                qxfj.OrgCode = sbxs.OrgCode;
                qxfj.OrgName = sbxs.OrgName;
                qxfj.qxlb = sbxs.qxlb;
                qxfj.qxly = "设备巡视";
                qxfj.qxnr = sbxs.qxnr;
                qxfj.xcqx = sbxs.xcqx;
                qxfj.xcr = sbxs.xcr;
                qxfj.xlqd = sbxs.xlqd;
                qxfj.xsr = sbxs.xsr;
                qxfj.xssj = sbxs.xssj;
                try
                {
                    MainHelper.PlatformSqlMap.Create<PJ_qxfl>(qxfj);
                }
                catch { }



                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                //Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                //mrwt = new WF_ModleRecordWorkTaskIns();
                //mrwt.ID = mrwt.CreateID();
                //mrwt.ModleRecordID = qxfj.ID;
                //mrwt.RecordID = currRecord.ID;
                //mrwt.WorkFlowId = dt.Rows[0]["WorkFlowId"].ToString();
                //mrwt.WorkFlowInsId = dt.Rows[0]["WorkFlowInsId"].ToString();
                //mrwt.WorkTaskId = dt.Rows[0]["WorkTaskId"].ToString();
                //mrwt.ModleTableName = qxfj.GetType().ToString();
                //mrwt.WorkTaskInsId = dt.Rows[0]["WorkTaskInsId"].ToString();
                //mrwt.CreatTime = DateTime.Now;
                //Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                //MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);

                mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ID = mrwt.CreateID();
                mrwt.ModleRecordID = sbxs.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = sbxs.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
            gridControl1.FindForm().Close();
        }