Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Insert(Entities.WorkOrderRevert model)
        {
            int intVal = 0;

            Entities.WorkOrderReceiver receiver = new Entities.WorkOrderReceiver();
            Entities.WorkOrderLog      log      = new Entities.WorkOrderLog();

            receiver.OrderID            = model.OrderID;
            receiver.CallID             = model.CallID;
            receiver.CreateTime         = DateTime.Now;
            receiver.CreateUserID       = model.CreateUserID;
            receiver.ReceiverDepartName = model.ReceiverDepartName;
            receiver.RevertContent      = model.RevertContent;
            if (int.TryParse(model.ReceiverID, out intVal))
            {
                receiver.ReceiverUserID = intVal;
            }

            log.CreateTime   = model.CreateTime;
            log.CreateUserID = model.CreateUserID;
            log.OrderID      = model.OrderID;
            log.LogDesc      = GetLogDescByModel(model);

            int recid = BLL.WorkOrderReceiver.Instance.Insert(receiver);

            log.ReceiverRecID = recid;

            BLL.WorkOrderLog.Instance.Insert(log);
            return(recid);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(Entities.WorkOrderRevert model)
        {
            int ReturnID = 0;
            int intVal   = 0;

            Entities.WorkOrderReceiver receiver = new Entities.WorkOrderReceiver();
            Entities.WorkOrderLog      log      = new Entities.WorkOrderLog();

            receiver = BLL.WorkOrderReceiver.Instance.GetWorkOrderReceiver((int)model.WORID);
            log      = BLL.WorkOrderLog.Instance.GetWorkOrderLogByReceiverRecID((int)model.WORID);
            if (receiver != null && log != null)
            {
                receiver.CallID             = model.CallID;
                receiver.ReceiverDepartName = model.ReceiverDepartName;
                receiver.RevertContent      = model.RevertContent;
                if (int.TryParse(model.ReceiverID, out intVal))
                {
                    receiver.ReceiverUserID = intVal;
                }

                log.LogDesc = GetLogDescByModel(model);

                ReturnID = BLL.WorkOrderReceiver.Instance.Update(receiver);
                BLL.WorkOrderLog.Instance.Update(log);
            }

            return(ReturnID);
        }
Ejemplo n.º 3
0
        private static string GetLogDescByModel(Entities.WorkOrderRevert model)
        {
            Dictionary <string, string> logDescDic = new Dictionary <string, string>();

            logDescDic.Add("ProvinceName", model.ProvinceName);
            logDescDic.Add("CityName", model.CityName);
            logDescDic.Add("AttentionCarBrandName", model.AttentionCarBrandName);
            logDescDic.Add("AttentionCarSerialName", model.AttentionCarSerialName);
            logDescDic.Add("AttentionCarTypeName", model.AttentionCarTypeName);
            logDescDic.Add("CategoryName", model.CategoryName);
            logDescDic.Add("Contact", model.Contact);
            logDescDic.Add("ContactTel", model.ContactTel);
            logDescDic.Add("CountyName", model.CountyName);
            logDescDic.Add("CRMCustID", model.CRMCustID);
            logDescDic.Add("CustName", model.CustName);
            logDescDic.Add("PriorityLevelName", model.PriorityLevelName);
            logDescDic.Add("ReceiverName", model.ReceiverName);
            logDescDic.Add("SaleCarBrandName", model.SaleCarBrandName);
            logDescDic.Add("NominateActivity", model.NominateActivity);
            logDescDic.Add("SaleCarSerialName", model.SaleCarSerialName);
            logDescDic.Add("SaleCarTypeName", model.SaleCarTypeName);
            logDescDic.Add("SelectDealerID", model.SelectDealerID);
            logDescDic.Add("SelectDealerName", model.SelectDealerName);
            logDescDic.Add("TagName", model.TagName);
            logDescDic.Add("Title", model.Title);
            logDescDic.Add("WorkOrderStatus", model.WorkOrderStatus);
            logDescDic.Add("LastProcessDate", model.LastProcessDate);
            logDescDic.Add("DataSource", model.DataSource);



            string logDesc = BLL.WorkOrderLog.Instance.GetLogDesc(logDescDic);

            return(logDesc);
        }
        private Entities.WorkOrderRevert LoadSingleWorkOrderRevert(DataRow row)
        {
            Entities.WorkOrderRevert model = new Entities.WorkOrderRevert();

            if (row["WORID"].ToString() != "")
            {
                model.WORID = long.Parse(row["WORID"].ToString());
            }
            model.OrderID                = row["OrderID"].ToString();
            model.RevertContent          = row["RevertContent"].ToString();
            model.CategoryName           = row["CategoryName"].ToString();
            model.DataSource             = row["DataSource"].ToString();
            model.CustName               = row["CustName"].ToString();
            model.CRMCustID              = row["CRMCustID"].ToString();
            model.ProvinceName           = row["ProvinceName"].ToString();
            model.CityName               = row["CityName"].ToString();
            model.CountyName             = row["CountyName"].ToString();
            model.Contact                = row["Contact"].ToString();
            model.ContactTel             = row["ContactTel"].ToString();
            model.PriorityLevelName      = row["PriorityLevelName"].ToString();
            model.LastProcessDate        = row["LastProcessDate"].ToString();
            model.IsComplaintType        = row["IsComplaintType"].ToString();
            model.Title                  = row["Title"].ToString();
            model.TagName                = row["TagName"].ToString();
            model.WorkOrderStatus        = row["WorkOrderStatus"].ToString();
            model.ReceiverID             = row["ReceiverID"].ToString();
            model.ReceiverName           = row["ReceiverName"].ToString();
            model.ReceiverDepartName     = row["ReceiverDepartName"].ToString();
            model.IsSales                = row["IsSales"].ToString();
            model.AttentionCarBrandName  = row["AttentionCarBrandName"].ToString();
            model.AttentionCarSerialName = row["AttentionCarSerialName"].ToString();
            model.AttentionCarTypeName   = row["AttentionCarTypeName"].ToString();
            model.SelectDealerID         = row["SelectDealerID"].ToString();
            model.SelectDealerName       = row["SelectDealerName"].ToString();
            model.NominateActivity       = row["NominateActivity"].ToString();
            model.SaleCarBrandName       = row["SaleCarBrandName"].ToString();
            model.SaleCarSerialName      = row["SaleCarSerialName"].ToString();
            model.SaleCarTypeName        = row["SaleCarTypeName"].ToString();
            model.IsReturnVisit          = row["IsReturnVisit"].ToString();
            if (row["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
            }
            if (row["CreateUserID"].ToString() != "")
            {
                model.CreateUserID = int.Parse(row["CreateUserID"].ToString());
            }
            if (row["CallID"].ToString() != "")
            {
                model.CallID = Int64.Parse(row["CallID"].ToString());
            }
            if (row.Table.Columns.Contains("DemandID"))
            {
                if (row["DemandID"] != null)
                {
                    model.DemandID = row["DemandID"].ToString();
                }
            }
            return(model);
        }
Ejemplo n.º 5
0
        public Entities.WorkOrderRevert GetWorkOrderRevertByCallID(Int64 CallID)
        {
            Entities.WorkOrderRevert        model = new Entities.WorkOrderRevert();
            Entities.QueryWorkOrderReceiver query = new QueryWorkOrderReceiver();
            query.CallID = (long)CallID;
            int       totalCount = 0;
            DataTable dt         = BLL.WorkOrderReceiver.Instance.GetWorkOrderReceiver(query, "", 1, 9999, out totalCount);

            if (dt != null && dt.Rows.Count > 0)
            {
                model = GetWorkOrderRevert(long.Parse(dt.Rows[0]["RecID"].ToString()));
            }
            else
            {
                model = null;
            }
            return(model);
        }
        //绑定工单回复表信息
        private Entities.WorkOrderRevert bindWorkOrderRevert(out string msg)
        {
            msg = string.Empty;

            string errMsg = string.Empty;

            Entities.WorkOrderRevert model_Revert = new Entities.WorkOrderRevert();
            BLL.ConverToEntitie <Entities.WorkOrderRevert> converRevert = new BLL.ConverToEntitie <Entities.WorkOrderRevert>(model_Revert);

            errMsg = converRevert.Conver(RevertData);

            if (errMsg != "")
            {
                msg = "{'result':'false','msg':'给对应实体赋值时出错,操作失败!'}";
                return(model_Revert);
            }
            model_Revert.CreateTime   = operTime;
            model_Revert.CreateUserID = operUserID;

            return(model_Revert);
        }
Ejemplo n.º 7
0
        private void NewEstablished(out string msg)
        {
            int logUser = BLL.Util.GetLoginUserID();

            //插入工单回复信息
            Entities.WorkOrderRevert workorderrevert = new Entities.WorkOrderRevert();
            workorderrevert.OrderID      = TaskID;
            workorderrevert.CreateTime   = DateTime.Now;
            workorderrevert.CreateUserID = logUser;

            Int64 _callID = 0;

            if (Int64.TryParse(CallID, out _callID))
            {
            }
            workorderrevert.CallID             = _callID;
            workorderrevert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(Convert.ToInt32(logUser));
            long ival = BLL.WorkOrderRevert.Instance.Insert(workorderrevert);

            msg = "{'worid':'" + ival + "'}";
        }
Ejemplo n.º 8
0
        private Entities.WorkOrderRevert GetWorkOrderRevertByLogDesc(string LogDesc)
        {
            Entities.WorkOrderRevert model = new Entities.WorkOrderRevert();

            PropertyInfo[] myfList   = typeof(LogDesc).GetProperties();
            LogDesc        checkInfo = (LogDesc)Newtonsoft.Json.JsonConvert.DeserializeObject(LogDesc, typeof(LogDesc));

            if (checkInfo != null)
            {
                for (int i = 0; i < myfList.Length; i++)
                {
                    PropertyInfo p = typeof(Entities.WorkOrderRevert).GetProperty(myfList[i].Name);
                    if (p != null)
                    {
                        object val = myfList[i].GetValue(checkInfo, null);
                        p.SetValue(model, val, null);
                    }
                }
            }
            return(model);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Entities.WorkOrderRevert GetWorkOrderRevert(long WORID)
 {
     Entities.WorkOrderReceiver receiver = BLL.WorkOrderReceiver.Instance.GetWorkOrderReceiver((int)WORID);
     Entities.WorkOrderLog      log      = BLL.WorkOrderLog.Instance.GetWorkOrderLogByReceiverRecID((int)WORID);
     Entities.WorkOrderRevert   model    = new Entities.WorkOrderRevert();
     if (receiver != null && log != null)
     {
         model                    = GetWorkOrderRevertByLogDesc(log.LogDesc);
         model.CallID             = receiver.CallID;
         model.CreateTime         = receiver.CreateTime;
         model.CreateUserID       = receiver.CreateUserID;
         model.OrderID            = receiver.OrderID;
         model.ReceiverDepartName = receiver.ReceiverDepartName;
         model.ReceiverID         = receiver.ReceiverUserID.ToString();
         model.WORID              = receiver.RecID;
         model.AudioURL           = receiver.AudioURL;
         return(model);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 10
0
        private void BindData()
        {
            if (OrderID != string.Empty)
            {
                GetEstablishStr();
                string    orderBy = ViewType == 1 ? orderByDesc : orderByAsc;
                DataTable dt      = BLL.WorkOrderRevert.Instance.GetWorkOrderRevertByOrderID(OrderID, orderBy);

                if (dt != null && dt.Rows.Count > 0)
                {
                    int worid;
                    if (ViewType == 2)
                    {
                        worid = int.Parse(dt.Rows[0]["RecID"].ToString());
                        dt.Rows.RemoveAt(0);

                        modelRevert = BLL.WorkOrderRevert.Instance.GetWorkOrderRevert(worid);

                        Entities.WorkOrderInfo info = BLL.WorkOrderInfo.Instance.GetWorkOrderInfo(OrderID);
                        hlDemandDetails.Text        = info.DemandID;
                        hlDemandDetails.NavigateUrl = ConfigurationManager.AppSettings["DemandDetailsUrl"] + "?DemandID=" + info.DemandID + "&r=" + new Random().Next();
                        hlDemandDetails.Target      = "_blank";

                        if (string.IsNullOrEmpty(hlDemandDetails.Text))
                        {
                            liDemand.Visible = false;
                        }
                        else
                        {
                            liDemand.Visible = true;
                        }
                    }
                }
                repeaterTableList.DataSource = dt;
                repeaterTableList.DataBind();
            }
        }
        private void PersonalSubmit(out string msg)
        {
            msg = string.Empty;
            try
            {
                BLL.Loger.Log4Net.Info("【个人工单提交Step1——数据验证】");
                #region 验证

                validate(out msg);

                if (msg != string.Empty)
                {
                    msg = "{'result':'false','msg':'" + msg + "'}";
                    return;
                }

                #endregion

                #region 插入工单表

                Entities.WorkOrderInfo model_WorkOrderInfo = bindWorkOrderInfo(out msg);

                if (msg != string.Empty)
                {
                    return;
                }

                //个人类型增加工单,状态默认-已完成
                model_WorkOrderInfo.WorkOrderStatus = (int)Entities.WorkOrderStatus.Completed;

                model_WorkOrderInfo.WorkCategory = 1;//工单类型-个人;add lxw 13.9.11
                BLL.Loger.Log4Net.Info("【个人工单提交Step2——添加工单开始】");
                model_WorkOrderInfo.OrderID = BLL.WorkOrderInfo.Instance.Insert(model_WorkOrderInfo);
                BLL.Loger.Log4Net.Info("【个人工单提交Step2——添加工单结束】OrderID=" + model_WorkOrderInfo.OrderID);
                //回写IM库
                BLL.Loger.Log4Net.Info("【个人工单提交Step3——工单数据回写IM开始】");
                UpdateCCWorkOrder2IM(model_WorkOrderInfo);
                BLL.Loger.Log4Net.Info("【个人工单提交Step3——工单数据回写IM结束】");
                #endregion

                //如果有推荐活动,插入WorkOrderActivity表,add lxw 13.1.14
                #region 插入推荐活动

                if (ActivityIDs != "")
                {
                    string[] aIDs = ActivityIDs.Split(',');
                    for (int i = 0; i < aIDs.Length; i++)
                    {
                        Entities.WorkOrderActivity model_Activity = new Entities.WorkOrderActivity();
                        model_Activity.ActivityGUID = new Guid(aIDs[i]);
                        model_Activity.OrderID      = model_WorkOrderInfo.OrderID;
                        model_Activity.CreateTime   = operTime;
                        model_Activity.CreateUserID = operUserID;
                        BLL.Loger.Log4Net.Info("【个人工单提交Step4——WorkOrderActivity数据入库开始】");
                        BLL.WorkOrderActivity.Instance.Insert(model_Activity);
                        BLL.Loger.Log4Net.Info("【个人工单提交Step4——WorkOrderActivity数据入库结束】");
                    }
                }

                #endregion

                #region 插入工单回复表

                Entities.WorkOrderRevert model_Revert = bindWorkOrderRevert(out msg);

                if (msg != string.Empty)
                {
                    return;
                }

                model_Revert.OrderID            = model_WorkOrderInfo.OrderID;
                model_Revert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(operUserID);
                model_Revert.WorkOrderStatus    = "已完成";
                if (CallID != string.Empty)
                {
                    model_Revert.CallID = Int64.Parse(CallID);
                }
                BLL.Loger.Log4Net.Info("【个人工单提交Step5——WorkOrderRevert数据入库开始】");
                BLL.WorkOrderRevert.Instance.Insert(model_Revert);
                BLL.Loger.Log4Net.Info("【个人工单提交Step5——WorkOrderRevert数据入库结束】");
                #endregion

                #region 插入标签

                if (TagIDs != string.Empty)
                {
                    string[] array_TagIDs = TagIDs.Split(',');
                    for (int k = 0; k < array_TagIDs.Length; k++)
                    {
                        Entities.WorkOrderTagMapping model_Mapping = new Entities.WorkOrderTagMapping();
                        model_Mapping.OrderID      = model_WorkOrderInfo.OrderID;
                        model_Mapping.TagID        = int.Parse(array_TagIDs[k]);
                        model_Mapping.Status       = 0;
                        model_Mapping.CreateTime   = model_Mapping.ModifyTime = operTime;
                        model_Mapping.CreateUserID = model_Mapping.ModifyUserID = operUserID;
                        BLL.Loger.Log4Net.Info("【个人工单提交Step6——插入标签数据入库开始】");
                        BLL.WorkOrderTagMapping.Instance.Insert(model_Mapping);
                        BLL.Loger.Log4Net.Info("【个人工单提交Step6——插入标签数据入库结束】");
                    }
                }

                #endregion
                msg = "{'result':'true','OrderID':'" + model_WorkOrderInfo.OrderID + "'}";
            }
            catch (Exception ex)
            {
                BLL.Loger.Log4Net.Error("【个人工单提交】出现方法出现问题:" + ex.Message);
            }
        }
        private void DealerSubmit(out string msg)
        {
            msg = string.Empty;
            try
            {
                BLL.Loger.Log4Net.Info("【经销商工单提交Step1——参数验证】CallID IS:" + CallID);

                #region 验证
                validate(out msg);
                if (LastProcessDate != string.Empty)
                {
                    DateTime dtLastProcessDate;
                    if (DateTime.TryParse(LastProcessDate, out dtLastProcessDate))
                    {
                        if (dtLastProcessDate < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")))
                        {
                            msg += "最晚处理日期不能小于当前时间!<br/>";
                        }
                    }
                }

                if (msg != string.Empty)
                {
                    msg = "{'result':'false','msg':'" + msg + "'}";

                    return;
                }
                #endregion

                #region 插入工单表
                BLL.Loger.Log4Net.Info("【经销商工单提交Step2——绑定工单信息】");
                Entities.WorkOrderInfo model_WorkOrderInfo = bindWorkOrderInfo(out msg);

                if (msg != string.Empty)
                {
                    return;
                }

                string orderCustID = string.Empty;
                //根据CRMCustName查询获取CustID
                BLL.Loger.Log4Net.Info("【经销商工单提交Step3——根据CRMCustName查询获取CustID开始】");
                DataSet ds_CustID = BitAuto.YanFa.Crm2009.BLL.CustInfo.Instance.GetCustIDByNameToCC(model_WorkOrderInfo.CustName);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step3——根据CRMCustName查询获取CustID结束】");
                if (ds_CustID != null && ds_CustID.Tables.Count > 0 && ds_CustID.Tables[0].Rows.Count > 0)
                {
                    model_WorkOrderInfo.CRMCustID = orderCustID = ds_CustID.Tables[0].Rows[0]["CustID"].ToString();
                }

                //OperType=1:添加(状态:已完成);OperType=2:转出(状态:待审核)
                model_WorkOrderInfo.WorkOrderStatus = OperType == "1" ? (int)Entities.WorkOrderStatus.Completed : (int)Entities.WorkOrderStatus.Pending;

                model_WorkOrderInfo.WorkCategory = 2;//工单类型-经销商;add lxw 13.9.11

                model_WorkOrderInfo.DemandID = DemandID;
                BLL.Loger.Log4Net.Info("【经销商工单提交Step4——WorkOrderInfo入库开始】");
                model_WorkOrderInfo.OrderID = BLL.WorkOrderInfo.Instance.Insert(model_WorkOrderInfo);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step4——WorkOrderInfo入库结束】OrderID=:" + OrderID);


                //回写IM库
                BLL.Loger.Log4Net.Info("【经销商工单提交Step5——工单信息回写IM库开始】");
                UpdateCCWorkOrder2IM(model_WorkOrderInfo);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step5——工单信息回写IM库结束】");
                #endregion

                #region 插入工单回复表
                BLL.Loger.Log4Net.Info("【经销商工单提交Step6——绑定工单回复信息】OrderID=" + model_WorkOrderInfo.OrderID + ",CallID=" + CallID);
                Entities.WorkOrderRevert model_Revert = bindWorkOrderRevert(out msg);

                model_Revert.OrderID = model_WorkOrderInfo.OrderID;
                if (CallID != string.Empty)
                {
                    model_Revert.CallID = Int64.Parse(CallID);
                }

                if (msg != string.Empty)
                {
                    return;
                }

                model_Revert.WorkOrderStatus = OperType == "1" ? "已完成" : "待审核";
                BLL.Loger.Log4Net.Info("【经销商工单提交Step7——根据部门获取部门名称开始】");
                model_Revert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(operUserID);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step7——根据部门获取部门名称结束】");

                BLL.Loger.Log4Net.Info("【经销商工单提交Step8——工单回复信息入库开始】");
                BLL.WorkOrderRevert.Instance.Insert(model_Revert);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step8——工单回复信息入库结束】");
                #endregion

                #region 插入标签
                if (TagIDs != string.Empty)
                {
                    string[] array_TagIDs = TagIDs.Split(',');
                    for (int k = 0; k < array_TagIDs.Length; k++)
                    {
                        Entities.WorkOrderTagMapping model_Mapping = new Entities.WorkOrderTagMapping();
                        model_Mapping.OrderID      = model_WorkOrderInfo.OrderID;
                        model_Mapping.TagID        = int.Parse(array_TagIDs[k]);
                        model_Mapping.Status       = 0;
                        model_Mapping.CreateTime   = model_Mapping.ModifyTime = operTime;
                        model_Mapping.CreateUserID = model_Mapping.ModifyUserID = operUserID;
                        BLL.Loger.Log4Net.Info("【经销商工单提交Step9——插入标签开始】");
                        BLL.WorkOrderTagMapping.Instance.Insert(model_Mapping);
                        BLL.Loger.Log4Net.Info("【经销商工单提交Step9——插入标签结束】");
                    }
                }

                #endregion

                #region 把工单联系人插入个人用户
                Web.AjaxServers.CustBaseInfo.CustBasicInfo model_cbInfo = bindCustBasicInfo(out msg);
                if (msg != string.Empty)
                {
                    return;
                }
                Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo cbi = new Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo();
                BLL.Loger.Log4Net.Info("【经销商工单提交Step10——插入个人用户库信息开始】");
                cbi.InsertCustInfo(model_cbInfo, out msg);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step10——插入个人用户库信息结束】");
                string   ccCustID = string.Empty;
                string[] aMsg     = msg.Split(',');
                //如果不存在会新增个人用户 返回ccCustID
                //如果存在会直接返回该联系人ccCustID
                if (aMsg.Length == 2 && aMsg[0].Split(':')[1] == "'true'")
                {
                    ccCustID = aMsg[1].Split(':')[1].Replace("'", "");
                }
                #endregion

                #region 插入访问记录
                if (ccCustID != string.Empty)
                {
                    BLL.Loger.Log4Net.Info("【经销商工单提交Step11——插入联系记录开始】");
                    long callid = CommonFunction.ObjectToLong(CallID, -2);
                    int  userid = BLL.Util.GetLoginUserID();

                    BitAuto.ISDC.CC2012.Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo.OperCustVisitBusiness(ccCustID, model_WorkOrderInfo.OrderID, callid, (int)VisitBusinessTypeEnum.S1_工单, TaskSource, userid, model_WorkOrderInfo.ContactTel);
                    BLL.Loger.Log4Net.Info("【经销商工单提交Step11——插入联系记录结束】");
                }
                #endregion

                msg = "{'result':'true','OrderID':'" + model_WorkOrderInfo.OrderID + "','orderCustID':'" + orderCustID + "'}";
            }
            catch (Exception ex)
            {
                BLL.Loger.Log4Net.Error("【经销商工单提交】出现方法出现问题:" + ex.Message);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        ///工单外呼电话呼出接通。
        ///2040-06-18 毕帆 返回数据添加WORID值
        /// </summary>
        /// <param name="msg"></param>
        private void Established(out string msg)
        {
            msg = string.Empty;
            Entities.CallRecordInfo model = new Entities.CallRecordInfo();
            //通话流水号
            model.SessionID = RecordID;
            //坐席分机号
            model.ExtensionNum = UserName;

            //对方号码
            model.PhoneNum = CallerNum;
            //呼出号码
            model.ANI = CalledNum;

            //呼出
            model.CallStatus = 2;
            //录音开始时间
            model.BeginTime = System.DateTime.Now;

            DateTime beginTime = DateTime.Now;

            if (DateTime.TryParse(RequestEstablishBeginTime, out beginTime))
            {
            }
            model.BeginTime = beginTime;

            //录音地址
            model.AudioURL = RecordIDURL;
            //CRM客户ID
            model.CustID = CustID;
            //客户名称
            model.CustName   = CustName;
            model.CreateTime = System.DateTime.Now;
            int loginID = BLL.Util.GetLoginUserID();

            model.CreateUserID = loginID;
            //联系人
            model.Contact = Contact;
            //任务ID
            model.TaskID = TaskID;

            model.TallTime = 0;

            //坐席振铃时长
            int AgentRingTime = 0;

            if (int.TryParse(NetworkRTimeSpan, out AgentRingTime))
            {
                model.AgentRingTime = AgentRingTime;
            }
            //客户振铃时长
            int CustomRingTime = 0;

            if (int.TryParse(EstablishTimeSpan, out CustomRingTime))
            {
                model.CustomRingTime = CustomRingTime;
            }
            int _newcustid;

            if (int.TryParse(NewCustID, out _newcustid))
            {
                model.CCCustID = _newcustid.ToString();
            }
            //工单取业务组,分类
            int _bgid = BLL.SurveyCategory.Instance.GetSelfBGIDByUserID(loginID); //登陆者所在业务组ID
            int _scid = BLL.SurveyCategory.Instance.GetSelfSCIDByUserID(loginID); //登陆者所在业务组下的工单分类ID

            model.BGID = _bgid;
            model.SCID = _scid;

            //西门子callid
            Int64 _callID = 0;

            if (Int64.TryParse(CallID, out _callID))
            {
            }
            model.CallID = _callID;


            int RecID = BLL.CallRecordInfo.Instance.Insert(model);

            //插入工单回复信息
            Entities.WorkOrderRevert workorderrevert = new Entities.WorkOrderRevert();
            workorderrevert.OrderID            = model.TaskID;
            workorderrevert.CreateTime         = DateTime.Now;
            workorderrevert.CreateUserID       = model.CreateUserID;
            workorderrevert.CallID             = model.CallID;
            workorderrevert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(Convert.ToInt32(model.CreateUserID));
            long ival = BLL.WorkOrderRevert.Instance.Insert(workorderrevert);

            BLL.Loger.Log4Net.Info("【工单外呼】准备调用接口CallRecordServiceHelper.Instance.UpdateBusinessDataByCallID开始");

            //调用webservice,保存callid,业务id,业务组,分类对应关系
            //int Result = CallRecordServiceHelper.Instance.UpdateBusinessDataByCallID(model.CallID, model.TaskID, model.BGID, model.SCID, Convert.ToInt32(model.CreateUserID), ref msg);
            int Result = BLL.CallRecord_ORIG_Business.Instance.UpdateBusinessDataByCallID(model.CallID, model.TaskID, model.BGID, model.SCID, Convert.ToInt32(model.CreateUserID), ref msg);

            BLL.Loger.Log4Net.Info("【工单外呼】准备调用接口CallRecordServiceHelper.Instance.UpdateBusinessDataByCallID结束返回值Result=" + Result);

            msg = "{'success':'yes','recordid':'" + RecID + "','WORID':'" + ival + "'}";
        }
        //编辑工单回复表信息
        private void EditWorkOrderRevert(Entities.WorkOrderInfo newModel, Entities.WorkOrderInfo oldModel, out string msg)
        {
            msg = string.Empty;

            if (newModel == null || oldModel == null)
            {
                return;
            }

            Entities.WorkOrderRevert model_Revert = new Entities.WorkOrderRevert();

            Int64 callID = 0;

            if (Int64.TryParse(CallID, out callID))
            {
                //如果有录音,则在之前的录音记录的基础上进行回复表的修改
                model_Revert = BLL.WorkOrderRevert.Instance.GetWorkOrderRevertByCallID(callID);
            }
            else
            {
                model_Revert.OrderID      = oldModel.OrderID;
                model_Revert.CreateTime   = operTime;
                model_Revert.CreateUserID = operUserID;
            }
            model_Revert.RevertContent      = RevertContent;
            model_Revert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(operUserID);

            model_Revert.IsReturnVisit = RevertContent == string.Empty ? "否" : "是";

            //比较工单分类
            if (newModel.CategoryID != oldModel.CategoryID)
            {
                string oldCategoryName = BLL.WorkOrderCategory.Instance.GetCategoryFullName(oldModel.CategoryID.ToString());

                string newCategoryName = BLL.WorkOrderCategory.Instance.GetCategoryFullName(newModel.CategoryID.ToString());

                model_Revert.CategoryName = fieldDesc(oldCategoryName, newCategoryName);
            }

            //比较工单状态
            if (newModel.WorkOrderStatus != oldModel.WorkOrderStatus)
            {
                string oldStatus = BLL.Util.GetEnumOptText(typeof(Entities.WorkOrderStatus), (int)oldModel.WorkOrderStatus);

                string newStatus = BLL.Util.GetEnumOptText(typeof(Entities.WorkOrderStatus), (int)newModel.WorkOrderStatus);

                model_Revert.WorkOrderStatus = fieldDesc(oldStatus, newStatus);
            }

            //比较优先级
            if (newModel.PriorityLevel != oldModel.PriorityLevel)
            {
                string oldLevel = oldModel.PriorityLevel == 1 ? "普通" : "紧急";

                string newLevel = newModel.PriorityLevel == 1 ? "普通" : "紧急";

                model_Revert.PriorityLevelName = fieldDesc(oldLevel, newLevel);
            }

            //比较接收人
            if (!string.IsNullOrEmpty(newModel.ReceiverName) || !string.IsNullOrEmpty(oldModel.ReceiverName))
            {
                model_Revert.ReceiverID   = newModel.ReceiverID.ToString();
                model_Revert.ReceiverName = fieldDesc(oldModel.ReceiverName, newModel.ReceiverName);
            }

            //比较是否投诉
            if (newModel.IsComplaintType != oldModel.IsComplaintType)
            {
                string oldIsComplaint = oldModel.IsComplaintType == true ? "投诉" : "普通";

                string newIsComplaint = newModel.IsComplaintType == true ? "投诉" : "普通";

                model_Revert.IsComplaintType = fieldDesc(oldIsComplaint, newIsComplaint);
            }

            //比较标签
            string tagDesc = GetCompareTagDesc(model_Revert.OrderID, TagIDs);

            if (tagDesc != string.Empty)
            {
                model_Revert.TagName = tagDesc;

                //修改标签表
                BLL.WorkOrderTagMapping.Instance.DeleteByOrderID(model_Revert.OrderID);

                if (TagIDs != string.Empty)
                {
                    string[] array_TagIDs = TagIDs.Split(',');
                    for (int k = 0; k < array_TagIDs.Length; k++)
                    {
                        Entities.WorkOrderTagMapping model_Mapping = new Entities.WorkOrderTagMapping();
                        model_Mapping.OrderID      = model_Revert.OrderID;
                        model_Mapping.TagID        = int.Parse(array_TagIDs[k]);
                        model_Mapping.Status       = 0;
                        model_Mapping.CreateTime   = model_Mapping.ModifyTime = operTime;
                        model_Mapping.CreateUserID = model_Mapping.ModifyUserID = operUserID;
                        BLL.WorkOrderTagMapping.Instance.Insert(model_Mapping);
                    }
                }
            }

            if (callID != 0)
            {
                BLL.WorkOrderRevert.Instance.Update(model_Revert);
            }
            else
            {
                BLL.WorkOrderRevert.Instance.Insert(model_Revert);
            }
        }
        private void SalesProcessSubmit(out string msg)
        {
            msg = string.Empty;
            if (!string.IsNullOrEmpty(Requester) && Requester.Trim() == "intelligentplatform")
            {
                msg = "process";
            }
            else
            {
                judgeSalesPermission(out msg);
            }

            if (msg == "none" || msg == "view" || msg == "over")
            {
                return;
            }

            if (string.IsNullOrEmpty(OrderID))
            {
                msg = "工单号不能为空!";
                return;
            }
            if (string.IsNullOrEmpty(RevertContent))
            {
                msg = "回复内容不能为空!";
                return;
            }
            Web.AjaxServers.ValidateDataFormat vd = new Web.AjaxServers.ValidateDataFormat();

            int contentLen = vd.GetLength(RevertContent);

            if (contentLen > 600)
            {
                msg = "回复内容超过300个字!";
                return;
            }

            #region 更新工单表

            Entities.WorkOrderInfo model_WorkOrderInfo = BLL.WorkOrderInfo.Instance.GetWorkOrderInfo(OrderID);

            string oldReceiverName = model_WorkOrderInfo.ReceiverName;
            int    _receiverID;
            if (int.TryParse(ReceiverID, out _receiverID))
            {
                //坐席操作,只有在选择接收人,才会覆盖当前操作人,否则不清空
                model_WorkOrderInfo.ReceiverID   = _receiverID;
                model_WorkOrderInfo.ReceiverName = ReceiverName;
            }

            model_WorkOrderInfo.IsSales = IsSales == "true" ? true : false;

            if (RevertContent != string.Empty)
            {
                model_WorkOrderInfo.IsRevert = true;
            }
            if (!string.IsNullOrEmpty(ReceiverName) && !string.IsNullOrEmpty(ReceiverID) && ReceiverID != "-2")
            {
                model_WorkOrderInfo.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(int.Parse(ReceiverID));
            }

            model_WorkOrderInfo.ModifyTime   = operTime;
            model_WorkOrderInfo.ModifyUserID = operUserID;

            model_WorkOrderInfo.WorkOrderStatus = (int)Entities.WorkOrderStatus.Processing;

            BLL.WorkOrderInfo.Instance.Update(model_WorkOrderInfo);

            #endregion

            #region 插入工单回复表(原来的)

            Entities.WorkOrderRevert model_Revert = new Entities.WorkOrderRevert();
            if (string.IsNullOrEmpty(RTWORID))  //没有接通电话时提交回复信息,则插入[WorkOrderRevert]表一条数据
            {
                model_Revert.OrderID       = OrderID;
                model_Revert.RevertContent = RevertContent;

                if (!string.IsNullOrEmpty(oldReceiverName) || !string.IsNullOrEmpty(ReceiverName))
                {
                    model_Revert.ReceiverName = fieldDesc(oldReceiverName, model_WorkOrderInfo.ReceiverName);
                    model_Revert.ReceiverID   = model_WorkOrderInfo.ReceiverID.ToString();
                }
                model_Revert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(operUserID);
                model_Revert.WorkOrderStatus    = "处理中";
                model_Revert.CreateTime         = operTime;
                model_Revert.CreateUserID       = operUserID;

                BLL.WorkOrderRevert.Instance.Insert(model_Revert);
            }
            else  //已经接通电话,并插入[WorkOrderRevert]表一条数据,则更新这条数据
            {
                model_Revert = BLL.WorkOrderRevert.Instance.GetWorkOrderRevert(long.Parse(RTWORID));
                model_Revert.RevertContent = RevertContent;
                if (!string.IsNullOrEmpty(oldReceiverName) || !string.IsNullOrEmpty(ReceiverName))
                {
                    model_Revert.ReceiverName = fieldDesc(oldReceiverName, model_WorkOrderInfo.ReceiverName);
                    model_Revert.ReceiverID   = model_WorkOrderInfo.ReceiverID.ToString();
                }
                model_Revert.WorkOrderStatus = "处理中";

                BLL.WorkOrderRevert.Instance.Update(model_Revert);
            }

            #endregion

            #region 插入工单回复表、工单日志表

            //Entities.WorkOrderLog log = new Entities.WorkOrderLog();
            //Entities.WorkOrderReceiver receiver = new Entities.WorkOrderReceiver();

            //if (string.IsNullOrEmpty(RTWORID))  //没有接通电话时提交回复信息,则插入 日志表、回复表
            //{
            //    log.OrderID = OrderID;
            //    if (!string.IsNullOrEmpty(oldReceiverName) || !string.IsNullOrEmpty(ReceiverName))
            //    {
            //        log.LogDesc = fieldDesc(oldReceiverName, model_WorkOrderInfo.ReceiverName);
            //        /// model_Revert.WorkOrderStatus = "处理中";
            //    }
            //    log.CreateTime = operTime;
            //    log.CreateUserID = operUserID;

            //    receiver.RevertContent = RevertContent;
            //    receiver.ReceiverUserID = model_WorkOrderInfo.ReceiverID;
            //    receiver.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(operUserID);
            //    receiver.CreateTime = operTime;
            //    receiver.CreateUserID = operUserID;

            //    int ReceiverRecID = BLL.WorkOrderReceiver.Instance.Insert(receiver);
            //    log.ReceiverRecID = ReceiverRecID;
            //    BLL.WorkOrderLog.Instance.Insert(log);
            //}
            //else
            //{
            //    receiver = BLL.WorkOrderReceiver.Instance.GetWorkOrderReceiver(int.Parse(RTWORID));
            //    receiver.RevertContent = RevertContent;
            //    receiver.ReceiverUserID = model_WorkOrderInfo.ReceiverID;

            //    log = BLL.WorkOrderLog.Instance.GetWorkOrderLogByRtRecID(int.Parse(RTWORID));
            //    if (!string.IsNullOrEmpty(oldReceiverName) || !string.IsNullOrEmpty(ReceiverName))
            //    {
            //        log .LogDesc= fieldDesc(oldReceiverName, model_WorkOrderInfo.ReceiverName);
            //        //model_Revert.WorkOrderStatus = "处理中";
            //    }

            //    BLL.WorkOrderLog.Instance.Update(log);
            //    BLL.WorkOrderReceiver.Instance.Update(receiver);
            //}

            #endregion

            #region 发送邮件

            if (int.TryParse(ReceiverID, out _receiverID))
            {
                AjaxServers.SendEmailInfo sendInfo = new AjaxServers.SendEmailInfo();
                sendInfo.ReceiverID   = _receiverID;
                sendInfo.ReceiverName = ReceiverName;
                sendInfo.LastOperTime = model_WorkOrderInfo.LastProcessDate;
                sendInfo.OrderID      = model_WorkOrderInfo.OrderID;
                sendInfo.Title        = model_WorkOrderInfo.Title;
                sendInfo.DepartName   = model_WorkOrderInfo.ReceiverDepartName;
                sendInfo.Desc         = model_WorkOrderInfo.Content;

                SendEmailToReceiver(sendInfo);
            }

            #endregion

            msg = "true";
        }
Ejemplo n.º 16
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(SqlTransaction sqltran, Entities.WorkOrderRevert model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@WORID",                  SqlDbType.BigInt,       8),
                new SqlParameter("@OrderID",                SqlDbType.VarChar,     20),
                new SqlParameter("@RevertContent",          SqlDbType.NVarChar,  2000),
                new SqlParameter("@CategoryName",           SqlDbType.NVarChar,  2000),
                new SqlParameter("@DataSource",             SqlDbType.NVarChar,  2000),
                new SqlParameter("@CustName",               SqlDbType.NVarChar,  2000),
                new SqlParameter("@CRMCustID",              SqlDbType.NVarChar,  2000),
                new SqlParameter("@ProvinceName",           SqlDbType.NVarChar,  2000),
                new SqlParameter("@CityName",               SqlDbType.NVarChar,  2000),
                new SqlParameter("@CountyName",             SqlDbType.NVarChar,  2000),
                new SqlParameter("@Contact",                SqlDbType.NVarChar,  2000),
                new SqlParameter("@ContactTel",             SqlDbType.NVarChar,  2000),
                new SqlParameter("@PriorityLevelName",      SqlDbType.NVarChar,  2000),
                new SqlParameter("@LastProcessDate",        SqlDbType.NVarChar,  2000),
                new SqlParameter("@IsComplaintType",        SqlDbType.NVarChar,  2000),
                new SqlParameter("@Title",                  SqlDbType.NVarChar,  2000),
                new SqlParameter("@TagName",                SqlDbType.NVarChar,  2000),
                new SqlParameter("@WorkOrderStatus",        SqlDbType.NVarChar,  2000),
                new SqlParameter("@ReceiverID",             SqlDbType.NVarChar,  2000),
                new SqlParameter("@ReceiverName",           SqlDbType.NVarChar,  2000),
                new SqlParameter("@ReceiverDepartName",     SqlDbType.NVarChar,  2000),
                new SqlParameter("@IsSales",                SqlDbType.NVarChar,  2000),
                new SqlParameter("@AttentionCarBrandName",  SqlDbType.NVarChar,  2000),
                new SqlParameter("@AttentionCarSerialName", SqlDbType.NVarChar,  2000),
                new SqlParameter("@AttentionCarTypeName",   SqlDbType.NVarChar,  2000),
                new SqlParameter("@SelectDealerID",         SqlDbType.NVarChar,  2000),
                new SqlParameter("@SelectDealerName",       SqlDbType.NVarChar,  2000),
                new SqlParameter("@NominateActivity",       SqlDbType.NVarChar,  2000),
                new SqlParameter("@SaleCarBrandName",       SqlDbType.NVarChar,  2000),
                new SqlParameter("@SaleCarSerialName",      SqlDbType.NVarChar,  2000),
                new SqlParameter("@SaleCarTypeName",        SqlDbType.NVarChar,  2000),
                new SqlParameter("@IsReturnVisit",          SqlDbType.NVarChar,  2000),
                new SqlParameter("@CreateTime",             SqlDbType.DateTime),
                new SqlParameter("@CreateUserID",           SqlDbType.Int,          4),
                new SqlParameter("@CallID",                 SqlDbType.BigInt, 8)
            };
            parameters[0].Value  = model.WORID;
            parameters[1].Value  = model.OrderID;
            parameters[2].Value  = model.RevertContent;
            parameters[3].Value  = model.CategoryName;
            parameters[4].Value  = model.DataSource;
            parameters[5].Value  = model.CustName;
            parameters[6].Value  = model.CRMCustID;
            parameters[7].Value  = model.ProvinceName;
            parameters[8].Value  = model.CityName;
            parameters[9].Value  = model.CountyName;
            parameters[10].Value = model.Contact;
            parameters[11].Value = model.ContactTel;
            parameters[12].Value = model.PriorityLevelName;
            parameters[13].Value = model.LastProcessDate;
            parameters[14].Value = model.IsComplaintType;
            parameters[15].Value = model.Title;
            parameters[16].Value = model.TagName;
            parameters[17].Value = model.WorkOrderStatus;
            parameters[18].Value = model.ReceiverID;
            parameters[19].Value = model.ReceiverName;
            parameters[20].Value = model.ReceiverDepartName;
            parameters[21].Value = model.IsSales;
            parameters[22].Value = model.AttentionCarBrandName;
            parameters[23].Value = model.AttentionCarSerialName;
            parameters[24].Value = model.AttentionCarTypeName;
            parameters[25].Value = model.SelectDealerID;
            parameters[26].Value = model.SelectDealerName;
            parameters[27].Value = model.NominateActivity;
            parameters[28].Value = model.SaleCarBrandName;
            parameters[29].Value = model.SaleCarSerialName;
            parameters[30].Value = model.SaleCarTypeName;
            parameters[31].Value = model.IsReturnVisit;
            parameters[32].Value = model.CreateTime;
            parameters[33].Value = model.CreateUserID;
            parameters[34].Value = model.CallID;

            return(SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_WORKORDERREVERT_UPDATE, parameters));
        }