Пример #1
0
        public void usp_ImportMaterialReq(
            int communityID,
            long importID,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                $"{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("@ImportID", DbType.Int64, importID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(
                    new IRAPProcParameter(
                        "@ErrCode",
                        DbType.Int32,
                        ParameterDirection.Output,
                        4));
                paramList.Add(
                    new IRAPProcParameter(
                        "@ErrText",
                        DbType.String,
                        ParameterDirection.Output,
                        400));
                WriteLog.Instance.Write(
                    "执行存储过程 IRAPDPA..usp_ImportMaterialReq,参数:" +
                    $"CommunityID={communityID}|ImportID={importID}|SysLogID={sysLogID}",
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn =
                           new IRAPSQLConnection(
                               TParams.Instance.DBConnectionStr))
                {
                    IRAPError error = conn.CallProc("IRAPDPA..usp_ImportMaterialReq", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    WriteLog.Instance.Write(
                        string.Format("({0}){1}", errCode, errText),
                        strProcedureName);
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAPDPA..usp_ImportMaterialReq 时发生异常:{0}", error.Message);
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #2
0
        /// <summary>
        /// 申请系统登录标识 , 必要时也获取短信验证码
        /// </summary>
        /// <remarks>
        /// UserCode        string          用户代码
        /// StationID       string          站点标识/社区标识
        /// 输出
        /// SysLogID        long            系统登录标识
        /// SMSVeriCode     string          短信验证码
        /// </remarks>
        /// <param name="userCode">用户代码</param>
        /// <param name="stationID">站点标识/社区标识</param>
        public IRAPJsonResult ssp_GetSysLogID(
            string userCode,
            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("@StationID", DbType.String, stationID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, ParameterDirection.Output, 8));
                paramList.Add(new IRAPProcParameter("@SMSVeriCode", DbType.String, ParameterDirection.Output, 10));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_GetSysLogID", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        Hashtable rlt = new Hashtable();
                        rlt = DBUtils.DBParamsToHashtable(paramList);

                        foreach (DictionaryEntry entry in rlt)
                        {
                            WriteLog.Instance.Write(
                                string.Format(
                                    "[{0}]=[{1}]",
                                    entry.Key,
                                    entry.Value),
                                strProcedureName);
                        }

                        return(Json(rlt));
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 ssp_GetSysLogID 函数发生异常:{0}", error.Message);
                    return(Json(new Hashtable()));
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #3
0
        /// <summary>
        /// 创建表
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t19LeafID">导入导出叶标识</param>
        /// <param name="treeID">导入关联树标识</param>
        /// <param name="txLeafID">导出导出关联树叶标识</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="blName"></param>
        /// <returns></returns>
        public IRAPJsonResult sfn_Get_ProcToCreateTBL(int communityID, int t19LeafID, int treeID, int txLeafID,
                                                      long sysLogID, string blName, out int errCode, out string errText)
        {
            string strProcedureName = string.Format("{0}.{1}", className, MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            List <IRAPError> data = new List <IRAPError>();

            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@T19LeafID", DbType.Int32, t19LeafID));
                paramList.Add(new IRAPProcParameter("@TreeID", DbType.Int32, treeID));
                paramList.Add(new IRAPProcParameter("@TxLeafID", DbType.Int32, txLeafID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 800));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用存储过程 IRAP..sfn_Get_ProcToCreateTBL," +
                        "参数:communityID={0}|t19LeafID={1}|treeID={2}|txLeafID={3}|sysLogID={4}|blName={5}",
                        communityID, t19LeafID, treeID, txLeafID, sysLogID, blName), strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        string strSQL = "IRAPDPA.." + blName;
                        var    err    = conn.CallProc(strSQL, ref paramList);
                        errCode = err.ErrCode;
                        errText = err.ErrText;
                        WriteLog.Instance.Write(errText, strProcedureName);
                        data.Add(err);
                    }
                }
                catch (Exception ex)
                {
                    IRAPError errInfo = new IRAPError(9999, ex.Message);
                    errCode = 9999;
                    errText = string.Format("创建table:{0}发生异常{1}", blName, ex.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(ex.StackTrace, strProcedureName);
                    data.Add(errInfo);
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
            return(Json(data));
        }
Пример #4
0
        /// <summary>
        /// 生产开始
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t216LeafID">产品叶标识</param>
        /// <param name="t107LeafID">工位叶标识</param>
        /// <param name="t131LeafID">材质</param>
        /// <param name="operatorCode">操作工代码</param>
        /// <param name="batchNumber">熔次号</param>
        /// <param name="rSFactXML">工艺参数XML</param>
        /// <RSFact>
        ///   <RF25 Ordinal="" T102LeafID="" T216LeafID="" WIPCode="" LotNumber="" Texture="" PWONo="" BatchLot="" Qty="" Scale="" />
        /// </RSFact>
        /// <param name="sysLogID">系统登录标识</param>
        /// <returns></returns>
        public IRAPJsonResult usp_SaveFact_SmeltBatchProductionStart(int communityID, int t216LeafID, int t107LeafID, int t131LeafID,
                                                                     string operatorCode, string batchNumber, string rSFactXML, 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("@T216LeafID", DbType.Int64, t216LeafID));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.Int32, t107LeafID));
                paramList.Add(new IRAPProcParameter("@T131LeafID", DbType.Int32, t131LeafID));
                paramList.Add(new IRAPProcParameter("@OperatorCode", DbType.String, operatorCode));
                paramList.Add(new IRAPProcParameter("@BatchNumber", DbType.String, batchNumber));
                paramList.Add(new IRAPProcParameter("@RSFactXML", DbType.String, rSFactXML));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format("执行存储过程 " +
                                  "IRAPMES..usp_SaveFact_SmeltBatchProductionStart,参数:" +
                                  "CommunityID={0}|T216LeafID={1}|T107LeafID={2}|T131LeafID={3}|OperatorCode={4}|BatchNumber={5}|RSFactXML={6}" +
                                  "|SysLogID={7}",
                                  communityID, t216LeafID, t107LeafID, t131LeafID, operatorCode, batchNumber, rSFactXML, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error = conn.CallProc("IRAPMES..usp_SaveFact_SmeltBatchProductionStart", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    WriteLog.Instance.Write(string.Format("({0}){1}", errCode, errText), strProcedureName);

                    return(Json(""));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAPMES..usp_SaveFact_SmeltBatchProductionStart 时发生异常:{0}", error.Message);
                return(Json(""));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #5
0
        public IRAPJsonResult ssp_ModiPWD(
            int communityID,
            string userCode,
            string oldPassword,
            string newPassword,
            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("@UserCode", DbType.String, userCode));
                paramList.Add(new IRAPProcParameter("@OldPWD", DbType.String, oldPassword));
                paramList.Add(new IRAPProcParameter("@NewPWD", DbType.String, newPassword));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format("执行存储过程 IRAP..ssp_ModiPWD,参数:" +
                                  "CommunityID={0}|UserCode={1}|OldPWD={2}|NewPWD={3}",
                                  communityID, userCode, oldPassword, newPassword),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error = conn.CallProc("IRAP..ssp_ModiPWD", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;

                    return(Json(""));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAP..ssp_ModiPWD 时发生异常:{0}", error.Message);
                return(Json(""));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #6
0
        /// <summary>
        /// 功能站点注册
        /// </summary>
        /// <param name="stationID">站点编号</param>
        /// <param name="communityID">社区标识</param>
        /// <param name="funcGroupID">功能组标识</param>
        /// <param name="templateSTN">模板站点号</param>
        public IRAPJsonResult ssp_RegistStation(string stationID, int communityID, int funcGroupID, string templateSTN, 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("@StationID", DbType.String, stationID));
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@FuncGroupID", DbType.Int32, funcGroupID));
                paramList.Add(new IRAPProcParameter("@TemplateSTN", DbType.String, templateSTN));
                WriteLog.Instance.Write(string.Format("执行存储过程 IRAP..ssp_RegistStation,参数:StationID={0}|" +
                                                      "CommunityID={1}|FuncGroupID={2}|TemplateSTN={3}",
                                                      stationID, communityID, funcGroupID, templateSTN),
                                        strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error = conn.CallProc("IRAP..ssp_RegistStation", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception err)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAP..ssp_RegistStation 函数发生异常:{0}", err.Message);
                return(Json(new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #7
0
        /// <summary>
        /// 调用加载存储过程
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t19LeafID">导入导出叶标识</param>
        /// <param name="treeID">导入关联树标识</param>
        /// <param name="txLeafID">导出导出关联树叶标识</param>
        /// <param name="importLogID"></param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="blName"></param>
        /// <param name="loadName">验证存储过程名</param>
        /// <param name="IncludeAll">是否导入全量</param>
        /// <param name="MigrateImportLog">加载后是否迁移导入日志</param>
        /// <param name="isLoad">是否是加载</param>
        /// <returns></returns>
        public IRAPJsonResult ProcOnLoad(int communityID, int t19LeafID, int treeID, int txLeafID, long importLogID, long sysLogID,
                                         string blName, string loadName, int isLaodAll, int isLoadLog, bool isLoad, out int errCode, out string errText)
        {
            string strProcedureName = string.Format("{0}.{1}", className, MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);

            DataTable dt = new DataTable("grid");

            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@communityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@t19LeafID", DbType.Int32, t19LeafID));
                paramList.Add(new IRAPProcParameter("@treeID", DbType.Int32, treeID));
                paramList.Add(new IRAPProcParameter("@txLeafID", DbType.Int32, txLeafID));
                paramList.Add(new IRAPProcParameter("@importLogID", DbType.Int64, importLogID));
                paramList.Add(new IRAPProcParameter("@blName", DbType.String, blName));
                paramList.Add(new IRAPProcParameter("@sysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 8));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 800));
                if (isLoad)
                {
                    paramList.Add(new IRAPProcParameter("@isLaodAll", DbType.Boolean, isLaodAll));
                    paramList.Add(new IRAPProcParameter("@MigrateImportLog ", DbType.Boolean, isLoadLog));
                    WriteLog.Instance.Write(
                        string.Format(
                            "调用存储过程{0},参数:communityID={1}|t19LeafID={2}|treeID={3}|txLeafID={4}|importLogID={5}|blName={6}|sysLogID={7}|isLaodAll={8}|isLoadLog={9}",
                            loadName, communityID, t19LeafID, treeID, txLeafID, importLogID, blName, sysLogID, isLaodAll, isLoadLog), strProcedureName);
                }
                else
                {
                    WriteLog.Instance.Write(
                        string.Format(
                            "调用存储过程{0},参数:communityID={1}|t19LeafID={2}|treeID={3}|txLeafID={4}|importLogID={5}|blName={6}|sysLogID={7}",
                            loadName, communityID, t19LeafID, treeID, txLeafID, importLogID, blName, sysLogID), strProcedureName);
                }
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        var err = conn.CallProc("IRAPDPA.." + loadName + "", ref paramList);
                        errCode = 0;
                        errText = string.Format("调用存储过程{0}成功", loadName);
                        WriteLog.Instance.Write(errText, strProcedureName);

                        dt = conn.QuerySQL(string.Format("select * from IRAPDPA..{0} where PartitioningKey={1} and ImportLogID={2}", blName, communityID * 10000, importLogID));
                        return(Json(dt));
                    }
                }
                catch (Exception ex)
                {
                    IRAPError errInfo = new IRAPError(9999, ex.Message);
                    errCode = 9999;
                    errText = string.Format("调用存储过程{0}异常:{1}", loadName, ex.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(ex.StackTrace, strProcedureName);
                }


                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
            return(Json(dt));
        }
Пример #8
0
        /// <summary>
        /// 变更正在生产中的炉次绑定生产工单
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="batchNumber">熔次号</param>
        /// <param name="opType">操作类别:A-新增;D-删除</param>
        /// <param name="pwoNo">生产工单号</param>
        /// <param name="moNumber">制造订单号</param>
        /// <param name="moLineNo">制造订单行号</param>
        /// <param name="t102Code">产品物料号</param>
        /// <param name="linkedFactID">关联事实号</param>
        /// <param name="t131Code">材质</param>
        /// <param name="qty">计划数量</param>
        /// <param name="plateNo">型板号</param>
        /// <param name="batchLot">容次号</param>
        /// <param name="machineModelling">造型机台号</param>
        /// <param name="foldNumber">叠数</param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult usp_SaveChangeFact_SmeltBatchProduction(
            int communityID,
            string batchNumber,
            string opType,
            string pwoNo,
            string moNumber,
            int moLineNo,
            string t102Code,
            long linkedFactID,
            string t131Code,
            long qty,
            string plateNo,
            string batchLot,
            string machineModelling,
            int foldNumber,
            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("@BatchNumber", DbType.String, batchNumber));
                paramList.Add(new IRAPProcParameter("@OpType", DbType.String, opType));
                paramList.Add(new IRAPProcParameter("@PWONo", DbType.String, pwoNo));
                paramList.Add(new IRAPProcParameter("@MONumber", DbType.String, moNumber));
                paramList.Add(new IRAPProcParameter("@MOLineNo", DbType.Int32, moLineNo));
                paramList.Add(new IRAPProcParameter("@T102Code", DbType.String, t102Code));
                paramList.Add(new IRAPProcParameter("@LinkedFactID", DbType.Int64, linkedFactID));
                paramList.Add(new IRAPProcParameter("@T131Code", DbType.String, t131Code));
                paramList.Add(new IRAPProcParameter("@Qty", DbType.Int64, qty));
                paramList.Add(new IRAPProcParameter("@PlateNo", DbType.String, plateNo));
                paramList.Add(new IRAPProcParameter("@BatchLot", DbType.String, batchLot));
                paramList.Add(new IRAPProcParameter("@MachineModelling", DbType.String, machineModelling));
                paramList.Add(new IRAPProcParameter("@FoldNumber", DbType.Int32, foldNumber));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "执行存储过程 IRAPMES..usp_SaveChangeFact_SmeltBatchProduction,参数:" +
                        "CommunityID={0}|BatchNumber={1}|OpType={2}|" +
                        "PWONo={3}|MONumber={4}|MOLineNo={5}|T102Code={6}|" +
                        "LinkedFactID={7}|T131Code={8}|Qty={9}|PlateNo={10}|" +
                        "BatchLot={11}|MachineModelling={12}|FoldNumber={13}|" +
                        "SysLogID={14}",
                        communityID, batchNumber, opType, pwoNo, moNumber,
                        moLineNo, t102Code, linkedFactID, t131Code,
                        qty, plateNo, batchLot, machineModelling,
                        foldNumber, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc("IRAPMES..usp_SaveChangeFact_SmeltBatchProduction", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_SaveChangeFact_SmeltBatchProduction 函数发生异常:{0}",
                        error.Message);
                return(Json(
                           new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText,
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #9
0
        /// <summary>
        /// 修改批次管理系统中的生产过程参数
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="linkedFactID">保存关联事实号</param>
        /// <param name="t216LeafID">产品叶标识</param>
        /// <param name="t107LeafID">工位叶标识</param>
        /// <param name="batchNumber">炉次号</param>
        /// <param name="rsFactXML">
        /// 工单信息列表
        /// [RSFact]
        ///     [RF25
        ///         Ordinal=""
        ///         T20LeafID=""
        ///         ParameterName=""
        ///         LowLimit=""
        ///         Criterion=""
        ///         HighLimit=""
        ///         Scale=""
        ///         UnitOfMeasure=""
        ///         Metric01="" /]
        /// [/RSFact]
        /// </param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>Hashtable</returns>
        public IRAPJsonResult usp_SaveFact_BatchMethodParams_Modify(
            int communityID,
            long linkedFactID,
            int t216LeafID,
            int t107LeafID,
            string batchNumber,
            string rsFactXML,
            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("@LinkedFactID", DbType.Int64, linkedFactID));
                paramList.Add(new IRAPProcParameter("@T216LeafID", DbType.Int32, t216LeafID));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.Int32, t107LeafID));
                paramList.Add(new IRAPProcParameter("@BatchNumber", DbType.String, batchNumber));
                paramList.Add(new IRAPProcParameter("@RSFactXML", DbType.String, rsFactXML));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    "执行存储过程 IRAPMES..usp_SaveFact_BatchMethodParams_Modify," +
                    $"参数:CommunityID={communityID}|LinkedFactID={linkedFactID}|" +
                    $"T216LeafID={t216LeafID}|T107LeafID={t107LeafID}|" +
                    $"BatchNumber={batchNumber}|RSFactXML={rsFactXML}|" +
                    $"SysLogID={sysLogID}",
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc(
                            "IRAPMES..usp_SaveFact_BatchMethodParams_Modify",
                            ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;

                    Hashtable rtnParams = new Hashtable();
                    if (errCode == 0)
                    {
                        foreach (IRAPProcParameter param in paramList)
                        {
                            if (param.Direction == ParameterDirection.InputOutput ||
                                param.Direction == ParameterDirection.Output)
                            {
                                if (param.DbType == DbType.Int32 && param.Value == DBNull.Value)
                                {
                                    rtnParams.Add(param.ParameterName.Replace("@", ""), 0);
                                }
                                else
                                {
                                    rtnParams.Add(param.ParameterName.Replace("@", ""), param.Value);
                                }
                            }
                        }

                        string text = "";
                        foreach (string key in rtnParams.Keys)
                        {
                            text += $"{key}={rtnParams[key]}|";
                        }
                        WriteLog.Instance.Write($"返回参数:{text}", strProcedureName);
                    }
                    else
                    {
                        WriteLog.Instance.Write($"({errCode}){errText}", strProcedureName);
                    }

                    return(Json(rtnParams));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_SaveFact_BatchMethodParams_Modify 过程发生异常:{0}",
                        error.Message);
                WriteLog.Instance.Write($"({errCode}){errText}", strProcedureName);
                return(Json(new Hashtable()));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #10
0
        /// <summary>
        /// 向数据库注册当前用户准备使用的子系统
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="systemID">系统标识</param>
        /// <param name="progLanguageID">编程语言标识</param>
        /// <param name="isBSMode">是否 B/S 方式</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>
        /// [
        ///     MenuCacheID int: 菜单缓冲区标识
        /// ]
        /// </returns>
        public IRAPJsonResult ssp_OnSelectionASystem(
            int communityID,
            int systemID,
            int progLanguageID,
            bool isBSMode,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                Hashtable rlt = new Hashtable();

                #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("@ProgLanguageID", DbType.Int32, progLanguageID));
                paramList.Add(new IRAPProcParameter("@IsBSMode", DbType.Boolean, isBSMode));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@MenuCacheID", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用 IRAP..ssp_OnSelectionASystem,输入参数:" +
                        "CommunityID={0}|SystemID={1}|ProgLanguageID={2}|" +
                        "IsBSMode={3}|SysLogID={4}",
                        communityID, systemID, progLanguageID, isBSMode,
                        sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_OnSelectionASystem", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        foreach (IRAPProcParameter param in paramList)
                        {
                            if (param.Direction == ParameterDirection.InputOutput || param.Direction == ParameterDirection.Output)
                            {
                                rlt.Add(param.ParameterName.Replace("@", ""), param.Value);
                            }
                        }

                        foreach (DictionaryEntry entry in rlt)
                        {
                            WriteLog.Instance.Write(
                                string.Format(
                                    "[{0}]=[{1}]",
                                    entry.Key,
                                    entry.Value),
                                strProcedureName);
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP..ssp_OnSelectionASystem 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #11
0
        public IRAPJsonResult usp_SaveFact_Packaging(
            int communityID,
            long transactNo,
            long factID,
            int productLeaf,
            int workUnitLeaf,
            int packagingSpecNo,
            string wipPattern,
            int layerNumOfPallet,
            int cartonNumOfLayer,
            int layerNumOfCarton,
            int rowNumOfCarton,
            int colNumOfCarton,
            int layerNumOfBox,
            int rowNumOfBox,
            int colNumOfBox,
            string boxSerialNumber,
            string cartonSerialNumber,
            string layerSerialNumber,
            string palletSerialNumber,
            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.Clear();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@TransactNo", DbType.Int64, transactNo));
                paramList.Add(new IRAPProcParameter("@FactID", DbType.Int64, factID));
                paramList.Add(new IRAPProcParameter("@ProductLeaf", DbType.Int32, productLeaf));
                paramList.Add(new IRAPProcParameter("@WorkUnitLeaf", DbType.Int32, workUnitLeaf));
                paramList.Add(new IRAPProcParameter("@PackagingSpecNo", DbType.Byte, packagingSpecNo));
                paramList.Add(new IRAPProcParameter("@WIPPattern", DbType.String, wipPattern));
                paramList.Add(new IRAPProcParameter("@LayerNumOfPallet", DbType.Byte, layerNumOfPallet));
                paramList.Add(new IRAPProcParameter("@CartonNumOfLayer", DbType.Byte, cartonNumOfLayer));
                paramList.Add(new IRAPProcParameter("@LayerNumOfCarton", DbType.Byte, layerNumOfCarton));
                paramList.Add(new IRAPProcParameter("@RowNumOfCarton", DbType.Byte, rowNumOfCarton));
                paramList.Add(new IRAPProcParameter("@ColNumOfCarton", DbType.Byte, colNumOfCarton));
                paramList.Add(new IRAPProcParameter("@LayerNumOfBox", DbType.Byte, layerNumOfBox));
                paramList.Add(new IRAPProcParameter("@RowNumOfBox", DbType.Byte, rowNumOfBox));
                paramList.Add(new IRAPProcParameter("@ColNumOfBox", DbType.Byte, colNumOfBox));
                paramList.Add(new IRAPProcParameter("@BoxSerialNumber", DbType.String, boxSerialNumber));
                paramList.Add(new IRAPProcParameter("@CartonSerialNumber", DbType.String, cartonSerialNumber));
                paramList.Add(new IRAPProcParameter("@LayerSerialNumber", DbType.String, layerSerialNumber));
                paramList.Add(new IRAPProcParameter("@PalletSerialNumber", DbType.String, palletSerialNumber));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@OutputStr", DbType.Xml, ParameterDirection.Output, 2000));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用 IRAPMES..usp_SaveFact_Packaging,输入参数:" +
                        "CommunityID={0}|TransactNo={1}|FactID={2}|" +
                        "ProductLeaf={3}|WorkUnitLeaf={4}|PackagingSpecNo={5}|" +
                        "WIPPattern={6}|LayerNumOfPallet={7}|CartonNumOfLayer={8}|" +
                        "LayerNumOfCarton={9}|RowNumOfCarton={10}|ColNumOfCarton={11}|" +
                        "LayerNumOfBox={12}|RowNumOfBox={13}|ColNumOfBox={14}|" +
                        "BoxSerialNumber={15}|CartonSerialNumber={16}|LayerSerialNumber={17}|" +
                        "PalletSerialNumber={18}|SysLogID={19}",
                        communityID,
                        transactNo,
                        factID,
                        productLeaf,
                        workUnitLeaf,
                        packagingSpecNo,
                        wipPattern,
                        layerNumOfPallet,
                        cartonNumOfLayer,
                        layerNumOfCarton,
                        rowNumOfCarton,
                        colNumOfCarton,
                        layerNumOfBox,
                        rowNumOfBox,
                        colNumOfBox,
                        boxSerialNumber,
                        cartonSerialNumber,
                        layerSerialNumber,
                        palletSerialNumber,
                        sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error =
                            conn.CallProc("IRAPMES..usp_SaveFact_Packaging", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;
                        string outputStr = paramList[20].Value.ToString();
                        WriteLog.Instance.Write(
                            $"OutpuStr={outputStr}",
                            strProcedureName);
                        return(Json(outputStr));
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText =
                        string.Format(
                            "调用 IRAPMES..usp_SaveFact_Packaging 过程发生异常:{0}",
                            error.Message);
                    return(Json(
                               new IRAPError()
                    {
                        ErrCode = errCode,
                        ErrText = errText,
                    }));
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #12
0
        public IRAPJsonResult usp_CancelDeliverMaterual(
            int communityID,
            long pwoIssuingFactID,
            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("@PWOIssuingFactID", DbType.Int64, pwoIssuingFactID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    "执行存储过程 IRAPMES..usp_CancelDeliverMaterual," +
                    $"参数:CommunityID={communityID}|PWOIssuingFactID={pwoIssuingFactID}",
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc(
                            "IRAPMES..usp_CancelDeliverMaterual",
                            ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;

                    Hashtable rtnParams = new Hashtable();
                    if (errCode == 0)
                    {
                        foreach (IRAPProcParameter param in paramList)
                        {
                            if (param.Direction == ParameterDirection.InputOutput ||
                                param.Direction == ParameterDirection.Output)
                            {
                                if (param.DbType == DbType.Int32 && param.Value == DBNull.Value)
                                {
                                    rtnParams.Add(param.ParameterName.Replace("@", ""), 0);
                                }
                                else
                                {
                                    rtnParams.Add(param.ParameterName.Replace("@", ""), param.Value);
                                }
                            }
                        }

                        string text = "";
                        foreach (string key in rtnParams.Keys)
                        {
                            text += $"{key}={rtnParams[key]}|";
                        }
                        WriteLog.Instance.Write($"返回参数:{text}", strProcedureName);
                    }
                    else
                    {
                        WriteLog.Instance.Write($"({errCode}){errText}", strProcedureName);
                    }

                    return(Json(rtnParams));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_CancelDeliverMaterual 过程发生异常:{0}",
                        error.Message);
                WriteLog.Instance.Write($"({errCode}){errText}", strProcedureName);
                return(Json(new Hashtable()));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #13
0
        /// <summary>
        /// 登录 IRAP 平台
        /// 1、校验用户名、用户密码、验证码集信息站点的合法性
        /// 2、校验通过时写系统登录日志,取得用户及站点的有关信息
        /// </summary>
        /// <param name="dbName">数据库名</param>
        /// <param name="userCode">用户代码</param>
        /// <param name="plainPWD">登录密码</param>
        /// <param name="veriCode">验证码</param>
        /// <param name="stationID">站点标识</param>
        /// <param name="ipAddress">IP 地址</param>
        /// <param name="agencyLeaf">登录机构叶标识</param>
        /// <param name="roleLeaf">登录角色叶标识</param>
        /// <param name="sysLogID">系统登录标识(可预先获取)</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>
        /// [
        ///     UserName string: 用户姓名
        ///     NickName string: 用户昵称
        ///     SysLogID long: 系统登录标识
        ///     LanguageID int: 语言标识
        ///     OPHoneNo string: 办公电话
        ///     HPhoneNo string: 住宅电话
        ///     MPhoneNo string: 移动电话
        ///     AgencyID int: 机构标识
        ///     AgencyName string: 机构名称
        ///     HostName string: 主机名
        /// ]
        /// </returns>
        public IRAPJsonResult ssp_Login(
            string dbName,
            string userCode,
            string plainPWD,
            string veriCode,
            string stationID,
            string ipAddress,
            int agencyLeaf,
            int roleLeaf,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            string userName   = "";
            string nickName   = "";
            int    languageID = 30;
            string oPhoneNo   = "";
            string hPhoneNo   = "";
            string mPhoneNo   = "";
            int    agencyID   = 0;
            string hostName   = "";

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@DBName", DbType.String, dbName));
                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));
                paramList.Add(new IRAPProcParameter("@IPAddress", DbType.String, ipAddress));
                paramList.Add(new IRAPProcParameter("@AgencyLeaf", DbType.Int32, agencyLeaf));
                paramList.Add(new IRAPProcParameter("@RoleLeaf", DbType.Int32, roleLeaf));
                paramList.Add(new IRAPProcParameter("@UserName", DbType.String, ParameterDirection.Output, 40));
                paramList.Add(new IRAPProcParameter("@NickName", DbType.String, ParameterDirection.Output, 40));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, ParameterDirection.InputOutput, 8)
                {
                    Value = sysLogID,
                });
                paramList.Add(new IRAPProcParameter("@LanguageID", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@OPhoneNo", DbType.String, ParameterDirection.Output, 20));
                paramList.Add(new IRAPProcParameter("@HPhoneNo", DbType.String, ParameterDirection.Output, 20));
                paramList.Add(new IRAPProcParameter("@MPhoneNo", DbType.String, ParameterDirection.Output, 20));
                paramList.Add(new IRAPProcParameter("@AgencyID", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@AgencyName", DbType.String, ParameterDirection.Output, 100));
                paramList.Add(new IRAPProcParameter("@HostName", DbType.String, ParameterDirection.Output, 30));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format("执行存储过程 IRAP..ssp_Login,参数:" +
                                  "DBName={0}|UserCode={1}|PlainPWD={2}|VeriCode={3}" +
                                  "StationID={4}|IPAddress={5}|AgencyLeaf={6}|" +
                                  "RoleLeaf={7}|SysLogID={8}",
                                  dbName, userCode, plainPWD, veriCode, stationID,
                                  ipAddress, agencyLeaf, roleLeaf, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error = conn.CallProc("IRAP..ssp_Login", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    WriteLog.Instance.Write(
                        string.Format(
                            "({0}){1}",
                            errCode,
                            errText),
                        strProcedureName);

                    Hashtable rtnParams = new Hashtable();
                    rtnParams = DBUtils.DBParamsToHashtable(paramList);

                    foreach (DictionaryEntry entry in rtnParams)
                    {
                        WriteLog.Instance.Write(
                            string.Format(
                                "[{0}]=[{1}]",
                                entry.Key,
                                entry.Value),
                            strProcedureName);
                    }

                    return(Json(rtnParams));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAP..ssp_Login 时发生异常:{0}", error.Message);
                return(Json(new Hashtable()));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #14
0
        /// <summary>
        /// 万能表单统一防错入口
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="ctrlParameter1">个性功能号</param>
        /// <param name="ctrlParameter2">选项一标识</param>
        /// <param name="ctrlParameter3">选项二标识</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="strParameter1">字串参数1</param>
        /// <param name="strParameter2">字串参数2</param>
        /// <param name="strParameter3">字串参数3</param>
        /// <param name="strParameter4">字串参数4</param>
        /// <param name="strParameter5">字串参数5</param>
        /// <param name="strParameter6">字串参数6</param>
        /// <param name="strParameter7">字串参数7</param>
        /// <param name="strParameter8">字串参数8</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>OutputStr</returns>
        public IRAPJsonResult ssp_PokaYoke_UDFForm(
            int communityID,
            int ctrlParameter1,
            int ctrlParameter2,
            int ctrlParameter3,
            long sysLogID,
            string strParameter1,
            string strParameter2,
            string strParameter3,
            string strParameter4,
            string strParameter5,
            string strParameter6,
            string strParameter7,
            string strParameter8,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                Hashtable rlt = new Hashtable();

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@CtrlParameter1", DbType.Int32, ctrlParameter1));
                paramList.Add(
                    new IRAPProcParameter(
                        "@CtrlParameter2",
                        DbType.Int32,
                        ParameterDirection.InputOutput,
                        4)
                {
                    Value = ctrlParameter2,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@CtrlParameter3",
                        DbType.Int32,
                        ParameterDirection.InputOutput,
                        4)
                {
                    Value = ctrlParameter3,
                });
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@OutputStr", DbType.String, ParameterDirection.Output, 2147483647));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 2147483647));
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter1",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter1,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter2",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter2,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter3",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter3,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter4",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter4,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter5",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter5,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter6",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter6,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter7",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter7,
                });
                paramList.Add(
                    new IRAPProcParameter(
                        "@StrParameter8",
                        DbType.String,
                        ParameterDirection.InputOutput,
                        128)
                {
                    Value = strParameter8,
                });
                WriteLog.Instance.Write(
                    string.Format(
                        "调用 IRAP..ssp_PokaYoke_UDFForm,输入参数:" +
                        "CommunityID={0}|CtrlParameter1={1}|CtrlParameter2={2}|" +
                        "CtrlParameter3={3}|SysLogID={4}|StrParameter1={5}|" +
                        "StrParameter2={6}|StrParameter3={7}|StrParameter4={8}|" +
                        "StrParameter5={9}|StrParameter6={10}|StrParameter7={11}|" +
                        "StrParameter8={12}",
                        communityID, ctrlParameter1, ctrlParameter2,
                        ctrlParameter3, sysLogID, strParameter1, strParameter2,
                        strParameter3, strParameter4, strParameter5, strParameter6,
                        strParameter7, strParameter8),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_PokaYoke_UDFForm", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        rlt = DBUtils.DBParamsToHashtable(paramList);

                        foreach (DictionaryEntry entry in rlt)
                        {
                            WriteLog.Instance.Write(
                                string.Format(
                                    "[{0}]=[{1}]",
                                    entry.Key,
                                    entry.Value),
                                strProcedureName);
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText =
                        string.Format(
                            "调用 IRAP..ssp_PokaYoke_UDFForm 函数发生异常:{0}",
                            error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #15
0
        /// <summary>
        /// 手动同步四班的订单
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="dstT173LeafID">目标产线代码</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns></returns>
        public IRAPJsonResult usp_ManualMODispatch(
            int communityID,
            int dstT173LeafID,
            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("@DstT173LeafID", DbType.Int32, dstT173LeafID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "执行存储过程 IRAPAPS..usp_ManualMODispatch,参数:" +
                        "CommunityID={0}|DstT173LeafID={1}|SysLogID={2}",
                        communityID, dstT173LeafID, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc("IRAPAPS..usp_ManualMODispatch", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPAPS..usp_ManualMODispatch 过程发生异常:{0}",
                        error.Message);
                return(Json(
                           new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText,
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #16
0
        /// <summary>
        /// 保存理化检验中的检验值
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="factID">关联事实号</param>
        /// <param name="optype">操作类型</param>
        /// <param name="t102LeafID">产品叶标识</param>
        /// <param name="t107LeafID">工位叶标识</param>
        /// <param name="batchNumber">容次号</param>
        /// <param name="lotNumber">生产批次号</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns></returns>
        public IRAPJsonResult usp_SaveFact_SmeltBatchManualInspecting(
            int communityID,
            long factID,
            string opType,
            int t102LeafID,
            int t107LeafID,
            string batchNumber,
            string lotNumber,
            string rsFactXML,
            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("@FactID", DbType.Int64, factID));
                paramList.Add(new IRAPProcParameter("@OpType", DbType.String, opType));
                paramList.Add(new IRAPProcParameter("@T102LeafID", DbType.Int32, t102LeafID));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.Int32, t107LeafID));
                paramList.Add(new IRAPProcParameter("@BatchNumber", DbType.String, batchNumber));
                paramList.Add(new IRAPProcParameter("@LotNumber", DbType.String, lotNumber));
                paramList.Add(new IRAPProcParameter("@RSFactXML", DbType.Xml, rsFactXML));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "执行存储过程 IRAPMES..usp_SaveFact_SmeltBatchManualInspecting,参数:" +
                        "CommunityID={0}|FactID={1}|OpType={2}|T102LeafID={3}|T107LeafID={4}|" +
                        "BatchNumber={5}|LotNumber={6}|RSFactXML={7}|SysLogID={8}",
                        communityID, factID, opType, t102LeafID, t107LeafID, batchNumber, lotNumber, rsFactXML,
                        sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc("IRAPMES..usp_SaveFact_SmeltBatchManualInspecting", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_SaveFact_SmeltBatchManualInspecting 函数发生异常:{0}",
                        error.Message);
                return(Json(
                           new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText,
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #17
0
        /// <summary>
        /// 保存人工外观检查事实记录,记录失效模式清单
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="transactNo">申请到的交易号</param>
        /// <param name="factID">申请到的事实编号</param>
        /// <param name="productLeaf">产品叶标识(T102LeafID)</param>
        /// <param name="workUnitLeaf">工位叶标识(T107LeafID)</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="barCode">产品条码</param>
        /// <param name="scrapCode">失效模式代码清单</param>
        public IRAPJsonResult usp_SaveFact_Inspecting(
            int communityID,
            long transactNo,
            long factID,
            int productLeaf,
            int workUnitLeaf,
            long sysLogID,
            string barCode,
            string scrapCode,
            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("@TransactNo", DbType.Int64, transactNo));
                paramList.Add(new IRAPProcParameter("@FactID", DbType.Int64, factID));
                paramList.Add(new IRAPProcParameter("@ProductLeaf", DbType.Int32, productLeaf));
                paramList.Add(new IRAPProcParameter("@WorkUnitLeaf", DbType.Int32, workUnitLeaf));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@BarCode", DbType.String, barCode));
                paramList.Add(new IRAPProcParameter("@ScrapCode", DbType.String, scrapCode));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "执行存储过程 IRAPMES..usp_SaveFact_Inspecting,参数:CommunityID={0}|" +
                        "TransactNo={1}|FactID={2}|ProductLeaf={3}|WorkUnitLeaf={4}|" +
                        "SysLogID={5}|Barcode={6}|ScrapCode={7}|",
                        communityID, transactNo, factID, productLeaf, workUnitLeaf,
                        sysLogID, barCode, scrapCode),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc("IRAPMES..usp_SaveFact_Inspecting", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_SaveFact_Inspecting 函数发生异常:{0}",
                        error.Message);
                return(Json(
                           new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText,
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #18
0
        /// <summary>
        /// 申请序列号
        /// ⒈ 申请预定义序列的一个或多个序列号;
        /// ⒉ 如果序列是交易号的,自动写交易日志。
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="sequenceCode">序列代码</param>
        /// <param name="count">申请序列值个数</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="opNode">业务操作节点列表</param>
        /// <param name="voucherNo">业务凭证号</param>
        /// <returns>申请到的第一个序列值[long]</returns>
        private void ssp_GetSequenceNo(
            int communityID,
            string sequenceCode,
            int count,
            long sysLogID,
            string opNode,
            string voucherNo,
            ref long sequenceNo,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

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

                Hashtable rlt = new Hashtable();
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@SequenceCode", DbType.String, sequenceCode));
                paramList.Add(new IRAPProcParameter("@Count", DbType.Int32, count));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@OpNode", DbType.String, opNode));
                paramList.Add(new IRAPProcParameter("@VoucherNo", DbType.String, voucherNo));
                paramList.Add(new IRAPProcParameter("@SequenceNo", DbType.Int64, ParameterDirection.Output, 8));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用 IRAP..ssp_GetSequenceNo,输入参数:" +
                        "CommunityID={0}|SequenceCode={1}|Count={2}|SysLogID={3}" +
                        "OpNode={4}|VoucherNo={5}",
                        communityID, sequenceCode, count, sysLogID, opNode, voucherNo),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_GetSequenceNo", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        rlt = DBUtils.DBParamsToHashtable(paramList);
                        if (rlt["SequenceNo"] != null)
                        {
                            sequenceNo = (long)rlt["SequenceNo"];
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP..ssp_GetSequenceNo 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #19
0
        public IRAPJsonResult usp_UploadMO(
            int communityID,
            long importID,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                $"{className}.{MethodBase.GetCurrentMethod().Name}";

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                Hashtable rlt = new Hashtable();

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@ImportID", DbType.Int64, importID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    "调用 IRAPDPA..usp_UploadMO,输入参数:" +
                    $"CommunityID={communityID}|ImportID={importID}|" +
                    $"SysLogID={sysLogID}",
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error =
                            conn.CallProc(
                                "IRAPDPA..usp_UploadMO",
                                ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        rlt = DBUtils.DBParamsToHashtable(paramList);
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText =
                        string.Format(
                            "调用 IRAPDPA..usp_UploadMO 函数发生异常:{0}",
                            error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #20
0
        /// <summary>
        /// 设置统计过程控制中 XBar-R 图的上下控制线
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="c1ID">产品工位关联标识</param>
        /// <param name="t47LeafID">SPC控制图标识号:373564-彩虹图;373565-XBarR图</param>
        /// <param name="lcl">XBar 控制线下限</param>
        /// <param name="ucl">XBar 控制线上限</param>
        /// <param name="rlcl">R 控制线下限</param>
        /// <param name="rucl">R 控制线上限</param>
        /// <param name="rbar">R 的均值</param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult usp_WriteLog_SPCCtrlLineSet(
            int communityID,
            int c1ID,
            int t47LeafID,
            long lcl,
            long ucl,
            long rlcl,
            long rucl,
            long rbar,
            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("@C1ID", DbType.Int32, c1ID));
                paramList.Add(new IRAPProcParameter("@T47LeafID", DbType.Int32, t47LeafID));
                paramList.Add(new IRAPProcParameter("@LCL", DbType.Int64, lcl));
                paramList.Add(new IRAPProcParameter("@UCL", DbType.Int64, ucl));
                paramList.Add(new IRAPProcParameter("@RLCL", DbType.Int64, rlcl));
                paramList.Add(new IRAPProcParameter("@RUCL", DbType.Int64, rucl));
                paramList.Add(new IRAPProcParameter("@RBar", DbType.Int64, rbar));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "执行存储过程 IRAPMES..usp_WriteLog_SPCCtrlLineSet,参数:CommunityID={0}|" +
                        "C1ID={1}|T47LeafID={2}|LCL={3}|UCL={4}|RLCL={5}|RUCL={6}|RBar={7}|SysLogID={8}",
                        communityID, c1ID, t47LeafID, lcl, ucl, rlcl, rucl, rbar, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc("IRAPMES..usp_WriteLog_SPCCtrlLineSet", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_WriteLog_SPCCtrlLineSet 函数发生异常:{0}",
                        error.Message);
                return(Json(
                           new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText,
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #21
0
        /// <summary>
        /// 保存停线记录
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="transactNo">申请到的交易号</param>
        /// <param name="factID">申请到的事实编号(新发起时新申请,复核时传递未关闭的停线事件)</param>
        /// <param name="resourceTreeID">工作中心传211,生产线传134</param>
        /// <param name="resourceLeafID">工作中心或产线叶标识</param>
        /// <param name="eventFactIDs">关联安灯事件点击流 (发起新事件时传空)</param>
        /// <param name="andonEventID">关联的安灯事件FactID</param>
        /// <param name="t144LeafID">停线记录根源原因</param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult usp_SaveFact_StopEvent(
            int communityID,
            long transactNo,
            long factID,
            int resourceTreeID,
            int resourceLeafID,
            string eventFactIDs,
            int t144LeafID,
            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("@TransactNo", DbType.Int64, transactNo));
                paramList.Add(new IRAPProcParameter("@FactID", DbType.Int64, factID));
                paramList.Add(new IRAPProcParameter("@ResourceTreeID", DbType.Int32, resourceTreeID));
                paramList.Add(new IRAPProcParameter("@ResourceLeafID", DbType.Int32, resourceLeafID));
                paramList.Add(new IRAPProcParameter("@EventFactIDs", DbType.String, eventFactIDs));
                paramList.Add(new IRAPProcParameter("@T144LeafID", DbType.Int32, t144LeafID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(
                    new IRAPProcParameter(
                        "@ErrCode",
                        DbType.Int32,
                        ParameterDirection.Output,
                        4));
                paramList.Add(
                    new IRAPProcParameter(
                        "@ErrText",
                        DbType.String,
                        ParameterDirection.Output,
                        400));
                WriteLog.Instance.Write(
                    string.Format("执行存储过程 " +
                                  "IRAPFVS..usp_SaveFact_StopEvent,参数:" +
                                  "CommunityID={0}|TransactNo={1}|FactID={2}|ResourceTreeID={3}|" +
                                  "ResourceLeafID={4}|EventFactIDs={5}|T144LeafID={6}|SysLogID={7}",
                                  communityID, transactNo, factID, resourceTreeID,
                                  resourceLeafID, eventFactIDs, t144LeafID, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error = conn.CallProc("IRAPFVS..usp_SaveFact_StopEvent", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    WriteLog.Instance.Write(
                        string.Format("({0}){1}", errCode, errText),
                        strProcedureName);

                    return(Json(""));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAPFVS..usp_SaveFact_StopEvent 时发生异常:{0}", error.Message);
                return(Json(""));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #22
0
        /// <summary>
        /// 在制品路由控制
        /// ⒈ 支持个体可追溯产品个体或群体标识代码的路由控制;
        /// ⒉ 支持批次可追溯产品在制品容器标识的路由控制;
        /// ⒊ 支持在路由终点直接下线到在制品线边库位(如果有线边库位);
        /// ⒋ 支持在路由终点直接下线到在制品缓冲区的收料库位(如果没有线边库位)。
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t102LeafID">产品叶标识</param>
        /// <param name="wipPattern">在制品标识样式</param>
        /// <param name="lotNumber">在制品批次</param>
        /// <param name="containerNo">在制品容器号</param>
        /// <param name="pwoNo">生产工单号</param>
        /// <param name="qcStatus">在制品质量状态</param>
        /// <param name="t107LeafID">当前滞在工序叶标识</param>
        /// <param name="routingCondition">路由条件控制值</param>
        public IRAPJsonResult usp_WIPForward(
            int communityID,
            int t102LeafID,
            string wipPattern,
            string lotNumber,
            string containerNo,
            string pwoNo,
            long qcStatus,
            int t107LeafID,
            long routingCondition,
            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("@T102LeafID", DbType.Int32, t102LeafID));
                paramList.Add(new IRAPProcParameter("@WIPPattern", DbType.String, wipPattern));
                paramList.Add(new IRAPProcParameter("@LotNumber", DbType.String, lotNumber));
                paramList.Add(new IRAPProcParameter("@ContainerNo", DbType.String, containerNo));
                paramList.Add(new IRAPProcParameter("@PWONo", DbType.String, pwoNo));
                paramList.Add(new IRAPProcParameter("@QCStatus", DbType.Int64, qcStatus));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.Int32, t107LeafID));
                paramList.Add(new IRAPProcParameter("@RoutingCondition", DbType.Int64, routingCondition));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "执行存储过程 IRAPMES..usp_WIPForward,参数:CommunityID={0}|" +
                        "T102LeafID={1}|WIPPattern={2}|LotNumber={3}|ContainerNo={4}|" +
                        "PWONo={5}|QCStatus={6}|T107LeafID={7}|RoutingCondition={8}|" +
                        "SysLogID={9}",
                        communityID, t102LeafID, wipPattern, lotNumber, containerNo,
                        pwoNo, qcStatus, t107LeafID, routingCondition, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error =
                        conn.CallProc("IRAPMES..usp_WIPForward", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    return(Json(error));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText =
                    string.Format(
                        "调用 IRAPMES..usp_WIPForward 函数发生异常:{0}",
                        error.Message);
                return(Json(
                           new IRAPError()
                {
                    ErrCode = errCode,
                    ErrText = errText,
                }));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #23
0
        /// <summary>
        /// 替换交易操作员
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="transactNo">交易号</param>
        /// <param name="operatorUserCode">替换后的交易操作员号</param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult ssp_ReplaceTranOperator(
            int communityID,
            long transactNo,
            string operatorUserCode,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                Hashtable rlt = new Hashtable();

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@TransactNo", DbType.Int64, transactNo));
                paramList.Add(new IRAPProcParameter("@OperatorUserCode", DbType.String, operatorUserCode));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用 IRAP..ssp_ReplaceTranOperator,输入参数:" +
                        "CommunityID={0}|TransactNo={1}|OperatorUserCode={2}" +
                        "|SysLogID={3}",
                        communityID, transactNo, operatorUserCode, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_ReplaceTranOperator", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        rlt = DBUtils.DBParamsToHashtable(paramList);

                        foreach (DictionaryEntry entry in rlt)
                        {
                            WriteLog.Instance.Write(
                                string.Format(
                                    "[{0}]=[{1}]",
                                    entry.Key,
                                    entry.Value),
                                strProcedureName);
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP..ssp_OLTP_UDFForm 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #24
0
        /// <summary>
        /// 申请系统登录标识 , 必要时也获取短信验证码
        /// </summary>
        /// <remarks>
        /// UserCode        string          用户代码
        /// StationID       string          站点标识/社区标识
        /// 输出
        /// SysLogID        long            系统登录标识
        /// SMSVeriCode     string          短信验证码
        /// </remarks>
        /// <param name="userCode">用户代码</param>
        /// <param name="stationID">站点标识/社区标识</param>
        public long ssp_GetSysLogID(
            string userCode,
            string stationID,
            out string smsVeriCode,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                $"{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("@StationID", DbType.String, stationID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, ParameterDirection.Output, 8));
                paramList.Add(new IRAPProcParameter("@SMSVeriCode", DbType.String, ParameterDirection.Output, 10));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    "执行存储过程 IRAP..ssp_GetSysLogID," +
                    $"参数:UserCode={userCode}|StationID={stationID}",
                    strProcedureName);
                #endregion

                long sysLogID = 0;
                smsVeriCode = "";

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn =
                               new IRAPSQLConnection(
                                   TParams.Instance.DBConnectionStr))
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_GetSysLogID", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;

                        foreach (IDataParameter param in paramList)
                        {
                            if (param.ParameterName == "@SysLogID")
                            {
                                if (param.Value != DBNull.Value)
                                {
                                    sysLogID = (long)param.Value;
                                }
                            }
                            else if (param.ParameterName == "@SMSVeriCode")
                            {
                                if (param.Value != DBNull.Value)
                                {
                                    smsVeriCode = param.Value.ToString();
                                }
                            }
                        }
                        WriteLog.Instance.Write(
                            $"SysLogID=({sysLogID})|SMSVeriCode=({smsVeriCode})",
                            strProcedureName);

                        return(sysLogID);
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 ssp_GetSysLogID 函数发生异常:{0}", error.Message);
                    return(sysLogID);
                }
                #endregion
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #25
0
        /// <summary>
        /// 根据输入参数描述的属性,记录运行的功能
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <param name="menuItemID">点中的菜单项</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>
        /// [
        ///     ScenarioIndex int: 返回的应用情景
        ///     RefreshGUIOptions bool: 是否刷新界面选择
        /// ]
        /// </returns>
        public IRAPJsonResult ssp_RunAFunction(
            int communityID,
            long sysLogID,
            int menuItemID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                Hashtable rlt = new Hashtable();

                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, communityID));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(new IRAPProcParameter("@MenuItemID", DbType.Int32, menuItemID));
                paramList.Add(new IRAPProcParameter("@ScenarioIndex", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@RefreshGUIOptions", DbType.Boolean, ParameterDirection.Output, 1));
                paramList.Add(new IRAPProcParameter("@UserDefinedGUI", DbType.String, ParameterDirection.Output, DBConfigParams.StringMaxLength));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format(
                        "调用 IRAP..ssp_RunAFunction,输入参数:" +
                        "CommunityID={0}|SysLogID={1}|MenuItemID={2}",
                        communityID, sysLogID, menuItemID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn = new IRAPSQLConnection())
                    {
                        IRAPError error = conn.CallProc("IRAP..ssp_RunAFunction", ref paramList);
                        errCode = error.ErrCode;
                        errText = error.ErrText;
                        WriteLog.Instance.Write(errText, strProcedureName);

                        rlt = DBUtils.DBParamsToHashtable(paramList);

                        foreach (DictionaryEntry entry in rlt)
                        {
                            WriteLog.Instance.Write(
                                string.Format(
                                    "[{0}]=[{1}]",
                                    entry.Key,
                                    entry.Value),
                                strProcedureName);
                        }
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("调用 IRAP..ssp_RunAFunction 函数发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion

                return(Json(rlt));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #26
0
        /// <summary>
        /// 登录 IRAP 平台
        /// 1、校验用户名、用户密码、验证码集信息站点的合法性
        /// 2、校验通过时写系统登录日志,取得用户及站点的有关信息
        /// </summary>
        /// <param name="dbName">数据库名</param>
        /// <param name="userCode">用户代码</param>
        /// <param name="plainPWD">登录密码</param>
        /// <param name="veriCode">验证码</param>
        /// <param name="stationID">站点标识</param>
        /// <param name="ipAddress">IP 地址</param>
        /// <param name="agencyLeaf">登录机构叶标识</param>
        /// <param name="roleLeaf">登录角色叶标识</param>
        /// <param name="sysLogID">系统登录标识(可预先获取)</param>
        /// <param name="errCode"></param>
        /// <param name="errText"></param>
        /// <returns>
        /// [
        ///     UserName string: 用户姓名
        ///     NickName string: 用户昵称
        ///     SysLogID long: 系统登录标识
        ///     LanguageID int: 语言标识
        ///     OPHoneNo string: 办公电话
        ///     HPhoneNo string: 住宅电话
        ///     MPhoneNo string: 移动电话
        ///     AgencyID int: 机构标识
        ///     AgencyName string: 机构名称
        ///     HostName string: 主机名
        /// ]
        /// </returns>
        public void ssp_Login(
            string dbName,
            string userCode,
            string plainPWD,
            string veriCode,
            string stationID,
            string ipAddress,
            int agencyLeaf,
            int roleLeaf,
            ref string userName,
            ref string nickName,
            ref long sysLogID,
            ref int languageID,
            ref string oPhoneNo,
            ref string hPhoneNo,
            ref string mPhoneNo,
            ref int agencyID,
            ref string agencyName,
            ref string hostName,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                $"{className}.{MethodBase.GetCurrentMethod().Name}";

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                #region 创建数据库调用参数组,并赋值
                IList <IDataParameter> paramList = new List <IDataParameter>();
                paramList.Add(new IRAPProcParameter("@DBName", DbType.String, dbName));
                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));
                paramList.Add(new IRAPProcParameter("@IPAddress", DbType.String, ipAddress));
                paramList.Add(new IRAPProcParameter("@AgencyLeaf", DbType.Int32, agencyLeaf));
                paramList.Add(new IRAPProcParameter("@RoleLeaf", DbType.Int32, roleLeaf));
                paramList.Add(new IRAPProcParameter("@UserName", DbType.String, ParameterDirection.Output, 40));
                paramList.Add(new IRAPProcParameter("@NickName", DbType.String, ParameterDirection.Output, 40));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, ParameterDirection.InputOutput, 8)
                {
                    Value = sysLogID,
                });
                paramList.Add(new IRAPProcParameter("@LanguageID", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@OPhoneNo", DbType.String, ParameterDirection.Output, 20));
                paramList.Add(new IRAPProcParameter("@HPhoneNo", DbType.String, ParameterDirection.Output, 20));
                paramList.Add(new IRAPProcParameter("@MPhoneNo", DbType.String, ParameterDirection.Output, 20));
                paramList.Add(new IRAPProcParameter("@AgencyID", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@AgencyName", DbType.String, ParameterDirection.Output, 100));
                paramList.Add(new IRAPProcParameter("@HostName", DbType.String, ParameterDirection.Output, 30));
                paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    "执行存储过程 IRAP..ssp_Login,参数:" +
                    $"DBName={dbName}|UserCode={userCode}|PlainPWD={plainPWD}|" +
                    $"VeriCode={veriCode}|StationID={stationID}|IPAddress={ipAddress}|" +
                    $"AgencyLeaf={agencyLeaf}|RoleLeaf={roleLeaf}|SysLogID={sysLogID}",
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn =
                           new IRAPSQLConnection(
                               TParams.Instance.DBConnectionStr))
                {
                    IRAPError error = conn.CallProc("IRAP..ssp_Login", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    WriteLog.Instance.Write(
                        string.Format(
                            "({0}){1}",
                            errCode,
                            errText),
                        strProcedureName);

                    foreach (IDataParameter param in paramList)
                    {
                        switch (param.ParameterName)
                        {
                        case "@UserName":
                            if (param.Value != DBNull.Value)
                            {
                                userName = (string)param.Value;
                            }
                            break;

                        case "@NickName":
                            if (param.Value != DBNull.Value)
                            {
                                nickName = (string)param.Value;
                            }
                            break;

                        case "@SysLogID":
                            if (param.Value != DBNull.Value)
                            {
                                sysLogID = (long)param.Value;
                            }
                            break;

                        case "@LanguageID":
                            if (param.Value != DBNull.Value)
                            {
                                languageID = (int)param.Value;
                            }
                            break;

                        case "@OPhoneNo":
                            if (param.Value != DBNull.Value)
                            {
                                oPhoneNo = (string)param.Value;
                            }
                            break;

                        case "@HPhoneNo":
                            if (param.Value != DBNull.Value)
                            {
                                hPhoneNo = (string)param.Value;
                            }
                            break;

                        case "@MPhoneNo":
                            if (param.Value != DBNull.Value)
                            {
                                mPhoneNo = (string)param.Value;
                            }
                            break;

                        case "@AgencyID":
                            if (param.Value != DBNull.Value)
                            {
                                agencyID = (int)param.Value;
                            }
                            break;

                        case "@AgencyName":
                            if (param.Value != DBNull.Value)
                            {
                                agencyName = (string)param.Value;
                            }
                            break;

                        case "@HostName":
                            if (param.Value != DBNull.Value)
                            {
                                hostName = (string)param.Value;
                            }
                            break;
                        }
                    }
                    WriteLog.Instance.Write(
                        $"UserName=({userName})|NickName=({nickName})|" +
                        $"SysLogID=({sysLogID})|LanguageID=({languageID})|" +
                        $"OPhoneNo=({oPhoneNo})|HPhoneNo=({hPhoneNo})|" +
                        $"MPhoneNo=({mPhoneNo})|AgencyID=({agencyID})|" +
                        $"AgencyName=({agencyName})|HostName=({hostName})",
                        strProcedureName);
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAP..ssp_Login 时发生异常:{0}", error.Message);
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #27
0
        /// <summary>
        /// 操作工技能放错
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="t102LeafID">产品叶标识</param>
        /// <param name="t107LeafID">工位叶标识</param>
        /// <param name="pokaYokeMode">
        /// 放错方式:
        /// 1-按工序员工技能放错;
        /// 2-按产品族+工序技能放错;
        /// 3-按产品+工序技能放错。
        /// </param>
        /// <param name="sysLogID">系统登录标识</param>
        public IRAPJsonResult usp_PokaYoke_OperatorSkill(
            int communityID,
            int t102LeafID,
            int t107LeafID,
            int pokaYokeMode,
            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("@T102LeafID", DbType.Int32, t102LeafID));
                paramList.Add(new IRAPProcParameter("@T107LeafID", DbType.Int32, t107LeafID));
                paramList.Add(new IRAPProcParameter("@PokaYokeMode", DbType.Int32, pokaYokeMode));
                paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, sysLogID));
                paramList.Add(
                    new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                paramList.Add(
                    new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));
                WriteLog.Instance.Write(
                    string.Format("执行存储过程 IRAPMES..usp_PokaYoke_OperatorSkill,参数:" +
                                  "CommunityID={0}|T102LeafID={1}|T107LeafID={2}|PokaYokeMode={3}|" +
                                  "SysLogID={4}",
                                  communityID, t102LeafID, t107LeafID, pokaYokeMode, sysLogID),
                    strProcedureName);
                #endregion

                #region 执行数据库函数或存储过程
                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    IRAPError error = conn.CallProc("IRAPMES..usp_PokaYoke_OperatorSkill", ref paramList);
                    errCode = error.ErrCode;
                    errText = error.ErrText;
                    WriteLog.Instance.Write(
                        string.Format(
                            "({0}){1}",
                            errCode,
                            errText),
                        strProcedureName);

                    Hashtable rtnParams = new Hashtable();
                    if (errCode == 0)
                    {
                        foreach (IRAPProcParameter param in paramList)
                        {
                            if (param.Direction == ParameterDirection.InputOutput || param.Direction == ParameterDirection.Output)
                            {
                                if (param.DbType == DbType.Int32 && param.Value == DBNull.Value)
                                {
                                    rtnParams.Add(param.ParameterName.Replace("@", ""), 0);
                                }
                                else
                                {
                                    rtnParams.Add(param.ParameterName.Replace("@", ""), param.Value);
                                }
                            }
                        }
                    }

                    return(Json(rtnParams));
                }
                #endregion
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = string.Format("调用 IRAPMES..usp_PokaYoke_OperatorSkill 时发生异常:{0}", error.Message);
                return(Json(new Hashtable()));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Пример #28
0
        /// <summary>
        /// 处理当前的日志
        /// </summary>
        public void Do()
        {
            if (ShowEditorDialogs())
            {
                string newXMLString =
                    (ExChange[0] as IXMLNodeObject).GetXMLString();

                TEntityCustomLog logWait4Exec = null;
                if (ErrCode != 0 && !Retried)
                {
                    // 当前日志的最新待重试记录
                    try
                    {
                        TWaitting.Instance.ShowWaitForm("获取最新待重试记录");
                        logWait4Exec =
                            DAL.TDBHelper.GetLastUnsuccessedLogWithLinkedLogID(LinkedLogID);
                    }
                    catch (Exception error)
                    {
                        TWaitting.Instance.CloseWaitForm();
                        MSGHelp.Instance.ShowErrorMessage(error);
                        return;
                    }
                }
                else
                {
                    logWait4Exec = this;
                }

                if (logWait4Exec == null)
                {
                    Exception error = new Exception();
                    error.Data["ErrCode"] = 999999;
                    error.Data["ErrText"] = "当前待处理的日志已经被批量作业处理成功";

                    TWaitting.Instance.CloseWaitForm();
                    MSGHelp.Instance.ShowErrorMessage(error);
                }
                else
                {
                    using (IRAPSQLConnection conn =
                               new IRAPSQLConnection(SysParams.Instance.DBConnectionString))
                    {
                        try
                        {
                            TWaitting.Instance.ShowWaitForm("更新日志记录");
                            logWait4Exec.ExChangeXML =
                                (ExChange[0] as IXMLNodeObject).GetXMLString();

                            IList <IDataParameter> paramList = new List <IDataParameter>();
                            paramList.Add(new IRAPProcParameter("@ExChangeXML", DbType.Xml, newXMLString));
                            paramList.Add(new IRAPProcParameter("@LogID", DbType.Int64, LogID));

                            conn.Update(
                                "UPDATE IRAP..stb_Log_WebServiceShuttling " +
                                "SET ExChangeXML=@ExChangeXML " +
                                "WHERE LogID=@LogID",
                                paramList);
                        }
                        catch (Exception error)
                        {
                            error.Data["ErrCode"] = 999999;
                            error.Data["ErrText"] =
                                string.Format(
                                    "更新日志记录时发生异常:[{0}]",
                                    error.Message);
                            TWaitting.Instance.CloseWaitForm();
                            MSGHelp.Instance.ShowErrorMessage(error);

                            return;
                        }

                        int    errCode = 0;
                        string errText = "";

                        try
                        {
                            TWaitting.Instance.ShowWaitForm("调用 WebService");
                            IList <IDataParameter> paramList = new List <IDataParameter>();
                            paramList.Add(new IRAPProcParameter("@CommunityID", DbType.Int32, 60010));
                            paramList.Add(new IRAPProcParameter("@SysLogID", DbType.Int64, 1));
                            paramList.Add(new IRAPProcParameter("@WSSLogID", DbType.Int64, logWait4Exec.LogID));
                            paramList.Add(new IRAPProcParameter("@ErrCode", DbType.Int32, ParameterDirection.Output, 4));
                            paramList.Add(new IRAPProcParameter("@ErrText", DbType.String, ParameterDirection.Output, 400));

                            IRAPError error =
                                conn.CallProc("IRAP..ssp_BackgroundJob_WSRetry", ref paramList);
                            errCode = error.ErrCode;
                            errText = error.ErrText;

                            if (errCode != 0)
                            {
                                MSGHelp.Instance.ShowErrorMessage(errText);
                                return;
                            }
                        }
                        catch (Exception error)
                        {
                            error.Data["ErrCode"] = 999999;
                            error.Data["ErrText"] =
                                string.Format(
                                    "执行 IRAP..ssp_BackgroundJob_WSRetry 时发生异常:[{0}]",
                                    error.Message);
                            TWaitting.Instance.CloseWaitForm();
                            MSGHelp.Instance.ShowErrorMessage(error);

                            return;
                        }

                        try
                        {
                            TWaitting.Instance.ShowWaitForm("获取执行结果");

                            IList <TEntityCustomLog> datas =
                                conn.CallTableFunc <TEntityCustomLog>(
                                    string.Format(
                                        "SELECT TOP 1 * FROM IRAP..stb_Log_WebServiceShuttling " +
                                        "WHERE LinkedLogID={0} ORDER BY LogID DESC",
                                        logWait4Exec.LinkedLogID),
                                    new List <IDataParameter>());
                            if (datas.Count > 0)
                            {
                                logWait4Exec = datas[0];
                            }
                            else
                            {
                                logWait4Exec = null;
                            }

                            if (logWait4Exec != null)
                            {
                                if (logWait4Exec.ErrCode == 0)
                                {
                                    //MSGHelp.Instance.ShowNormalMessage("手工处理成功,稍后进行后续处理");
                                    AfterExecute(logWait4Exec);
                                }
                                else
                                {
                                    MSGHelp.Instance.ShowErrorMessage(
                                        logWait4Exec.ErrCode,
                                        logWait4Exec.ErrText);
                                }
                            }
                            else
                            {
                                MSGHelp.Instance.ShowErrorMessage("未获取到执行的结果");
                            }
                        }
                        catch (Exception error)
                        {
                            MSGHelp.Instance.ShowErrorMessage(error);
                        }
                    }
                }
            }
        }