public void InitCol(string[] arrCol, LP_Temple lp) { m_ColName = arrCol; DataTable ds = new DataTable(); string[] arrColtype = lp.ComBoxItem.Split('|'); for (int i = 0; i < arrCol.Length; i++) { if (arrCol[i].ToString() == "") continue; if (arrColtype[i].IndexOf("RepositoryItemCalcEdit") > -1 || arrColtype[i].IndexOf("RepositoryItemSpinEdit") > -1) { ds.Columns.Add(arrCol[i], typeof(double)); } else if (arrColtype[i].IndexOf("RepositoryItemDateEdit") > -1) { ds.Columns.Add(arrCol[i], typeof(DateTime)); } else { ds.Columns.Add(arrCol[i], typeof(string)); } ds.Columns[i].Caption = arrCol[i]; } try { gridControl1.DataSource = ds; } catch (Exception err) { } DevExpress.XtraGrid.Views.Grid.GridView grid = gridView1; grid.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True; grid.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.True; grid.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom; grid.OptionsView.ShowGroupPanel = false; string[] comItem = SelectorHelper.ToDBC(lp.ComBoxItem).Split('|'); ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); for (int i = 0; i < grid.Columns.Count; i++) { if (grid.Columns[i].FieldName == "序号" || grid.Columns[i].FieldName == "月份" || grid.Columns[i].FieldName == "季度") { grid.Columns[i].MinWidth = 20; } Regex r1 = new Regex(@"(?<=" + i + ":).*?(?=])"); string strcom = r1.Match(comItem[i]).Value; if (strcom.IndexOf("RepositoryItemDateEdit") > -1) { r1 = new Regex(@"(?<=:).*"); DevExpress.XtraEditors.Repository.RepositoryItemDateEdit date = new DevExpress.XtraEditors.Repository.RepositoryItemDateEdit(); if (r1.Match(strcom).Value != "") { date.Properties.EditMask = r1.Match(strcom).Value; date.Mask.UseMaskAsDisplayFormat = true; if (r1.Match(strcom).Value.ToLower().IndexOf("hh") > -1) { date.VistaDisplayMode = DevExpress.Utils.DefaultBoolean.True; date.VistaEditTime = DevExpress.Utils.DefaultBoolean.True; } } grid.Columns[i].ColumnEdit = date; grid.Columns[i].DisplayFormat.FormatString = date.Properties.EditMask; grid.Columns[i].ColumnEdit.EditFormat.FormatString = date.Properties.EditMask; } else if (strcom.IndexOf("RepositoryItemCalcEdit") > -1) { r1 = new Regex(@"(?<=:).*"); DevExpress.XtraEditors.Repository.RepositoryItemCalcEdit date = new DevExpress.XtraEditors.Repository.RepositoryItemCalcEdit(); if (r1.Match(strcom).Value != "") date.Properties.EditMask = r1.Match(strcom).Value; grid.Columns[i].ColumnEdit = date; } else if (strcom.IndexOf("RepositoryItemSpinEdit") > -1) { r1 = new Regex(@"(?<=:).*"); DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit lue1 = new DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit(); ((System.ComponentModel.ISupportInitialize)(lue1)).BeginInit(); if (r1.Match(strcom).Value != "") { if (r1.Match(strcom).Value.IndexOf("p") > -1) { lue1.Increment = (decimal)0.0001; lue1.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; } else if (r1.Match(strcom).Value.IndexOf(".") > -1) { Regex r2 = new Regex(@"(?<=\.).*"); lue1.Increment = (decimal)Math.Pow(0.1, r2.Match(strcom).Value.Length / 2); lue1.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; } lue1.Name = ("lue1" + i.ToString()); lue1.Properties.EditMask = r1.Match(strcom).Value; lue1.DisplayFormat.FormatString = r1.Match(strcom).Value; lue1.Properties.DisplayFormat.FormatString = r1.Match(strcom).Value; lue1.EditMask = r1.Match(strcom).Value; } gridView1.Columns[i].ColumnEdit = lue1; //if (lue1.Properties.EditMask.IndexOf("p") > -1 || lue1.Properties.EditMask.IndexOf("%") > -1) { gridView1.Columns[i].DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; gridView1.Columns[i].DisplayFormat.FormatString = lue1.Properties.EditMask.ToString(); } ((System.ComponentModel.ISupportInitialize)(lue1)).EndInit(); } else if (strcom.IndexOf("RepositoryItemCheckedComboBoxEdit") > -1) { DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit lue1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit(); lue1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; grid.Columns[i].ColumnEdit = lue1; //colctrllist.Add(lue1); } else { DevExpress.XtraEditors.Repository.RepositoryItemComboBox lue1 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); lue1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; grid.Columns[i].ColumnEdit = lue1; colctrllist.Add(lue1); } } ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit(); gridView1.BestFitColumns(); }
public void InitIndex() { templeList = MainHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", "where ParentID!='0' and Kind='" + kind + "' Order by SortID"); IList<LP_Temple> parentlist = MainHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", "where ParentID='0' and Kind='" + kind + "'"); if (parentlist.Count > 0) parentTemple = parentlist[0]; // dsoFramerWordControl1. }
public void iniTableRecordData(string recordId, LP_Temple lp, string WorkflowId, string WorkFlowInsId) { if (lp != null) { DataTable ds = gridControl1.DataSource as DataTable; string[] arrCellpos = lp.CellPos.Split('|'); int i = 0; for (i = 0; ; i++) { IList<WF_TableFieldValue> tfvli; if (lp.ExtraWord == "横向") { string strtemp = " where RecordId='" + recordId + "' and FieldId='" + lp.LPID + "' and WorkflowId='" + WorkflowId + "' and YExcelPos='" + (GetCellPos(arrCellpos[0])[1] + i) + "' and WorkFlowInsId='" + WorkFlowInsId + "' order by XExcelPos,id "; tfvli = MainHelper.PlatformSqlMap.GetList<WF_TableFieldValue>("SelectWF_TableFieldValueList", strtemp ); } else { string strtemp = " where RecordId='" + recordId + "' and FieldId='" + lp.LPID + "' and WorkflowId='" + WorkflowId + "' and XExcelPos='" + (GetCellPos(arrCellpos[0])[0] + i) + "' and WorkFlowInsId='" + WorkFlowInsId + "' order by YExcelPos,id "; tfvli = MainHelper.PlatformSqlMap.GetList<WF_TableFieldValue>("SelectWF_TableFieldValueList", strtemp ); } if (tfvli.Count == 0) break; ds.Rows.Add(ds.NewRow()); foreach (WF_TableFieldValue tfv in tfvli) { Regex r2 = new Regex(@"(?<=-).*"); string strname = r2.Match(tfv.FieldName).Value; if (tfv.ControlValue.Trim() != "") ds.Rows[i][strname] = tfv.ControlValue; else { try { ds.Rows[i][strname] = ""; } catch { } } //gridView1.SetRowCellValue(i, strname, tfv.ControlValue); } } } }
void gridViewOperation_AfterAdd(LP_Temple e) { this.dsoFramerWordControl1.FileSave(); this.dsoFramerWordControl1.Refresh(); this.Refresh(); this.Update(); this.Hide(); Thread.Sleep(10); this.Show(); }
void gridViewOperation_AfterEdit(LP_Temple e) { //this.dsoFramerWordControl1.FileSave(); this.dsoFramerWordControl1.Refresh(); this.Refresh(); this.Update(); this.Hide(); this.Show(); }
void gridViewOperation_AfterDelete(LP_Temple obj) { string slqwhere = " where ParentID='" + obj.ParentID + "' "; slqwhere = slqwhere + " order by SortID"; IList<LP_Temple> li = MainHelper.PlatformSqlMap.GetListByWhere<LP_Temple>(slqwhere); int i = 1; List<LP_Temple> list = new List<LP_Temple>(); foreach (LP_Temple ob in li) { ob.SortID= i; if (ob.SignImg == null) { ob.SignImg = new byte[0]; } if (ob.ImageAttachment == null) { ob.ImageAttachment = new byte[0]; } if (ob.DocContent == null) { ob.DocContent = new byte[0]; } i++; list.Add(ob); } List<SqlQueryObject> list3 = new List<SqlQueryObject>(); if (list.Count > 0) { SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Update, list.ToArray()); list3.Add(obj3); } MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3); inidata(); }
public void ExportExcelSubmit(ref LP_Temple parentTemple, string orgid, bool isShow) { DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl(); string fname = Application.StartupPath + "\\00记录模板\\设备标志缺失变更明细表三.xls"; dsoFramerWordControl1.FileOpen(fname); if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent; ExcelAccess ex = new ExcelAccess(); Microsoft.Office.Interop.Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook; ex.MyWorkBook = wb; ex.MyExcel = wb.Application; string filter = ""; 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 ); ExportExcel(ex, datalist, orgid); //ex.ActiveSheet(1); //ex.DeleteWorkSheet(1); //Excel.Worksheet sheet; //for (int i = 1; i <= wb.Application.Sheets.Count; i++) //{ // sheet = wb.Application.Sheets[i] as Excel.Worksheet; // sheet.Cells.Clear(); // sheet.Cells.ClearContents(); // sheet.Cells.ClearOutline(); // sheet.Visible = Excel.XlSheetVisibility.xlSheetHidden; // dsoFramerWordControl1.FileSave(); // break; //} if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } dsoFramerWordControl1.FileSave(); parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); }
private void LPFrm_Load(object sender, EventArgs e) { if (tempCtrlList == null) { tempCtrlList = new List<Control>(); } this.Text = "20低压线路完好率及台区网络图"; //InitializeComponent(); if (valuehs == null) valuehs = new Hashtable(); ExcelAccess ea = new ExcelAccess(); WF_TableFieldValue wfv = null; parentTemple = MainHelper.PlatformSqlMap.GetOne<LP_Temple>(" where ( ParentID not in (select LPID from LP_Temple where 1=1 and CtrlSize!='目录') and CtrlSize!='目录' ) and CellName like '%低压线路完好率及台区网络图%'"); LP_Temple lp = MainHelper.PlatformSqlMap.GetOne<LP_Temple>(" where ParentID='" + parentTemple.LPID + "' and SortID=1"); currRecord = rowData; if (lp != null) { if (wfv == null) { wfv = new WF_TableFieldValue(); wfv.ID = wfv.CreateID(); wfv.RecordId = currRecord.ID; wfv.WorkFlowId = currRecord.tqCode; wfv.WorkFlowInsId = currRecord.tqName; wfv.WorkTaskId = "20低压设备完好率及台区网络图"; wfv.WorkTaskInsId = "20低压设备完好率及台区网络图"; wfv.UserControlId = parentTemple.LPID; wfv.ControlValue = ""; wfv.FieldId = lp.LPID; wfv.FieldName = lp.CellName; wfv.XExcelPos = GetCellPos(lp.CellPos)[0]; wfv.YExcelPos = GetCellPos(lp.CellPos)[1]; } wfv = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(" where UserControlId='" + parentTemple.LPID + "'" + " and WorkflowId='" + wfv.WorkFlowId + "'" + " and RecordId='" + wfv.RecordId + "'" + " and UserControlId='" + wfv.UserControlId + "'" + " and WorkFlowInsId='" + wfv.WorkFlowInsId + "'" + " and fieldname='" + lp.CellName + "'" + " and FieldId='" + lp.LPID + "' and Bigdata is not null" ); } if (parentTemple == null) { MsgBox.ShowWarningMessageBox("没有找到表单20低压线路完好率及台区网络图!"); return; } //if (currRecord.BigData == null || currRecord.BigData.Length == 0) { if (status != "edit" || wfv == null || wfv.Bigdata == null || wfv.Bigdata.Length == 0) { this.dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent; } else { this.dsoFramerWordControl1.FileDataGzip = wfv.Bigdata; } } //else //{ // this.dsoFramerWordControl1.FileDataGzip = currRecord.BigData; //} wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; xx = wb.ActiveSheet as Excel.Worksheet; sheet = xx; activeSheetName = xx.Name; InitIndex(); InitContorl(); InitData(); if (status == "edit") { IList<WF_TableFieldValue> tfvli = MainHelper.PlatformSqlMap.GetList<WF_TableFieldValue>("SelectWF_TableFieldValueList", " where RecordId='" + currRecord.ID + "' and UserControlId='" + parentTemple.LPID + "' and WorkflowId='" + currRecord.tqCode + "' and WorkFlowInsId='" + currRecord.tqName + "' "); //wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; //ea.MyWorkBook = wb; //ea.MyExcel = wb.Application; //xx = wb.Application.Sheets[1] as Excel.Worksheet; int i = 0; for (i = 0; i < tfvli.Count; i++) { Control ctl = FindCtrl(tfvli[i].FieldId); if (ctl != null) { //ctl.Text = tfvli[i].ControlValue; //ctl.Focus(); lp = ctl.Tag as LP_Temple; if (lp.CtrlType.Contains("DevExpress.XtraEditors.DateEdit") == false) { if (lp.CellName != "编号" && lp.CellName.IndexOf("低压线路") == -1 && lp.CellName.IndexOf("最大供电半径") == -1 && lp.CellName.IndexOf("低压杆基数") == -1 && lp.CellName.IndexOf("表箱数") == -1 && lp.CellName.IndexOf("四线的一类") == -1 && lp.CellName.IndexOf("四线的二类") == -1 && lp.CellName.IndexOf("四线的三类") == -1 && lp.CellName.IndexOf("二线的一类") == -1 && lp.CellName.IndexOf("二线的二类") == -1 && lp.CellName.IndexOf("二线的三类") == -1 ) { if (ctl.Text.IndexOf(tfvli[i].ControlValue) == -1) ctl.Text += tfvli[i].ControlValue; } else { ctl.Text = tfvli[i].ControlValue; } ctl.Focus(); } else { IList<WF_TableFieldValue> tfvlitemp = MainHelper.PlatformSqlMap.GetList<WF_TableFieldValue>("SelectWF_TableFieldValueList", " where RecordId='" + currRecord.ID + "' and UserControlId='" + parentTemple.LPID + "' and FieldId='" + tfvli[i].FieldId.ToString() + "' and FieldName='" + tfvli[i].FieldName + "完整时间' order by id desc, YExcelPos,XExcelPos"); if (tfvlitemp.Count > 0) { ((DevExpress.XtraEditors.DateEdit)ctl).DateTime = Convert.ToDateTime(tfvlitemp[0].ControlValue); } //((DevExpress.XtraEditors.DateEdit)ctl).DateTime = Convert.ToDateTime(tfvli[i].ControlValue); } } } dsoFramerWordControl1.FileSave(); } }
public void FillMutilRows(ExcelAccess ea, int i, LP_Temple lp, string str, List<int> arrCellCount, string[] arrCellPos) { StringHelper help = new StringHelper(); str = help.GetPlitString(str, arrCellCount[1]); string[] extraWord = lp.ExtraWord.Split(pchar); string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); int j = 0; for (; i < arrCellPos.Length; i++) { if (j >= arrRst.Length) break; ea.SetCellValue("'" + arrRst[j], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = arrRst[j]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = arrRst[j]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); } j++; } }
public void ExportExcelSubmit(ref LP_Temple parentTemple, string orgid, string strProject, string strfenProject, bool isShow) { DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl(); string fname = Application.StartupPath + "\\00记录模板\\出库单.xls"; dsoFramerWordControl1.FileOpen(fname); if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent; ExcelAccess ex = new ExcelAccess(); Microsoft.Office.Interop.Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook; ex.MyWorkBook = wb; ex.MyExcel = wb.Application; string strfirst = ""; string filter = ""; 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 ); ExportExcel(ex, datalist); } } } //ex.ActiveSheet(1); //ex.DeleteWorkSheet(1); Excel.Worksheet sheet; for (int i = 1; i <= wb.Application.Sheets.Count; i++) { sheet = wb.Application.Sheets[i] as Excel.Worksheet; sheet.Cells.Clear(); sheet.Cells.ClearContents(); sheet.Cells.ClearOutline(); sheet.Visible = Excel.XlSheetVisibility.xlSheetHidden; dsoFramerWordControl1.FileSave(); break; } if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } dsoFramerWordControl1.FileSave(); parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileClose(); }
public void ExportExcelSubmit(ref LP_Temple parentTemple, string orgid, bool isShow) { }
public void FillTime(ExcelAccess ea, LP_Temple lp, DateTime dt) { string[] arrCellPos = lp.CellPos.Split(pchar); arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split(pchar); string[] extraWord = lp.ExtraWord.Split(pchar); IList<string> strList = new List<string>(); //if (arrCellPos.Length == 5) //{ // strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); // strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 4) //{ // strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 3) //{ // // strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); // //strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); // strList.Add(dt.Year.ToString()); // strList.Add(dt.Month.ToString()); // strList.Add(dt.Day.ToString()); //} //else if (arrCellPos.Length == 2) //{ // strList.Add(dt.Hour.ToString()); // strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 1) //{ // strList.Add(dt.ToString()); //} switch (lp.WordCount) { case "yyyy-MM-dd": strList.Add(dt.Year.ToString()); strList.Add(string.Format("{0:D2}", dt.Month)); strList.Add(string.Format("{0:D2}", dt.Day)); break; case "yyyy-MM-dd HH:mm:ss": strList.Add(dt.Year.ToString()); strList.Add(string.Format("{0:D2}", dt.Month)); strList.Add(string.Format("{0:D2}", dt.Day)); strList.Add(string.Format("{0:D2}", dt.Hour)); strList.Add(string.Format("{0:D2}", dt.Minute)); strList.Add(string.Format("{0:D2}", dt.Second)); break; case "HH:mm:ss": strList.Add(dt.Hour.ToString()); strList.Add(string.Format("{0:D2}", dt.Minute)); strList.Add(string.Format("{0:D2}", dt.Second)); break; case "MM-dd日 HH:mm": strList.Add(string.Format("{0:D2}", dt.Month)); strList.Add(string.Format("{0:D2}", dt.Day)); strList.Add(string.Format("{0:D2}", dt.Hour)); strList.Add(string.Format("{0:D2}", dt.Minute)); break; case "dd日 HH:mm": strList.Add(string.Format("{0:D2}", dt.Day)); strList.Add(string.Format("{0:D2}", dt.Hour)); strList.Add(string.Format("{0:D2}", dt.Minute)); break; case "HH:mm": strList.Add(string.Format("{0:D2}", dt.Hour)); strList.Add(string.Format("{0:D2}", dt.Minute)); break; default: if (lp.WordCount.IndexOf("yyyy") > -1) { if (lp.WordCount.IndexOf("yyyy年") > -1) strList.Add(dt.Year.ToString() + "年"); else strList.Add(dt.Year.ToString()); } if (lp.WordCount.IndexOf("MM") > -1) { if (lp.WordCount.IndexOf("MM月") > -1) strList.Add(string.Format("{0:D2}", dt.Month) + "月"); else strList.Add(string.Format("{0:D2}", dt.Month)); } if (lp.WordCount.IndexOf("dd") > -1) { if (lp.WordCount.IndexOf("dd日") > -1) strList.Add(string.Format("{0:D2}", dt.Day) + "日"); else strList.Add(string.Format("{0:D2}", dt.Day)); } if (lp.WordCount.IndexOf("HH") > -1) { if (lp.WordCount.IndexOf("HH时") > -1) strList.Add(string.Format("{0:D2}", dt.Hour) + "时"); else strList.Add(string.Format("{0:D2}", dt.Hour)); } if (lp.WordCount.IndexOf("mm") > -1) { if (lp.WordCount.IndexOf("mm分") > -1) strList.Add(string.Format("{0:D2}", dt.Minute) + "分"); else strList.Add(string.Format("{0:D2}", dt.Minute)); } if (lp.WordCount.IndexOf("ss") > -1) { if (lp.WordCount.IndexOf("ss秒") > -1) strList.Add(string.Format("{0:D2}", dt.Second) + "秒"); else strList.Add(string.Format("{0:D2}", dt.Second)); } break; } // int i = 0; string value = lp.ExtraWord; for (int i = 0; i < strList.Count; i++) { //if (extraWord.Length > i) //{ // ea.SetCellValue(strList[i] + extraWord[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); // if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) // { // WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; // tfv.ControlValue = strList[i] + extraWord[i]; // tfv.FieldId = lp.LPID; // tfv.FieldName = lp.CellName; // tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; // tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; // tfv.ExcelSheetName = activeSheetName; // } // else // { // WF_TableFieldValue tfv = new WF_TableFieldValue(); // tfv.ControlValue = strList[i] + extraWord[i]; // tfv.FieldId = lp.LPID; // tfv.FieldName = lp.CellName; // tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; // tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; // tfv.ExcelSheetName = activeSheetName; // valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); // } //} //else //{ // ea.SetCellValue(strList[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); // if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) // { // WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; // tfv.ControlValue = strList[i]; // tfv.FieldId = lp.LPID; // tfv.FieldName = lp.CellName; // tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; // tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; // tfv.ExcelSheetName = activeSheetName; // } // else // { // WF_TableFieldValue tfv = new WF_TableFieldValue(); // tfv.ControlValue = strList[i]; // tfv.FieldId = lp.LPID; // tfv.FieldName = lp.CellName; // tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; // tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; // tfv.ExcelSheetName = activeSheetName; // valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); // } //} if (lp.ExtraWord == "") { if (arrCellPos.Length > 1) { if (dt.ToString("yyyyMMdd") == "00010101") { strList[i] = " "; } try { if (lp.isExplorer != 1) ea.SetCellValue("'" + strList[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = strList[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; tfv = valuehs[lp.LPID + "$" + arrCellPos[i] + "时间"] as WF_TableFieldValue; if (tfv != null) { tfv.ControlValue = dt.ToString(); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; } } else { if (dt.ToString("yyyyMMdd") == "00010101") { strList[i] = " "; } WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = strList[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); tfv = new WF_TableFieldValue(); tfv.FieldId = lp.LPID; tfv.ControlValue = dt.ToString(); tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i] + "完整时间", tfv); } } else { if (dt.ToString("yyyyMMdd") == "00010101") { //for (int item = 0; i < strList.Count; i++) if (strList[i].IndexOf("年") > -1) strList[i] = "年"; else if (strList[i].IndexOf("月") > -1) strList[i] = " 月"; else if (strList[i].IndexOf("日") > -1) strList[i] = " 日"; else if (strList[i].IndexOf("时") > -1) strList[i] = " 时"; else if (strList[i].IndexOf("分") > -1) strList[i] = " 分"; } value += strList[i]; if (strList.Count == i + 1) { try { if (lp.isExplorer != 1) ea.SetCellValue("'" + value, GetCellPos(arrCellPos[0])[0], GetCellPos(arrCellPos[0])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[0])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[0]] as WF_TableFieldValue; tfv.ControlValue = value; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[0])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[0])[1]; tfv.ExcelSheetName = activeSheetName; tfv = valuehs[lp.LPID + "$" + arrCellPos[0] + "时间"] as WF_TableFieldValue; if (tfv != null) { tfv.ControlValue = dt.ToString(); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; } } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = value; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[0])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[0])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0], tfv); tfv = new WF_TableFieldValue(); tfv.FieldId = lp.LPID; tfv.ControlValue = dt.ToString(); tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0] + "完整时间", tfv); } } } } else { if (dt.ToString("yyyyMMdd") == "00010101") { strList[i] = " "; } if (lp.ExtraWord.IndexOf("|") == -1) { value = value.Replace("{" + i + "}", strList[i]); if (i == strList.Count - 1) { try { if (lp.isExplorer != 1) ea.SetCellValue("'" + value, GetCellPos(arrCellPos[0])[0], GetCellPos(arrCellPos[0])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[0])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[0]] as WF_TableFieldValue; tfv.ControlValue = value; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[0])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[0])[1]; tfv.ExcelSheetName = activeSheetName; tfv = valuehs[lp.LPID + "$" + arrCellPos[0] + "时间"] as WF_TableFieldValue; if (tfv != null) { tfv.ControlValue = dt.ToString(); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; } } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = value; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[0])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[0])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0], tfv); tfv = new WF_TableFieldValue(); tfv.FieldId = lp.LPID; tfv.ControlValue = dt.ToString(); tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0] + "完整时间", tfv); } } } else { if (dt.ToString("yyyyMMdd") == "00010101") { strList[i] = " "; } string[] strextrlist = lp.ExtraWord.Split('|'); value = strList[i]; if (strextrlist.Length > i) value += strextrlist[i]; try { if (lp.isExplorer != 1) ea.SetCellValue("'" + value, GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[0])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[0]] as WF_TableFieldValue; tfv.ControlValue = value; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[0])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[0])[1]; tfv.ExcelSheetName = activeSheetName; tfv = valuehs[lp.LPID + "$" + arrCellPos[0] + "时间"] as WF_TableFieldValue; if (tfv != null) { tfv.ControlValue = dt.ToString(); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; } } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = value; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[0])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[0])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0], tfv); tfv = new WF_TableFieldValue(); tfv.FieldId = lp.LPID; tfv.ControlValue = dt.ToString(); tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0] + "完整时间", tfv); } } //ea.SetCellValue(strList[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } } //foreach (string str in strList) //{ // ea.SetCellValue(str, GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); // i++; //} }
public void FillMutilRows(ExcelAccess ea, int i, LP_Temple lp, string str, List<int> arrCellCount, string[] arrCellPos) { StringHelper help = new StringHelper(); string[] extraWord = lp.ExtraWord.Split(pchar); if (lp.CtrlType.IndexOf("uc_gridcontrol") > -1) { str = help.GetPlitString(str, arrCellCount[1]); string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); int j = 0; for (; i < arrCellPos.Length; i++) { if (j >= arrRst.Length) break; try { if (lp.isExplorer != 1) ea.SetCellValue(arrRst[j], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = arrRst[j]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = arrRst[j]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); } j++; } } else { string strarrRst = str; int i1 = strarrRst.IndexOf("\r\n"); for (; i < arrCellPos.Length; i++) { i1 = strarrRst.IndexOf("\r\n"); if (i1 > help.GetFristLen(strarrRst, arrCellCount[i])) i1 = help.GetFristLen(strarrRst, arrCellCount[i]); if (i1 == 0) { strarrRst = strarrRst.Substring(2); i1 = strarrRst.IndexOf("\r\n"); if (i1 > help.GetFristLen(strarrRst, arrCellCount[i])) i1 = help.GetFristLen(strarrRst, arrCellCount[i]); } if (i1 == -1) i1 = help.GetFristLen(str, arrCellCount[i]); if (strarrRst.Length > i1 + 1 && (strarrRst.Substring(i1, 1) == "," || strarrRst.Substring(i1, 1) == "。" || strarrRst.Substring(i1 + 1, 1) == "、" || strarrRst.Substring(i1 + 1, 1) == ":" || strarrRst.Substring(i1 + 1, 1) == "!")) { i1 = i1 + 1; } //if (strarrRst.Length <= help.GetFristLen(str, arrCellCount[i])) //{ // try // { // if (lp.isExplorer != 1) ea.SetCellValue(strarrRst, GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); // } // catch { } // if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) // { // WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; // tfv.ControlValue = strarrRst; // tfv.FieldId = lp.LPID; // tfv.FieldName = lp.CellName; // tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; // tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; // tfv.ExcelSheetName = activeSheetName; // } // else // { // WF_TableFieldValue tfv = new WF_TableFieldValue(); // tfv.ControlValue = strarrRst; // tfv.FieldId = lp.LPID; // tfv.FieldName = lp.CellName; // tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; // tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; // tfv.ExcelSheetName = activeSheetName; // valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); // } // break; //} //else { if (strarrRst.Length >= i1) { try { if (lp.isExplorer != 1) if (lp.isExplorer != 1) ea.SetCellValue(strarrRst.Substring(0, i1), GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = strarrRst.Substring(0, i1); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = strarrRst.Substring(0, i1); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); } strarrRst = strarrRst.Substring(i1); } else { try { if (lp.isExplorer != 1) if (lp.isExplorer != 1) ea.SetCellValue(strarrRst, GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } catch { } if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = strarrRst; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = strarrRst; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); } strarrRst = ""; } //i++; //strarrRst = help.GetPlitString(strarrRst, arrCellCount[i]); } } } }
public static IList GetTaskCtrlData2(LP_Record record, LP_Temple lp, string sqlSentence, WF_WorkTastTrans wtt) { //LP_Temple lp =null ; string ctrltype = ""; //if (lp.CtrlType.IndexOf(',') == -1) // ctrltype = lp.CtrlType; //else // ctrltype = lp.CtrlType.Substring(0, lp.CtrlType.IndexOf(',')); /* * * SELECT cellname, SqlSentence,SqlColName FROM LP_Temple where SqlSentence !='' * * */ IList li = new ArrayList(); if (sqlSentence.IndexOf("Excel:") == 0) { //int index1 = sqlSentence.LastIndexOf(":"); //string tablename = sqlSentence.Substring(6, index1 - 6); //string cellpos = sqlSentence.Substring(index1 + 1); //string[] arrCellPos = cellpos.Split('|'); //arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|'); //string strcellvalue = ""; //Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; //ExcelAccess ea = new ExcelAccess(); //ea.MyWorkBook = wb; //ea.MyExcel = wb.Application; //Excel.Worksheet sheet; //sheet = wb.Application.Sheets[tablename] as Excel.Worksheet; //for (int i = 0; i < arrCellPos.Length; i++) { // Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标 // strcellvalue += range.Value2; //} //li.Add(strcellvalue); } else if (sqlSentence != "") { if (sqlSentence.IndexOf("{recordparentid}") > -1) { sqlSentence = sqlSentence.Replace("{recordparentid}", record.ParentID); } if (sqlSentence.IndexOf("{recordid}") > -1) { sqlSentence = sqlSentence.Replace("{recordid}", record.ID); } if (sqlSentence.IndexOf("{orgcode}") > -1) { sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode); } if (sqlSentence.IndexOf("{userid}") > -1) { sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID); } if (sqlSentence.IndexOf("{orgname}") > -1) { sqlSentence = sqlSentence.Replace("{orgname}", MainHelper.User.OrgName); } if (sqlSentence.IndexOf("{username}") > -1) { sqlSentence = sqlSentence.Replace("{username}", MainHelper.User.UserName); } Regex r1 = new Regex(@"(?<={)[0-9]+(?=})"); while (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { //Control ct = FindCtrl(listLPID[0].LPID); //if (ct != null) { // if (ct is DateEdit) { // ((DateEdit)ct).Properties.EditMask = listLPID[0].WordCount; // ((DateEdit)ct).Properties.DisplayFormat.FormatString = listLPID[0].WordCount; // } // sqlSentence = sqlSentence.Replace("{" + sortid + "}", ct.Text); //} else { string strSQL = "select ControlValue from WF_TableFieldValueView where" + " UserControlId='" + listLPID[0].ParentID + "' " + "and FieldId='" + listLPID[0].LPID + "' and ID='" + record.ID + "'"; li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", strSQL); if (li.Count > 0) { sqlSentence = sqlSentence.Replace("{" + sortid + "}", li[0].ToString()); } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } //} } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } //r1 = new Regex(@"(?<={编号规则一:)[0-9]+(?=})"); //if (r1.Match(sqlSentence).Value != "") { // string sortid = r1.Match(sqlSentence).Value; // IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); // if (listLPID.Count > 0) { // Control ct = FindCtrl(listLPID[0].LPID); // if (ct != null) { // IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("SelectmOrgList", // "where OrgName='" + ct.Text + "'"); // if (list.Count > 0) // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", RecordWorkTask.CreatWorkFolwNo(list[0], listLPID[0].ParentID, "编号规则一")); // else // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", ""); // } else { // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); // } // } else { // sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); // } //} try { sqlSentence = sqlSentence.Replace("\r\n", " "); if (sqlSentence.IndexOf("where 9=9") > -1) { string strtemp = li[0].ToString(); li.Clear(); r1 = new Regex(@"[0-9]+\+[0-9]+"); if (r1.Match(strtemp).Value != "") { int istart = 1; int ilen = 10; r1 = new Regex(@"[0-9]+(?=\+)"); if (r1.Match(strtemp).Value != "") { istart = Convert.ToInt32(r1.Match(strtemp).Value); } r1 = new Regex(@"(?<=\+)[0-9]+"); if (r1.Match(strtemp).Value != "") { ilen = Convert.ToInt32(r1.Match(strtemp).Value); ; } for (int i = istart; i <= ilen; i++) { li.Add(string.Format("{0}", i)); } } else { string[] strli = SelectorHelper.ToDBC(strtemp).Split(','); foreach (string ss in strli) { li.Add(ss); } } } else { IList ht = Client.ClientHelper.PlatformSqlMap.GetList("Select", sqlSentence); if (ht.Count > 0) { DataTable dt = ConvertHelper.ToDataTable(ht); li.Add(dt.Rows[0][0]); } } } catch (Exception ex) { li.Add("出错:" + ex.Message); } } return li; }
public static Dictionary<string, object> ReadTaskData(DataTable workflowdata, LP_Temple temp, LP_Record record) { Dictionary<string, object> dic = new Dictionary<string, object>(); IList<WF_WorkTastTrans> wttli = MainHelper.PlatformSqlMap.GetList<WF_WorkTastTrans>(" where WorkFlowId='" + workflowdata.Rows[0]["WorkFlowId"].ToString() + "' AND tlcjdid='" + workflowdata.Rows[0]["WorkTaskId"].ToString() + "' and tlcjdzdlx = '模块'"); foreach (WF_WorkTastTrans wtt in wttli) { IList list = GetTaskCtrlData2(record, temp, wtt.sSQL, wtt); if (list.Count > 0) dic.Add(wtt.tlcjdzdid, list[0]); } return dic; }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(LP_Temple newobj) { //newobj.OrgCode = parentID; //newobj.OrgName = parentObj.OrgName; //newobj.Valid = true; newobj.ParentID = parentID; newobj.Kind = ParentObj.Kind; byte[] bt = new byte[0]; newobj.DocContent = bt; newobj.ImageAttachment = bt; newobj.SignImg = bt; }
void gridViewOperation_AfterAdd(LP_Temple obj) { parentID = ParentObj.LPID; }
/// <summary> /// 获得任务节点绑定的表单 /// </summary> /// <param name="workflowId">任务模板Id</param> /// <returns></returns> public static DataTable GetTaskControls(string workTaskId) { try { string sqlStr = " where WorkTaskId ='" + workTaskId + "' and ControlType = '表单' "; IList li = MainHelper.PlatformSqlMap.GetList("SelectWF_WorkTaskControlsList", sqlStr); if (li.Count == 0 || ((WF_WorkTaskControls)li[0]).UserControlId == "") { DataTable dt = new DataTable(); return dt; } else { if (((WF_WorkTaskControls)li[0]).UserControlId != "节点审核") { sqlStr = " where LPID ='" + ((WF_WorkTaskControls)li[0]).UserControlId + "'"; li = MainHelper.PlatformSqlMap.GetList("SelectLP_TempleList", sqlStr); } else { li.Clear(); LP_Temple lp = new LP_Temple(); lp.LPID = "节点审核"; lp.CellName = "节点提交"; li.Add(lp); } } if (li.Count == 0 ) { DataTable dt = new DataTable(); return dt; } return ConvertHelper.ToDataTable(li); } catch (Exception ex) { throw ex; } }
public void InitCtrlData2(RepositoryItemCheckedComboBoxEdit combox, int index, LP_Temple lp, string sqlSentence, DSOFramerControl dsoFramerWordControl1, LP_Record currRecord) { string ctrltype = ""; if (lp.CtrlType.IndexOf(',') == -1) ctrltype = lp.CtrlType; else ctrltype = lp.CtrlType.Substring(0, lp.CtrlType.IndexOf(',')); /* * * SELECT cellname, SqlSentence,SqlColName FROM LP_Temple where SqlSentence !='' * * */ IList li = new ArrayList(); if (sqlSentence.IndexOf("Excel:") == 0) { int index1 = sqlSentence.LastIndexOf(":"); string tablename = sqlSentence.Substring(6, index1 - 6); string cellpos = sqlSentence.Substring(index1 + 1); string[] arrCellPos = cellpos.Split('|'); arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|'); string strcellvalue = ""; Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; ExcelAccess ea = new ExcelAccess(); ea.MyWorkBook = wb; ea.MyExcel = wb.Application; Excel.Worksheet sheet; sheet = wb.Application.Sheets[tablename] as Excel.Worksheet; for (int i = 0; i < arrCellPos.Length; i++) { Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标 strcellvalue += range.Value2; } li.Add(strcellvalue); } else if (sqlSentence != "") { if (sqlSentence.IndexOf("{recordid}") > -1) { sqlSentence = sqlSentence.Replace("{recordid}", currRecord.ID); } if (sqlSentence.IndexOf("{orgcode}") > -1) { sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode); } if (sqlSentence.IndexOf("{userid}") > -1) { sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID); } Regex r1 = new Regex(@"(?<={)[0-9]+(?=})"); while (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { string strSQL = "select ControlValue from WF_TableFieldValueView where" + " UserControlId='" + listLPID[0].ParentID + "' " + "and FieldId='" + listLPID[0].LPID + "' and ID='" + currRecord.ID + "'"; li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", strSQL); if (li.Count > 0) { sqlSentence = sqlSentence.Replace("{" + sortid + "}", li[0].ToString()); } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } r1 = new Regex(@"(?<={编号规则一:)[0-9]+(?=})"); if (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); } else { sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); } } sqlSentence = sqlSentence.Replace("\r\n", ""); try { li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", sqlSentence); } catch (Exception ex) { li.Add(sqlSentence + "出错:" + ex.Message); } if (sqlSentence.IndexOf("where 9=9") == -1) { foreach (string strname in li) { combox.Items.Add(strname); } } else { switch (li[0].ToString()) { case "{年}": combox.Items.Clear(); for (int j = 0; j <= 20; j++) { combox.Items.Add(string.Format("{0}", j + DateTime.Now.Year)); } break; case "{月}": combox.Items.Clear(); for (int j = 1; j <= 12; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{日}": combox.Items.Clear(); for (int j = 1; j <= 31; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{时}": combox.Items.Clear(); for (int j = 1; j <= 24; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{分}": case "{秒}": combox.Items.Clear(); for (int j = 0; j <= 59; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; default: string strexpress = li[0].ToString(); r1 = new Regex(@"[0-9]+\+[0-9]+"); if (r1.Match(strexpress).Value != "") { int istart = 1; int ilen = 10; r1 = new Regex(@"[0-9]+(?=\+)"); if (r1.Match(strexpress).Value != "") { istart = Convert.ToInt32(r1.Match(strexpress).Value); } r1 = new Regex(@"(?<=\+)[0-9]+"); if (r1.Match(strexpress).Value != "") { ilen = Convert.ToInt32(r1.Match(strexpress).Value); ; } for (int i = istart; i <= ilen; i++) { combox.Items.Add(string.Format("{0}", i)); } } else { string[] strItem = SelectorHelper.ToDBC(strexpress).Split(','); for (int i = 0; i < strItem.Length; i++) { combox.Items.Add(strItem[i]); } } break; } } } }
public void FillMutilRows(ExcelAccess ea, int i, LP_Temple lp, string str, List<int> arrCellCount, string[] arrCellPos) { StringHelper help = new StringHelper(); str = help.GetPlitString(str, arrCellCount[1]); string[] extraWord = lp.ExtraWord.Split(pchar); string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); int j = 0; for (; i < arrCellPos.Length; i++) { if (j >= arrRst.Length) break; ea.SetCellValue(arrRst[j], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); j++; } }
public void InitData(string sql, string[] sqlColName, string[] comBoxItem, DSOFramerControl dsoFramerWordControl1, LP_Temple lp, LP_Record currRecord) { //foreach (DevExpress.XtraEditors.Repository.RepositoryItemComboBox combox in colctrllist) for (int i = 0; i < gridView1.Columns.Count; i++) { if (gridView1.Columns[i].ColumnEdit is RepositoryItemComboBox) { RepositoryItemComboBox combox = gridView1.Columns[i].ColumnEdit as RepositoryItemComboBox; combox.Items.Clear(); Regex r1 = new Regex(@"(?<=\[" + i + ":).*?(?=\\])"); string sqlSentence = ""; if (r1.Match(sql).Value != "") { sqlSentence = r1.Match(sql).Value; } if (sqlSentence != "") InitCtrlData(combox, i, lp, sqlSentence, dsoFramerWordControl1, currRecord); } else if (gridView1.Columns[i].ColumnEdit is RepositoryItemCheckedComboBoxEdit) { RepositoryItemCheckedComboBoxEdit combox = gridView1.Columns[i].ColumnEdit as RepositoryItemCheckedComboBoxEdit; combox.Items.Clear(); Regex r1 = new Regex(@"(?<=\[" + i + ":).*?(?=\\])"); string sqlSentence = ""; if (r1.Match(sql).Value != "") { sqlSentence = r1.Match(sql).Value; } if (sqlSentence != "") InitCtrlData2(combox, i, lp, sqlSentence, dsoFramerWordControl1, currRecord); } } }
public void FillTime(ExcelAccess ea, LP_Temple lp,DateTime dt) { string[] arrCellPos = lp.CellPos.Split(pchar); arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split(pchar); string[] extraWord = lp.ExtraWord.Split(pchar); IList<string> strList=new List<string>(); //if (arrCellPos.Length == 5) //{ // strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); // strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 4) //{ // strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 3) //{ // // strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); // //strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); // strList.Add(dt.Year.ToString()); // strList.Add(dt.Month.ToString()); // strList.Add(dt.Day.ToString()); //} //else if (arrCellPos.Length == 2) //{ // strList.Add(dt.Hour.ToString()); // strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 1) //{ // strList.Add(dt.ToString()); //} switch (lp.WordCount) { case "yyyy-MM-dd": strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); break; case "MM-dd日": strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); break; case "yyyy-MM-dd HH:mm:ss": strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Second.ToString()); break; case "HH:mm:ss": strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); strList.Add(dt.Second.ToString()); break; case "MM-dd日 HH:mm": strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; case "dd日 HH:mm": strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; case "HH:mm": strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; default: strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; } // int i = 0; for (int i = 0; i < strList.Count;i++ ) { if (extraWord.Length>i) { ea.SetCellValue(strList[i] + extraWord[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } else { ea.SetCellValue(strList[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); } } //foreach (string str in strList) //{ // ea.SetCellValue(str, GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); // i++; //} }
public void FillTable(ExcelAccess ea, LP_Temple lp, string[] content) { string[] arrCol = lp.CellPos.Split(pchar); arrCol = StringHelper.ReplaceEmpty(arrCol).Split(pchar); string[] arrtemp = lp.WordCount.Split(pchar); arrtemp = StringHelper.ReplaceEmpty(arrtemp).Split(pchar); string[] coltemp = lp.ColumnName.Split(pchar); arrtemp = StringHelper.ReplaceEmpty(arrtemp).Split(pchar); List<int> arrCellCount = String2Int(arrtemp); for (int i = 0; i < arrCol.Length; i++) { if (string.IsNullOrEmpty(arrCol[i])) { continue; } if (content.Length > i && content[i] != null) FillMutilRowsT(ea, lp, content[i], arrCellCount[i], arrCol[i], coltemp[i]); } }
public void FillMutilRowsT(ExcelAccess ea, LP_Temple lp, string str, int cellcount, string arrCellPos) { StringHelper help = new StringHelper(); //str = help.GetPlitString(str, cellcount); string[] arrRst = str.Split(new string[] { "\r\n" },StringSplitOptions.None); for (int i=0; i < arrRst.Length; i++) { ea.SetCellValue(arrRst[i], GetCellPos(arrCellPos)[0] + i, GetCellPos(arrCellPos)[1]); } }
public void FillTime(ExcelAccess ea, LP_Temple lp, DateTime dt) { string[] arrCellPos = lp.CellPos.Split(pchar); arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split(pchar); string[] extraWord = lp.ExtraWord.Split(pchar); IList<string> strList = new List<string>(); //if (arrCellPos.Length == 5) //{ // strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); // strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 4) //{ // strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 3) //{ // // strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); // //strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); // strList.Add(dt.Year.ToString()); // strList.Add(dt.Month.ToString()); // strList.Add(dt.Day.ToString()); //} //else if (arrCellPos.Length == 2) //{ // strList.Add(dt.Hour.ToString()); // strList.Add(dt.Minute.ToString()); //} //else if (arrCellPos.Length == 1) //{ // strList.Add(dt.ToString()); //} switch (lp.WordCount) { case "yyyy-MM-dd": strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); break; case "MM-dd日": strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); break; case "yyyy-MM-dd HH:mm:ss": strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Second.ToString()); break; case "HH:mm:ss": strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); strList.Add(dt.Second.ToString()); break; case "MM-dd日 HH:mm": strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; case "dd日 HH:mm": strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; case "HH:mm": strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; default: strList.Add(dt.Year.ToString()); strList.Add(dt.Month.ToString()); strList.Add(dt.Day.ToString()); strList.Add(dt.Hour.ToString()); strList.Add(dt.Minute.ToString()); break; } // int i = 0; for (int i = 0; i < strList.Count; i++) { if (extraWord.Length > i) { ea.SetCellValue("'" + strList[i] + extraWord[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = strList[i] + extraWord[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; tfv = valuehs[lp.LPID + "$" + arrCellPos[i] + "时间"] as WF_TableFieldValue; if (tfv != null) { tfv.ControlValue = dt.ToString(); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; } } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = strList[i] + extraWord[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); tfv = new WF_TableFieldValue(); tfv.FieldId = lp.LPID; tfv.ControlValue = dt.ToString(); tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i] + "完整时间", tfv); } } else { ea.SetCellValue("'" + strList[i], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue; tfv.ControlValue = strList[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; tfv = valuehs[lp.LPID + "$" + arrCellPos[0] + "时间"] as WF_TableFieldValue; if (tfv != null) { tfv.ControlValue = dt.ToString(); tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; } } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = strList[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName; tfv.XExcelPos = GetCellPos(arrCellPos[i])[0]; tfv.YExcelPos = GetCellPos(arrCellPos[i])[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv); tfv = new WF_TableFieldValue(); tfv.FieldId = lp.LPID; tfv.ControlValue = dt.ToString(); tfv.FieldName = lp.CellName + "完整时间"; tfv.XExcelPos = -1; tfv.YExcelPos = -1; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + arrCellPos[0] + "完整时间", tfv); } } } //foreach (string str in strList) //{ // ea.SetCellValue(str, GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]); // i++; //} }
public void ExportExcelSubmit(ref LP_Temple parentTemple, string orgid, bool isShow) { DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl(); string fname = Application.StartupPath + "\\00记录模板\\备品备件计划.xls"; dsoFramerWordControl1.FileOpen(fname); if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent; ExcelAccess ex = new ExcelAccess(); Microsoft.Office.Interop.Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook; ex.MyWorkBook = wb; ex.MyExcel = wb.Application; string filter = " where jhnf = '" + (DateTime.Now.Year + 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_bpbjjhb> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_bpbjjhb>( filter ); ExportExcel(ex, datalist); if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } dsoFramerWordControl1.FileSave(); parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileClose(); }
public void FillMutilRowsT(ExcelAccess ea, LP_Temple lp, string str, int cellcount, string arrCellPos, string coltemp) { StringHelper help = new StringHelper(); //str = help.GetPlitString(str, cellcount); string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.None); if (lp.ExtraWord == "横向") { for (int i = 0; i < arrRst.Length; i++) { ea.SetCellValue("'" + arrRst[i], GetCellPos(arrCellPos)[0], GetCellPos(arrCellPos)[1] + i); if (valuehs.ContainsKey(lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1]] as WF_TableFieldValue; tfv.ControlValue = arrRst[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "-" + coltemp; tfv.XExcelPos = GetCellPos(arrCellPos)[0]; tfv.YExcelPos = GetCellPos(arrCellPos)[1] + i; tfv.ExcelSheetName = activeSheetName; } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = arrRst[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "-" + coltemp; tfv.XExcelPos = GetCellPos(arrCellPos)[0]; tfv.YExcelPos = GetCellPos(arrCellPos)[1] + i; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1], tfv); } } } else { for (int i = 0; i < arrRst.Length; i++) { ea.SetCellValue("'" + arrRst[i], GetCellPos(arrCellPos)[0] + i, GetCellPos(arrCellPos)[1]); if (valuehs.ContainsKey(lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1])) { WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1]] as WF_TableFieldValue; tfv.ControlValue = arrRst[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "-" + coltemp; tfv.XExcelPos = GetCellPos(arrCellPos)[0] + i; tfv.YExcelPos = GetCellPos(arrCellPos)[1]; tfv.ExcelSheetName = activeSheetName; } else { WF_TableFieldValue tfv = new WF_TableFieldValue(); tfv.ControlValue = arrRst[i]; tfv.FieldId = lp.LPID; tfv.FieldName = lp.CellName + "-" + coltemp; tfv.XExcelPos = GetCellPos(arrCellPos)[0] + i; tfv.YExcelPos = GetCellPos(arrCellPos)[1]; tfv.ExcelSheetName = activeSheetName; valuehs.Add(lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1], tfv); } } } }
public void ExportExcelSubmit(ref LP_Temple parentTemple, string orgid, bool isShow) { DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl(); string fname = Application.StartupPath + "\\00记录模板\\线路设备责任区划分明白表.xls"; dsoFramerWordControl1.FileOpen(fname); if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent; ExcelAccess ex = new ExcelAccess(); Microsoft.Office.Interop.Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook; ex.MyWorkBook = wb; ex.MyExcel = wb.Application; string filter = ""; int i = 0; string sdtrorg = " "; if (orgid != "") { sdtrorg += " and OrgCode='" + orgid + "'"; } IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct zrr from PJ_xlsbzrqhfmbb where 1=1 " + sdtrorg); List<WF_ModleRecordWorkTaskIns> mrwtlist = new List<WF_ModleRecordWorkTaskIns>(); foreach (string mc in mclist) { filter = " where 1=1 and zrr='" + mc + "' "; 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_xlsbzrqhfmbb> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_xlsbzrqhfmbb>( filter ); ExportExcel(ex, datalist,mc); } ex.DeleteSheet(1); if (parentTemple == null) { parentTemple = new LP_Temple(); parentTemple.Status = "文档生成"; } dsoFramerWordControl1.FileSave(); parentTemple.DocContent = dsoFramerWordControl1.FileDataGzip; dsoFramerWordControl1.FileSave(); dsoFramerWordControl1.FileClose(); }
/// <summary> /// 初始化数据 /// </summary> public void InitData() { Temple = MainHelper.PlatformSqlMap.GetOne<LP_Temple>(" where ( ParentID not in (select LPID from LP_Temple where 1=1 and CtrlSize!='目录') and CtrlSize!='目录' ) and CellName = '安全运行记录板'"); string slqwhere = " "; if (Temple == null) { MsgBox.ShowWarningMessageBox("没有找到表单安全运行记录板!"); return; } IList recordlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct RecordId from WF_TableFieldValue where UserControlId='" + Temple.LPID + "' and WorkflowId='" + modleGuid + "' and WorkFlowInsId='" + parentObj.OrgName + "' "); IList<LP_Temple> templeList = MainHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", "where ParentID ='" + Temple.LPID + "' order by SortID"); dt.Rows.Clear(); for (int i = 0; i < recordlist.Count; ) { slqwhere = " where RecordId='"+recordlist[i] + "' and UserControlId='" + Temple.LPID + "' and WorkflowId='" + modleGuid + "' and fieldname='" + "问题" + "' and WorkFlowInsId='" + parentObj.OrgName + "' "; WF_TableFieldValue value = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(slqwhere); DataRow dr = dt.NewRow(); dr["RecordId"] = recordlist[i]; if(value!=null) { dr["Question"] = value.ControlValue; } slqwhere = " where RecordId='"+recordlist[i] + "' and UserControlId='" + Temple.LPID + "' and WorkflowId='" + modleGuid + "' and fieldname='" + "答案" + "' and WorkFlowInsId='" + parentObj.OrgName + "' "; value = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(slqwhere); if(value!=null) { dr["Answer"] = value.ControlValue; } slqwhere = " where RecordId='" + recordlist[i] + "' and UserControlId='" + Temple.LPID + "' and WorkflowId='" + modleGuid + "' and fieldname='" + "人身安全生产天数" + "' and WorkFlowInsId='" + parentObj.OrgName + "' "; value = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(slqwhere); if (value != null) { dr["Rsaqts"] = value.ControlValue; } slqwhere = " where RecordId='" + recordlist[i] + "' and UserControlId='" + Temple.LPID + "' and WorkflowId='" + modleGuid + "' and fieldname='" + "设备安全生产天数" + "' and WorkFlowInsId='" + parentObj.OrgName + "' "; value = MainHelper.PlatformSqlMap.GetOne<WF_TableFieldValue>(slqwhere); if (value != null) { dr["Sbaqts"] = value.ControlValue; } dt.Rows.Add(dr); i++; } //treeViewOperator.RefreshData(" where OrgCode='" + parentID + "' order by linetype,linecode"); //treeViewOperator.RefreshData(slqwhere); gridControl1.DataSource = dt; }
private void LPFrm_Load(object sender, EventArgs e) { if (tempCtrlList==null) { tempCtrlList = new List<Control>(); } this.Text = "低压线路完好率及台区网络图"; //InitializeComponent(); if (valuehs == null) valuehs = new Hashtable(); Excel.Workbook wb; Excel.Worksheet sheet; ExcelAccess ea = new ExcelAccess(); parentTemple = MainHelper.PlatformSqlMap.GetOne<LP_Temple>(" where ( ParentID not in (select LPID from LP_Temple where 1=1 and CtrlSize!='目录') and CtrlSize!='目录' ) and CellName like '%低压线路完好率及台区网络图%'"); currRecord = rowData; if (currRecord.BigData == null || currRecord.BigData.Length == 0) { this.dsoFramerWordControl1.FileDataGzip = parentTemple.DocContent; } else { this.dsoFramerWordControl1.FileDataGzip = currRecord.BigData; } InitIndex(); InitContorl(); InitData(); if (status == "edit") { IList<WF_TableFieldValue> tfvli = MainHelper.PlatformSqlMap.GetList<WF_TableFieldValue>("SelectWF_TableFieldValueList", " where RecordId='" + currRecord.ID + "' and UserControlId='" + parentTemple.LPID + "' and WorkflowId='" + currRecord.tqCode + "' and WorkFlowInsId='" + currRecord.tqName + "' "); Excel.Worksheet xx; wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; ea.MyWorkBook = wb; ea.MyExcel = wb.Application; string activeSheetName = ""; xx = wb.Application.Sheets[1] as Excel.Worksheet; int i = 0; for (i = 0; i < tfvli.Count; i++) { Control ctl= FindCtrl(tfvli[i].FieldId); if (ctl != null) { ctl.Text = tfvli[i].ControlValue; } } dsoFramerWordControl1.FileSave(); } }