Пример #1
0
        private void gridView1_DoubleClick(object sender, EventArgs e) {
            if (gridView1.FocusedRowHandle < -1)
                return;
            PJ_anqgjcrkd rowdata = gridView1.GetFocusedRow() as PJ_anqgjcrkd;
            rowdata = ClientHelper.PlatformSqlMap.GetOneByKey<PJ_anqgjcrkd>(rowdata.ID);
            frmAQGJCKSingleXZ frm = new frmAQGJCKSingleXZ();
            frm.RowData = new PJ_anqgjcrkd();
            ConvertHelper.CopyTo<PJ_anqgjcrkd>(rowdata, (PJ_anqgjcrkd)frm.RowData);
            ((PJ_anqgjcrkd)frm.RowData).Remark = "";

            IList<PJ_anqgjcrkd> pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
            <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc ");
            if (pnumli.Count == 0)
                ((PJ_anqgjcrkd)frm.RowData).num = "JAQGJCK" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 1);
            else {
                ((PJ_anqgjcrkd)frm.RowData).num = "JAQGJCK" + (Convert.ToDecimal(pnumli[0].num.Replace("JAQGJCK", "")) + 1);

            }
            ((PJ_anqgjcrkd)frm.RowData).ckdate = DateTime.Now;
            double i = 0;
            if (frm.ShowDialog() == DialogResult.OK) {
                PJ_anqgjcrkd ckd = new PJ_anqgjcrkd();
                ConvertHelper.CopyTo<PJ_anqgjcrkd>(rowdata, ckd);
                ckd.ID = ckd.CreateID();

                System.Collections.IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneInt",
                    "select  sum(cast(kcsl as float) )  from PJ_anqgjcrkd where (type = '局安全工器具入库单' or type = '局安全工器具入库单原始库存')"
                    + " and wpmc='" + rowdata.wpmc + "' "
                    + " and wpgg='" + rowdata.wpgg + "' ");
                if (mclist[0] != null) i = Convert.ToDouble(mclist[0].ToString());
                double cktemp = Convert.ToDouble(frm.ReturnData.cksl);
                double zkc = Convert.ToDouble(i);
                // i = Client.ClientHelper.PlatformSqlMap.GetRowCount
                //<PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' ");
                ckd.num = frm.ReturnData.num;
                ckd.type = comboBoxEdit6.Text;
                ckd.Remark = frm.ReturnData.Remark;
                ckd.OrgName = frm.ReturnData.OrgName;
                ckd.OrgCode = frm.ReturnData.OrgCode;
                ckd.ckdate = DateTime.Now;
                if (cktemp >= Convert.ToDouble(rowdata.kcsl)) {
                    ckd.cksl = rowdata.kcsl;
                    ckd.zkcsl = (zkc - Convert.ToDouble(rowdata.kcsl)).ToString();
                    cktemp = cktemp - Convert.ToDouble(rowdata.kcsl);
                    ckd.kcsl = "0";
                    rowdata.kcsl = "0";
                    ClientHelper.PlatformSqlMap.Update<PJ_anqgjcrkd>(rowdata);
                } else {
                    ckd.cksl = cktemp.ToString();
                    ckd.zkcsl = (zkc - cktemp).ToString();
                    rowdata.kcsl = (Convert.ToDouble(rowdata.kcsl) - cktemp).ToString();
                    ckd.kcsl = rowdata.kcsl;
                    cktemp = 0;
                    ClientHelper.PlatformSqlMap.Update<PJ_anqgjcrkd>(rowdata);
                }
                ckd.lyparent = rowdata.ID;
                zkc = Convert.ToDouble(ckd.zkcsl);
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                if (isWorkflowCall) {

                    MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + ckd.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() + "'");
                }
                ClientHelper.PlatformSqlMap.Create<PJ_anqgjcrkd>(ckd);
                if (isWorkflowCall) {
                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                    mrwt.ModleRecordID = ckd.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 = ckd.GetType().ToString();
                    mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                    mrwt.CreatTime = DateTime.Now;
                    MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                }
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                PJ_anqgjcrkd slkd = new PJ_anqgjcrkd();
                //ConvertHelper.CopyTo<PJ_anqgjcrkd>(ckd, slkd);
                decimal snum;
                double szkc = 0;
                pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                         <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='所安全工器具入库单'  order by id desc  ");
                if (pnumli.Count == 0)
                    snum = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0));
                else {
                    snum = (Convert.ToDecimal(pnumli[0].num.Replace("SAQGJRK", "")));

                }

                slkd.ID = slkd.CreateID();
                slkd.wpmc = ckd.wpmc;
                slkd.wpgg = ckd.wpgg;
                slkd.wpdw = ckd.wpdw;
                slkd.wpdj = ckd.wpdj;
                slkd.wpsl = ckd.cksl;
                slkd.num = "SAQGJRK" + (snum + 1);
                slkd.type = "所安全工器具入库单";
                slkd.lyparent = ckd.ID;
                slkd.indate = ckd.ckdate;
                slkd.OrgName = ckd.OrgName;
                slkd.OrgCode = ckd.OrgCode;
                slkd.ckdate = new DateTime(1900, 1, 1);
                slkd.kcsl = ckd.cksl;
                slkd.synx = ckd.synx;
                slkd.syzq = ckd.syzq;
                slkd.scsydate = ckd.scsydate;
                pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                         <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='所安全工器具入库单' and orgname='" + ckd.OrgName + "'   order by id desc  ");
                if (mclist.Count > 0 && mclist[0] != null)
                    szkc = Convert.ToDouble(mclist[0]);
                slkd.zkcsl = (szkc + Convert.ToDouble(slkd.kcsl)).ToString();
                ClientHelper.PlatformSqlMap.Create<PJ_anqgjcrkd>(slkd);
                ucclck1.inidata();
            }
        }
Пример #2
0
        private void barxqjl_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.FocusedRowHandle < 0) return;
            //请求确认
            if (MsgBox.ShowAskMessageBox("是否确认选中记录消缺,并进入下一流程?") != DialogResult.OK)
            {
                return;
            }

            foreach (var item in gridView1.GetSelectedRows())
            {
                PJ_qxfl pj = gridView1.GetRow(item) as PJ_qxfl;
                PJ_qxfl pj1 = gridView1.GetRow(item) as PJ_qxfl;
                if (pj.s1 != pj1.s1)
                {
                    MsgBox.ShowWarningMessageBox("类型不一致,请统一后再消缺!");
                    return;
                }
            }
            foreach (var item in gridView1.GetSelectedRows())
            {
                PJ_qxfl pj = gridView1.GetRow(item) as PJ_qxfl;
                if (pj != null)
                {
                    ClientHelper.PlatformSqlMap.Update<PJ_qxfl>(pj);
                }
            }

            PJ_qxfl qxfl = gridView1.GetFocusedRow() as PJ_qxfl;
            string strmes = "";
            currRecord.OrgName = qxfl.OrgName;
            currRecord.LastChangeTime = DateTime.Now.ToString();
            if (RecordWorkTask.CheckOnRiZhi(WorkFlowData))
            {

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

            }
            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
            mrwt.ModleRecordID = qxfl.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 = qxfl.GetType().ToString();
            mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
            mrwt.CreatTime = DateTime.Now;
            MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            WF_WorkTaskCommands wt;


            //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID);
            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);
            strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
            if (strmes == "结束节点1")
            {
                currRecord.Status = "存档";
            }
            else
            {
                currRecord.Status = strmes;
            }
            if (currRecord.ImageAttachment == null)
            {
                currRecord.ImageAttachment = new byte[0];
            }
            if (currRecord.DocContent == null)
            {
                currRecord.DocContent = new byte[0];
            }
            if (currRecord.SignImg == null)
            {
                currRecord.SignImg = new byte[0];
            }

            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);



            gridControl1.FindForm().Close();
        }
Пример #3
0
 private void simpleButton4_Click(object sender, EventArgs e)
 {
     rowData.ID = rowData.CreateID();
     Thread.Sleep(new TimeSpan(100000));//0.1毫秒
     Client.ClientHelper.PlatformSqlMap.Create<PJ_wgclcrkd>(rowData);
     if (isWorkflowCall)
     {
         WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
         mrwt.ModleRecordID = rowData.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 = rowData.GetType().ToString();
         mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
         mrwt.CreatTime = DateTime.Now;
         MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
     }
     MsgBox.ShowTipMessageBox("添加成功!");
     rowData.ID = rowData.CreateID();
 }
Пример #4
0
        public void ExportExceljhbAllSubmitToWF_ModleRecordWorkTaskIns(string orgid, string strProject, string strfenProject)
        {

            string filter = "";
            int i = 0;
            List<WF_ModleRecordWorkTaskIns> mrwtlist = new List<WF_ModleRecordWorkTaskIns>();
            string strfirst = "";
            string filter2 = "";
            string filter3 = "";
            string filter4 = "";
            if (strProject != "全部")
                filter2 = "  where 1=1 and ssgc='" + strProject + "'  and type = '撤旧材料出库单' ";
            else
                filter2 = "  where 1=1  and type = '撤旧材料出库单' ";

            IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct ssgc  from PJ_clcrkd " + filter2 + " order by ssgc");

            foreach (string mc in mclist)
            {
                if (strfenProject == "全部")
                    filter3 = "  where 1=1 and type = '撤旧材料出库单' ";
                else
                    filter3 = "  where  ssxm='" + strfenProject + "'  and type = '撤旧材料出库单' ";

                IList xmlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct ssxm  from PJ_clcrkd " + filter3 + " order by ssxm");
                foreach (string xm in xmlist)
                {
                    filter4 = "  where 1=1 and type = '撤旧材料出库单'"
                        + "  and ssgc='" + mc + "' "
                        + "  and ssxm='" + xm + "' ";
                    //IList sjlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct CONVERT(varchar(50) ,indate, 112 )  from PJ_clcrkd " + filter4 + " ");

                    IList sjlist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct num  from PJ_clcrkd " + filter4 + " ");
                    foreach (string sj in sjlist)
                    {
                        filter = "  where 1=1 and type = '撤旧材料出库单'"
                        + "  and ssgc='" + mc + "' "
                        + "  and ssxm='" + xm
                        + "' and num= '" + sj + "' ";
                        if (isWorkflowCall)
                        {

                            filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                                + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                                    + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                                + "    RecordID='" + currRecord.ID + "') "
                                ;
                        }

                        IList<PJ_clcrkd> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_clcrkd>(
                         filter
                           );
                        if (isWorkflowCall)
                        {
                            for (i = 0; i < datalist.Count; i++)
                            {
                                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                                mrwt.ID = mrwt.CreateID();
                                mrwt.ModleRecordID = datalist[i].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.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                                mrwt.ModleTableName = datalist[i].GetType().ToString();
                                mrwt.CreatTime = DateTime.Now;
                                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                                mrwtlist.Add(mrwt);
                            }
                        }

                    }
                }

            }


            List<SqlQueryObject> list3 = new List<SqlQueryObject>();
            if (mrwtlist.Count > 0)
            {
                SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Insert, mrwtlist.ToArray());
                list3.Add(obj3);
            }
            MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3);





        }
Пример #5
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            if (gridView1.FocusedRowHandle < -1)
                return;
            PJ_clcrkd rowdata = gridView1.GetFocusedRow() as PJ_clcrkd;
            rowdata = ClientHelper.PlatformSqlMap.GetOneByKey<PJ_clcrkd>(rowdata.ID);
            frmFCLCKSingleXZ frm = new frmFCLCKSingleXZ();
            frm.RowData = new PJ_clcrkd();
            ConvertHelper.CopyTo<PJ_clcrkd>(rowdata, (PJ_clcrkd)frm.RowData);
            ((PJ_clcrkd)frm.RowData).Remark = "";

            IList<PJ_clcrkd> pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
            <PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc ");
            if (pnumli.Count == 0)
                ((PJ_clcrkd)frm.RowData).num = "FSCCK" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 1);
            else
            {
                ((PJ_clcrkd)frm.RowData).num = "FSCCK" + (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")) + 1);

            }
            ((PJ_clcrkd)frm.RowData).ckdate = DateTime.Now;
            double i = 0;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                PJ_clcrkd ckd = new PJ_clcrkd();
                ConvertHelper.CopyTo<PJ_clcrkd>(rowdata, ckd);
                ckd.ID = ckd.CreateID();
               
                System.Collections.IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneInt",
                    "select  sum(cast(kcsl as float) )  from PJ_clcrkd where (type = '非生产物资入库单' or type = '非生产物资入库单单原始库存')"
                    + " and wpmc='" + rowdata.wpmc + "' " + " and ssgc='" + rowdata.ssgc + "' "
                    + " and wpgg='" + rowdata.wpgg + "' ");
                if (mclist[0] != null) i = Convert.ToDouble(mclist[0].ToString());
                double cktemp = Convert.ToDouble(frm.ReturnData.cksl);
                double zkc = Convert.ToDouble(i);
                // i = Client.ClientHelper.PlatformSqlMap.GetRowCount
                //<PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' ");
                ckd.num = frm.ReturnData.num;
                ckd.type = comboBoxEdit6.Text;
                ckd.Remark = frm.ReturnData.Remark;
                ckd.yt = frm.ReturnData.yt;
                ckd.ssxm = frm.ReturnData.ssxm;
                ckd.lqdw = frm.ReturnData.lqdw;
                ckd.ghdw = frm.ReturnData.ghdw;
                ckd.ckdate = DateTime.Now;
                if (cktemp >= Convert.ToDouble(rowdata.kcsl))
                {
                    ckd.cksl = rowdata.kcsl;
                    ckd.zkcsl = (zkc - Convert.ToDouble(rowdata.kcsl)).ToString();
                    cktemp = cktemp - Convert.ToDouble(rowdata.kcsl);
                    ckd.kcsl = "0";
                    rowdata.kcsl = "0";
                    ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(rowdata);
                }
                else
                {
                    ckd.cksl = cktemp.ToString();
                    ckd.zkcsl = (zkc - cktemp).ToString();
                    rowdata.kcsl = (Convert.ToDouble(rowdata.kcsl) - cktemp).ToString();
                    ckd.kcsl = rowdata.kcsl;
                    cktemp = 0;
                    ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(rowdata);
                }
                ckd.lyparent = rowdata.ID;
                zkc = Convert.ToDouble(ckd.zkcsl);
                Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                if (isWorkflowCall)
                {

                    MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + ckd.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() + "'");
                }
                ClientHelper.PlatformSqlMap.Create<PJ_clcrkd>(ckd);
                if (isWorkflowCall)
                {
                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                    mrwt.ModleRecordID = ckd.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 = ckd.GetType().ToString();
                    mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                    mrwt.CreatTime = DateTime.Now;
                    MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                }
                ucclck1.inidata();
                //simpleButton2_Click(sender, e);
            }
        }
Пример #6
0
        private void btnOK_Click(object sender, EventArgs e) {
            string strmes = "";
            PJ_qxfl sbxs = RowData as PJ_qxfl;

            object obj = MainHelper.PlatformSqlMap.GetOneByKey<PJ_qxfl>(sbxs.ID);
            
            if (obj == null && isWorkflowCall) {

                sbxs.CreateDate = DateTime.Now;
                sbxs.CreateMan = MainHelper.User.UserName;
                MainHelper.PlatformSqlMap.Create<PJ_qxfl>(sbxs);
                if (isWorkflowCall) {
                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                    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;
                    MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                }
            } else if (isWorkflowCall) {
                MainHelper.PlatformSqlMap.Update<PJ_qxfl>(RowData);
            }
            PJ_06sbxsmx qxfltemp = new PJ_06sbxsmx();
            {
                qxfltemp.ID = sbxs.ID;
                qxfltemp.LineID = sbxs.LineID;
                qxfltemp.LineName = sbxs.LineName;
                qxfltemp.OrgCode = sbxs.OrgCode;
                qxfltemp.OrgName = sbxs.OrgName;
                qxfltemp.qxlb = sbxs.qxlb;
                qxfltemp.qxnr = sbxs.qxnr;
                qxfltemp.xssj = sbxs.xssj;
                qxfltemp.xsr = sbxs.xsr;
                qxfltemp.xcqx = sbxs.xcqx;
                qxfltemp.xlqd = sbxs.xlqd; ;
                qxfltemp.xcr = sbxs.xcr;
                qxfltemp.xcrq = sbxs.xcrq;
                qxfltemp.CreateMan = sbxs.CreateMan;
            }
            frmWorkFlow06sbxsEdit.update(qxfltemp);
            //currRecord.ImageAttachment = bt;
            //currRecord.SignImg = bt;
            currRecord.OrgName = rowData.OrgName;
            currRecord.LastChangeTime = DateTime.Now.ToString();
            if (RecordWorkTask.CheckOnRiZhi(WorkFlowData)) {

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

            }
            WF_WorkTaskCommands wt;

            //if (RecordWorkTask.CheckOnRiZhi(WorkFlowData)) {

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

            //}
            //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID);
            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);
            strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
            if (strmes == "结束节点1") {
                currRecord.Status = "存档";
            } else {
                currRecord.Status = strmes;
            }
            if (currRecord.ImageAttachment == null) {
                currRecord.ImageAttachment = new byte[0];
            }
            if (currRecord.DocContent == null) {
                currRecord.DocContent = new byte[0];
            }
            if (currRecord.SignImg == null) {
                currRecord.SignImg = new byte[0];
            }

            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);
        }
Пример #7
0
        private void btnOK_Click(object sender, EventArgs e)
        {

            string strname = "";
            string fname = "";
            string bhname = "";
            int icount = 1;


            DSOFramerControl dsoFramerControl1 = new DSOFramerControl();
            Microsoft.Office.Interop.Excel.Workbook wb;
            ExcelAccess ea = new ExcelAccess();
            if (rowData.BigData == null || rowData.BigData.Length == 0)
            {
                fname = Application.StartupPath + "\\00记录模板\\26防护通知书.xls";
                dsoFramerControl1.FileOpen(fname);
            }
            else
                dsoFramerControl1.FileData = rowData.BigData;
            wb = dsoFramerControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook;
            ea.MyWorkBook = wb;
            ea.MyExcel = wb.Application;
            if (rowData.BigData == null || rowData.BigData.Length == 0)
            {
                fname = Application.StartupPath + "\\00记录模板\\26防护通知书.xls";



                mOrg org = MainHelper.PlatformSqlMap.GetOneByKey<mOrg>(rowData.ParentID);
                bhname = org.OrgName.Replace("供电所", "");
                PJ_26 objtemp = (PJ_26)MainHelper.PlatformSqlMap.GetObject("SelectPJ_26List", "where ParentID='" + rowData.ParentID + "' and xybh like '" + SelectorHelper.GetPysm(org.OrgName.Replace("供电所", ""), true) + "-" + DateTime.Now.Year.ToString() + "-%' order by xybh ASC");

                if (objtemp != null && objtemp.xybh != "")
                {
                    icount = Convert.ToInt32(objtemp.xybh.Split('-')[2]) + 1;
                }
                rowData.xybh = SelectorHelper.GetPysm(bhname, true).ToUpper() + "-" + DateTime.Now.Year.ToString() + "-" + string.Format("{0:D3}", icount);
                strname = SelectorHelper.GetPysm(bhname, true);
                ea.SetCellValue(strname.ToUpper(), 4, 9);
                strname = DateTime.Now.Year.ToString();
                ea.SetCellValue(strname, 4, 11);
                strname = string.Format("{0:D3}", icount);
                ea.SetCellValue(strname, 4, 13);

            }
            ea.SetCellValue(comboBoxEdit1.Text + ":", 5, 2);
            ea.SetCellValue(comboBoxEdit3.Text, 6, 11);
            if (memoEdit2.Text.Length > 25)
            {
                ea.SetCellValue(memoEdit2.Text.Substring(0, 25), 7, 3);
                ea.SetCellValue(memoEdit2.Text.Substring(26), 8, 2);
            }
            else
            {
                ea.SetCellValue(memoEdit2.Text, 7, 3);
            }
            if (memoEdit3.Text.Length > 23)
            {
                ea.SetCellValue(memoEdit3.Text.Substring(0, 23), 13, 4);
                ea.SetCellValue(memoEdit3.Text.Substring(24), 14, 2);
            }
            else
            {
                ea.SetCellValue(memoEdit3.Text, 13, 4);
            }
            dsoFramerControl1.FileSave();
            rowData.BigData = dsoFramerControl1.FileData;
            dsoFramerControl1.FileClose();
            dsoFramerControl1.Dispose();
            dsoFramerControl1 = null;
            PJ_26 sbxs = RowData as PJ_26;
            string strmes = "";
            object obj = MainHelper.PlatformSqlMap.GetOneByKey<PJ_26>(sbxs.ID);
            if (obj == null)
            {
                MainHelper.PlatformSqlMap.Create<PJ_26>(sbxs);

                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                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;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }

            else
            {
                MainHelper.PlatformSqlMap.Update<PJ_26>(sbxs);

            }

            currRecord.LastChangeTime = DateTime.Now.ToString();
            if (RecordWorkTask.CheckOnRiZhi(WorkFlowData))
            {

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

            }
            WF_WorkTaskCommands wt;

            if (RecordWorkTask.CheckOnRiZhi(WorkFlowData))
            {

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

            }
            //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID);
            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);
            strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
            if (strmes == "结束节点1")
            {
                currRecord.Status = "存档";
            }
            else
            {
                currRecord.Status = strmes;
            }
            if (currRecord.ImageAttachment == null)
            {
                currRecord.ImageAttachment = new byte[0];
            }
            if (currRecord.DocContent == null)
            {
                currRecord.DocContent = new byte[0];
            }
            if (currRecord.SignImg == null)
            {
                currRecord.SignImg = new byte[0];
            }

            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);
        }
Пример #8
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();
        }
Пример #9
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;
        }
Пример #10
0
        public void ExportExceljhbAllSubmitToWF_ModleRecordWorkTaskIns(DateTime dt,DateTime dt2, string orgid)
        {

            string filter = "";
            int i = 0;
            if (orgid != "") filter = " and OrgCode='" + orgid + "'";
            string startday = "20";
            IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                string.Format("select nr from pj_dyk where  dx='所月度停电计划' and sx like '%{0}%' and nr!=''", "申报截止日期"));
            if (list.Count > 0)
                startday = list[0].ToString();

            filter = " where (TDtime between '" + dt.Year + "-"
                + dt.Month + "-" + dt.Day
                + " 00:00:00' and  '"
                + dt2.Year + "-"
                + dt2.Month + "-" + dt2.Day + " 23:59:59' ) ";
             if (orgid != "") filter += " and OrgCode='" + orgid + "'";
            if (isWorkflowCall)
            {
                filter = filter + " and (id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowInsId='"
                    + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "') "
                        + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                    + "    RecordID='" + currRecord.ID + "')) "
                    ;
            }
            IList<PJ_tdjh> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_tdjh>(
                 filter
                 );
            List<WF_ModleRecordWorkTaskIns> mrwtlist = new List<WF_ModleRecordWorkTaskIns>();
            
            if (isWorkflowCall)
            {
                for (i = 0; i < datalist.Count; i++)
                {

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

           


                List<SqlQueryObject> list3 = new List<SqlQueryObject>();
                if (mrwtlist.Count > 0)
                {
                    SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Insert, mrwtlist.ToArray());
                    list3.Add(obj3);
                }

                MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3);
            }
Пример #11
0
        void gridViewOperation_AfterAdd(PJ_06sbxs newobj)
        {
            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
            if (isWorkflowCall)
            {

                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.qxlb != "")
            {
                PJ_qxfl qxfj = new PJ_qxfl();
                qxfj.ID = newobj.ID;
                qxfj.CreateDate = newobj.CreateDate;
                qxfj.CreateMan = newobj.CreateMan;
                qxfj.LineID = newobj.LineID;
                qxfj.LineName = newobj.LineName;
                qxfj.OrgCode = newobj.OrgCode;
                qxfj.OrgName = newobj.OrgName;
                qxfj.qxlb = newobj.qxlb;
                qxfj.qxly = "设备巡视";
                qxfj.qxnr = newobj.qxnr;
                qxfj.xcqx = newobj.xcqx;
                qxfj.xcr = newobj.xcr;
                qxfj.xlqd = newobj.xlqd;
                qxfj.xsr = newobj.xsr;
                qxfj.xssj = newobj.xssj;
                MainHelper.PlatformSqlMap.Create<PJ_qxfl>(qxfj);




                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ID = mrwt.CreateID();
                mrwt.ModleRecordID = qxfj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = qxfj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
        }
Пример #12
0
 void gridViewOperation_AfterAdd(PJ_14aqgjsy obj)
 {
     if (isWorkflowCall)
     {
         WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
         mrwt.ModleRecordID = obj.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.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
         mrwt.CreatTime = DateTime.Now;
         mrwt.ModleTableName = obj.GetType().ToString();
         MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
     }
     RefreshData(" where OrgCode='" + parentID + "' and sbID='" + PSObj.sbID+"'" );
     if (PSObj != null) {
         _parentobj.syrq = obj.rq;
         _parentobj.syrq2 = obj.xcsyrq;
         ClientHelper.PlatformSqlMap.Update<PS_aqgj>(_parentobj);
     }
 }
Пример #13
0
        public void ExportExceljhbAllSubmitToWF_ModleRecordWorkTaskIns(string orgid)
        {

            string filter = "";
            int i = 0;
            if (orgid != "") filter = " and OrgCode='" + orgid + "'";
            if (isWorkflowCall)
            {
                filter = filter + " and (id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                    + "    WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                    + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                    + "    RecordID='" + currRecord.ID + "')) "
                    ;
            }
            List<WF_ModleRecordWorkTaskIns> mrwtlist = new List<WF_ModleRecordWorkTaskIns>();
            IList<PJ_yfsyjl> byqdatalist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_yfsyjl>("SelectPJ_yfsyjlList", " where  type='变压器'   and planExpTime like '%" + DateTime.Now.Year + "%' " + filter + " order by xh ");
            if (isWorkflowCall)
            {
                for (i = 0; i < byqdatalist.Count; i++)
                {

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

            byqdatalist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_yfsyjl>("SelectPJ_yfsyjlList", " where  type='断路器'  and planExpTime like '%" + DateTime.Now.Year + "%' " + filter + " order by xh ");
            if (isWorkflowCall)
            {
                for (i = 0; i < byqdatalist.Count; i++)
                {

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


            byqdatalist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_yfsyjl>("SelectPJ_yfsyjlList", " where  type='避雷器'  and planExpTime like '%" + DateTime.Now.Year + "%' " + filter + " order by xh ");
            if (isWorkflowCall)
            {
                for (i = 0; i < byqdatalist.Count; i++)
                {

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


            byqdatalist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_yfsyjl>("SelectPJ_yfsyjlList", " where  type='电容器'  and planExpTime like '%" + DateTime.Now.Year + "%' " + filter + " order by xh ");
            if (isWorkflowCall)
            {
                for (i = 0; i < byqdatalist.Count; i++)
                {

                    WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                    mrwt.ID = mrwt.CreateID();
                    mrwt.ModleRecordID = byqdatalist[i].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.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                    mrwt.ModleTableName = byqdatalist[i].GetType().ToString();
                    mrwt.CreatTime = DateTime.Now;
                    Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                    mrwtlist.Add(mrwt);
                }
                List<SqlQueryObject> list3 = new List<SqlQueryObject>();
                if (mrwtlist.Count > 0)
                {
                    SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Insert, mrwtlist.ToArray());
                    list3.Add(obj3);
                }

                MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3);
            }





        }
Пример #14
0
        void gridViewOperation_AfterAdd(PJ_yfsyhcjl obj)
        {
            if (isWorkflowCall)
            {
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ModleRecordID = obj.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.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                mrwt.ModleTableName = obj.GetType().ToString();
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
            string slqwhere = " where OrgCode='" + obj.OrgCode + "' ";
            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() + "')";
            }
            //slqwhere = slqwhere + " order by xh";
            obj.xh = MainHelper.PlatformSqlMap.GetRowCount<PJ_yfsyhcjl>(slqwhere);

            MainHelper.PlatformSqlMap.Update<PJ_yfsyhcjl>(obj);

            
            RefreshData(" where OrgCode='" + ParentID + "'   ");
           

        }
Пример #15
0
 void gridViewOperation_AfterAdd(PJ_12kgbd obj) {
     if (isWorkflowCall) {
         WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
         mrwt.ModleRecordID = obj.ID;
         mrwt.RecordID = currRecord.ID;
         mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
         mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
         mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
         mrwt.ModleTableName = obj.GetType().ToString();
         mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
         mrwt.CreatTime = DateTime.Now;
         MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
         MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
     }
     RefreshData(" where OrgCode='" + ParentID + "'  and kgID='" + PSObj.kgID + "' ");
 }
Пример #16
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;
        }
Пример #17
0
        void gridViewOperation_AfterAdd(PJ_18gysbpjmx obj) {
            //RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by id desc");
            RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh ");

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

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

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



                Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ID = mrwt.CreateID();
                mrwt.ModleRecordID = qxfj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = qxfj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
        }
Пример #18
0
        public void RunTaskRecordCtrlData(string sqlSentence, WF_TaskVar wtt)
        {
            IList li = MainHelper.PlatformSqlMap.GetList("GetTableColumns", wtt.VarName);
            Hashtable hs = new Hashtable();
            Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "Ebada.Scgl.Model.dll");
            Type tpe = assembly.GetType("Ebada.Scgl.Model." + wtt.VarName);

            for (int i = 0; i < li.Count; i++)
            {
                Regex r1 = new Regex(@"(?<=\[" + (li[i] as WF_WorkFlow).Name + ":).*?(?=\\])");
                if (r1.Match(sqlSentence.Replace("\r\n", " ")).Value != "")
                {

                    IList sli = ExTaskRecordCtrlSQL(r1.Match(sqlSentence.Replace("\r\n", " ")).Value, wtt);
                    if (hs.Contains((li[i] as WF_WorkFlow).Name) == false) hs.Add((li[i] as WF_WorkFlow).Name, "");
                    if (sli.Count > 0)
                    {

                        if (GetDisplayName(tpe, (li[i] as WF_WorkFlow).Name).IndexOf("时间") > 0)
                        {
                            if (sli[0].ToString().IndexOf("年") > -1)
                                hs[(li[i] as WF_WorkFlow).Name] = sli[1];
                            else
                                hs[(li[i] as WF_WorkFlow).Name] = sli[0];

                        }
                        else
                        {
                            hs[(li[i] as WF_WorkFlow).Name] = sli[0];
                        }

                    }
                }


            }
            ArrayList akeys = new ArrayList(hs.Keys);
            string strsql = "";
            IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select   COLUMN_NAME   from   INFORMATION_SCHEMA.KEY_COLUMN_USAGE  where   TABLE_NAME   =   '" + wtt.VarName + "'");
            strsql = " INSERT INTO " + wtt.VarName;

            foreach (string strv in list)
            {
                if (strv == list[0].ToString())
                {
                    strsql = strsql + " ( " + strv;
                }
                else
                {
                    strsql = strsql + "," + strv;
                }
            }
            for (int i = 0; i < akeys.Count; i++)
            {
                if (list[0].ToString() != akeys[i].ToString())
                {
                    strsql += "," + akeys[i];
                }
            }
            string strid = DateTime.Now.ToString("yyyyMMddHHmmssffffff");
            strsql += " )  values (";
            foreach (string strv in list)
            {
                if (strv == list[0].ToString())
                {
                    if (hs.Contains(strv))
                        strsql = strsql + "  '" + hs[strv] + "'";
                    else
                        strsql = strsql + "  '" + strid + "'";

                }
                else
                {

                    if (hs.Contains(strv))
                        strsql = strsql + ",'" + hs[strv] + "'";
                    else
                        strsql = strsql + ",'" + strid + "'";
                }
            }
            //strsql += "'" + strid + "' ";
            for (int i = 0; i < akeys.Count; i++)
            {

                if (list[0].ToString() != akeys[i].ToString())
                {
                    if (tpe.GetMember(akeys[i].ToString())[0].ToString().IndexOf("System.Int") > 0
                        || tpe.GetMember(akeys[i].ToString())[0].ToString().IndexOf("System.Double") > 0
                        )
                        strsql += " , " + hs[akeys[i]] + " ";
                    else
                        strsql += " , '" + hs[akeys[i]] + "' ";
                }
            }
            strsql += " )  ";
            MainHelper.PlatformSqlMap.Update("Update", strsql);
            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
            mrwt.ModleRecordID = strid;
            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 = wtt.VarName;
            mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
            mrwt.CreatTime = DateTime.Now;
            MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
        }
Пример #19
0
        void gridViewOperation_AfterAdd(PJ_ccxqjh newobj)
        {
            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
            if (isWorkflowCall)
            {
                
                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毫秒
                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);
            }
        }
Пример #20
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            PJ_jggcjh sbxs = RowData as PJ_jggcjh;
            string strmes = "";
            object obj = MainHelper.PlatformSqlMap.GetOneByKey<PJ_jggcjh>(sbxs.ID);
            if (obj == null)
            {
                MainHelper.PlatformSqlMap.Create<PJ_jggcjh>(sbxs);

                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                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;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }

            else
            {
                MainHelper.PlatformSqlMap.Update<PJ_jggcjh>(sbxs);

            }
            if (isWorkflowCall)
            {


                currRecord.LastChangeTime = DateTime.Now.ToString();
                if (RecordWorkTask.CheckOnRiZhi(WorkFlowData))
                {

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

                }
                WF_WorkTaskCommands wt;

                if (RecordWorkTask.CheckOnRiZhi(WorkFlowData))
                {

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

                }
                //string[] strtemp = RecordWorkTask.RunNewGZPRecord(currRecord.ID, kind, MainHelper.User.UserID);
                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);
                strmes = RecordWorkTask.GetWorkFlowTaskCaption(WorkFlowData.Rows[0]["WorkTaskInsId"].ToString());
                if (strmes == "结束节点1")
                {
                    currRecord.Status = "存档";
                }
                else
                {
                    currRecord.Status = strmes;
                }
                if (currRecord.ImageAttachment == null)
                {
                    currRecord.ImageAttachment = new byte[0];
                }
                if (currRecord.DocContent == null)
                {
                    currRecord.DocContent = new byte[0];
                }
                if (currRecord.SignImg == null)
                {
                    currRecord.SignImg = new byte[0];
                }

                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);
            }
        }
Пример #21
0
        void gridViewOperation_AfterAdd(PJ_sdytz obj) {
            if (isWorkflowCall) {


                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ModleRecordID = obj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = obj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
            }
        }
Пример #22
0
 void treeViewOperator_AfterAdd(PJ_17 newobj)
 {
     if (AfterAdd != null)
         AfterAdd(treeList1, 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);
         MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
     }
 }
Пример #23
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            frmFCLCKXZ frm = new frmFCLCKXZ();
            frm.strType = comboBoxEdit5.Text;
            if (clccktemp == null) clccktemp = new PJ_clcrkd();
            clccktemp.cksl = "0";
            clccktemp.wpgg = ""; 

            //int i = Client.ClientHelper.PlatformSqlMap.GetRowCount
            //       <PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc  ");
            //frm.strNum = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", i + 1);
            
            IList<PJ_clcrkd> pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                       <PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "'  order by id desc  ");

            if (clccktemp.num == "")
            {
                if (pnumli.Count == 0)
                    clccktemp.num = "FSCCK" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 1);
                else
                {
                    clccktemp.num = "FSCCK" + (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")) + 1);

                }
            }
            else
            {
                if (pnumli.Count > 0)
                {

                    if ((Convert.ToDecimal(clccktemp.num.Replace("FSCCK", ""))) - (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", ""))) > 1)
                    {
                        clccktemp.num = "FSCCK" + (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "") + 1));
                    }
                }
            }
            frm.strNum = clccktemp.num;
            frm.RowData = new PJ_clcrkd();
            ((PJ_clcrkd)frm.RowData).ckdate = DateTime.Now;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                string ssgc = " and 1=1 ",  wpgg = " and 1=1 ", wpmc = " and 1=1 ";
                double isum = 0;
                    ssgc = " and ssgc='" + frm.ReturnData.ssgc  + "' ";

                    wpmc = " and wpmc='" + frm.ReturnData.wpmc  + "' ";

                    wpgg = " and wpgg='" + frm.ReturnData.wpgg  + "' ";
                    isum =Convert.ToDouble( frm.ReturnData.cksl);
                  string   strsql = " where  (type = '" + comboBoxEdit5.Text
                    + "' or type = '" + comboBoxEdit5.Text + "原始库存') "
                    + ssgc + wpmc + wpgg + " and cast(kcsl as float)>0 order by cast( indate as datetime) ";
                IList<PJ_clcrkd> datalist = ClientHelper.PlatformSqlMap.GetListByWhere<PJ_clcrkd>
                    (strsql);
                double cktemp = isum;
                double zkc = Convert.ToDouble(frm.ReturnData.zkcsl);
                IList<PJ_clcrkd> ckdatalist = new List<PJ_clcrkd>();
                decimal num = 0;
                 pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                               <PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "'  order by id desc  ");
                    if (pnumli.Count == 0)
                        num = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0));
                    else
                    {
                        num =  (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")));

                    }
                
                foreach (PJ_clcrkd pc in datalist)
                {
                    PJ_clcrkd ckd =new PJ_clcrkd() ;
                    ConvertHelper.CopyTo<PJ_clcrkd>(pc, ckd);
                    ckd.ID = ckd.CreateID();
                    //int i = Client.ClientHelper.PlatformSqlMap.GetRowCount
                    //       <PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc  ");
                    //frm.strNum = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", i + 1);

                    //ckd.num = "FSCCK" + (num + 1);
                    ckd.num = clccktemp.num;
                    ckd.type = comboBoxEdit6.Text;
                    ckd.Remark = frm.ReturnData.Remark;
                    ckd.yt = pc.yt;
                    ckd.ssxm = pc.ssxm;
                    ckd.lqdw = frm.ReturnData.lqdw;
                    ckd.ckdate = DateTime.Now;
                    if (cktemp >= Convert.ToDouble(pc.kcsl))
                    {
                        ckd.cksl = pc.kcsl;
                        ckd.zkcsl = (zkc - Convert.ToDouble(pc.kcsl)).ToString();
                        cktemp = cktemp - Convert.ToDouble(pc.kcsl);
                        pc.kcsl = "0";
                        //ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc);
                    }
                    else
                    {
                        ckd.cksl = cktemp.ToString();
                        ckd.zkcsl = (zkc - cktemp).ToString();

                        pc.kcsl = (Convert.ToDouble(pc.kcsl) - cktemp).ToString();
                        cktemp = 0;
                        //ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc);
                    }
                    ckd.lyparent = pc.ID;
                    zkc = Convert.ToDouble(ckd.zkcsl);
                    Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                    
                    //ClientHelper.PlatformSqlMap.Create<PJ_clcrkd>(ckd);

                    ckdatalist.Add(ckd);
                    if (cktemp<1) break;
                    //num=(num + 1);
                }
                frmFCLCKXZShow frmshow = new frmFCLCKXZShow();
                frmshow.DataList = ckdatalist;
                if (frmshow.ShowDialog() == DialogResult.OK)
                {
                    cktemp = isum;
                    zkc = Convert.ToDouble(frm.ReturnData.zkcsl);
                    pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                       <PJ_clcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' ");
                    if (pnumli.Count == 0)
                        num = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0));
                    else
                    {
                        num =  (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")) );

                    } 
                    datalist = ClientHelper.PlatformSqlMap.GetListByWhere<PJ_clcrkd>
                     (strsql);
                    foreach (PJ_clcrkd pc in datalist)
                    {
                        PJ_clcrkd ckd = new PJ_clcrkd();
                        ConvertHelper.CopyTo<PJ_clcrkd>(pc, ckd);
                        ckd.ID = ckd.CreateID();
                        //ckd.num = "FSCCK" + (num + 1);
                        ckd.num = clccktemp.num;
                        ckd.type = comboBoxEdit6.Text;
                        ckd.Remark = frm.ReturnData.Remark;
                        ckd.lqdw = frm.ReturnData.lqdw;
                        ckd.ghdw = frm.ReturnData.ghdw;
                        ckd.yt = frm.ReturnData.yt;
                        ckd.ssxm = frm.ReturnData.ssxm;
                        ckd.ckdate = DateTime.Now;
                        if (cktemp >= Convert.ToDouble(pc.kcsl))
                        {
                            ckd.cksl = pc.kcsl;
                            ckd.zkcsl = (zkc - Convert.ToDouble(pc.kcsl)).ToString();
                            cktemp = cktemp - Convert.ToDouble(pc.kcsl);
                            pc.kcsl = "0";
                            ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc);
                        }
                        else
                        {
                            ckd.cksl = cktemp.ToString();
                            ckd.zkcsl = (zkc - cktemp).ToString();

                            pc.kcsl = (Convert.ToDouble(pc.kcsl) - cktemp).ToString();
                            cktemp = 0;
                            ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc);
                        }
                        ckd.lyparent = pc.ID;
                        zkc = Convert.ToDouble(ckd.zkcsl);
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                        if (isWorkflowCall)
                        {

                            MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + ckd.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() + "'");
                        }
                        ClientHelper.PlatformSqlMap.Create<PJ_clcrkd>(ckd);
                        if (isWorkflowCall)
                        {
                            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                            mrwt.ModleRecordID = ckd.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 = ckd.GetType().ToString();
                            mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                            mrwt.CreatTime = DateTime.Now;
                            MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                        }


                        if (cktemp < 1) break;
                        //num = (num + 1);

                    }
                    ucclck1.inidata();
                    simpleButton1_Click(sender, e);
                    //simpleButton2_Click(sender, e);
                }
            }
        }
Пример #24
0
        private void btReAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (btXlList.EditValue == null|| btXlList.EditValue.ToString()=="" )
            {
                return;
            }
            PS_xl xl= btXlList.EditValue as PS_xl;
            PJ_17 pj = new PJ_17();
            pj.CreateDate = DateTime.Now;
            pj.CreateMan = MainHelper.User.UserName;
            pj.LineName = xl.LineName;
            pj.LineCode = xl.LineCode;
            pj.OrgCode  = xl.OrgCode ;
            pj.OrgName = parentObj.OrgName;
            pj.Remark ="";
            MainHelper.PlatformSqlMap.Create<PJ_17>(pj);
            if (isWorkflowCall)
            {
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ModleRecordID = pj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = pj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
            }

            InitData();
            //if (MsgBox.ShowAskMessageBox("是否马上生成条图") == DialogResult.OK)
            {
                
                try
                {
                    if (ExportToExcel("高压配电线路条图", "", pj) < 1) return;

                    frm17Template frm = new frm17Template();
                    frm.pjobject = pj;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        Client.ClientHelper.PlatformSqlMap.Update<PJ_17>(frm.pjobject);
                        //MessageBox.Show("保存成功");
                    }
                }
                catch (Exception ex)
                {
                    MsgBox.ShowException(ex);  

                }
            }
            
        }
Пример #25
0
        private void btAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            PJ_ryda newobj = new PJ_ryda();
            if (parentID == null) return;
            newobj.OrgCode = parentObj.OrgCode;
            newobj.OrgName = parentObj.OrgName;
            if (parentID != null)
            {
                newobj.OrgCode = parentObj.OrgCode;
                newobj.OrgName = parentObj.OrgName;
            }
            newobj.CreateDate = DateTime.Now;
            Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin();
            newobj.CreateMan = m_UserBase.RealName;
            frmrsdaTemplate frm = new frmrsdaTemplate();
            frm.CurrRecord = newobj;
            frm.RowData = newobj;
            frm.Status = "add";
            if (frm.ShowDialog() == DialogResult.OK)
            {

                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);
                    MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
                }
            }
            InitData();
        }
Пример #26
0
        private void TaskPlanChangeButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {

            if (isWorkflowCall) {
                PS_tqbyq obj = gridView1.GetFocusedRow() as PS_tqbyq;
                if (obj != null) {
                    WF_ModleRecordWorkTaskIns mrwt = null;
                    mrwt = MainHelper.PlatformSqlMap.GetOne<WF_ModleRecordWorkTaskIns>(" where WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"] + "'"
                            + " and WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"] + "'"
                            + " and ModleRecordID='" + obj.byqID + "'"
                            + " and WorkTaskInsId='" + WorkFlowData.Rows[0]["WorkTaskInsId"].ToString() + "'"
                            + " and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"

                    );
                    if (mrwt == null) {
                        mrwt = new WF_ModleRecordWorkTaskIns();
                        mrwt.ModleRecordID = obj.byqID;
                        mrwt.RecordID = currRecord.ID;
                        mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                        mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                        mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                        mrwt.ModleTableName = obj.GetType().ToString();
                        mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                        mrwt.CreatTime = DateTime.Now;
                        MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                    }
                }
            }
            string statustemp = currRecord.Status;
            currRecord.Status = "方案调整";
            MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
            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("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!");
                currRecord.Status = statustemp;
                if (currRecord.ImageAttachment == null) currRecord.ImageAttachment = new byte[0];
                if (currRecord.SignImg == null) currRecord.SignImg = new byte[0];
                MainHelper.PlatformSqlMap.Update("UpdateLP_Record", CurrRecord);
                return;
            } else
                MsgBox.ShowTipMessageBox(strmes);
            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);
            gridControl1.FindForm().Close();

        }
Пример #27
0
        public void ExportExceljhbAllSubmitToWF_ModleRecordWorkTaskIns(string orgid)
        {

            string filter = "";
            int i = 0;
          
            List<WF_ModleRecordWorkTaskIns> mrwtlist = new List<WF_ModleRecordWorkTaskIns>();
            
                filter = "  where 1=1 ";
                if (orgid != "") filter += " and OrgCode='" + orgid + "'";
                if (isWorkflowCall)
                {
                    filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                        + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                            + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                        + "    RecordID='" + currRecord.ID + "') ";
                }
                IList<PJ_sbbzqsbgmxb3> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_sbbzqsbgmxb3>(
                 filter
                   );
                if (isWorkflowCall)
                {
                    for (i = 0; i < datalist.Count; i++)
                    {
                        WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                        mrwt.ID = mrwt.CreateID();
                        mrwt.ModleRecordID = datalist[i].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.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                        mrwt.ModleTableName = datalist[i].GetType().ToString();
                        mrwt.CreatTime = DateTime.Now;
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        mrwtlist.Add(mrwt);
                    }
                }
                
            
           
            List<SqlQueryObject> list3 = new List<SqlQueryObject>();
            if (mrwtlist.Count > 0)
            {
                SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Insert, mrwtlist.ToArray());
                list3.Add(obj3);
            }
            MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3);
            



           
        }
Пример #28
0
        void gridViewOperation_AfterAdd(PJ_gdscrk 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);
            }
            GetWpmc();

            //RefreshData();
            //gridControl1.RefreshDataSource();
            //gridView1.RefreshData();
        }
Пример #29
0
 void gridViewOperation_AfterAdd(PJ_cqcssqk 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);
     }
 }
Пример #30
0
        private void simpleButton1_Click(object sender, EventArgs e) {
            frmAQGJCKXZ frm = new frmAQGJCKXZ();
            frm.strType = comboBoxEdit5.Text;
            if (clccktemp == null) clccktemp = new PJ_anqgjcrkd();

            //int i = Client.ClientHelper.PlatformSqlMap.GetRowCount
            //       <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc  ");
            //frm.strNum = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", i + 1);

            IList<PJ_anqgjcrkd> pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                       <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "'  order by id desc  ");
            if (clccktemp.num == "") {
                if (pnumli.Count == 0)
                    clccktemp.num = "JAQGJCK" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 1);
                else {
                    clccktemp.num = "JAQGJCK" + (Convert.ToDecimal(pnumli[0].num.Replace("JAQGJCK", "")) + 1);

                }
            } else {
                if (pnumli.Count > 0) {

                    if ((Convert.ToDecimal(clccktemp.num.Replace("JAQGJCK", ""))) - (Convert.ToDecimal(pnumli[0].num.Replace("JAQGJCK", ""))) > 1) {
                        clccktemp.num = "JAQGJCK" + (Convert.ToDecimal(pnumli[0].num.Replace("JAQGJCK", "") + 1));
                    }
                }
            }
            frm.strNum = clccktemp.num;
            //frm.RowData = new PJ_anqgjcrkd();
            frm.RowData = clccktemp;
            ((PJ_anqgjcrkd)frm.RowData).ckdate = DateTime.Now;
            if (frm.ShowDialog() == DialogResult.OK) {
                string ssgc = " and 1=1 ", wpgg = " and 1=1 ", wpmc = " and 1=1 ";
                double isum = 0;

                wpmc = " and wpmc='" + frm.ReturnData.wpmc + "' ";

                wpgg = " and wpgg='" + frm.ReturnData.wpgg + "' ";
                isum = Convert.ToDouble(frm.ReturnData.cksl);
                string strsql = " where  (type = '" + comboBoxEdit5.Text
                  + "' or type = '" + comboBoxEdit5.Text + "原始库存') "
                  + ssgc + wpmc + wpgg + " and cast(kcsl as float)>0 order by cast( indate as datetime) ";
                IList<PJ_anqgjcrkd> datalist = ClientHelper.PlatformSqlMap.GetListByWhere<PJ_anqgjcrkd>
                    (strsql);
                double cktemp = isum;
                double zkc = Convert.ToDouble(frm.ReturnData.zkcsl);
                double szkc = 0;
                IList<PJ_anqgjcrkd> ckdatalist = new List<PJ_anqgjcrkd>();
                decimal num = 0;
                pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                              <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "'  order by id desc  ");
                if (pnumli.Count == 0)
                    num = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0));
                else {
                    num = (Convert.ToDecimal(pnumli[0].num.Replace("JAQGJCK", "")));

                }


                foreach (PJ_anqgjcrkd pc in datalist) {
                    PJ_anqgjcrkd ckd = new PJ_anqgjcrkd();
                    ConvertHelper.CopyTo<PJ_anqgjcrkd>(pc, ckd);
                    ckd.ID = ckd.CreateID();
                    //int i = Client.ClientHelper.PlatformSqlMap.GetRowCount
                    //       <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc  ");
                    //frm.strNum = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", i + 1);

                    //ckd.num = "JAQGJCK" + (num + 1);
                    ckd.num = clccktemp.num;
                    ckd.type = comboBoxEdit6.Text;
                    ckd.Remark = frm.ReturnData.Remark;
                    ckd.OrgName = frm.ReturnData.OrgName;
                    ckd.OrgCode = frm.ReturnData.OrgCode;
                    ckd.ckdate = DateTime.Now;
                    if (cktemp >= Convert.ToDouble(pc.kcsl)) {
                        ckd.cksl = pc.kcsl;
                        ckd.zkcsl = (zkc - Convert.ToDouble(pc.kcsl)).ToString();
                        cktemp = cktemp - Convert.ToDouble(pc.kcsl);
                        pc.kcsl = "0";
                        //ClientHelper.PlatformSqlMap.Update<PJ_anqgjcrkd>(pc);
                    } else {
                        ckd.cksl = cktemp.ToString();
                        ckd.zkcsl = (zkc - cktemp).ToString();

                        pc.kcsl = (Convert.ToDouble(pc.kcsl) - cktemp).ToString();
                        cktemp = 0;
                        //ClientHelper.PlatformSqlMap.Update<PJ_anqgjcrkd>(pc);
                    }
                    ckd.lyparent = pc.ID;
                    zkc = Convert.ToDouble(ckd.zkcsl);
                    Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                    //ClientHelper.PlatformSqlMap.Create<PJ_anqgjcrkd>(ckd);

                    ckdatalist.Add(ckd);
                    if (cktemp < 1) break;
                    //num=(num + 1);
                }
                frmAQGJCKXZShow frmshow = new frmAQGJCKXZShow();
                frmshow.DataList = ckdatalist;
                if (frmshow.ShowDialog() == DialogResult.OK) {
                    cktemp = isum;
                    zkc = Convert.ToDouble(frm.ReturnData.zkcsl);
                    pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                       <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' ");
                    if (pnumli.Count == 0)
                        num = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0));
                    else {
                        num = (Convert.ToDecimal(pnumli[0].num.Replace("JAQGJCK", "")));

                    }

                    datalist = ClientHelper.PlatformSqlMap.GetListByWhere<PJ_anqgjcrkd>
                     (strsql);
                    decimal snum;
                    pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere
                             <PJ_anqgjcrkd>(" where  id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='所安全工器具入库单' and orgname='" + frm.ReturnData.OrgName + "'   order by id desc  ");
                    if (pnumli.Count == 0)
                        snum = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0));
                    else {
                        snum = (Convert.ToDecimal(pnumli[0].num.Replace("SAQGJRK", "")));

                    }
                    if (clccktemp.num == "JAQGJCK" + num.ToString()) {
                        snum = (snum + 1);
                    }
                    foreach (PJ_anqgjcrkd pc in datalist) {
                        PJ_anqgjcrkd ckd = new PJ_anqgjcrkd();

                        ConvertHelper.CopyTo<PJ_anqgjcrkd>(pc, ckd);
                        ckd.ID = ckd.CreateID();
                        //ckd.num = "JAQGJCK" + (num + 1);
                        ckd.num = clccktemp.num;
                        ckd.type = comboBoxEdit6.Text;
                        ckd.Remark = frm.ReturnData.Remark;
                        ckd.OrgName = frm.ReturnData.OrgName;
                        ckd.OrgCode = frm.ReturnData.OrgCode;
                        ckd.ckdate = DateTime.Now;
                        if (cktemp >= Convert.ToDouble(pc.kcsl)) {
                            ckd.cksl = pc.kcsl;
                            ckd.zkcsl = (zkc - Convert.ToDouble(pc.kcsl)).ToString();
                            cktemp = cktemp - Convert.ToDouble(pc.kcsl);
                            pc.kcsl = "0";
                            ClientHelper.PlatformSqlMap.Update<PJ_anqgjcrkd>(pc);
                        } else {
                            ckd.cksl = cktemp.ToString();
                            ckd.zkcsl = (zkc - cktemp).ToString();

                            pc.kcsl = (Convert.ToDouble(pc.kcsl) - cktemp).ToString();
                            cktemp = 0;
                            ClientHelper.PlatformSqlMap.Update<PJ_anqgjcrkd>(pc);
                        }
                        ckd.lyparent = pc.ID;
                        zkc = Convert.ToDouble(ckd.zkcsl);
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒

                        if (isWorkflowCall) {

                            MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + ckd.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() + "'");
                        }
                        ClientHelper.PlatformSqlMap.Create<PJ_anqgjcrkd>(ckd);
                        if (isWorkflowCall) {
                            WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                            mrwt.ModleRecordID = ckd.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 = ckd.GetType().ToString();
                            mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                            mrwt.CreatTime = DateTime.Now;
                            MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                        }
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        PJ_anqgjcrkd slkd = new PJ_anqgjcrkd();
                        //ConvertHelper.CopyTo<PJ_anqgjcrkd>(ckd, slkd);



                        slkd.ID = slkd.CreateID();
                        slkd.wpmc = ckd.wpmc;
                        slkd.wpgg = ckd.wpgg;
                        slkd.wpdw = ckd.wpdw;
                        slkd.wpdj = ckd.wpdj;
                        slkd.wpsl = ckd.cksl;
                        slkd.num = "SAQGJRK" + (snum);
                        slkd.type = "所安全工器具入库单";
                        slkd.lyparent = ckd.ID;
                        slkd.indate = ckd.ckdate;
                        slkd.OrgName = ckd.OrgName;
                        slkd.OrgCode = ckd.OrgCode;
                        slkd.ckdate = new DateTime(1900, 1, 1);
                        slkd.kcsl = ckd.cksl;
                        System.Collections.IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneInt",
                   "select sum(cast(kcsl as float))    from PJ_anqgjcrkd where (type = '所安全工器具入库单' or type = '所安全工器具入库单原始库存') and wpmc='" + slkd.wpmc + "' and wpgg='" + slkd.wpgg + "'  ");
                        if (mclist.Count > 0 && mclist[0] != null)
                            szkc = Convert.ToDouble(mclist[0]);
                        slkd.zkcsl = (szkc + Convert.ToDouble(slkd.kcsl)).ToString();
                        ClientHelper.PlatformSqlMap.Create<PJ_anqgjcrkd>(slkd);
                        if (cktemp < 1) break;
                        //num = (num + 1);

                    }
                    ucclck1.inidata();
                    simpleButton1_Click(sender, e);
                }
            }
        }