Ejemplo n.º 1
0
        /// <summary>
        /// 查询所有未检验的订单
        /// </summary>
        public List <VAN_OA.Model.JXC.CAI_POCaiView> GetListViewCai_POOrders_Cai_POOrderChecks_View(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select   ");
            strSql.Append(" GoodAreaNumber,[ProNo],[PONo] ,[POName],[PODate],[POPayStype],[POTotal],[GuestName],[AE] ");
            strSql.Append(",[INSIDE],[GuestNo],[Ids],[Id],[Num],[GoodId],[totalOrderNum],[lastSupplier],[lastPrice],[GoodNo],[GoodName],[GoodSpec]");
            strSql.Append(",[GoodModel],[GoodUnit],[GoodTypeSmName],[CaiGou],loginName,LastTruePrice");
            strSql.Append(" from Cai_POOrders_Cai_POOrderChecks_View ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by ids desc");
            List <VAN_OA.Model.JXC.CAI_POCaiView> list = new List <VAN_OA.Model.JXC.CAI_POCaiView>();

            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(strSql.ToString(), conn);
                using (SqlDataReader dataReader = objCommand.ExecuteReader())
                {
                    while (dataReader.Read())
                    {
                        Model.JXC.CAI_POCaiView model = new VAN_OA.Model.JXC.CAI_POCaiView();
                        object ojb;

                        model.GoodAreaNumber = dataReader["GoodAreaNumber"].ToString();

                        model.PONo = dataReader["PONo"].ToString();


                        ojb = dataReader["GuestNo"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GuestNo = ojb.ToString();
                        }

                        ojb = dataReader["ProNo"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.ProNo = ojb.ToString();
                        }

                        ojb = dataReader["GuestName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GuestName = ojb.ToString();
                        }

                        ojb = dataReader["AE"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.AE = ojb.ToString();
                        }

                        ojb = dataReader["INSIDE"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.INSIDE = ojb.ToString();
                        }

                        ojb = dataReader["POName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.POName = ojb.ToString();
                        }
                        ojb = dataReader["PODate"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.PODate = Convert.ToDateTime(ojb);
                        }

                        ojb = dataReader["POTotal"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.POTotal = Convert.ToDecimal(ojb);
                        }

                        ojb = dataReader["POPayStype"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.POPayStype = ojb.ToString();
                        }


                        model.POCaiId = Convert.ToInt32(dataReader["Ids"]);


                        ojb = dataReader["Num"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Num = Convert.ToDecimal(ojb);
                        }

                        ojb = dataReader["totalOrderNum"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.totalOrderNum = Convert.ToDecimal(ojb);
                        }

                        model.ResultNum = model.Num - model.totalOrderNum;

                        ojb = dataReader["lastPrice"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Price = Convert.ToDecimal(ojb);
                        }
                        model.Total = model.Price * model.ResultNum;

                        ojb = dataReader["LastSupplier"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Supplier = ojb.ToString();
                        }

                        ojb = dataReader["GoodNo"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodNo = ojb.ToString();
                        }
                        ojb = dataReader["GoodName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodName = ojb.ToString();
                        }
                        ojb = dataReader["GoodSpec"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodSpec = ojb.ToString();
                        }

                        ojb = dataReader["GoodModel"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Good_Model = ojb.ToString();
                        }
                        ojb = dataReader["GoodUnit"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodUnit = ojb.ToString();
                        }

                        ojb = dataReader["GoodTypeSmName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodTypeSmName = ojb.ToString();
                        }

                        ojb = dataReader["loginName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.loginName = ojb.ToString();
                        }



                        ojb = dataReader["GoodId"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodId = Convert.ToInt32(ojb);
                        }
                        ojb = dataReader["LastTruePrice"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.LastTruePrice = Convert.ToDecimal(ojb);
                        }

                        model.CaiGou = dataReader["CaiGou"].ToString();
                        list.Add(model);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询所有未检验的订单
        /// </summary>
        public List <VAN_OA.Model.JXC.CAI_POCaiView> GetListView(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select   ");
            strSql.Append(" * ");
            strSql.Append(" from CAI_Order_Supplier_View ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List <VAN_OA.Model.JXC.CAI_POCaiView> list = new List <VAN_OA.Model.JXC.CAI_POCaiView>();

            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(strSql.ToString(), conn);
                using (SqlDataReader dataReader = objCommand.ExecuteReader())
                {
                    while (dataReader.Read())
                    {
                        Model.JXC.CAI_POCaiView model = new VAN_OA.Model.JXC.CAI_POCaiView();
                        object ojb;



                        model.PONo    = dataReader["PONo"].ToString();
                        model.BusType = dataReader["BusType"].ToString();

                        ojb = dataReader["GuestNo"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GuestNo = ojb.ToString();
                        }

                        ojb = dataReader["ProNo"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.ProNo = ojb.ToString();
                        }

                        ojb = dataReader["GuestName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GuestName = ojb.ToString();
                        }

                        ojb = dataReader["AE"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.AE = ojb.ToString();
                        }

                        ojb = dataReader["INSIDE"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.INSIDE = ojb.ToString();
                        }

                        ojb = dataReader["POName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.POName = ojb.ToString();
                        }
                        ojb = dataReader["PODate"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.PODate = Convert.ToDateTime(ojb);
                        }

                        ojb = dataReader["POTotal"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.POTotal = Convert.ToDecimal(ojb);
                        }

                        ojb = dataReader["POPayStype"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.POPayStype = ojb.ToString();
                        }


                        model.POCaiId = Convert.ToInt32(dataReader["POCaiId"]);


                        ojb = dataReader["Num"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Num = Convert.ToInt32(ojb);
                        }

                        ojb = dataReader["lastPrice"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Price = Convert.ToDecimal(ojb);
                        }
                        model.Total = model.Price * model.Num;

                        ojb = dataReader["LastSupplier"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Supplier = ojb.ToString();
                        }

                        ojb = dataReader["GoodNo"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodNo = ojb.ToString();
                        }
                        ojb = dataReader["GoodName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodName = ojb.ToString();
                        }
                        ojb = dataReader["GoodSpec"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodSpec = ojb.ToString();
                        }

                        ojb = dataReader["GoodModel"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Good_Model = ojb.ToString();
                        }
                        ojb = dataReader["GoodUnit"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodUnit = ojb.ToString();
                        }

                        ojb = dataReader["GoodTypeSmName"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodTypeSmName = ojb.ToString();
                        }

                        ojb = dataReader["GoodId"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodId = Convert.ToInt32(ojb);
                        }



                        list.Add(model);
                    }
                }
            }
            return(list);
        }