示例#1
0
 public bool InsertCallCenterOrderInfo(Order entity, out string error)
 {
     error = "";
     try
     {
         var paras = new SqlParameter[] { new SqlParameter("@OrderId",SqlDbType.NVarChar,30),
       new SqlParameter("@Address", SqlDbType.NVarChar,200),
       new SqlParameter("@AppointTime", SqlDbType.DateTime),
       new SqlParameter("@BusinessType", SqlDbType.Int),
       new SqlParameter("@Cellphone", SqlDbType.NVarChar,20),
       new SqlParameter("@FromCellphone", SqlDbType.NVarChar,20),
       new SqlParameter("@Lat", SqlDbType.Float),
       new SqlParameter("@Lng", SqlDbType.Float),
       new SqlParameter("@OrderFrom", SqlDbType.Int),
       new SqlParameter("@Parterid", SqlDbType.Int),
       new SqlParameter("@Ucode", SqlDbType.NVarChar,20),
       new SqlParameter("@States",SqlDbType.VarChar,50),
       new SqlParameter("@Remark", SqlDbType.NVarChar,400),
       new SqlParameter("@CarCode", SqlDbType.VarChar,100),
       new SqlParameter("@CustomerName",SqlDbType.VarChar,100),
       new SqlParameter("@AllUserCount", SqlDbType.Int),
       new SqlParameter("@PhoneCallTime",SqlDbType.Int),
       new SqlParameter("@SendUserId",SqlDbType.Int),
       new SqlParameter("@SendUserName",SqlDbType.VarChar,50),
       new SqlParameter("@CreateUser",SqlDbType.VarChar,50),
       new SqlParameter("@OrderTime",SqlDbType.VarChar,50),
       new SqlParameter("@ErrorMsg", SqlDbType.NVarChar,100)
     };
         paras[0].Value = entity.OrderId;
         paras[1].Value =string.IsNullOrEmpty(entity.Address)?"" : entity.Address;
         paras[2].Value = string.IsNullOrEmpty(entity.AppointTime) ? DateTime.Now.ToString("yyyy-MM-dd HH:mm") : entity.AppointTime;
         paras[3].Value = entity.BusinessType;
         paras[4].Value =string.IsNullOrEmpty(entity.CellPhone) ? "" : entity.CellPhone;
         paras[5].Value =string.IsNullOrEmpty(entity.FromCellPhone)? "" : entity.FromCellPhone;
         paras[6].Value = entity.Lat;
         paras[7].Value = entity.Lng;
         paras[8].Value = entity.OrderFrom;
         paras[9].Value = entity.Parterid;
         paras[10].Value =string.IsNullOrEmpty(entity.Ucode)?"":entity.Ucode;
         switch (entity.Status)
         {
                 //客服取消
             case 6:
                 entity.Status = 45;
                 break;
                 //第三方取消
             case 13:
                 entity.Status=46;
                 break;
             default:
                 break;
         }
         paras[11].Value = entity.Status;
         paras[12].Value =string.IsNullOrEmpty(entity.Remark)? "" : entity.Remark;
         paras[13].Value =string.IsNullOrEmpty(entity.CarNumber)? "" : entity.CarNumber;
         paras[14].Value =string.IsNullOrEmpty(entity.CustomerName) ? "" : entity.CustomerName;
         paras[15].Value = entity.AllUserCount;
         paras[16].Value = entity.PhoneCallTime;
         paras[17].Value = entity.SendUserId;
         paras[18].Value =string.IsNullOrEmpty(entity.SendUserName)?"":entity.SendUserName;
         paras[19].Value = string.IsNullOrEmpty(entity.CreateUser) ? "sysSocketApi" : entity.CreateUser;
         paras[20].Value = string.IsNullOrEmpty(entity.OrderTime) ? DateTime.Now.ToString("yyyy-MM-dd HH:mm") : entity.OrderTime;
         paras[21].Direction = ParameterDirection.Output;
         //插入订单
         var value = helper.ExecuteCommandProc("gsp_InsertCallCenterOrderInfo", paras);
         if (value >= 0)
         {
             return true;
         }
         else
         {
             error = paras[21] == null ? "" : paras[21].Value.ToString();
             return false;
         }
     }
     catch (Exception ex)
     {
         error = ex.Message;
         LogControl.WriteError("InsertOrder插入调度中心失败|Error:" + ex.Message);
         return false;
     }
 }
示例#2
0
        public List<Order> GetOrderByOrderIds(string orderIds, out List<string> lastIds)
        {
            List<Order> result = new List<Order>();
            lastIds = new List<string>();
            try
            {
                string[] sIds = orderIds.Split(',');
                string newIds = "";

                for (int i = 0; i < sIds.Length; i++)
                {
                    newIds += "'" + sIds[i] + "',";
                    lastIds.Add(sIds[i].ToUpper());
                }
                newIds = newIds.Substring(0, newIds.Length - 1);
                string sSql = string.Format(@"
                   DECLARE @TotalPrice DECIMAL(18,2)=0,
                           @PreferentialPrice DECIMAL(18,2)=0,
                           @AllMoney DECIMAL(18,2)=0,
                           @MileageMoney DECIMAL(18,2)=0,
                           @WaitMoney DECIMAL(18,2)=0,
                           @NewMileage FLOAT=0,
                           @NewWaitTime INT=0
                   SELECT TOP(1) @TotalPrice=TotalPrice,@PreferentialPrice=PreferentialPrice,@MileageMoney=NewMileagePrice,@WaitMoney=NewWaitPrice,@NewWaitTime=NewWaitTime,@NewMileage=NewMileage
                   FROM dbo.D_PaymentRecord(NOLOCK) WHERE OrderId in({0}) ORDER BY InsertTime ASC
                   IF @TotalPrice-@PreferentialPrice>=0
                     SET @AllMoney=@TotalPrice-@PreferentialPrice
                       Select a.OrderId, OrderFrom, a.Address, AppointTime, OrderTime, a.BusinessType, FromCellphone, States,
                       CellPhone, a.Remark, a.Ucode, CustomerName, AllUserCount, a.Create_User, SendUserName, a.CarCode, 0 as Mileage,
                       0 as MileageMoney, 0 as WaitTime, 0 as WaitMoney, 0 as AllMoney, 0 as DiscountMoney, '' as driverPhone,
                       di.DriverName, dod.BeginDriveTime, dod.EndDriveTime, dod.ArrivedTime
                       From D_CallCenterOrderInfo a with(nolock)
                       join D_DriverInfo di with(nolock) on a.Ucode=di.Ucode
                       join D_OrderDetail dod with(nolock) on a.OrderId=dod.OrderId
                       where states>41 and a.OrderId in({0})
                       union
                       Select d.OrderId, OrderFrom, BeginAddress, AppointmentTime, OrderTime, d.BusinessType, FromCellphone, d.State,
                       CellPhone, CustomerRemark, d.Ucode, CustomerName, 0, d.Create_User, '', '',
                       @NewMileage,
                       @MileageMoney,
                       @NewWaitTime,
                       @WaitMoney,
                       @AllMoney,
                       @PreferentialPrice,
                       case when d.state<30 then dd.phone else '' end as driverPhone,
                       dd.DriverName, do.BeginDriveTime, do.EndDriveTime, do.ArrivedTime
                       From D_OrderInfo d with(nolock)
                       join D_OrderDetail do with(nolock) on d.OrderId=do.OrderId
                       join D_DriverInfo dd with(nolock) on d.Ucode=dd.Ucode
                       where d.OrderId in({0})", newIds);
                var dt = helper.GetDataTable(sSql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Order entity = new Order();
                        entity.OrderId = dt.Rows[0]["OrderId"] == DBNull.Value ? "" : dt.Rows[0]["OrderId"].ToString();
                        entity.Address = dt.Rows[0]["Address"] == DBNull.Value ? "" : dt.Rows[0]["Address"].ToString();
                        entity.AppointTime = dt.Rows[0]["AppointTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["AppointTime"]).ToString("yyyy-MM-dd HH:mm");
                        entity.OrderTime = dt.Rows[0]["OrderTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["OrderTime"]).ToString("yyyy-MM-dd HH:mm");
                        entity.AllUserCount = 1;
                        entity.BusinessType = Convert.ToInt32(dt.Rows[0]["BusinessType"] == DBNull.Value ? 0 : dt.Rows[0]["BusinessType"]);
                        entity.FromCellPhone = dt.Rows[0]["FromCellphone"] == DBNull.Value ? "" : dt.Rows[0]["FromCellphone"].ToString();
                        entity.Status = Convert.ToInt32(dt.Rows[0]["States"] == DBNull.Value ? 0 : dt.Rows[0]["States"]);
                        entity.CellPhone = dt.Rows[0]["CellPhone"] == DBNull.Value ? "" : dt.Rows[0]["CellPhone"].ToString();
                        entity.Remark = dt.Rows[0]["Remark"] == DBNull.Value ? "" : dt.Rows[0]["Remark"].ToString();
                        entity.Ucode = dt.Rows[0]["Ucode"] == DBNull.Value ? "" : dt.Rows[0]["Ucode"].ToString();
                        entity.Status = dt.Rows[0]["States"] == DBNull.Value ? 0 :Convert.ToInt32(dt.Rows[0]["States"]);
                        entity.AllMoney = dt.Rows[0]["AllMoney"] == DBNull.Value ? 0 : Convert.ToDecimal(dt.Rows[0]["AllMoney"]);
                        entity.MileageMoney = dt.Rows[0]["MileageMoney"] == DBNull.Value ? 0 : Convert.ToDecimal(dt.Rows[0]["MileageMoney"]);
                        entity.WaitMoney = dt.Rows[0]["WaitMoney"] == DBNull.Value ? 0 : Convert.ToDecimal(dt.Rows[0]["WaitMoney"]);
                        entity.WaitTime = dt.Rows[0]["WaitTime"] == DBNull.Value ? 0 : Convert.ToDouble(dt.Rows[0]["WaitTime"]);
                        entity.Mileage = dt.Rows[0]["Mileage"] == DBNull.Value ? 0 : Convert.ToDouble(dt.Rows[0]["Mileage"]);
                        entity.DiscountMoney = dt.Rows[0]["DiscountMoney"] == DBNull.Value ? 0 : Convert.ToDecimal(dt.Rows[0]["DiscountMoney"]);
                        entity.DriverPhone = dt.Rows[0]["driverPhone"] == DBNull.Value ? "" : dt.Rows[0]["driverPhone"].ToString();
                        entity.CustomerName = dt.Rows[0]["CustomerName"] == DBNull.Value ? "" : dt.Rows[0]["CustomerName"].ToString();

                        entity.DriverName = dt.Rows[0]["DriverName"] == DBNull.Value ? "" : dt.Rows[0]["DriverName"].ToString();
                        entity.BeginDriveTime = dt.Rows[0]["BeginDriveTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["BeginDriveTime"]).ToString("yyyy-MM-dd HH:mm");
                        entity.EndDriveTime = dt.Rows[0]["EndDriveTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["EndDriveTime"]).ToString("yyyy-MM-dd HH:mm");
                        entity.ArrivedTime = dt.Rows[0]["ArrivedTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["ArrivedTime"]).ToString("yyyy-MM-dd HH:mm");

                        result.Add(entity);
                        lastIds.Remove(entity.OrderId.ToUpper());
                    }
                }
            }
            catch (Exception ex)
            {
                LogControl.WriteError("GetOrderByOrderIds查询订单失败|Error:" + ex.Message);
            }
            return result;
        }
示例#3
0
 public List<Order> GetOrderByParterid(string parterid)
 {
     List<Order> result = new List<Order>();
     try
     {
         string sSql = string.Format(@"Select OrderId,Address,AppointTime,OrderTime,BusinessType,FromCellphone,States,CellPhone,Remark,Ucode where D.Parterid='{0}'", parterid);
         //插入订单
         var dt = helper.GetDataTable(sSql);
         if (dt != null && dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 Order entity = new Order();
                 entity.OrderId = dt.Rows[0]["OrderId"] == DBNull.Value ? "" : dt.Rows[0]["OrderId"].ToString();
                 entity.Address = dt.Rows[0]["Address"] == DBNull.Value ? "" : dt.Rows[0]["Address"].ToString();
                 entity.AppointTime = dt.Rows[0]["AppointTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["AppointTime"]).ToString("yyyy-MM-dd HH:mm");
                 entity.OrderTime = dt.Rows[0]["OrderTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[0]["OrderTime"]).ToString("yyyy-MM-dd HH:mm");
                 entity.AllUserCount = 1;
                 entity.BusinessType = Convert.ToInt32(dt.Rows[0]["BusinessType"] == DBNull.Value ? 0 : dt.Rows[0]["BusinessType"]);
                 entity.FromCellPhone = dt.Rows[0]["FromCellphone"] == DBNull.Value ? "" : dt.Rows[0]["FromCellphone"].ToString();
                 entity.Status = Convert.ToInt32(dt.Rows[0]["States"] == DBNull.Value ? 0 : dt.Rows[0]["States"]);
                 entity.CellPhone = dt.Rows[0]["CellPhone"] == DBNull.Value ? "" : dt.Rows[0]["CellPhone"].ToString();
                 entity.Remark = dt.Rows[0]["Remark"] == DBNull.Value ? "" : dt.Rows[0]["Remark"].ToString();
                 entity.Ucode = dt.Rows[0]["Ucode"] == DBNull.Value ? "" : dt.Rows[0]["Ucode"].ToString();
                 result.Add(entity);
             }
         }
     }
     catch (Exception ex)
     {
         LogControl.WriteError("GetOrderByParterid查询订单失败|Error:" + ex.Message);
     }
     return result;
 }
示例#4
0
        public List<Order> GetOrderByCellPhone(string cellPhone)
        {
            List<Order> result = new List<Order>();
            try
            {
                string   sSql = string.Format(@"Select OrderId,OrderFrom, Address,AppointTime,OrderTime,BusinessType,FromCellphone,States,
                      CellPhone,Remark,Ucode,CustomerName,AllUserCount,Create_User,SendUserName,CarCode From D_CallCenterOrderInfo(nolock)
                  where (create_time between dateadd(hour,-12,getdate()) and getdate()) and  (FromCellPhone='{0}' or CellPhone='{0}')",
                      cellPhone);
                var dt = helper.GetDataTable(sSql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Order entity = new Order();

                        entity.OrderId = dt.Rows[i]["OrderId"] == DBNull.Value ? "" : dt.Rows[i]["OrderId"].ToString();
                        entity.Address = dt.Rows[i]["Address"] == DBNull.Value ? "" : dt.Rows[i]["Address"].ToString();
                        entity.AppointTime = dt.Rows[i]["AppointTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[i]["AppointTime"]).ToString("yyyy-MM-dd HH:mm");
                        entity.OrderTime = dt.Rows[i]["OrderTime"] == DBNull.Value ? "" : Convert.ToDateTime(dt.Rows[i]["OrderTime"]).ToString("yyyy-MM-dd HH:mm");
                        entity.AllUserCount = dt.Rows[i]["AllUserCount"] == DBNull.Value ? 0 :Convert.ToInt32(dt.Rows[i]["AllUserCount"]);
                        entity.BusinessType = Convert.ToInt32(dt.Rows[i]["BusinessType"] == DBNull.Value ? 0 : dt.Rows[i]["BusinessType"]);
                        entity.FromCellPhone = dt.Rows[i]["FromCellphone"] == DBNull.Value ? "" : dt.Rows[i]["FromCellphone"].ToString();
                        int Status = Convert.ToInt32(dt.Rows[i]["States"] == DBNull.Value ? 0 : dt.Rows[i]["States"]);
                        switch (Status)
                        {
                                //接单
                            case 11:
                                entity.Status = 3;
                                break;
                            case 20:
                                entity.Status = 9;
                                break;
                            case 21:
                                entity.Status = 10;
                                break;
                            case 22:
                                entity.Status = 11;
                                break;
                            case 30:
                                entity.Status = 12;
                                break;
                                //用户取消
                            case 40:
                                entity.Status = 7;
                                break;
                            //第三方 司机取消
                            case 41:
                                entity.Status = 8;
                                break;
                             //客服取消
                            case 45:
                                entity.Status = 6;
                                break;
                                //第三方取消
                            case 46:
                                entity.Status = 9;
                                break;
                            default:
                                break;
                        }
                        entity.CellPhone = dt.Rows[i]["CellPhone"] == DBNull.Value ? "" : dt.Rows[i]["CellPhone"].ToString();
                        entity.Remark = dt.Rows[i]["Remark"] == DBNull.Value ? "" : dt.Rows[i]["Remark"].ToString();
                        entity.Ucode = dt.Rows[i]["Ucode"] == DBNull.Value ? "" : dt.Rows[i]["Ucode"].ToString();
                        entity.CustomerName = dt.Rows[i]["CustomerName"] == DBNull.Value ? "" : dt.Rows[i]["CustomerName"].ToString();
                        entity.OrderFrom = dt.Rows[i]["OrderFrom"] == DBNull.Value ? 0: Convert.ToInt32(dt.Rows[i]["OrderFrom"]);
                        entity.CreateUser = dt.Rows[i]["Create_User"] == DBNull.Value ? "" : dt.Rows[i]["Create_User"].ToString();
                        entity.SendUserName = dt.Rows[i]["SendUserName"] == DBNull.Value ? "" : dt.Rows[i]["SendUserName"].ToString();
                        entity.CarNumber = dt.Rows[i]["CarCode"] == DBNull.Value ? "" : dt.Rows[i]["CarCode"].ToString();
                        result.Add(entity);
                    }

                }
            }
            catch (Exception ex)
            {
                LogControl.WriteError("GetOrderByCellPhone查询订单失败|Error:" + ex.Message);
            }
            return result;
        }