Example #1
0
        private void ButtonReprintClick(object sender, EventArgs e)
        {
            if (sender is SimpleButton)
            {
                string strProcedureName =
                    string.Format(
                        "{0}.{1}",
                        className,
                        MethodBase.GetCurrentMethod().Name);

                SimpleButton button = sender as SimpleButton;
                try
                {
                    button.Enabled = false;

                    if (busUDFForm.OutputStr != "")
                    {
                        object tag = null;
                        try
                        {
                            UDFActions.DoActions(
                                busUDFForm.OutputStr,
                                new ExtendEventHandler(RefreshForm),
                                ref tag);
                        }
                        catch (Exception error)
                        {
                            WriteLog.Instance.Write(
                                string.Format("错误信息:{0}。跟踪堆栈:{1}。",
                                              error.Message,
                                              error.StackTrace),
                                strProcedureName);
                            xucIRAPListView.WriteLog(-1, error.Message, DateTime.Now);
                        }
                    }
                }
                finally
                {
                    button.Enabled = true;
                }

                //RefreshTheButtonControl();

                // 在编辑框数组中,第一个可见的并且可编辑的输入框获得焦点
                for (int i = 0; i < _edits.Count; i++)
                {
                    if (_edits[i].Enabled && _edits[i].Visible)
                    {
                        _edits[i].Focus();
                        break;
                    }
                }
            }
        }
Example #2
0
        private void timerPrint_Tick(object sender, EventArgs e)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            timerPrint.Enabled = false;

            try
            {
                if (wait4Print.Count <= 0)
                {
                    return;
                }

                string temp = wait4Print[0];
                lock (lockArea)
                {
                    wait4Print.RemoveAt(0);
                }

                // 打印
                if (temp != "")
                {
                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.LoadXml(temp);

                        foreach (XmlNode node in xmlDoc.SelectNodes("Softland/Body"))
                        {
                            UDFActions.DoActions(
                                node,
                                null);
                        }
                    }
                    catch (Exception error)
                    {
                        OutputLog(error.Message, strProcedureName, ToolTipIcon.Error);
                    }
                }
            }
            finally
            {
                timerPrint.Enabled = true;
            }
        }
Example #3
0
        public void SaveOLTPUDFFormDataWithoutFactIDAndTransactNo(
            int processLeaf,
            int workUnitLeaf,
            ExtendEventHandler extendAction,
            object tag)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                long intTransactNo     = 0;
                long intFactID         = 0;
                int  ctrlParameter1    = this.ctrlParameter1;
                int  ctrlParameter2    = this.ctrlParameter2;
                int  ctrlParameter3    = this.ctrlParameter3;
                int  ctrlParameter2_bk = 0;
                int  ctrlParameter3_bk = 0;

                #region 统一防错校验
                try
                {
                    if (ctrlParameter2 >= 0)
                    {
                        ctrlParameter2_bk = ctrlParameter2;
                        ctrlParameter3_bk = ctrlParameter3;

                        IRAPUTSClient.Instance.ssp_PokaYoke_UDFForm(
                            IRAPUser.Instance.CommunityID,
                            ctrlParameter1,
                            ref ctrlParameter2,
                            ref ctrlParameter3,
                            IRAPUser.Instance.SysLogID,
                            ref strParameter1,
                            ref strParameter2,
                            ref strParameter3,
                            ref strParameter4,
                            ref strParameter5,
                            ref strParameter6,
                            ref strParameter7,
                            ref strParameter8,
                            ref outputStr,
                            out errorCode,
                            out errorMessage);
                    }
                    else
                    {
                        ctrlParameter2    = processLeaf;
                        ctrlParameter3    = workUnitLeaf;
                        ctrlParameter2_bk = ctrlParameter2;
                        ctrlParameter3_bk = ctrlParameter3;

                        IRAPUTSClient.Instance.ssp_PokaYoke_UDFForm(
                            IRAPUser.Instance.CommunityID,
                            ctrlParameter1,
                            ref ctrlParameter2,
                            ref ctrlParameter3,
                            IRAPUser.Instance.SysLogID,
                            ref strParameter1,
                            ref strParameter2,
                            ref strParameter3,
                            ref strParameter4,
                            ref strParameter5,
                            ref strParameter6,
                            ref strParameter7,
                            ref strParameter8,
                            ref outputStr,
                            out errorCode,
                            out errorMessage);
                    }
                    WriteLog.Instance.Write(
                        string.Format(
                            "{0}.{1}",
                            errorCode,
                            errorMessage),
                        strProcedureName);

                    WriteLog.Instance.Write(
                        string.Format("Output={0}", outputStr),
                        strProcedureName);
                    if (outputStr != "")
                    {
                        try
                        {
                            UDFActions.DoActions(
                                outputStr,
                                extendAction,
                                ref tag);
                        }
                        catch (Exception error)
                        {
                            outputStr = "";
                            WriteLog.Instance.Write(
                                string.Format("错误信息:{0}。跟踪堆栈:{1}。",
                                              error.Message,
                                              error.StackTrace),
                                strProcedureName);
                            throw error;
                        }
                    }

                    outputStr = "";
                }
                catch (Exception err)
                {
                    outputStr = "";
                    WriteLog.Instance.Write(err.Message, strProcedureName);
                    throw err;
                }
                if (errorCode != 0)
                {
                    return;
                }
                #endregion

                #region 如果交易存储过程返回的 CtrlParameter2 和 CtrlParameter3 有变化,则刷新选项一和选项二
                if (ctrlParameter2 != ctrlParameter2_bk)
                {
                    outputStr =
                        string.Format(
                            "T107LeafID=\"{0}\" ",
                            ctrlParameter2);
                }
                else
                {
                    outputStr = "T107LeafID=\"\" ";
                }
                if (ctrlParameter3 != ctrlParameter3_bk)
                {
                    outputStr +=
                        string.Format(
                            " T102LeafID=\"{1}\" ",
                            ctrlParameter3);
                }
                else
                {
                    outputStr += " T102LeafID=\"\" ";
                }

                outputStr =
                    string.Format(
                        "<ROOT><Action Ordinal=\"1\" Action=\"SelectChoice\" {0}/></ROOT>",
                        outputStr);
                if (ctrlParameter2 != ctrlParameter2_bk ||
                    ctrlParameter3 != ctrlParameter3_bk)
                {
                    try
                    {
                        UDFActions.DoActions(
                            outputStr,
                            extendAction,
                            ref tag);
                    }
                    catch (Exception error)
                    {
                        outputStr = "";
                        WriteLog.Instance.Write(
                            string.Format("错误信息:{0}。跟踪堆栈:{1}。",
                                          error.Message,
                                          error.StackTrace),
                            strProcedureName);
                        throw error;
                    }
                }
                #endregion

                #region 保存
                try
                {
                    if (ctrlParameter2 >= 0)
                    {
                        IRAPUTSClient.Instance.ssp_OLTP_UDFForm(
                            IRAPUser.Instance.CommunityID,
                            intTransactNo,
                            intFactID,
                            ctrlParameter1,
                            ctrlParameter2,
                            ctrlParameter3,
                            IRAPUser.Instance.SysLogID,
                            strParameter1,
                            strParameter2,
                            strParameter3,
                            strParameter4,
                            strParameter5,
                            strParameter6,
                            strParameter7,
                            strParameter8,
                            ref outputStr,
                            out errorCode,
                            ref errorMessage);
                    }
                    else
                    {
                        IRAPUTSClient.Instance.ssp_OLTP_UDFForm(
                            IRAPUser.Instance.CommunityID,
                            intTransactNo,
                            intFactID,
                            ctrlParameter1,
                            processLeaf,
                            workUnitLeaf,
                            IRAPUser.Instance.SysLogID,
                            strParameter1,
                            strParameter2,
                            strParameter3,
                            strParameter4,
                            strParameter5,
                            strParameter6,
                            strParameter7,
                            strParameter8,
                            ref outputStr,
                            out errorCode,
                            ref errorMessage);
                    }
                }
                catch (Exception error)
                {
                    outputStr = "";
                    WriteLog.Instance.Write(error.Message, strProcedureName);
                    throw error;
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Example #4
0
        private void ButtonSaveDataClick(object sender, EventArgs e)
        {
            if (sender is SimpleButton)
            {
                string strProcedureName =
                    string.Format(
                        "{0}.{1}",
                        className,
                        MethodBase.GetCurrentMethod().Name);

                WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                (sender as SimpleButton).Enabled = false;

                foreach (TextEdit edit in _edits)
                {
                    if (edit.Enabled)
                    {
                        edit.Enabled = false;
                    }
                }

                try
                {
                    for (int i = 0; i < _edits.Count; i++)
                    {
                        if (_edits[i].Text.Trim() == "" &&
                            _edits[i].Visible &&
                            _edits[i].Enabled)
                        //    busUDFForm.SetStrParameterValue(_edits[i].Text.Trim(), i + 1);
                        //else
                        {
                            _edits[i].Focus();
                            return;
                        }
                        else
                        {
                            busUDFForm.SetStrParameterValue(_edits[i].Text.Trim(), i + 1);
                        }
                    }

                    try
                    {
                        object tag = null;

                        busUDFForm.SaveOLTPUDFFormData(
                            CurrentOptions.Instance.OptionTwo.T102LeafID,
                            CurrentOptions.Instance.OptionOne.T107LeafID,
                            new ExtendEventHandler(RefreshForm),
                            ref tag);
                        WriteLog.Instance.Write(
                            string.Format(
                                "{0}.{1}",
                                busUDFForm.ErrorCode,
                                busUDFForm.ErrorMessage),
                            strProcedureName);
                        xucIRAPListView.WriteLog(
                            busUDFForm.ErrorCode,
                            busUDFForm.ErrorMessage,
                            DateTime.Now);

                        WriteLog.Instance.Write(
                            string.Format("Output={0}", busUDFForm.OutputStr),
                            strProcedureName);
                        if (busUDFForm.OutputStr != "")
                        {
                            try
                            {
                                UDFActions.DoActions(
                                    busUDFForm.OutputStr,
                                    new ExtendEventHandler(RefreshForm),
                                    ref tag);
                            }
                            catch (Exception error)
                            {
                                WriteLog.Instance.Write(
                                    string.Format("错误信息:{0}。跟踪堆栈:{1}。",
                                                  error.Message,
                                                  error.StackTrace),
                                    strProcedureName);
                                xucIRAPListView.WriteLog(-1, error.Message, DateTime.Now);
                            }
                        }
                    }
                    catch (Exception error)
                    {
                        WriteLog.Instance.Write(error.Message, strProcedureName);
                        xucIRAPListView.WriteLog(-1, error.Message, DateTime.Now);
                    }
                }
                finally
                {
                    ClearTheInputs();

                    (sender as SimpleButton).Enabled = true;
                    WriteLog.Instance.WriteEndSplitter(strProcedureName);
                }
            }
        }