コード例 #1
0
        /// <summary>
        /// Carga los parametros de un SP.-
        /// </summary>
        /// <param name="pSP">StoreProcedure</param>
        /// <param name="pDattSPs">DataTable con los parametros.-</param>
        private void SetParameters(StoreProcedure pSP, DataTable pDattSPs)
        {
            SPParameter wParameter = null;

            if (pDattSPs.Rows.Count > 0)
            {
                foreach (DataRow wDtrParameter in pDattSPs.Rows)
                {
                    if (wDtrParameter[3].ToString().ToUpper() != "@RETURN_VALUE")
                    {
                        wParameter = new SPParameter();

                        wParameter.Name = wDtrParameter["COLUMN_NAME"].ToString().Replace("@", String.Empty);
                        wParameter.Type = wDtrParameter["TYPE_NAME"].ToString();
                        //wSPParametro.DbSqlType = wDtrParameter[6];
                        wParameter.Length     = Convert.ToInt32(wDtrParameter["LENGTH"]);
                        wParameter.ParamOrder = Convert.ToInt32(wDtrParameter["ORDINAL_POSITION"]);
                        wParameter.Collation  = string.Empty;
                        if (Convert.ToBoolean(wDtrParameter["NULLABLE"]) == true)
                        {
                            wParameter.Nullable = true;
                        }
                        wParameter.Prec = Convert.ToInt32(wDtrParameter["PRECISION"]);

                        wParameter.Direction = SPParameter.GetDirecction(Convert.ToInt32(wDtrParameter["COLUMN_TYPE"]));

                        pSP.Parameters.Add(wParameter);
                    }
                }
            }
        }
コード例 #2
0
 private void tvwChilds_AfterCheck(object sender, TreeViewEventArgs e)
 {
     if (e.Node == null)
     {
         return;
     }
     if (e.Node.Level == 0)
     {
         StoreProcedure wStoreProcedure = _StoreProcedures.GetStoreProcedure(e.Node.Text);
         wStoreProcedure.Checked = e.Node.Checked;
         if (wStoreProcedure.IsParametersLoaded == false)
         {
             TreeViewHelper.FillParameters(e.Node, wStoreProcedure);
             base.OnSelectObjectEvent();
         }
         this.tvwChilds.AfterCheck  -= new System.Windows.Forms.TreeViewEventHandler(this.tvwChilds_AfterCheck);
         this.tvwChilds.BeforeCheck -= new TreeViewCancelEventHandler(this.tvwChilds_BeforeCheck);
         TreeViewHelper.UncheckChildNodes(e.Node);
         this.tvwChilds.AfterCheck  += new System.Windows.Forms.TreeViewEventHandler(this.tvwChilds_AfterCheck);
         this.tvwChilds.BeforeCheck += new TreeViewCancelEventHandler(this.tvwChilds_BeforeCheck);
     }
     if (e.Node.Level == 1)
     {
         SPParameter wSPParameter = _SelectedStoreProcedure.Parameters.GetSPParameter(e.Node.Tag.ToString());
         wSPParameter.Selected = e.Node.Checked;
         if (!TreeViewHelper.HasSelectedNodes(e.Node.Parent))
         {
             e.Node.Parent.Checked = false;
         }
     }
 }
コード例 #3
0
 public bool UpdateSupplyState(SupplyInfo currentSupplyInfo)
 {
     var spa = TransactionScopeManager[Global.THOK_STOCK_DB_NAME].NewSPAccesser();
     IList<SPParameter> @params = new List<SPParameter>();
     SPParameter sPParameter1 = new SPParameter("product_code", ParameterDirection.Input, currentSupplyInfo.ProductCode);
     SPParameter sPParameter2 = new SPParameter("quantity", ParameterDirection.Input, currentSupplyInfo.Quantity);
     @params.Add(sPParameter1);
     @params.Add(sPParameter2);
     IDictionary<string, object> outVals = new Dictionary<string, object>();
     //todo:存储过程未实现;
     spa.ExecuteNoneQuery("pro_update_supply_Info", @params, out outVals);
     return true;
 }
コード例 #4
0
        public bool UpdateSupplyState(SupplyInfo currentSupplyInfo)
        {
            var spa = TransactionScopeManager[Global.THOK_STOCK_DB_NAME].NewSPAccesser();
            IList <SPParameter> @params      = new List <SPParameter>();
            SPParameter         sPParameter1 = new SPParameter("product_code", ParameterDirection.Input, currentSupplyInfo.ProductCode);
            SPParameter         sPParameter2 = new SPParameter("quantity", ParameterDirection.Input, currentSupplyInfo.Quantity);

            @params.Add(sPParameter1);
            @params.Add(sPParameter2);
            IDictionary <string, object> outVals = new Dictionary <string, object>();

            //todo:存储过程未实现;
            spa.ExecuteNoneQuery("pro_update_supply_Info", @params, out outVals);
            return(true);
        }
コード例 #5
0
        /// <summary>
        /// Setea los parametros de un StoreProcedure determinado
        /// </summary>
        /// <param name="pSP">StoreProcedure</param>
        private void SetParameterToStoreProcedure(StoreProcedure pSP)
        {
            //Si estan cargados los parametros no hacer nada .-
            if (pSP.IsParametersLoaded)
            {
                return;
            }

            DataSet wDts = GetParametersFromStoredProcedure(pSP.Name);



            if (wDts.Tables[0].Rows.Count > 0)
            {
                pSP.IsParametersLoaded = true;

                foreach (DataRow wDtrParameter in wDts.Tables[0].Rows)
                {
                    if (wDtrParameter[3].ToString().ToUpper() != "@RETURN_VALUE")
                    {
                        SPParameter wSPParametro = new SPParameter();

                        wSPParametro.Name = wDtrParameter["COLUMN_NAME"].ToString().Replace("@", String.Empty);
                        wSPParametro.Type = wDtrParameter["TYPE_NAME"].ToString();
                        //wSPParametro.DbSqlType	= wDtrParameter[6];
                        wSPParametro.Length     = Convert.ToInt32(wDtrParameter["LENGTH"]);
                        wSPParametro.ParamOrder = Convert.ToInt32(wDtrParameter["ORDINAL_POSITION"]);
                        wSPParametro.Collation  = String.Empty;
                        if (Convert.ToBoolean(wDtrParameter["NULLABLE"]) == true)
                        {
                            wSPParametro.Nullable = true;
                        }
                        wSPParametro.Prec = Convert.ToInt32(wDtrParameter["PRECISION"]);

                        wSPParametro.Direction = SPParameter.GetDirecction(Convert.ToInt32(wDtrParameter["COLUMN_TYPE"]));

                        pSP.Parameters.Add(wSPParametro);
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Carga los parametros de un SP.-
        /// </summary>
        /// <param name="pSP">StoreProcedure</param>
        /// <param name="pDattSPs">DataTable con los parametros.-</param>
		private   void SetParameters(StoreProcedure pSP,DataTable pDattSPs)
		{
            SPParameter wParameter = null;
			if ( pDattSPs.Rows.Count >0)
			{
				foreach(DataRow wDtrParameter in pDattSPs.Rows)
				{
					if(wDtrParameter[3].ToString().ToUpper() != "@RETURN_VALUE")
					{
						wParameter = new SPParameter ();

						wParameter.Name = wDtrParameter["COLUMN_NAME"].ToString().Replace("@",String.Empty);
						wParameter.Type = wDtrParameter["TYPE_NAME"].ToString();
						//wSPParametro.DbSqlType = wDtrParameter[6];
						wParameter.Length =  Convert.ToInt32(wDtrParameter["LENGTH"]);
						wParameter.ParamOrder = Convert.ToInt32(wDtrParameter["ORDINAL_POSITION"]);
						wParameter.Collation = string.Empty ;
						if(Convert.ToBoolean (wDtrParameter["NULLABLE"]) == true)
							wParameter.Nullable = true;
						wParameter.Prec = Convert.ToInt32(wDtrParameter["PRECISION"]);
						
                        wParameter.Direction = SPParameter.GetDirecction(Convert.ToInt32(wDtrParameter["COLUMN_TYPE"]));

						pSP.Parameters.Add(wParameter);
					}

				}
								
			}
        }
コード例 #7
0
        /// <summary>
        /// Setea los parametros de un StoreProcedure determinado
        /// </summary>
        /// <param name="pSP">StoreProcedure</param>
		private  void SetParameterToStoreProcedure(StoreProcedure pSP)
		{
            //Si estan cargados los parametros no hacer nada .-
            if (pSP.IsParametersLoaded) return;

			DataSet wDts = GetParametersFromStoredProcedure(pSP.Name);

            

			if ( wDts.Tables[0].Rows.Count >0)
            {
                pSP.IsParametersLoaded = true;

				foreach(DataRow wDtrParameter in wDts.Tables[0].Rows)
				{
					if(wDtrParameter[3].ToString().ToUpper() != "@RETURN_VALUE")
					{
						SPParameter wSPParametro = new SPParameter ();

						wSPParametro.Name			= wDtrParameter["COLUMN_NAME"].ToString().Replace("@",String.Empty);
						wSPParametro.Type			= wDtrParameter["TYPE_NAME"].ToString();
						//wSPParametro.DbSqlType	= wDtrParameter[6];
						wSPParametro.Length			=  Convert.ToInt32(wDtrParameter["LENGTH"]);
						wSPParametro.ParamOrder		= Convert.ToInt32(wDtrParameter["ORDINAL_POSITION"]);
						wSPParametro.Collation		= String.Empty ;
						if(Convert.ToBoolean (wDtrParameter["NULLABLE"]) == true)
							wSPParametro.Nullable = true;
						wSPParametro.Prec			= Convert.ToInt32(wDtrParameter["PRECISION"]);

                        wSPParametro.Direction = SPParameter.GetDirecction(Convert.ToInt32(wDtrParameter["COLUMN_TYPE"]));

						pSP.Parameters.Add(wSPParametro);
					}

				}
								
			}
			
		

		}
コード例 #8
0
ファイル: TaskDal.cs プロジェクト: radtek/Automation.Plugins
        public TaskInfo GetNewTask(string proName, string srmName, int travelPos, int waitingTask, int[] waitTasks, string productCode = "")
        {
            var spa = TransactionScopeManager[Global.THOK_WCS_DB_NAME].NewSPAccesser();
            IList <SPParameter> @params      = new List <SPParameter>();
            SPParameter         sPParameter1 = new SPParameter("srm_name", ParameterDirection.Input, srmName);
            SPParameter         sPParameter2 = new SPParameter("travelPos", ParameterDirection.Input, travelPos);
            SPParameter         sPParameter3 = new SPParameter("waitingTask", ParameterDirection.Input, waitingTask);
            string strTaitingTasks           = "";

            if (waitTasks != null)
            {
                strTaitingTasks = "(";
                for (int i = 0; i < waitTasks.Length; i++)
                {
                    strTaitingTasks += string.Format("{0},0", waitTasks[i]);
                }
                strTaitingTasks += ")";
            }
            SPParameter sPParameter4 = new SPParameter("waitingTasks", ParameterDirection.Input, strTaitingTasks);
            SPParameter sPParameter5 = new SPParameter("product_code", ParameterDirection.Input, productCode);

            @params.Add(sPParameter1);
            @params.Add(sPParameter2);
            @params.Add(sPParameter3);
            @params.Add(sPParameter4);
            @params.Add(sPParameter5);

            IDictionary <string, object> outVals = new Dictionary <string, object>();
            var set = spa.ExecuteQuery(proName, @params, out outVals);

            if (set.Tables.Count == 1 && set.Tables[0].Rows.Count == 1)
            {
                var      row      = set.Tables[0].Rows[0];
                TaskInfo taskInfo = new TaskInfo();

                taskInfo.ID                = Convert.ToInt32(row["id"]);
                taskInfo.TaskType          = row["task_type"].ToString();
                taskInfo.OrderID           = row["order_id"].ToString();
                taskInfo.OrderType         = row["order_type"].ToString();
                taskInfo.AllotID           = Convert.ToInt32(row["allot_id"]);
                taskInfo.OriginCellCode    = row["origin_cell_code"].ToString();
                taskInfo.TargetCellCode    = row["target_cell_code"].ToString();
                taskInfo.OriginStorageCode = row["origin_storage_code"].ToString();
                taskInfo.TargetStorageCode = row["target_storage_code"].ToString();
                taskInfo.TaskQuantity      = Convert.ToInt32(row["task_quantity"]);

                taskInfo.Length = Convert.ToInt32(row["length"]);
                taskInfo.Width  = Convert.ToInt32(row["width"]);
                taskInfo.Height = Convert.ToInt32(row["height"]);

                taskInfo.TravelPos1 = Convert.ToInt32(row["travelPos1"]);
                taskInfo.LiftPos1   = Convert.ToInt32(row["liftPos1"]);
                taskInfo.TravelPos2 = Convert.ToInt32(row["travelPos2"]);
                taskInfo.LiftPos2   = Convert.ToInt32(row["liftPos2"]);

                taskInfo.CurrentPositionID        = Convert.ToInt32(row["currentPositionID"]);
                taskInfo.CurrentPositionName      = row["currentPositionName"].ToString();
                taskInfo.CurrentPositionType      = row["currentPositionType"].ToString();
                taskInfo.CurrentPositionExtension = Convert.ToInt32(row["currentPositionExtension"]);
                taskInfo.CurrentPositionState     = row["currentPositionState"].ToString();

                taskInfo.NextPositionID        = Convert.ToInt32(row["nextPositionID"]);
                taskInfo.NextPositionName      = row["nextPositionName"].ToString();
                taskInfo.NextPositionType      = row["nextPositionType"].ToString();
                taskInfo.NextPositionExtension = Convert.ToInt32(row["nextPositionExtension"]);

                taskInfo.EndPositionID   = Convert.ToInt32(row["endPositionID"]);
                taskInfo.EndPositionName = row["endPositionName"].ToString();
                taskInfo.EndPositionType = row["endPositionType"].ToString();

                taskInfo.State = row["state"].ToString();

                taskInfo.HasGetRequest = Convert.ToBoolean(row["has_get_request"]);
                taskInfo.HasPutRequest = Convert.ToBoolean(row["has_put_request"]);

                return(taskInfo);
            }
            return(null);
        }
コード例 #9
0
        public TaskInfo GetNewTask(string proName,string srmName,int travelPos,int waitingTask,int[] waitTasks,string productCode = "")
        {
            var spa = TransactionScopeManager[Global.THOK_WCS_DB_NAME].NewSPAccesser();
            IList<SPParameter> @params = new List<SPParameter>();
            SPParameter sPParameter1 = new SPParameter("srm_name",ParameterDirection.Input, srmName);
            SPParameter sPParameter2 = new SPParameter("travelPos", ParameterDirection.Input, travelPos);
            SPParameter sPParameter3 = new SPParameter("waitingTask", ParameterDirection.Input, waitingTask);
            string strTaitingTasks = "";
            if (waitTasks != null)
            {
                strTaitingTasks = "(";
                for (int i = 0; i < waitTasks.Length; i++)
                    strTaitingTasks += string.Format("{0},0", waitTasks[i]);
                strTaitingTasks += ")";
            }
            SPParameter sPParameter4 = new SPParameter("waitingTasks", ParameterDirection.Input, strTaitingTasks);
            SPParameter sPParameter5 = new SPParameter("product_code", ParameterDirection.Input, productCode);
            @params.Add(sPParameter1);
            @params.Add(sPParameter2);
            @params.Add(sPParameter3);
            @params.Add(sPParameter4);
            @params.Add(sPParameter5);

            IDictionary<string, object> outVals = new Dictionary<string, object>();
            var set = spa.ExecuteQuery(proName, @params, out outVals);
            
            if (set.Tables.Count == 1 && set.Tables[0].Rows.Count == 1)
            {
                var row = set.Tables[0].Rows[0];
                TaskInfo taskInfo = new TaskInfo();

                taskInfo.ID = Convert.ToInt32(row["id"]);
                taskInfo.TaskType = row["task_type"].ToString();
                taskInfo.OrderID = row["order_id"].ToString();
                taskInfo.OrderType = row["order_type"].ToString();
                taskInfo.AllotID = Convert.ToInt32(row["allot_id"]);
                taskInfo.OriginCellCode = row["origin_cell_code"].ToString();
                taskInfo.TargetCellCode = row["target_cell_code"].ToString();
                taskInfo.OriginStorageCode = row["origin_storage_code"].ToString();
                taskInfo.TargetStorageCode = row["target_storage_code"].ToString();
                taskInfo.TaskQuantity = Convert.ToInt32(row["task_quantity"]);

                taskInfo.Length = Convert.ToInt32(row["length"]);
                taskInfo.Width = Convert.ToInt32(row["width"]);
                taskInfo.Height = Convert.ToInt32(row["height"]);

                taskInfo.TravelPos1 = Convert.ToInt32(row["travelPos1"]);
                taskInfo.LiftPos1 = Convert.ToInt32(row["liftPos1"]);
                taskInfo.TravelPos2 = Convert.ToInt32(row["travelPos2"]);
                taskInfo.LiftPos2 = Convert.ToInt32(row["liftPos2"]);

                taskInfo.CurrentPositionID = Convert.ToInt32(row["currentPositionID"]);
                taskInfo.CurrentPositionName = row["currentPositionName"].ToString();
                taskInfo.CurrentPositionType = row["currentPositionType"].ToString();
                taskInfo.CurrentPositionExtension = Convert.ToInt32(row["currentPositionExtension"]);
                taskInfo.CurrentPositionState = row["currentPositionState"].ToString();

                taskInfo.NextPositionID = Convert.ToInt32(row["nextPositionID"]);
                taskInfo.NextPositionName = row["nextPositionName"].ToString();
                taskInfo.NextPositionType = row["nextPositionType"].ToString();
                taskInfo.NextPositionExtension = Convert.ToInt32(row["nextPositionExtension"]);

                taskInfo.EndPositionID = Convert.ToInt32(row["endPositionID"]);
                taskInfo.EndPositionName = row["endPositionName"].ToString();
                taskInfo.EndPositionType = row["endPositionType"].ToString();

                taskInfo.State = row["state"].ToString();

                taskInfo.HasGetRequest = Convert.ToBoolean(row["has_get_request"]);
                taskInfo.HasPutRequest = Convert.ToBoolean(row["has_put_request"]);

                return taskInfo;
            }
            return null;
        }