Exemplo n.º 1
0
        /// <summary>
        /// 获取用户名及密码的验证结果
        /// </summary>
        /// <param name="userCode"></param>
        /// <param name="plainPWD"></param>
        /// <param name="veriCode"></param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>false:验证不通过;true:验证通过</returns>
        public bool sfn_UserPWDVerify(
            string userCode,
            string plainPWD,
            string veriCode,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@UserCode", DbType.String, userCode));
                paramList.Add(new IRAPProcParameter("@PlainPWD", DbType.String, plainPWD));
                paramList.Add(new IRAPProcParameter("@VeriCode", DbType.String, veriCode));
                WriteLog.Instance.Write(
                    $"调用函数 IRAP.dbo.sfn_UserPWDVerify,参数:UserCode={userCode}|" +
                    $"PlainPWD={plainPWD}|VeriCode={veriCode}",
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn =
                               new IRAPSQLConnection(
                                   TParams.Instance.DBConnectionStr))
                    {
                        bool rlt = (bool)conn.CallScalarFunc("IRAP.dbo.sfn_UserPWDVerify", paramList);
                        errCode = 0;
                        errText = $"调用成功!获得函数结果 ({rlt})";
                        WriteLog.Instance.Write(errText, strProcedureName);
                        return(rlt);
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP.dbo.sfn_UserPWDVerify 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                    return(false);
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Exemplo n.º 2
0
        /// <param name="communityID">社区标识</param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult ufn_GetT134ClickStream(
            int communityID,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                string data = "";

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用函数 IRAPFVS..ufn_GetT134ClickStream," +
                        "参数:CommunityID={0}|SysLogID={1}",
                        communityID, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        data    = (string)conn.CallScalarFunc("IRAPFVS.dbo.ufn_GetT134ClickStream", paramList);
                        errCode = 0;
                        errText = string.Format("调用成功!获得返回值:{0}", data);
                        WriteLog.Instance.Write(errText, strProcedureName);
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAPFVS..ufn_GetT134ClickStream 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion

                return(Json(data));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Exemplo n.º 3
0
        public IRAPJsonResult sfn_DefaultFunctionToRun(
            int communityID,
            int systemID,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName = string.Format("{0}.{1}",
                                                    className,
                                                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                int rlt = 0;

                try
                {
                    #region 创建数据库调用参数组,并赋值
                    IList <IDataParameter> paramList = new List <IDataParameter>();
                    paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                    paramList.Add(new IRAPProcParameter("@SystemID", DbType.Int32, systemID));
                    paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                    WriteLog.Instance.Write(string.Format("执行函数 IRAP..sfn_DefaultFunctionToRun,参数:" +
                                                          "CommunityID={0}|SystemID={1}|SysLogID={2}",
                                                          communityID, systemID, sysLogID),
                                            strProcedureName);
                    #endregion

                    #region 执行数据库函数或存储过程
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        rlt = (int)conn.CallScalarFunc("IRAP.dbo.sfn_DefaultFunctionToRun", paramList);

                        errCode = 0;
                        errText = string.Format("调用成功,获得值: [{0}]", rlt);
                        WriteLog.Instance.Write(errText, strProcedureName);
                    }
                    #endregion
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP.dbo.sfn_DefaultFunctionToRun 时发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="portalCode"></param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>int PortalID</returns>
        public IRAPJsonResult sfn_GetID_Portal(string portalCode, out int errCode, out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                int rlt = 0;

                try
                {
                    #region 创建数据库调用参数组,并赋值
                    IList <IDataParameter> paramList = new List <IDataParameter>();
                    paramList.Add(new IRAPProcParameter("@PortalCode", DbType.String, portalCode));
                    WriteLog.Instance.Write(string.Format("执行函数 IRAP.dbo.sfn_GetID_Portal,参数:" +
                                                          "PortalCode={0}", portalCode),
                                            strProcedureName);
                    #endregion

                    #region 执行数据库函数或存储过程
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        rlt = (int)conn.CallScalarFunc("IRAP.dbo.sfn_GetID_Portal", paramList);

                        errCode = 0;
                        errText = string.Format("调用成功,获得值: [{0}]", rlt);
                        WriteLog.Instance.Write(errText, strProcedureName);
                    }
                    #endregion
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP.dbo.sfn_GetID_Portal 时发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 指定时区地方时转换为Unix时间
        /// </summary>
        /// <returns>Unix时间 </returns>
        public IRAPJsonResult sfn_LocalToUnixTime(out int errCode, out string errText)
        {
            string strProcedureName = string.Format("{0}.{1}", className, MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            var localDateTime = DateTime.Now;
            int timeZone      = 8;
            int result        = 0;

            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@LocalDateTime", DbType.DateTime, localDateTime));
                paramList.Add(new IRAPProcParameter("@TimeZone", DbType.Int16, timeZone));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用函数 IRAP..sfn_LocalToUnixTime,参数:LocalDateTime={0}|TimeZone={1}", localDateTime, timeZone),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        result  = Convert.ToInt32(conn.CallScalarFunc("IRAP.dbo.sfn_LocalToUnixTime", paramList));
                        errCode = 0;
                        errText = "调用函数 IRAP..sfn_LocalToUnixTime成功";
                        WriteLog.Instance.Write(errText, strProcedureName);
                    }
                }
                catch (Exception ex)
                {
                    IRAPError errInfo = new IRAPError(9999, ex.Message);
                    errCode = 9999;
                    errText = string.Format("调用函数 IRAP..sfn_LocalToUnixTime异常:{0}", ex.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(ex.StackTrace, strProcedureName);
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
            return(Json(result));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取包装工位需要打印的标识串
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="correlationID">C64 关联号</param>
        /// <param name="ordinal">C64 包装行集序号</param>
        /// <param name="labelType">标签类型(3种)</param>
        /// <param name="nowTime">当前事件</param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult ufn_GetNextPackageSN(
            int communityID,
            int correlationID,
            int ordinal,
            string labelType,
            DateTime nowTime,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@CorrelationID", DbType.Int32, correlationID));
                paramList.Add(new IRAPProcParameter("@Ordinal", DbType.Int32, ordinal));
                paramList.Add(new IRAPProcParameter("@LabelType", DbType.String, labelType));
                paramList.Add(new IRAPProcParameter("@NowTime", DbType.DateTime, nowTime));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用函数 IRAPMES.dbo.ufn_GetNextPackageSN,参数:" +
                        "CommunityID={0}|CorrelationID={1}|Ordinal={2}|" +
                        "LabelType={3}|NowTime={4}|SysLogID={5}",
                        communityID,
                        correlationID,
                        ordinal,
                        labelType,
                        nowTime,
                        sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        string rlt =
                            (string)conn.CallScalarFunc(
                                "IRAPMES.dbo.ufn_GetNextPackageSN",
                                paramList);
                        errCode = 0;
                        errText = "调用成功!";
                        WriteLog.Instance.Write(errText, strProcedureName);
                        return(Json(rlt));
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText =
                        string.Format(
                            "调用 IRAPMES.dbo.ufn_GetNextPackageSN 函数发生异常:{0}",
                            error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                    return(Json(""));
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取用户名及密码验证的结果(0:验证不通过;-1:信息站点未注册;>0:验证通过,返回社区标识号)
        /// </summary>
        /// <param name="userCode">用户代码</param>
        /// <param name="plainPWD">用户密码明码</param>
        /// <param name="veriCode">验证码,不需时传空串</param>
        /// <param name="stationID">验证站点或社区标识</param>
        public IRAPJsonResult sfn_UserPWDVerify(
            string userCode,
            string plainPWD,
            string veriCode,
            string stationID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@UserCode", DbType.String, userCode));
                paramList.Add(new IRAPProcParameter("@PlainPWD", DbType.String, plainPWD));
                paramList.Add(new IRAPProcParameter("@VeriCode", DbType.String, veriCode));
                paramList.Add(new IRAPProcParameter("@StationID", DbType.String, stationID));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用函数 IRAP.dbo.sfn_UserPWDVerify,参数:UserCode={0}|" +
                        "PlainPWD={1}|VeriCode={2}|StationID={3}",
                        userCode,
                        plainPWD,
                        veriCode,
                        stationID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        int rlt = (int)conn.CallScalarFunc("IRAP.dbo.sfn_UserPWDVerify", paramList);
                        if (rlt == -1)
                        {
                            errCode = -1;
                            errText =
                                string.Format(
                                    "站点[{0}]未注册!",
                                    stationID);
                        }
                        else
                        {
                            errCode = 0;
                            errText = "调用成功!";
                        }
                        WriteLog.Instance.Write(errText, strProcedureName);
                        return(Json(rlt));
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP.dbo.sfn_UserPWDVerify 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                    return(Json(0));
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 根据工位呼叫安灯记录计算工位停产时间(秒)
        /// [功能假定同一工位异常事件不重叠]
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t107LeafID">工位叶标识</param>
        /// <param name="periodBegin">期间开始时间</param>
        /// <param name="periodEnd">期间结束时间</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <returns>long[异常停产时间(s)]</returns>
        public IRAPJsonResult ufn_GetUnscheduledPDTofAWorkUnit(
            int communityID,
            int t107LeafID,
            DateTime periodBegin,
            DateTime periodEnd,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                long rlt = 0;

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.String, t107LeafID));
                paramList.Add(new IRAPProcParameter("@PeriodBegin", DbType.DateTime2, periodBegin));
                paramList.Add(new IRAPProcParameter("@PeriodEnd", DbType.DateTime2, periodEnd));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用函数 IRAPMES.dbo.ufn_GetUnscheduledPDTofAWorkUnit," +
                        "参数:CommunityID={0}|T107LeafID={1}|PeridoBegin={2}|" +
                        "PeriodEnd={3}|SysLogID={4}",
                        communityID, t107LeafID, periodBegin, periodEnd, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        rlt = (long)conn.CallScalarFunc(
                            "IRAPMES.dbo.ufn_GetUnscheduledPDTofAWorkUnit",
                            paramList);
                        if (rlt > -2147483648)
                        {
                            errCode = 0;
                            errText =
                                string.Format(
                                    "调用成功!获得 UnscheduledPDTofAWorkUnit={0}",
                                    rlt);
                            WriteLog.Instance.Write(errText, strProcedureName);
                        }
                        else
                        {
                            errCode = 99999;
                            errText = "未得到 UnscheduledPDTofAWorkUnit 的值";
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText =
                        string.Format(
                            "调用 IRAPMES.dbo.ufn_GetUnscheduledPDTofAWorkUnit 函数发生异常:{0}",
                            error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
                WriteLog.Instance.Write("");
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取指定在制品经过指定工位的次数
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t102LeafID">产品叶标识</param>
        /// <param name="t107LeafID">工位叶标识</param>
        /// <param name="wipCode">在制品主标识代码</param>
        public IRAPJsonResult ufn_GetWIPPassByTimes(
            int communityID,
            int t102LeafID,
            int t107LeafID,
            string wipCode,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                int rlt = 0;

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@T102LeafID", DbType.Int32, t102LeafID));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.Int32, t107LeafID));
                paramList.Add(new IRAPProcParameter("@WIPCode", DbType.String, wipCode));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用函数 IRAPMES.dbo.ufn_GetWIPPassByTimes,参数:" +
                        "CommunityID={0}|T102LeafID={1}|T107LeafID={2}|WIPCode={3}",
                        communityID,
                        t102LeafID,
                        t107LeafID,
                        wipCode),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        rlt =
                            (int)conn.CallScalarFunc(
                                "IRAPMES.dbo.ufn_GetWIPPassByTimes",
                                paramList);
                        if (rlt > -2147483648)
                        {
                            errCode = 0;
                            errText = string.Format("调用成功!获得 PassByTimes={0}", rlt);
                            WriteLog.Instance.Write(errText, strProcedureName);
                        }
                        else
                        {
                            errCode = 99999;
                            errText = "未得到 PassByTimes 的值";
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText =
                        string.Format(
                            "调用 IRAPMES.dbo.ufn_GetWIPPassByTimes 函数发生异常:{0}",
                            error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
                WriteLog.Instance.Write("");
            }
        }