Exemplo n.º 1
0
        private void tmrShowLabelTemplate_Tick(object sender, EventArgs e)
        {
            if (selectedChanged)
            {
                TimeSpan span = DateTime.Now - lastSelectedChangedTime;
                if (span.TotalSeconds >= 0.5)
                {
                    selectedChanged = false;

                    if (lstTemplates.SelectedItem == null)
                    {
                        report.Preview = null;
                        previewControl.Clear();
                        return;
                    }

                    LeafSetEx item = lstTemplates.SelectedItem as LeafSetEx;
                    if (item.LeafID != 0)
                    {
                        string template = LoadTemplateFromDB(item.LeafID);
                        report.Clear();
                        report.LoadFromString(template);
                        SetReportParameters(report);
                        report.Preview = previewControl;

                        if (report.Prepare())
                        {
                            report.ShowPrepared();
                            previewControl.ZoomWholePage();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据 T103LeafID 获取工单列表
        /// </summary>
        private void GetProductWorkOrders()
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            if (lstT103LeafSet.SelectedIndex >= 0)
            {
                WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                try
                {
                    LeafSetEx workType = lstT103LeafSet.SelectedItem as LeafSetEx;

                    int    errCode = 0;
                    string errText = "";

                    try
                    {
                        IRAPFVSClient.Instance.ufn_GetKanban_PWOSurveillance(
                            IRAPUser.Instance.CommunityID,
                            workType.LeafID,
                            IRAPUser.Instance.SysLogID,
                            ref pwos,
                            out errCode,
                            out errText);
                        WriteLog.Instance.Write(string.Format("({0}){1}", errCode, errText), strProcedureName);
                        if (errCode != 0)
                        {
                            XtraMessageBox.Show(
                                errText,
                                "系统信息",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                            return;
                        }
                    }
                    catch (Exception error)
                    {
                        WriteLog.Instance.Write(error.Message, strProcedureName);
                        XtraMessageBox.Show(
                            error.Message,
                            "系统信息",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                        return;
                    }

                    grdPWOs.DataSource = pwos;
                    for (int i = 0; i < cardView.Columns.Count; i++)
                    {
                        cardView.Columns[i].BestFit();
                    }
                    cardView.LayoutChanged();
                }
                finally
                {
                    WriteLog.Instance.WriteEndSplitter(strProcedureName);
                }
            }
        }
Exemplo n.º 3
0
        private void tsmiEdit_Click(object sender, EventArgs e)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            if (File.Exists(tempTemplateFile))
            {
                File.Delete(tempTemplateFile);
            }

            // 将未修改前的模板保存到临时文件中
            report.Save(tempTemplateFile);
            // 保存未修改前的模板内容,作为是否保存的依据
            string oldTemplate = report.SaveToString();

            report.FileName = tempTemplateFile;
            if (report.Design(true))
            {
                report.Load(tempTemplateFile);
                string newTemplate = report.SaveToString();

                #region 保存修改后的模板内容
                WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                try
                {
                    int       errCode   = 0;
                    string    errText   = "";
                    int       newLeafID = 0;
                    LeafSetEx data      = lstTemplates.SelectedItem as LeafSetEx;

                    IRAPMDMClient.Instance.usp_SaveFact_IRAP117Node(
                        IRAPUser.Instance.CommunityID,
                        117,
                        "U",
                        data.LeafID,
                        "FRX",
                        "",
                        data.LeafName,
                        newTemplate,
                        IRAPUser.Instance.SysLogID,
                        ref newLeafID,
                        out errCode,
                        out errText);
                    WriteLog.Instance.Write(
                        string.Format("({0}){1}", errCode, errText),
                        strProcedureName);
                    if (errCode != 0)
                    {
                        IRAPMessageBox.Instance.Show(
                            errText,
                            "保存模板失败",
                            MessageBoxIcon.Error);
                        report.LoadFromString(oldTemplate);
                    }
                }
                catch (Exception error)
                {
                    WriteLog.Instance.Write(error.Message, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                    IRAPMessageBox.Instance.Show(
                        error.Message,
                        "系统信息",
                        MessageBoxIcon.Error);
                }
                finally
                {
                    WriteLog.Instance.WriteEndSplitter(strProcedureName);
                }
                #endregion

                lstTemplates_SelectedIndexChanged(null, null);
            }
        }
Exemplo n.º 4
0
        private void tsmiRename_Click(object sender, EventArgs e)
        {
            if (lstTemplates.SelectedItem == null)
            {
                return;
            }

            LeafSetEx data = lstTemplates.SelectedItem as LeafSetEx;

            // 给标签模板取个名字
            string newTemplateName =
                GetString.Instance.Show(
                    "重命名",
                    string.Format(
                        "您想将标签模板[{0}]更换成:",
                        data.LeafName),
                    data.LeafName);

            if (newTemplateName.Trim() != "")
            {
                string strProcedureName =
                    string.Format(
                        "{0}.{1}",
                        className,
                        MethodBase.GetCurrentMethod().Name);

                #region 保存修改后的模板内容
                WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                try
                {
                    int    errCode   = 0;
                    string errText   = "";
                    int    newLeafID = 0;

                    IRAPMDMClient.Instance.usp_SaveFact_IRAP117Node(
                        IRAPUser.Instance.CommunityID,
                        117,
                        "U",
                        data.LeafID,
                        "FRX",
                        "",
                        newTemplateName,
                        report.SaveToString(),
                        IRAPUser.Instance.SysLogID,
                        ref newLeafID,
                        out errCode,
                        out errText);
                    WriteLog.Instance.Write(
                        string.Format("({0}){1}", errCode, errText),
                        strProcedureName);
                    if (errCode != 0)
                    {
                        IRAPMessageBox.Instance.Show(
                            errText,
                            "重命名失败",
                            MessageBoxIcon.Error);
                    }
                    else
                    {
                        data.LeafName = newTemplateName;
                    }
                }
                catch (Exception error)
                {
                    WriteLog.Instance.Write(error.Message, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                    IRAPMessageBox.Instance.Show(
                        error.Message,
                        "系统信息",
                        MessageBoxIcon.Error);
                }
                finally
                {
                    WriteLog.Instance.WriteEndSplitter(strProcedureName);
                }
                #endregion
            }
        }
Exemplo n.º 5
0
        private void tsmiNew_Click(object sender, EventArgs e)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            if (File.Exists(tempTemplateFile))
            {
                File.Delete(tempTemplateFile);
            }

            // 给新的标签模板取个名字
            LeafSetEx data            = lstTemplates.SelectedItem as LeafSetEx;
            string    newTemplateName =
                GetString.Instance.Show(
                    "给新的标签模板取个名",
                    "请给新的标签模板设置一个名称:",
                    data.LeafName);

            if (newTemplateName.Trim() == "")
            {
                newTemplateName = "未取名的标签模板";
            }

            // 将当前的标签模板作为样本,新增新模板
            report.Save(tempTemplateFile);
            report.FileName = tempTemplateFile;
            if (report.Design(true))
            {
                report.Load(tempTemplateFile);
                string templateContext = report.SaveToString();

                #region 保存修改后的模板内容
                WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                try
                {
                    int    errCode   = 0;
                    string errText   = "";
                    int    newLeafID = 0;

                    IRAPMDMClient.Instance.usp_SaveFact_IRAP117Node(
                        IRAPUser.Instance.CommunityID,
                        117,
                        "A",
                        currentTemplate.T117LeafID,
                        "FRX",
                        "",
                        newTemplateName,
                        templateContext,
                        IRAPUser.Instance.SysLogID,
                        ref newLeafID,
                        out errCode,
                        out errText);
                    WriteLog.Instance.Write(
                        string.Format("({0}){1}", errCode, errText),
                        strProcedureName);
                    if (errCode != 0)
                    {
                        IRAPMessageBox.Instance.Show(
                            errText,
                            "新增模板失败",
                            MessageBoxIcon.Error);
                    }
                    else
                    {
                        GetTemplateList();
                        for (int i = 0; i < lstTemplates.Items.Count; i++)
                        {
                            LeafSetEx temp = lstTemplates.Items[i] as LeafSetEx;
                            if (temp.LeafID == newLeafID)
                            {
                                lstTemplates.SelectedIndex = i;
                                break;
                            }
                        }
                    }
                }
                catch (Exception error)
                {
                    WriteLog.Instance.Write(error.Message, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                    IRAPMessageBox.Instance.Show(
                        error.Message,
                        "系统信息",
                        MessageBoxIcon.Error);
                }
                finally
                {
                    WriteLog.Instance.WriteEndSplitter(strProcedureName);
                }
                #endregion

                lstTemplates_SelectedIndexChanged(null, null);
            }
        }