public ActionResult CompleteOrder1(List <Model.ViewModel.CartsView> list)
        {
            //string result = Newtonsoft.Json.JsonConvert.SerializeObject(list);
            //List<Model.ViewModel.CartsView> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ViewModel.CartsView>>(result);

            int _userId = Convert.ToInt32(Session["userId"]);

            Model.Orders orders = ordersBll.LoadEntity(m => m.userId == _userId).FirstOrDefault();

            foreach (var item in list)
            {
                Model.OrderDetail orderDetail = new Model.OrderDetail()
                {
                    OrderDetail_Id = Convert.ToInt32(CreateId.CreateNum()),
                    order_no       = orders.orderId,
                    Pid            = item.ProductId,
                    pname          = item.Pname,
                    pnum           = item.Pcount,
                    p_price        = item.Price,
                    subtotal       = item.Pcount * item.Price
                };
                if (orderDetailBll.addEntity(orderDetail))
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
            }
            cartsBll.EmptyCarts(_userId);

            return(Json(new { flag1 = flag }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        /// <summary>
        ///  实体转换
        /// <summary>
        private static Model.OrderDetail TranEntity(DataRow dr)
        {
            if (dr != null)
            {
                Model.OrderDetail model = new Model.OrderDetail();

                if (!string.IsNullOrEmpty(dr["Id"].ToString()))
                {
                    model.Id = int.Parse(dr["Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["IsDeleted"].ToString()))
                {
                    model.IsDeleted = bool.Parse(dr["IsDeleted"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Status"].ToString()))
                {
                    model.Status = int.Parse(dr["Status"].ToString());
                }
                model.Code      = dr["Code"].ToString();
                model.OrderCode = dr["OrderCode"].ToString();
                if (!string.IsNullOrEmpty(dr["GId"].ToString()))
                {
                    model.GId = int.Parse(dr["GId"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["GCount"].ToString()))
                {
                    model.GCount = decimal.Parse(dr["GCount"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["BuyPrice"].ToString()))
                {
                    model.BuyPrice = decimal.Parse(dr["BuyPrice"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["TotalMoney"].ToString()))
                {
                    model.TotalMoney = decimal.Parse(dr["TotalMoney"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["CreatedTime"].ToString()))
                {
                    model.CreatedTime = DateTime.Parse(dr["CreatedTime"].ToString());
                }
                model.CreatedBy = dr["CreatedBy"].ToString();
                if (!string.IsNullOrEmpty(dr["ReCount"].ToString()))
                {
                    model.ReCount = decimal.Parse(dr["ReCount"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
        protected override void SetPowerZone()
        {
            Spare2.DataSource     = BLL.C_Car.GetList(" IsDelete = 0 and CType='牵引车' order by ID");
            Spare2.DataTextField  = "PZCode";
            Spare2.DataValueField = "PZCode";
            Spare2.DataBind();

            CSpare2.DataSource     = BLL.C_Car.GetList(" IsDelete = 0 and CType='挂车' order by ID");
            CSpare2.DataTextField  = "PZCode";
            CSpare2.DataValueField = "PZCode";
            CSpare2.DataBind();
            //ListItem lt = new ListItem();
            //lt.Value = "";
            //lt.Text = "空项";
            //CSpare2.Items.Insert(0, lt);

            CarSJ1.DataSource     = BLL.Member.ManageMember.GetMemberEntityList("  RoleCode='SiJi' AND FMID='1' AND IsClock=0 AND IsClose=0  order by ID");
            CarSJ1.DataTextField  = "MName";
            CarSJ1.DataValueField = "MID";
            //CarSJ1.Items.Insert(0, "--请选择--");
            CarSJ1.DataBind();


            CarSJ2.DataSource     = BLL.Member.ManageMember.GetMemberEntityList("  RoleCode='SiJi' AND FMID IN('2','3') AND IsClock=0 AND IsClose=0  order by ID");
            CarSJ2.DataTextField  = "MName";
            CarSJ2.DataValueField = "MID";
            CarSJ2.DataBind();
            //CarSJ2.Items.Insert(0, "--请选择--");
            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                ocode.Value = Request.QueryString["oid"];
                oid.Value   = Request.QueryString["oid"];
            }
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                string          id  = Request.QueryString["id"];
                Model.C_CarTast car = BLL.C_CarTast.GetModel(Convert.ToInt32(id));
                Spare2.Value  = car.Spare2.ToString();
                CSpare2.Value = car.CSpare2.ToString();
                CarSJ1.Value  = car.CarSJ1.ToString();
                CarSJ2.Value  = car.CarSJ2.ToString();

                if (!string.IsNullOrEmpty(car.OCode))
                {
                    Model.OrderDetail od = BLL.OrderDetail.GetModelCode(car.OCode);
                    goodcount = od.GCount.ToString();
                    Model.Goods good = BLL.Goods.GetModel(od.GId.ToString());
                    goodname = good.GName;
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Hashtable Update(Model.OrderDetail model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OrderDetail set ");
            strSql.Append(" IsDeleted = @IsDeleted , ");
            strSql.Append(" Status = @Status , ");
            strSql.Append(" Code = @Code , ");
            strSql.Append(" OrderCode = @OrderCode , ");
            strSql.Append(" GId = @GId , ");
            strSql.Append(" GCount = @GCount , ");
            strSql.Append(" BuyPrice = @BuyPrice , ");
            strSql.Append(" TotalMoney = @TotalMoney , ");
            strSql.Append(" CreatedTime = @CreatedTime , ");
            strSql.Append(" CreatedBy = @CreatedBy,  ");
            strSql.Append(" ReCount = @ReCount  ");
            strSql.Append(" where Id=@Id  ");
            strSql.AppendFormat(" ;select '{0}'", guid);

            SqlParameter[] parameters =
            {
                new SqlParameter("@IsDeleted",   SqlDbType.Bit,        1),
                new SqlParameter("@Status",      SqlDbType.Int,        4),
                new SqlParameter("@Code",        SqlDbType.VarChar,   50),
                new SqlParameter("@OrderCode",   SqlDbType.VarChar,   50),
                new SqlParameter("@GId",         SqlDbType.Int,        4),
                new SqlParameter("@GCount",      SqlDbType.Decimal,    9),
                new SqlParameter("@BuyPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@TotalMoney",  SqlDbType.Decimal,    9),
                new SqlParameter("@CreatedTime", SqlDbType.DateTime),
                new SqlParameter("@CreatedBy",   SqlDbType.VarChar,   50),
                new SqlParameter("@ReCount",     SqlDbType.Decimal,    9),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.IsDeleted;
            parameters[1].Value  = model.Status;
            parameters[2].Value  = model.Code;
            parameters[3].Value  = model.OrderCode;
            parameters[4].Value  = model.GId;
            parameters[5].Value  = model.GCount;
            parameters[6].Value  = model.BuyPrice;
            parameters[7].Value  = model.TotalMoney;
            parameters[8].Value  = model.CreatedTime;
            parameters[9].Value  = model.CreatedBy;
            parameters[10].Value = model.ReCount;
            parameters[11].Value = model.Id;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
 protected decimal GetOrderDetailCount(object gid)
 {
     Model.Order objOrder = (Model.Order)ViewState["OrderInfo"];
     if (objOrder != null)
     {
         int goodId           = Convert.ToInt32(gid);
         Model.OrderDetail od = objOrder.OrderDetail.Where(c => c.GId == goodId).FirstOrDefault();
         if (od != null)
         {
             return(od.GCount);
         }
     }
     return(0);
 }
Exemple #6
0
        public Model.OrderDetail GetBlankOrderDetail()
        {
            var orderDetailData = new Model.OrderDetail();

            try
            {
                orderDetailData.Products = GetProducts();
            }
            catch (Exception ex)
            {
                logger.LogError(ex, ex.Message);
            }
            return(orderDetailData);
        }
        protected override void SetValue(string id)
        {
            Model.Account c = BLL.Account.GetModel(int.Parse(id));
            CName.Value    = c.CName;
            SuppName.Value = c.SupplierName;
            type.Value     = c.AType.ToString();

            Model.C_CarTast tast = BLL.C_CarTast.GetModel(c.CID);
            if (!string.IsNullOrEmpty(tast.OCode))
            {
                Model.OrderDetail od    = BLL.OrderDetail.GetModelCode(tast.OCode);
                Model.Goods       goods = BLL.Goods.GetModel(od.GId);
                GoodName.Value     = goods.GName;
                txtGoodCount.Value = c.OrderCount.ToString();
                txtGoodPrice.Value = c.OrderPrice.ToString();
            }
            Remark.Value = c.Spare2.ToString();

            fid.Value = c.ID.ToString();
        }
Exemple #8
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Insert(Model.OrderDetail model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OrderDetail(");
            strSql.Append("IsDeleted,Status,Code,OrderCode,GId,GCount,BuyPrice,TotalMoney,CreatedTime,CreatedBy,ReCount");
            strSql.Append(") values (");
            strSql.Append("@IsDeleted,@Status,@Code,@OrderCode,@GId,@GCount,@BuyPrice,@TotalMoney,@CreatedTime,@CreatedBy,@ReCount");
            strSql.Append(") ");
            strSql.AppendFormat(";select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@IsDeleted",   SqlDbType.Bit,        1),
                new SqlParameter("@Status",      SqlDbType.Int,        4),
                new SqlParameter("@Code",        SqlDbType.VarChar,   50),
                new SqlParameter("@OrderCode",   SqlDbType.VarChar,   50),
                new SqlParameter("@GId",         SqlDbType.Int,        4),
                new SqlParameter("@GCount",      SqlDbType.Decimal,    9),
                new SqlParameter("@BuyPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@TotalMoney",  SqlDbType.Decimal,    9),
                new SqlParameter("@CreatedTime", SqlDbType.DateTime),
                new SqlParameter("@CreatedBy",   SqlDbType.VarChar,   50),
                new SqlParameter("@ReCount",     SqlDbType.Decimal, 9)
            };

            parameters[0].Value  = model.IsDeleted;
            parameters[1].Value  = model.Status;
            parameters[2].Value  = model.Code;
            parameters[3].Value  = model.OrderCode;
            parameters[4].Value  = model.GId;
            parameters[5].Value  = model.GCount;
            parameters[6].Value  = model.BuyPrice;
            parameters[7].Value  = model.TotalMoney;
            parameters[8].Value  = model.CreatedTime;
            parameters[9].Value  = model.CreatedBy;
            parameters[10].Value = model.ReCount;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
        protected void binddata(string id)
        {
            Model.C_CarTast c = BLL.C_CarTast.GetModel(int.Parse(id));
            Name.Value          = c.Name;
            TType.Value         = c.TType.ToString();
            SupplierName.Value  = c.SupplierName;
            SupplierName2.Value = c.SupplierName;
            SupplierName3.Value = c.SupplierName;

            SupplierAddress.Value = c.SupplierAddress;
            SupplierTelName.Value = c.SupplierTelName;
            SupplierTel.Value     = c.SupplierTel;
            Spare2.Value          = c.Spare2.ToString();
            CSpare2.Value         = c.CSpare2.ToString();
            CarSJ1.Value          = c.CarSJ1.ToString();
            CarSJ2.Value          = c.CarSJ2.ToString();
            //CostType.Value = c.CostType.ToString();
            uploadurl.Value = c.BDImg.ToString();
            Spare1.Value    = c.Spare1.ToString();
            ocode.Value     = c.OCode;
            fid.Value       = c.ID.ToString();
            oid.Value       = c.OCode.ToString();
            ComDate.Value   = c.ComDate.ToString();


            if (!string.IsNullOrEmpty(c.OCode))//如果不是空车,就显示商品
            {
                Model.OrderDetail od = BLL.OrderDetail.GetModelCode(c.OCode);
                txtGood.Value      = od.GId.ToString();
                txtGoodCount.Value = od.GCount.ToString();
                txtGoodPrice.Value = od.BuyPrice.ToString();
            }

            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                ocode.Value = Request.QueryString["oid"];
            }
        }
Exemple #10
0
 protected override string btnAdd_Click()
 {
     try
     {
         Model.C_CarTast cartast = BLL.C_CarTast.GetModel(int.Parse(Request.Form["cid"]));
         if (cartast.TState == 1)
         {
             return("非法操作,此任务已结束");
         }
         decimal           money = Convert.ToDecimal(Request.Form["txtGCount"]);
         Model.OrderDetail ord   = BLL.OrderDetail.GetList(" ordercode='" + cartast.OCode + "' and  code='" + Request.Form["txtGoodList"] + "' ").FirstOrDefault();
         if (ord != null)
         {
             if (money <= 0)
             {
                 return("输入数量有误或此商品已不可调度");
             }
             ord.ReCount = money;
             if (BLL.OrderDetail.Update(ord))
             {
                 return("调度成功");
             }
             else
             {
                 return("调度失败");
             }
         }
         else
         {
             return("数据有误,请重试");
         }
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Exemple #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(Model.OrderDetail model)
 {
     return(DAL.CommonBase.RunHashtable(Update(model, new Hashtable())));
 }
        protected override string btnModify_Click()
        {
            Hashtable MyHs = new Hashtable();

            Model.C_CarTast c = BLL.C_CarTast.GetModelname(Request.Form["Name"]);
            //Model.C_CarTast c = new Model.C_CarTast();
            //c.Name = Request.Form["Name"];
            c.TType = int.Parse(Request.Form["TType"]);
            if (c.TType == 1)
            {
                c.SupplierName = Request.Form["SupplierName"];
            }
            else if (c.TType == 2)
            {
                c.SupplierName = Request.Form["SupplierName2"];
            }
            else
            {
                c.SupplierName = Request.Form["SupplierName3"];
            }

            c.SupplierAddress = Request.Form["SupplierAddress"];
            c.SupplierTelName = Request.Form["SupplierTelName"];
            c.SupplierTel     = Request.Form["SupplierTel"];
            c.Spare2          = Request.Form["Spare2"];
            c.CSpare2         = Request.Form["CSpare2"];
            c.CarSJ1          = Request.Form["CarSJ1"];
            c.CarSJ2          = Request.Form["CarSJ2"];

            //c.CostType = int.Parse(Request.Form["CostType"]);
            c.BDImg   = Request.Form["uploadurl"];
            c.OCode   = Request.Form["ocode"];
            c.Spare1  = Request.Form["Spare1"];
            c.ComDate = DateTime.Parse(Request.Form["ComDate"]);

            #region 司机车辆验证
            Model.C_Car car = BLL.C_Car.GetModelByCode(c.Spare2);
            if (car == null)
            {
                return("此牵引车不存在,请正确输入车辆牌照");
            }
            //if (!string.IsNullOrEmpty(car.Spare1)&&car.ID!=c.ID)
            //	return "此牵引车任务未完成,请选择别的车辆";
            if (!string.IsNullOrEmpty(c.CSpare2))
            {
                Model.C_Car car2 = BLL.C_Car.GetModelByCode(c.CSpare2);
                if (car2 == null)
                {
                    return("此挂车不存在,请正确输入车辆牌照");
                }
                //if (!string.IsNullOrEmpty(car2.Spare1) && car.ID != c.ID)
                //	return "此挂车任务未完成,请选择别的车辆";
            }

            //存在商品订单
            if (!string.IsNullOrEmpty(c.OCode))
            {
                Model.OrderDetail od = BLL.OrderDetail.GetModelCode(c.OCode);
                od.GId      = Convert.ToInt32(Request.Form["txtGood"]);
                od.BuyPrice = Convert.ToDecimal(Request.Form["txtGoodPrice"]);
                od.GCount   = Convert.ToDecimal(Request.Form["txtGoodCount"]);
                od.ReCount  = Convert.ToDecimal(Request.Form["txtGoodCount"]);
                BLL.OrderDetail.Update(od, MyHs);
            }


            Model.Member siji1 = BLL.Member.GetModelByMID(c.CarSJ1);
            if (siji1 != null)
            {
                if (siji1.FMID != "1")
                {
                    return("此司机不是主司机");
                }
            }
            else
            {
                return("主司机不存在");
            }

            if (!string.IsNullOrEmpty(c.CarSJ2))
            {
                Model.Member siji2 = BLL.Member.GetModelByMID(c.CarSJ2);
                if (siji2 != null)
                {
                    if (siji2.FMID != "2" && siji2.FMID != "3")
                    {
                        return("此司机不是押运员");
                    }
                }
                else
                {
                    return("押运员不存在");
                }
            }


            #endregion
            c.ID = int.Parse(Request.Form["fid"]);
            BLL.C_CarTast.Update(c, MyHs);
            if (BLL.CommonBase.RunHashtable(MyHs))
            {
                return("修改成功");
            }
            else
            {
                return("修改失败");
            }
        }
Exemple #13
0
 public static bool Update(Model.OrderDetail model)
 {
     return(yny_005.DAL.OrderDetail.Update(model));
 }
Exemple #14
0
        protected override string btnAdd_Click()
        {
            lock (obj)
            {
                Model.C_CarTast cartast      = BLL.C_CarTast.GetModel(int.Parse(Request.Form["cid"]));
                decimal         retotalMoney = 0;//实际总额
                if (cartast.TState == 1)
                {
                    return("状态已改变,请勿重复提交");
                }
                cartast.TState = 1;

                decimal recount = 0;
                decimal reprice = 0;

                if (cartast.TType == 1 || cartast.TType == 2)
                {
                    if (string.IsNullOrEmpty(cartast.BDImg))
                    {
                        return("请上传磅单图片");
                    }


                    List <Model.OrderDetail> listord2 = null;
                    if (!string.IsNullOrEmpty(cartast.OCode))
                    {
                        order    = BLL.Order.GetModel(cartast.OCode);
                        listord2 = order.OrderDetail;
                        Model.OrderDetail od = BLL.OrderDetail.GetModelCode(cartast.OCode);
                        if (od != null)
                        {
                            retotalMoney = od.ReCount * od.BuyPrice;
                            recount      = od.ReCount;
                            reprice      = od.BuyPrice;
                        }
                    }
                    //if (listord2.Sum(m => m.ReCount) <= 0)
                    //	return "未查询到实际装车/卸车数量,不能完成";
                }
                Hashtable   MyHs = new Hashtable();
                Model.C_Car c1   = BLL.C_Car.GetModelByCode(cartast.Spare2);
                c1.Spare1 = "";
                BLL.C_Car.Update(c1, MyHs);
                Model.C_Car c2 = BLL.C_Car.GetModelByCode(cartast.CSpare2);
                if (c2 != null)
                {
                    c2.Spare1 = "";
                    BLL.C_Car.Update(c2, MyHs);
                }
                BLL.C_CarTast.Update(cartast, MyHs);

                if (cartast.TType == 1 || cartast.TType == 2)
                {
                    Model.Account acc = new Model.Account();
                    acc.CID          = cartast.ID;
                    acc.CName        = cartast.Name;
                    acc.AType        = cartast.TType == 1 ? 0 : 1;
                    acc.SupplierID   = Convert.ToInt32(cartast.SupplierName);
                    supplier         = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName));
                    acc.SupplierName = supplier.Name;
                    acc.TotalMoney   = retotalMoney;
                    acc.ReMoney      = 0;
                    acc.CreateDate   = DateTime.Now;
                    acc.AStutas      = 0;
                    acc.comDate      = DateTime.MaxValue;
                    acc.OrderCount   = recount;
                    acc.OrderPrice   = reprice;

                    BLL.Account.Add(acc, MyHs);
                }


                if (BLL.CommonBase.RunHashtable(MyHs))
                {
                    return("结束任务成功");
                }
                else
                {
                    return("数据有误,结束任务失败");
                }
            }
        }
Exemple #15
0
 public static bool Insert(Model.OrderDetail model)
 {
     return(yny_005.DAL.OrderDetail.Insert(model));
 }
Exemple #16
0
 public static Hashtable Update(Model.OrderDetail model, Hashtable MyHs)
 {
     return(yny_005.DAL.OrderDetail.Update(model, MyHs));
 }
Exemple #17
0
 public static Hashtable Insert(Model.OrderDetail model, Hashtable MyHs)
 {
     return(yny_005.DAL.OrderDetail.Insert(model, MyHs));
 }
Exemple #18
0
        /// <summary>
        /// 更新基本资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override string btnModify_Click()
        {
            Hashtable MyHs = new Hashtable();

            if (Request.Form["chkCloseAll"] == "on" || Request.Form["chkClockAll"] == "on")
            {
                string where = "";
                if (Request.Form["chkCloseAll"] == "on")
                {
                    where += string.Format(" IsClose = {0} ", (MemberModel.IsClose ? 1 : 0));
                }
                if (Request.Form["chkClockAll"] == "on")
                {
                    where += string.Format(" IsClock = {0} ", (MemberModel.IsClock ? 1 : 0));
                }
                if (!string.IsNullOrEmpty(where))
                {
                    MyHs.Add(string.Format("update Member set {0} where MID in (select mid from [dbo].[getSubBDMember]('{1}'))", where, MemberModel.MID), null);
                }
                //List<Model.Member> list = BllModel.GetMemberEntityList("MID in (select mid from getTreeBuyMID('" + MemberModel.MID + "'))");
                //foreach (Model.Member item in list)
                //{
                //    if (Request.Form["chkCloseAll"] == "on")
                //        item.IsClose = MemberModel.IsClose;
                //    if (Request.Form["chkClockAll"] == "on")
                //        item.IsClock = MemberModel.IsClock;
                //    BllModel.Update(item, MyHs);
                //}
            }

            BllModel.Update(MemberModel, MyHs);
            //string error = BLL.Member.CanSetAgency(MemberModel);
            //if (!string.IsNullOrEmpty(error))
            //{
            //    return error;
            //}
            //MyHs.Add(" update member set MSH = '" + MemberModel.MID + "' where  " + BLL.Member.GetLeaderCondition(MemberModel) + " and MID <> '" + MemberModel.MID + "'", null);
            if (MemberModel.Role.IsAdmin)
            {
                UpdateQuestion(MemberModel.ID, MyHs);
            }
            if (BLL.CommonBase.RunHashtable(MyHs))
            {
                Hashtable            MyHs2       = new Hashtable();
                List <Model.Account> listaccount = BLL.Account.GetModelList("");
                foreach (var item in listaccount)
                {
                    Model.C_CarTast tast = BLL.C_CarTast.GetModelname(item.CName);
                    Model.Goods     g    = null;
                    if (tast != null)
                    {
                        if (!string.IsNullOrWhiteSpace(tast.OCode))
                        {
                            Model.Member mc1 = BLL.Member.GetModelByMID(tast.CarSJ1);
                            Model.Member mc2 = BLL.Member.GetModelByMID(tast.CarSJ2);
                            if (mc1 != null)
                            {
                                item.SJ1 = mc1.MName;
                            }
                            if (mc2 != null)
                            {
                                item.SJ2 = mc2.MName;
                            }

                            Model.OrderDetail od = BLL.OrderDetail.GetModelCode(tast.OCode);
                            g = BLL.Goods.GetModel(od.GId);
                            if (g != null)
                            {
                                item.GName = g.GName;
                                item.Unit  = g.Unit;
                            }
                        }
                    }
                    BLL.Account.Update(item, MyHs2);
                }

                BLL.CommonBase.RunHashtable(MyHs2);

                BLL.OperationRecordBLL.Add(TModel.MID, ChangeType.O_XGHYZL, string.Format("修改{0}的资料", MemberModel.MID));
                return("操作成功");
            }
            return("操作失败");
        }
Exemple #19
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Insert(Model.OrderDetail model)
 {
     return(DAL.CommonBase.RunHashtable(Insert(model, new Hashtable())));
 }
        protected override void SetPowerZone()
        {
            //CostType.DataSource = BLL.C_CostType.GetList(" 1 = 1  order by ID");
            //CostType.DataTextField = "Name";
            //CostType.DataValueField = "ID";
            //CostType.DataBind();


            txtGood.DataSource     = BLL.Goods.GetList(" IsDeleted = 0 order by GID");
            txtGood.DataTextField  = "GName";
            txtGood.DataValueField = "GID";
            txtGood.DataBind();
            txtGood.Items.Insert(0, "--请选择--");

            //         Spare2.DataSource = BLL.C_Car.GetList(" IsDelete = 0 and CType='牵引车' order by ID");
            //Spare2.DataTextField = "PZCode";
            //Spare2.DataValueField = "PZCode";
            //Spare2.DataBind();

            //CSpare2.DataSource = BLL.C_Car.GetList(" IsDelete = 0 and CType='挂车' order by ID");
            //CSpare2.DataTextField = "PZCode";
            //CSpare2.DataValueField = "PZCode";
            //CSpare2.DataBind();

            SupplierName.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   and Type=1 order by ID");
            SupplierName.DataTextField  = "Name";
            SupplierName.DataValueField = "ID";
            SupplierName.DataBind();
            SupplierName.Items.Insert(0, "--请选择--");
            SupplierName2.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   and Type=2  order by ID");
            SupplierName2.DataTextField  = "Name";
            SupplierName2.DataValueField = "ID";
            SupplierName2.DataBind();
            SupplierName2.Items.Insert(0, "--请选择--");
            SupplierName3.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   order by ID");
            SupplierName3.DataTextField  = "Name";
            SupplierName3.DataValueField = "ID";
            SupplierName3.DataBind();
            SupplierName3.Items.Insert(0, "--请选择--");

            Name.Value = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                ocode.Value = Request.QueryString["oid"];
                oid.Value   = Request.QueryString["oid"];
            }
            else
            {
            }
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                Model.C_CarTast ct = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.QueryString["id"]));
                Name.Value = ct.Name;

                sid.Value = ct.SupplierName;
                if (ct.TType == 1)
                {
                    SupplierName.Value = ct.SupplierName;
                }
                else if (ct.TType == 2)
                {
                    SupplierName2.Value = ct.SupplierName;
                }
                else
                {
                    SupplierName3.Value = ct.SupplierName;
                }
                SupplierAddress.Value = ct.SupplierAddress;

                Model.OrderDetail od = BLL.OrderDetail.GetModelCode(ct.OCode);
                if (od != null)
                {
                    txtGood.Value      = od.GId.ToString();
                    txtGoodCount.Value = od.GCount.ToString();
                    txtGoodPrice.Value = od.BuyPrice.ToString();
                }
            }
            //ocode.Disabled = true;
        }
        protected override string btnModify_Click()
        {
            Hashtable MyHs = new Hashtable();

            Model.C_CarTast cartast = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.Form["tid"]));
            if (cartast.SHInt != 0)
            {
                return("此任务审核状态为已审核状态");
            }

            cartast.SHInt = 1;
            BLL.C_CarTast.Update(cartast, MyHs);

            int acount = Convert.ToInt32(BLL.CommonBase.GetSingle("select count(*) from Account where CName='" + cartast.Name + "';"));

            if (acount == 0)
            {
                if (cartast.TType == 1 || cartast.TType == 2)
                {
                    Model.Member mc1 = BLL.Member.GetModelByMID(cartast.CarSJ1);
                    Model.Member mc2 = BLL.Member.GetModelByMID(cartast.CarSJ2);

                    string SJ1 = ""; string SJ2 = "";
                    if (mc1 != null)
                    {
                        SJ1 = mc1.MName;
                    }
                    if (mc2 != null)
                    {
                        SJ2 = mc2.MName;
                    }

                    decimal retotalMoney = 0;//实际总额
                    decimal recount      = 0;
                    decimal reprice      = 0;
                    string  gname        = "";
                    string  unit         = "";
                    if (!string.IsNullOrEmpty(cartast.OCode))
                    {
                        Model.OrderDetail od = BLL.OrderDetail.GetModelCode(cartast.OCode);
                        if (od != null)
                        {
                            retotalMoney = od.ReCount * od.BuyPrice;
                            recount      = od.ReCount;
                            reprice      = od.BuyPrice;

                            Model.Goods mg = BLL.Goods.GetModel(od.GId);
                            if (mg != null)
                            {
                                gname = mg.GName;
                                unit  = mg.Unit;
                            }
                        }
                    }

                    Model.Account acc = new Model.Account();
                    acc.CID        = cartast.ID;
                    acc.CName      = cartast.Name;
                    acc.AType      = cartast.TType == 1 ? 0 : 1;
                    acc.SupplierID = Convert.ToInt32(cartast.SupplierName);
                    var supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName));
                    acc.SupplierName = supplier.Name;
                    acc.TotalMoney   = retotalMoney;
                    acc.ReMoney      = 0;
                    acc.CreateDate   = DateTime.Now;
                    acc.AStutas      = 0;
                    acc.comDate      = DateTime.MaxValue;
                    acc.OrderCount   = recount;
                    acc.OrderPrice   = reprice;
                    acc.SJ1          = SJ1;
                    acc.SJ2          = SJ2;
                    acc.GName        = gname;
                    acc.Unit         = unit;
                    BLL.Account.Add(acc, MyHs);
                }
            }

            if (BLL.CommonBase.RunHashtable(MyHs))
            {
                return("审核成功");
            }
            else
            {
                return("审核失败");
            }
        }
Exemple #22
0
        protected override void SetPowerZone()
        {
            txtGood.DataSource     = BLL.Goods.GetList(" IsDeleted = 0 order by GID");
            txtGood.DataTextField  = "GName";
            txtGood.DataValueField = "GID";
            txtGood.DataBind();
            txtGood.Items.Insert(0, "--请选择--");

            SupplierName.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   and Type=1 order by ID");
            SupplierName.DataTextField  = "Name";
            SupplierName.DataValueField = "ID";
            SupplierName.DataBind();
            SupplierName.Items.Insert(0, "--请选择--");
            SupplierName2.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   and Type=2  order by ID");
            SupplierName2.DataTextField  = "Name";
            SupplierName2.DataValueField = "ID";
            SupplierName2.DataBind();
            SupplierName2.Items.Insert(0, "--请选择--");
            SupplierName3.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   order by ID");
            SupplierName3.DataTextField  = "Name";
            SupplierName3.DataValueField = "ID";
            SupplierName3.DataBind();
            SupplierName3.Items.Insert(0, "--请选择--");

            Name.Value = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                ocode.Value = Request.QueryString["oid"];
                oid.Value   = Request.QueryString["oid"];
            }
            else
            {
            }
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                Model.C_CarTast ct = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.QueryString["id"]));
                Name.Value = ct.Name;

                sid.Value = ct.SupplierName;
                if (ct.TType == 1)
                {
                    SupplierName.Value = ct.SupplierName;
                }
                else if (ct.TType == 2)
                {
                    SupplierName2.Value = ct.SupplierName;
                }
                else
                {
                    SupplierName3.Value = ct.SupplierName;
                }
                SupplierAddress.Value = ct.SupplierAddress;

                Model.OrderDetail od = BLL.OrderDetail.GetModelCode(ct.OCode);
                if (od != null)
                {
                    txtGood.Value      = od.GId.ToString();
                    txtGoodCount.Value = od.GCount.ToString();
                    txtGoodPrice.Value = od.BuyPrice.ToString();
                }



                //装车信息
                if (ct.TType != 1)
                {
                    xcView.Visible = false;
                    tcode          = ct.TCode;
                    CTModel        = BLL.C_CarTast.GetModelname(tcode);
                    if (CTModel != null)
                    {
                        SuppModel = BLL.C_Supplier.GetModel(Convert.ToInt32(CTModel.SupplierName));
                        if (!string.IsNullOrEmpty(CTModel.OCode))
                        {
                            OdModel = BLL.OrderDetail.GetList(" ordercode='" + CTModel.OCode + "'; ").FirstOrDefault();
                            Good    = BLL.Goods.GetModel(OdModel.GId);
                        }
                    }
                }
                else
                {
                    zcView.Visible = false;
                    List <Model.C_CarTast> carList = BLL.C_CarTast.GetModelList(" TCode='" + ct.Name + "' ");
                    foreach (var item in carList)
                    {
                        CarTast cModel = new CarTast();
                        cModel.Code = item.Name;
                        cModel.Supp = BLL.C_Supplier.GetModel(Convert.ToInt32(item.SupplierName)).Name;
                        Model.OrderDetail XCod = BLL.OrderDetail.GetModelCode(item.OCode);
                        if (XCod != null)
                        {
                            cModel.Count    = XCod.GCount;
                            cModel.ReCount  = XCod.ReCount;
                            cModel.GoodName = BLL.Goods.GetModel(Convert.ToInt32(XCod.GId)).GName;
                        }
                        cModel.CreateTime = item.CreateDate;
                        XCList.Add(cModel);
                    }
                }
            }
            //ocode.Disabled = true;
        }
Exemple #23
0
        protected override string btnModify_Click()
        {
            lock (obj)
            {
                try
                {
                    Model.C_CarTast c = null;
                    if (string.IsNullOrEmpty(Request.Form["fid"]))
                    {
                        c = new Model.C_CarTast();
                    }
                    else
                    {
                        c = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.Form["fid"]));
                    }
                    c.Name  = Request.Form["Name"];
                    c.TType = int.Parse(Request.Form["TType"]);
                    if (c.TType == 1)
                    {
                        c.SupplierName = Request.Form["SupplierName"];
                    }
                    else if (c.TType == 2)
                    {
                        c.SupplierName = Request.Form["SupplierName2"];
                    }
                    else
                    {
                        c.SupplierName = Request.Form["SupplierName3"];
                    }

                    c.SupplierAddress = Request.Form["SupplierAddress"];
                    c.SupplierTelName = Request.Form["SupplierTelName"];
                    c.SupplierTel     = Request.Form["SupplierTel"];
                    c.BDImg           = Request.Form["uploadurl"];
                    //c.OCode = Request.Form["ocode"];
                    c.Spare1  = Request.Form["Spare1"];
                    c.Prot    = Convert.ToInt32(Request.Form["txtProt"]);
                    c.ComDate = DateTime.Parse(Request.Form["ComDate"]);

                    string          zcCode  = Request.Form["zcCode"];
                    Model.C_CarTast carTast = BLL.C_CarTast.GetModelname(zcCode);
                    if (carTast == null)
                    {
                        return("未查询到装车单");
                    }
                    if (carTast.XSMID != TModel.MID)
                    {
                        return("此装车单无权限");
                    }

                    Hashtable MyHs = new Hashtable();

                    if (c.TType != 3)//不是空车才能生成商品订单
                    {
                        #region 生成商品订单
                        string      code   = "";
                        string      goodid = Request.Form["txtGood"];
                        Model.Goods go     = BLL.Goods.GetModel(goodid);
                        if (go == null)
                        {
                            return("此商品找不到");
                        }

                        if (!string.IsNullOrEmpty(goodid))
                        {
                            decimal goodcount = 0;
                            decimal goodprice = 0;
                            try
                            {
                                goodcount = Convert.ToDecimal(Request.Form["txtGoodCount"]);
                                goodprice = Convert.ToDecimal(Request.Form["txtGoodPrice"]);
                            }
                            catch (Exception e)
                            {
                                return(e.Message);
                            }
                            //先生成订单主表
                            Model.Order order = new Model.Order();
                            DateTime    dt    = DateTime.Now;
                            code              = dt.ToString("yyyyMMddHHmmssfff");// dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Second.ToString() + dt.Millisecond.ToString();
                            order.Code        = code;
                            order.ReceiveId   = 0;
                            order.CreatedBy   = TModel.MID;
                            order.CreatedTime = DateTime.Now;
                            //order.GoodCount
                            decimal count = goodcount; decimal totalMoney = goodcount * goodprice;
                            string  error = string.Empty;

                            //生成订单明细表
                            Model.OrderDetail od = new Model.OrderDetail();
                            od.BuyPrice    = goodprice;
                            od.Code        = GetGuid();
                            od.CreatedBy   = TModel.MID;
                            od.CreatedTime = DateTime.Now;
                            od.GCount      = count;
                            od.GId         = Convert.ToInt32(goodid);
                            //查看库存数量是否足够,不够的话暂时不能提交订单

                            od.IsDeleted  = false;
                            od.OrderCode  = order.Code;
                            od.Status     = 1;
                            od.TotalMoney = od.GCount * od.BuyPrice;
                            totalMoney   += od.TotalMoney;
                            BLL.OrderDetail.Insert(od, MyHs);

                            order.GoodCount          = count;
                            order.IsDeleted          = false;
                            order.MID                = c.SupplierName;
                            order.OrderTime          = DateTime.Now;
                            order.TotalPrice         = totalMoney;
                            order.DisCountTotalPrice = order.TotalPrice;// * BLL.Configuration.Model.E_GWDiscount;

                            order.ExpressCompany = c.Name;
                            order.Status         = 2;
                            c.OCode = order.Code;
                            BLL.Order.Insert(order, MyHs);

                            if (!string.IsNullOrEmpty(error))
                            {
                                return(error);
                            }
                        }
                        #endregion
                    }

                    c.TState = -1;
                    c.XSMID  = TModel.MID;
                    c.TCode  = zcCode;
                    int ncount = Convert.ToInt32(BLL.CommonBase.GetSingle("select COUNT(*) from C_CarTast where Name='" + c.Name + "';"));
                    if (ncount > 0)
                    {
                        return("订单号重复,请刷新重试");
                    }

                    //int tid = BLL.C_CarTast.Add(c);
                    BLL.C_CarTast.Add(c, MyHs);
                    //if (tid > 0)
                    //{
                    //car.Spare1 = tid.ToString();
                    //BLL.C_Car.Update(car, MyHs);
                    //if (car2 != null)
                    //{
                    //	car.Spare1 = tid.ToString();
                    //	BLL.C_Car.Update(car2, MyHs);
                    //}
                    //}
                    //else {
                    //	return "任务添加失败";
                    //}
                    if (BLL.CommonBase.RunHashtable(MyHs))
                    {
                        return("添加成功");
                    }
                    else
                    {
                        return("添加失败");
                    }
                }
                catch (Exception e)
                {
                    return(e.Message);
                }
            }
        }
Exemple #24
0
        protected override void SetPowerZone()
        {
            tcode     = Request.QueryString["tcode"];
            CTModel   = BLL.C_CarTast.GetModelname(tcode);
            SuppModel = BLL.C_Supplier.GetModel(Convert.ToInt32(CTModel.SupplierName));
            if (!string.IsNullOrEmpty(CTModel.OCode))
            {
                OdModel = BLL.OrderDetail.GetList(" ordercode='" + CTModel.OCode + "'; ").FirstOrDefault();
                Good    = BLL.Goods.GetModel(OdModel.GId);
            }



            txtGood.DataSource     = BLL.Goods.GetList(" IsDeleted = 0 order by GID");
            txtGood.DataTextField  = "GName";
            txtGood.DataValueField = "GID";
            txtGood.DataBind();
            txtGood.Items.Insert(0, "--请选择--");

            SupplierName.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   and Type=1 order by ID");
            SupplierName.DataTextField  = "Name";
            SupplierName.DataValueField = "ID";
            SupplierName.DataBind();
            SupplierName.Items.Insert(0, "--请选择--");
            SupplierName2.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   and Type=2  order by ID");
            SupplierName2.DataTextField  = "Name";
            SupplierName2.DataValueField = "ID";
            SupplierName2.DataBind();
            SupplierName2.Items.Insert(0, "--请选择--");
            SupplierName3.DataSource     = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='')   order by ID");
            SupplierName3.DataTextField  = "Name";
            SupplierName3.DataValueField = "ID";
            SupplierName3.DataBind();
            SupplierName3.Items.Insert(0, "--请选择--");

            Name.Value = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            if (!string.IsNullOrEmpty(Request.QueryString["oid"]))
            {
                ocode.Value = Request.QueryString["oid"];
                oid.Value   = Request.QueryString["oid"];
            }
            else
            {
            }
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                Model.C_CarTast ct = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.QueryString["id"]));
                Name.Value = ct.Name;

                sid.Value = ct.SupplierName;
                if (ct.TType == 1)
                {
                    SupplierName.Value = ct.SupplierName;
                }
                else if (ct.TType == 2)
                {
                    SupplierName2.Value = ct.SupplierName;
                }
                else
                {
                    SupplierName3.Value = ct.SupplierName;
                }
                SupplierAddress.Value = ct.SupplierAddress;

                Model.OrderDetail od = BLL.OrderDetail.GetModelCode(ct.OCode);
                if (od != null)
                {
                    txtGood.Value      = od.GId.ToString();
                    txtGoodCount.Value = od.GCount.ToString();
                    txtGoodPrice.Value = od.BuyPrice.ToString();
                }
            }
        }
Exemple #25
0
        protected override void SetValue(string id)
        {
            cartast  = BLL.C_CarTast.GetModel(int.Parse(id));
            supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName));

            cid.Value = id;
            if (!string.IsNullOrEmpty(cartast.OCode))
            {
                order   = BLL.Order.GetModel(cartast.OCode);
                listord = order.OrderDetail;
            }
            if (order != null)
            {
                listcost = BLL.C_CostDetalis.GetModelList(" CID=" + order.Id);
            }
            if (cartast.TState == 1 || !TModel.Role.SiJi)
            {
                anbtn.Visible = false;
            }

            Model.Member zm = BLL.Member.GetModelByMID(cartast.CarSJ1);
            if (zm != null)
            {
                zhusiji = zm.MName;
            }
            Model.Member fm = BLL.Member.GetModelByMID(cartast.CarSJ2);
            if (fm != null)
            {
                fusiji = fm.MName;
            }

            //装车信息
            if (cartast.TType != 1)
            {
                xcView.Visible = false;
                tcode          = cartast.TCode;
                CTModel        = BLL.C_CarTast.GetModelname(tcode);
                if (CTModel != null)
                {
                    SuppModel = BLL.C_Supplier.GetModel(Convert.ToInt32(CTModel.SupplierName));
                    if (!string.IsNullOrEmpty(CTModel.OCode))
                    {
                        OdModel = BLL.OrderDetail.GetList(" ordercode='" + CTModel.OCode + "'; ").FirstOrDefault();
                        Good    = BLL.Goods.GetModel(OdModel.GId);
                    }
                }
            }
            else
            {
                zcView.Visible = false;
                List <Model.C_CarTast> carList = BLL.C_CarTast.GetModelList(" TCode='" + cartast.Name + "' ");
                foreach (var item in carList)
                {
                    CarTast cModel = new CarTast();
                    cModel.Code = item.Name;
                    cModel.Supp = BLL.C_Supplier.GetModel(Convert.ToInt32(item.SupplierName)).Name;
                    Model.OrderDetail XCod = BLL.OrderDetail.GetModelCode(item.OCode);
                    if (XCod != null)
                    {
                        cModel.Count    = XCod.GCount;
                        cModel.ReCount  = XCod.ReCount;
                        cModel.GoodName = BLL.Goods.GetModel(Convert.ToInt32(XCod.GId)).GName;
                    }
                    cModel.CreateTime = item.CreateDate;
                    XCList.Add(cModel);
                }
            }
        }