示例#1
0
        public int Update(OrderPickProductInfo model)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"update OrderPickProduct set StayQty = @StayQty,Qty = @Qty,StockLocations = @StockLocations,Status = @Status,LastUpdatedDate = @LastUpdatedDate 
			            where OrderPickId = @OrderPickId and OrderId = @OrderId and ProductId = @ProductId and CustomerId = @CustomerId
					    "                    );

            SqlParameter[] parms =
            {
                new SqlParameter("@OrderPickId",     SqlDbType.UniqueIdentifier),
                new SqlParameter("@OrderId",         SqlDbType.UniqueIdentifier),
                new SqlParameter("@ProductId",       SqlDbType.UniqueIdentifier),
                new SqlParameter("@CustomerId",      SqlDbType.UniqueIdentifier),
                new SqlParameter("@StayQty",         SqlDbType.Float),
                new SqlParameter("@Qty",             SqlDbType.Float),
                new SqlParameter("@StockLocations",  SqlDbType.VarChar),
                new SqlParameter("@Status",          SqlDbType.NVarChar,20),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value = model.OrderPickId;
            parms[1].Value = model.OrderId;
            parms[2].Value = model.ProductId;
            parms[3].Value = model.CustomerId;
            parms[4].Value = model.StayQty;
            parms[5].Value = model.Qty;
            parms[6].Value = model.StockLocations;
            parms[7].Value = model.Status;
            parms[8].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms));
        }
示例#2
0
        public int Insert(OrderPickProductInfo model)
        {
            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"insert into OrderPickProduct (OrderPickId,OrderId,ProductId,CustomerId,StayQty,Qty,StockLocations,Status,LastUpdatedDate)
			            values
						(@OrderPickId,@OrderId,@ProductId,@CustomerId,@StayQty,@Qty,@StockLocations,@Status,@LastUpdatedDate)
			            "            );

            SqlParameter[] parms =
            {
                new SqlParameter("@OrderPickId",     SqlDbType.UniqueIdentifier),
                new SqlParameter("@OrderId",         SqlDbType.UniqueIdentifier),
                new SqlParameter("@ProductId",       SqlDbType.UniqueIdentifier),
                new SqlParameter("@CustomerId",      SqlDbType.UniqueIdentifier),
                new SqlParameter("@StayQty",         SqlDbType.Float),
                new SqlParameter("@Qty",             SqlDbType.Float),
                new SqlParameter("@StockLocations",  SqlDbType.VarChar),
                new SqlParameter("@Status",          SqlDbType.NVarChar,20),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value = model.OrderPickId;
            parms[1].Value = model.OrderId;
            parms[2].Value = model.ProductId;
            parms[3].Value = model.CustomerId;
            parms[4].Value = model.StayQty;
            parms[5].Value = model.Qty;
            parms[6].Value = model.StockLocations;
            parms[7].Value = model.Status;
            parms[8].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms));
        }
示例#3
0
        public IList <OrderPickProductInfo> GetList()
        {
            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select OrderPickId,OrderId,ProductId,CustomerId,StayQty,Qty,StockLocations,Status,LastUpdatedDate 
			            from OrderPickProduct
					    order by LastUpdatedDate "                    );

            IList <OrderPickProductInfo> list = new List <OrderPickProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString()))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderPickProductInfo model = new OrderPickProductInfo();
                        model.OrderPickId     = reader.GetGuid(0);
                        model.OrderId         = reader.GetGuid(1);
                        model.ProductId       = reader.GetGuid(2);
                        model.CustomerId      = reader.GetGuid(3);
                        model.StayQty         = reader.GetDouble(4);
                        model.Qty             = reader.GetDouble(5);
                        model.StockLocations  = reader.GetString(6);
                        model.Status          = reader.GetString(7);
                        model.LastUpdatedDate = reader.GetDateTime(8);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#4
0
        public IList <OrderPickProductInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select count(*) from OrderPickProduct ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <OrderPickProductInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate) as RowNumber,
			          OrderPickId,OrderId,ProductId,CustomerId,StayQty,Qty,StockLocations,Status,LastUpdatedDate
					  from OrderPickProduct "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <OrderPickProductInfo> list = new List <OrderPickProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderPickProductInfo model = new OrderPickProductInfo();
                        model.OrderPickId     = reader.GetGuid(1);
                        model.OrderId         = reader.GetGuid(2);
                        model.ProductId       = reader.GetGuid(3);
                        model.CustomerId      = reader.GetGuid(4);
                        model.StayQty         = reader.GetDouble(5);
                        model.Qty             = reader.GetDouble(6);
                        model.StockLocations  = reader.GetString(7);
                        model.Status          = reader.GetString(8);
                        model.LastUpdatedDate = reader.GetDateTime(9);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#5
0
        public IList <OrderPickProductInfo> GetListByJoin(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb         = new StringBuilder(500);
            int           startIndex = (pageIndex - 1) * pageSize + 1;
            int           endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by opp.LastUpdatedDate desc) as RowNumber,
			            opp.OrderPickId,opp.OrderId,opp.ProductId,opp.CustomerId,opp.StayQty,opp.Qty,opp.StockLocations,opp.Status,opp.LastUpdatedDate
                        ,op.OrderCode,p.ProductCode,p.ProductName,c.Coded CustomerCode,c.Named CustomerName
                        from OrderPickProduct opp 
                        left join OrderPicked op on op.Id = opp.OrderPickId
                        left join Product p on p.Id = opp.ProductId
                        left join Customer c on c.Id = opp.CustomerId
                      ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            var list = new List <OrderPickProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    var slpBll = new StockLocationProduct();

                    while (reader.Read())
                    {
                        var model = new OrderPickProductInfo();
                        model.OrderPickId     = reader.GetGuid(1);
                        model.OrderId         = reader.GetGuid(2);
                        model.ProductId       = reader.GetGuid(3);
                        model.CustomerId      = reader.GetGuid(4);
                        model.StayQty         = reader.GetDouble(5);
                        model.Qty             = reader.GetDouble(6);
                        model.StockLocations  = reader.GetString(7);
                        model.Status          = reader.GetString(8);
                        model.LastUpdatedDate = reader.GetDateTime(9);

                        model.OrderCode      = reader.IsDBNull(10) ? "" : reader.GetString(10);
                        model.ProductCode    = reader.IsDBNull(11) ? "" : reader.GetString(11);
                        model.ProductName    = reader.IsDBNull(12) ? "" : reader.GetString(12);
                        model.CustomerCode   = reader.IsDBNull(13) ? "" : reader.GetString(13);
                        model.CustomerName   = reader.IsDBNull(14) ? "" : reader.GetString(14);
                        model.StockLocations = slpBll.GetNameByProductId(model.ProductId);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#6
0
        public IList <OrderPickProductInfo> GetListByJoin(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select opp.OrderPickId,opp.OrderId,opp.ProductId,opp.CustomerId,opp.StayQty,opp.Qty,opp.StockLocations,opp.Status,opp.LastUpdatedDate
                        ,op.OrderCode,p.ProductCode,p.ProductName,c.Coded CustomerCode,c.Named CustomerName                     
                        from OrderPickProduct opp 
                        left join OrderPicked op on op.Id = opp.OrderPickId
                        left join Product p on p.Id = opp.ProductId
                        left join Customer c on c.Id = opp.CustomerId ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.Append("order by LastUpdatedDate ");

            var list = new List <OrderPickProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderPickProductInfo model = new OrderPickProductInfo();
                        model.OrderPickId     = reader.GetGuid(0);
                        model.OrderId         = reader.GetGuid(1);
                        model.ProductId       = reader.GetGuid(2);
                        model.CustomerId      = reader.GetGuid(3);
                        model.StayQty         = reader.GetDouble(4);
                        model.Qty             = reader.GetDouble(5);
                        model.StockLocations  = reader.GetString(6);
                        model.Status          = reader.GetString(7);
                        model.LastUpdatedDate = reader.GetDateTime(8);

                        model.OrderCode    = reader.IsDBNull(9) ? "" : reader.GetString(9);
                        model.ProductCode  = reader.IsDBNull(10) ? "" : reader.GetString(10);
                        model.ProductName  = reader.IsDBNull(11) ? "" : reader.GetString(11);
                        model.CustomerCode = reader.IsDBNull(12) ? "" : reader.GetString(12);
                        model.CustomerName = reader.IsDBNull(13) ? "" : reader.GetString(13);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#7
0
        public OrderPickProductInfo GetModel(Guid orderPickId, Guid orderId, Guid productId, Guid customerId)
        {
            OrderPickProductInfo model = null;

            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select top 1 OrderPickId,OrderId,ProductId,CustomerId,StayQty,Qty,StockLocations,Status,LastUpdatedDate 
			            from OrderPickProduct
						where OrderPickId = @OrderPickId and OrderId = @OrderId and ProductId = @ProductId and CustomerId = @CustomerId "                        );
            SqlParameter[] parms =
            {
                new SqlParameter("@OrderPickId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@OrderId",     SqlDbType.UniqueIdentifier),
                new SqlParameter("@ProductId",   SqlDbType.UniqueIdentifier),
                new SqlParameter("@CustomerId",  SqlDbType.UniqueIdentifier)
            };
            parms[0].Value = orderPickId;
            parms[1].Value = orderId;
            parms[2].Value = productId;
            parms[3].Value = customerId;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms))
            {
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        model                 = new OrderPickProductInfo();
                        model.OrderPickId     = reader.GetGuid(0);
                        model.OrderId         = reader.GetGuid(1);
                        model.ProductId       = reader.GetGuid(2);
                        model.CustomerId      = reader.GetGuid(3);
                        model.StayQty         = reader.GetDouble(4);
                        model.Qty             = reader.GetDouble(5);
                        model.StockLocations  = reader.GetString(6);
                        model.Status          = reader.GetString(7);
                        model.LastUpdatedDate = reader.GetDateTime(8);
                    }
                }
            }

            return(model);
        }
示例#8
0
        public IList <OrderPickProductInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select OrderPickId,OrderId,ProductId,CustomerId,StayQty,Qty,StockLocations,Status,LastUpdatedDate
                        from OrderPickProduct ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.Append("order by LastUpdatedDate ");

            IList <OrderPickProductInfo> list = new List <OrderPickProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderPickProductInfo model = new OrderPickProductInfo();
                        model.OrderPickId     = reader.GetGuid(0);
                        model.OrderId         = reader.GetGuid(1);
                        model.ProductId       = reader.GetGuid(2);
                        model.CustomerId      = reader.GetGuid(3);
                        model.StayQty         = reader.GetDouble(4);
                        model.Qty             = reader.GetDouble(5);
                        model.StockLocations  = reader.GetString(6);
                        model.Status          = reader.GetString(7);
                        model.LastUpdatedDate = reader.GetDateTime(8);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#9
0
 public int Update(OrderPickProductInfo model)
 {
     return(dal.Update(model));
 }
示例#10
0
 public int Insert(OrderPickProductInfo model)
 {
     return(dal.Insert(model));
 }