Beispiel #1
0
        private DataTable shelfInfoTable_false = null; //不包含全部选项

        /// <summary>
        /// SearchLookUpEdit货架信息控件初始化
        /// </summary>
        public void SearchLookUpEdit_ShelfInfo(SearchLookUpEdit searchLookUp, bool addAllItem, string valueMemberStr = "AutoId", string displayMemberStr = "ShelfNo")
        {
            if (DataTypeConvert.GetString(searchLookUp.Properties.View.Tag) == "Init")
            {
                return;
            }

            GridColumn grdColAutoId = new GridColumn();

            grdColAutoId.Caption   = "AutoId";
            grdColAutoId.FieldName = "AutoId";
            grdColAutoId.Name      = "grdColAutoId";

            GridColumn grdColShelfNo = new GridColumn();

            grdColShelfNo.Caption   = "货架号";
            grdColShelfNo.FieldName = "ShelfNo";
            grdColShelfNo.Name      = "grdColShelfNo";
            grdColShelfNo.AppearanceHeader.Options.UseTextOptions = true;
            grdColShelfNo.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColShelfNo.Visible      = true;
            grdColShelfNo.VisibleIndex = 0;

            GridColumn grdColShelfLocation = new GridColumn();

            grdColShelfLocation.Caption   = "货架位置";
            grdColShelfLocation.FieldName = "ShelfLocation";
            grdColShelfLocation.Name      = "grdColShelfLocation";
            grdColShelfLocation.AppearanceHeader.Options.UseTextOptions = true;
            grdColShelfLocation.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColShelfLocation.Visible      = true;
            grdColShelfLocation.VisibleIndex = 1;

            GridColumn grdColLocationName = new GridColumn();

            grdColLocationName.Caption   = "仓位名称";
            grdColLocationName.FieldName = "LocationName";
            grdColLocationName.Name      = "grdColLocationName";
            grdColLocationName.AppearanceHeader.Options.UseTextOptions = true;
            grdColLocationName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColLocationName.Visible      = true;
            grdColLocationName.VisibleIndex = 2;

            searchLookUp.Properties.View.Columns.AddRange(new GridColumn[] { grdColAutoId, grdColShelfNo, grdColShelfLocation, grdColLocationName });

            searchLookUp.Properties.NullText      = "";
            searchLookUp.EnterMoveNextControl     = true;
            searchLookUp.Properties.ValueMember   = valueMemberStr;
            searchLookUp.Properties.DisplayMember = displayMemberStr;

            if (addAllItem)
            {
                if (shelfInfoTable_True == null)
                {
                    shelfInfoTable_True = commonDAO.QueryShelfInfo(true);
                }
                searchLookUp.Properties.DataSource = shelfInfoTable_True;
            }
            else
            {
                if (shelfInfoTable_false == null)
                {
                    shelfInfoTable_false = commonDAO.QueryShelfInfo(false);
                }
                searchLookUp.Properties.DataSource = shelfInfoTable_false;
            }

            searchLookUp.Properties.View.IndicatorWidth          = 60;
            searchLookUp.Properties.View.CustomDrawRowIndicator += searchLookUpView_CustomDrawRowIndicator;

            searchLookUp.Properties.View.Tag = "Init";
        }
Beispiel #2
0
        public void SearchLookUpEdit_UserInfo(SearchLookUpEdit searchLookUp, string valueMemberStr, bool addAllItem)
        {
            if (DataTypeConvert.GetString(searchLookUp.Properties.View.Tag) == "Init")
            {
                return;
            }

            GridColumn grdColAutoId = new GridColumn();

            grdColAutoId.Caption   = "AutoId";
            grdColAutoId.FieldName = "AutoId";
            grdColAutoId.Name      = "grdColAutoId";

            GridColumn grdColLoginId = new GridColumn();

            grdColLoginId.Caption   = "用户名";
            grdColLoginId.FieldName = "LoginId";
            grdColLoginId.Name      = "grdColLoginId";
            grdColLoginId.AppearanceHeader.Options.UseTextOptions = true;
            grdColLoginId.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColLoginId.Visible      = true;
            grdColLoginId.VisibleIndex = 0;

            GridColumn grdColEmpName = new GridColumn();

            grdColEmpName.Caption   = "员工名";
            grdColEmpName.FieldName = "EmpName";
            grdColEmpName.Name      = "grdColEmpName";
            grdColEmpName.AppearanceHeader.Options.UseTextOptions = true;
            grdColEmpName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColEmpName.Visible      = true;
            grdColEmpName.VisibleIndex = 1;

            GridColumn grdColDepartmentName = new GridColumn();

            grdColDepartmentName.Caption   = "部门";
            grdColDepartmentName.FieldName = "DepartmentName";
            grdColDepartmentName.Name      = "grdColDepartmentName";
            grdColDepartmentName.AppearanceHeader.Options.UseTextOptions = true;
            grdColDepartmentName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColDepartmentName.Visible      = true;
            grdColDepartmentName.VisibleIndex = 2;

            searchLookUp.Properties.View.Columns.AddRange(new GridColumn[] { grdColAutoId, grdColLoginId, grdColEmpName, grdColDepartmentName });

            searchLookUp.Properties.NullText      = "";
            searchLookUp.EnterMoveNextControl     = true;
            searchLookUp.Properties.DisplayMember = "EmpName";
            searchLookUp.Properties.ValueMember   = valueMemberStr;

            if (userInfoTable_True == null)
            {
                userInfoTable_True = commonDAO.QueryUserInfo(addAllItem);
            }

            searchLookUp.Properties.DataSource = userInfoTable_True;

            searchLookUp.Properties.View.IndicatorWidth          = 60;
            searchLookUp.Properties.View.CustomDrawRowIndicator += searchLookUpView_CustomDrawRowIndicator;

            searchLookUp.Properties.View.Tag = "Init";
        }
Beispiel #3
0
        private DataTable projectListTable_false = null; //不包含全部选项

        /// <summary>
        /// SearchLookUpEdit项目信息控件初始化
        /// </summary>
        public void SearchLookUpEdit_ProjectList(SearchLookUpEdit searchLookUp, bool addAllItem, string valueMemberStr = "ProjectNo", string displayMemberStr = "ProjectName")
        {
            if (DataTypeConvert.GetString(searchLookUp.Properties.View.Tag) == "Init")
            {
                return;
            }

            GridColumn grdColAutoId = new GridColumn();

            grdColAutoId.Caption   = "AutoId";
            grdColAutoId.FieldName = "AutoId";
            grdColAutoId.Name      = "grdColAutoId";

            GridColumn grdColProjectNo = new GridColumn();

            grdColProjectNo.Caption   = "项目号";
            grdColProjectNo.FieldName = "ProjectNo";
            grdColProjectNo.Name      = "grdColProjectNo";
            grdColProjectNo.AppearanceHeader.Options.UseTextOptions = true;
            grdColProjectNo.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColProjectNo.Visible      = true;
            grdColProjectNo.VisibleIndex = 0;

            GridColumn grdColProjectName = new GridColumn();

            grdColProjectName.Caption   = "项目名称";
            grdColProjectName.FieldName = "ProjectName";
            grdColProjectName.Name      = "grdColProjectName";
            grdColProjectName.AppearanceHeader.Options.UseTextOptions = true;
            grdColProjectName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColProjectName.Visible      = true;
            grdColProjectName.VisibleIndex = 1;

            GridColumn grdColRemark = new GridColumn();

            grdColRemark.Caption   = "备注";
            grdColRemark.FieldName = "Remark";
            grdColRemark.Name      = "grdColRemark";
            grdColRemark.AppearanceHeader.Options.UseTextOptions = true;
            grdColRemark.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColRemark.Visible      = true;
            grdColRemark.VisibleIndex = 2;

            searchLookUp.Properties.View.Columns.AddRange(new GridColumn[] { grdColAutoId, grdColProjectNo, grdColProjectName, grdColRemark });

            searchLookUp.Properties.NullText      = "";
            searchLookUp.EnterMoveNextControl     = true;
            searchLookUp.Properties.ValueMember   = valueMemberStr;
            searchLookUp.Properties.DisplayMember = displayMemberStr;

            if (addAllItem)
            {
                if (projectListTable_True == null)
                {
                    projectListTable_True = commonDAO.QueryProjectList(true);
                }
                searchLookUp.Properties.DataSource = projectListTable_True;
            }
            else
            {
                if (projectListTable_false == null)
                {
                    projectListTable_false = commonDAO.QueryProjectList(false);
                }
                searchLookUp.Properties.DataSource = projectListTable_false;
            }

            searchLookUp.Properties.View.IndicatorWidth          = 60;
            searchLookUp.Properties.View.CustomDrawRowIndicator += searchLookUpView_CustomDrawRowIndicator;

            searchLookUp.Properties.View.Tag = "Init";
        }
Beispiel #4
0
 /// <summary>
 /// 主线程执行的方法
 /// </summary>
 private void AlertMessageBox(object msg)//由于是主线程的同步对象Post调用,这个是在主线程中执行的
 {
     //new AlertControl().Show(null, "消息提示", DataTypeConvert.GetString(msg));
     new AlertControl().Show(null, f.tsmiXxts.Text, DataTypeConvert.GetString(msg));
 }
Beispiel #5
0
        /// <summary>
        /// 处理报表打印
        /// </summary>
        /// <param name="tableNameStr">数据表名</param>
        /// <param name="bindingDataSet">绑定的DataSet</param>
        /// <param name="paraList">参数列表</param>
        /// <param name="handleType">处理类型:1 预览 2 打印 3 设计</param>
        public void XtraReport_Handle(string tableNameStr, DataSet bindingDataSet, List <Parameter> paraList, int handleType)
        {
            FrmDocumentTempletDAO docDAO          = new FrmDocumentTempletDAO();
            DataTable             docTempletTable = docDAO.QueryDocTemplet(tableNameStr);

            if (docTempletTable.Rows.Count == 0)
            {
                //MessageHandler.ShowMessageBox("未查询到当前单据模板的信息记录,操作错误。");
                MessageHandler.ShowMessageBox(f.tsmiWcxddq.Text);

                return;
            }

            string path      = DataTypeConvert.GetString(docTempletTable.Rows[0]["DocPath"]) + DataTypeConvert.GetString(docTempletTable.Rows[0]["DocFileName"]);
            string docVerStr = DataTypeConvert.GetString(docTempletTable.Rows[0]["DocVersion"]);

            string      iniPath     = System.Windows.Forms.Application.StartupPath + "\\Report\\DocTemplet.ini";
            string      sectionStr  = "DocTemplet";
            FileHandler fileHandler = new FileHandler();

            if (File.Exists(path))
            {
                if (File.Exists(iniPath))
                {
                    string localVerStr = fileHandler.IniReadValue(iniPath, sectionStr, tableNameStr);
                    if (localVerStr != docVerStr && handleType != 3)
                    {
                        Byte[] fileByte = docDAO.QueryDocTemplet_FileByte(tableNameStr);
                        fileHandler.ByteArrayToFile(fileByte, path);
                        fileHandler.IniWriteValue(iniPath, sectionStr, tableNameStr, docVerStr);
                    }
                }
                else
                {
                    Byte[] fileByte = docDAO.QueryDocTemplet_FileByte(tableNameStr);
                    fileHandler.ByteArrayToFile(fileByte, path);
                    fileHandler.IniWriteValue(iniPath, sectionStr, tableNameStr, docVerStr);
                }
            }
            else
            {
                Byte[] fileByte = docDAO.QueryDocTemplet_FileByte(tableNameStr);
                fileHandler.ByteArrayToFile(fileByte, path);
                fileHandler.IniWriteValue(iniPath, sectionStr, tableNameStr, docVerStr);
            }
            XtraReport report = new XtraReport();

            report.LoadLayout(path);

            report.DataSource = bindingDataSet;
            if (paraList != null)
            {
                foreach (Parameter para in paraList)
                {
                    try
                    {
                        report.Parameters[para.Name].Value = para.Value;
                    }
                    catch
                    {
                        report.Parameters.Add(para);
                    }
                }
            }

            report.RequestParameters = false;
            report.CreateDocument();
            ReportPrintTool    rptPrintTool = new ReportPrintTool(report);
            PrintingSystemBase prtSysBase   = rptPrintTool.PrintingSystem;

            prtSysBase.SetCommandVisibility(new PrintingSystemCommand[] {
                //PrintingSystemCommand.Background,
                //PrintingSystemCommand.ClosePreview,
                //PrintingSystemCommand.Customize,
                //PrintingSystemCommand.DocumentMap,
                //PrintingSystemCommand.EditPageHF,
                //PrintingSystemCommand.ExportCsv,
                //PrintingSystemCommand.ExportFile,
                //PrintingSystemCommand.ExportGraphic,
                //PrintingSystemCommand.ExportHtm,
                //PrintingSystemCommand.ExportMht,
                //PrintingSystemCommand.ExportPdf,
                //PrintingSystemCommand.ExportRtf,
                //PrintingSystemCommand.ExportTxt,
                //PrintingSystemCommand.ExportXls,
                //PrintingSystemCommand.ExportXlsx,
                //PrintingSystemCommand.ExportXps,
                //PrintingSystemCommand.File,
                //PrintingSystemCommand.FillBackground ,
                //PrintingSystemCommand.Find,
                //PrintingSystemCommand.HandTool,
                //PrintingSystemCommand.Magnifier,
                //PrintingSystemCommand.MultiplePages,
                //PrintingSystemCommand.Open,
                //PrintingSystemCommand.PageLayout,
                //PrintingSystemCommand.PageLayoutContinuous,
                //PrintingSystemCommand.PageMargins,
                //PrintingSystemCommand.PageOrientation,
                //PrintingSystemCommand.PageSetup,
                //PrintingSystemCommand.PaperSize,
                PrintingSystemCommand.Parameters,
                //PrintingSystemCommand.Pointer,
                //PrintingSystemCommand.Print,
                //PrintingSystemCommand.PrintDirect ,
                //PrintingSystemCommand.Save,
                //PrintingSystemCommand.SendCsv,
                //PrintingSystemCommand.SendFile,
                //PrintingSystemCommand.SendGraphic,
                //PrintingSystemCommand.SendMht,
                //PrintingSystemCommand.SendPdf,
                //PrintingSystemCommand.SendRtf,
                //PrintingSystemCommand.SendTxt,
                //PrintingSystemCommand.SendXls,
                //PrintingSystemCommand.SendXlsx,
                //PrintingSystemCommand.SendXps,
                PrintingSystemCommand.SubmitParameters,
                //PrintingSystemCommand.View,
                //PrintingSystemCommand.Watermark
            }, DevExpress.XtraPrinting.CommandVisibility.None);

            switch (handleType)
            {
            case 1:
                XtraReport_Preview(report);
                break;

            case 2:
                XtraReport_Print(report);
                break;

            case 3:
                XtraReport_Designer(report, path);
                break;
            }
        }
Beispiel #6
0
        /// <summary>
        /// 记录绑定的DataTable里面变化的数据的日志
        /// </summary>
        /// <param name="tableCaption">数据表的中文标题</param>
        /// <param name="dataTable_NoHandle">未处理的DataTable</param>
        /// <param name="primaryKeyColumn">主键列名</param>
        public static string RecordLog_DataTable(SqlCommand cmd, string tableCaption, DataTable dataTable_NoHandle, string primaryKeyColumn)
        {
            string partLogStr = "";
            string typeStr    = "";
            string pkCaption  = "";
            string pkValue    = "";

            for (int i = 0; i < dataTable_NoHandle.Rows.Count; i++)
            {
                DataRow dr = dataTable_NoHandle.Rows[i];
                if (dr.RowState == DataRowState.Added)
                {
                    for (int j = 0; j < dataTable_NoHandle.Columns.Count; j++)
                    {
                        if (dataTable_NoHandle.Columns[j].ColumnName == primaryKeyColumn)
                        {
                            pkCaption = dataTable_NoHandle.Columns[j].Caption;
                            pkValue   = DataTypeConvert.GetString(dr[j]);
                            continue;
                        }
                        string tmpValue = DataTypeConvert.GetString(dr[j]);
                        if (tmpValue != "")
                        {
                            //partLogStr += string.Format("{0}的值为[{1}],", dataTable_NoHandle.Columns[j].Caption, tmpValue);
                            partLogStr += string.Format("{0}" + f.tsmiDzw.Text + "[{1}],", dataTable_NoHandle.Columns[j].Caption, tmpValue);
                        }
                    }
                    //typeStr = "新增";
                    typeStr = f.tsmiXz.Text;
                }
                else if (dr.RowState == DataRowState.Modified)
                {
                    for (int j = 0; j < dataTable_NoHandle.Columns.Count; j++)
                    {
                        if (dataTable_NoHandle.Columns[j].ColumnName == primaryKeyColumn)
                        {
                            pkCaption = dataTable_NoHandle.Columns[j].Caption;
                            pkValue   = DataTypeConvert.GetString(dr[j]);
                            continue;
                        }

                        string oldValue = DataTypeConvert.GetString(dr[j, DataRowVersion.Original]);
                        string newValue = DataTypeConvert.GetString(dr[j, DataRowVersion.Current]);
                        if (oldValue != newValue)
                        {
                            //partLogStr += string.Format("{0}的值由[{1}]变为[{2}],", dataTable_NoHandle.Columns[j].Caption, oldValue, newValue);
                            partLogStr += string.Format("{0}" + f.tsmiDzy.Text + "[{1}]" + f.tsmiBw.Text + "[{2}],", dataTable_NoHandle.Columns[j].Caption, oldValue, newValue);
                        }
                    }
                    //typeStr = "修改";
                    typeStr = f.tsmiXg.Text;
                }
                else if (dr.RowState == DataRowState.Deleted)
                {
                    for (int j = 0; j < dataTable_NoHandle.Columns.Count; j++)
                    {
                        if (dataTable_NoHandle.Columns[j].ColumnName == primaryKeyColumn)
                        {
                            pkCaption = dataTable_NoHandle.Columns[j].Caption;
                            pkValue   = DataTypeConvert.GetString(dr[j, DataRowVersion.Original]);
                            continue;
                        }

                        string tmpValue = DataTypeConvert.GetString(dr[j, DataRowVersion.Original]);
                        if (tmpValue != "")
                        {
                            //partLogStr += string.Format("{0}的原值为[{1}],", dataTable_NoHandle.Columns[j].Caption, tmpValue);
                            partLogStr += string.Format("{0}" + f.tsmiDyzw.Text + "[{1}],", dataTable_NoHandle.Columns[j].Caption, tmpValue);
                        }
                    }
                    //typeStr = "删除";
                    typeStr = f.tsmiSc.Text;
                }
            }

            //string logStr = string.Format("对[{0}]表进行[{1}]操作:主键[{2}]的值为[{3}],{4}", tableCaption, typeStr, pkCaption, pkValue, partLogStr);
            string logStr = string.Format(f.tsmiD.Text + "[{0}]" + f.tsmiBjx.Text + "[{1}]" + f.tsmiCz.Text + ":" + f.tsmiZj.Text + "[{2}]" + f.tsmiDzw.Text + "[{3}],{4}", tableCaption, typeStr, pkCaption, pkValue, partLogStr);

            //MessageHandler.ShowMessageBox(logStr);
            RecordLog(cmd, logStr);
            return(logStr);
        }