ComplianceServer/oldcode/WEB/Controllers/Ord/MemoController.cs

300 lines
12 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Web.Mvc;
using WX.CRM.Common;
using WX.CRM.IBLL.Base;
using WX.CRM.IBLL.Csvr;
using WX.CRM.IBLL.Ord;
using WX.CRM.IBLL.Res;
using WX.CRM.IBLL.Util;
using WX.CRM.Model.Entity;
using WX.CRM.WebHelper;
namespace WX.CRM.WEB.Controllers.Ord
{
public class MemoController : BaseController
{
private IORD_SALEMEMO saleMemoBiz;
private IORD_PURPOSEMEMO purposeMemoBiz;
private IORD_SERVICEMEMO serviceMemoBiz;
private IORD_SPECIALMEMO specialMemoBiz;
private ICSVR_TODAYRECORD_Q todaterecord;
[Ninject.Inject]
public ICACHE_Q _cacheQ { get; set; }
[Ninject.Inject]
public WX.CRM.IBLL.Res.IRES_ALLOCATESTRATEGY_Q allocateQ { get; set; }
[Ninject.Inject]
public IRES_DISTRIBUTE res_Distribute_BLL { get; set; }
private IBAS_PARAMETER_Q _BAS_PARAMETER_Q;
private string _ORD_SYNCTYPE = "";
ValidationErrors errors = new ValidationErrors();
public MemoController(
IORD_SALEMEMO _saleMemoBiz,
IORD_PURPOSEMEMO _purposeMemoBiz,
IORD_SERVICEMEMO _serviceMemoBiz,
IORD_SPECIALMEMO _specialMemoBiz,
ICSVR_TODAYRECORD_Q _todaterecord,
IBAS_PARAMETER_Q _BASPARAMETER
)
{
this.saleMemoBiz = _saleMemoBiz;
this.purposeMemoBiz = _purposeMemoBiz;
this.serviceMemoBiz = _serviceMemoBiz;
this.specialMemoBiz = _specialMemoBiz;
this.todaterecord = _todaterecord;
this._BAS_PARAMETER_Q = _BASPARAMETER;
var _ORD_SYNCTYPE_M = _BAS_PARAMETER_Q.GetModel_Patameter("ORD_SYNCTYPE");
if (null != _ORD_SYNCTYPE_M)
{
_ORD_SYNCTYPE = _ORD_SYNCTYPE_M.PARAVALUE;
}
}
public DateTime GetTime(string TxtDate, string HourDDL, string MinuteDDL)
{
if (!String.IsNullOrEmpty(TxtDate))
{
DateTime taskTime = Convert.ToDateTime(TxtDate);
taskTime = taskTime.AddHours(Convert.ToInt32(HourDDL));
taskTime = taskTime.AddMinutes(Convert.ToInt32(MinuteDDL));
taskTime = taskTime.AddSeconds(59);
return taskTime;
}
else
{
return DateTime.Now;
}
}
#region
public ActionResult SaleMemoAdd()
{
IList<SelectListItem> list = OperationUtil.GetItemFromEnum<WX.CRM.Model.Enum.EnumSaleMemoType>();
foreach (SelectListItem iterm in list)
{
if (iterm.Text == "呼出")
iterm.Selected = true;
}
ViewBag.SaleMemoType = list;
return View(new ORD_SALEMEMO());
}
[HttpPost]
public JsonResult SaleMemoCreate(ORD_SALEMEMO model)
{
model.INNERUSERID = UserId;
model.CTIME = DateTime.Now;
decimal eid = InnerUserHelper.Instance.GetEidByUserId(model.INNERUSERID) ?? 0;
var todayRecord = todaterecord.GetMode(model.RESID, eid, model.CTIME.Value);
if (todayRecord != null)
{
model.CALLTIME = todayRecord.TIMESTART;
model.CALLTIMEEND = todayRecord.TIMESTART.HasValue ? todayRecord.TIMESTART.Value.AddSeconds(Convert.ToDouble(todayRecord.TIMELENGTH ?? 0)) : (DateTime?)null;
model.RECORDID = todayRecord.RECORDID;
model.COID = todayRecord.COID;
}
bool result = saleMemoBiz.Create(ref errors, model);
if (result)
{
//更新资源最后工单标识和时间
res_Distribute_BLL.UpdateCacheResCountActiveFlag(model.RESID, model.CTIME.Value);
}
//#region 资源查看状态
//try
//{
// allocateQ.ViewMyRes(model.RESID, UserId);
//}
//catch (Exception ex)
//{
// LogHelper.Error("修改资源查看状态报错客户ID"+model.RESID+"员工ID"+UserId.ToString()+";" + ex);
//}
//#endregion
////推送
//if (Request.Form["CKTask"] != null && Request.Form["CKTask"] == "on")
//{
// DateTime time = GetTime(Request.Form["TxtDate"], Request.Form["HourDDL"], Request.Form["MinuteDDL"]);
// //添加任务
//}
return JsonHandler.InsertMessage(errors, result);
}
public ActionResult MemoList()
{
//table
Pager pager = new Pager() { page = 1, rows = 10 };
string tableId = "tablist";
WebHelper.Table tab = new WebHelper.Table(tableId);
tab.AddHeadCol("MEMOID", "8%", "编号");
tab.AddHeadCol("TYPENAME", "10%", "大类");
tab.AddHeadCol("TYPENAME", "10%", "小类");
tab.AddHeadCol("STRCONTENT", "", "工单");
tab.AddHeadCol("INNERUSERNAME", "10%", "受理人");
tab.AddHeadCol("CTIME", "10%", "受理时间");
tab.AddHeadCol("CALLTIMEEND", "20%", "通话时间");
tab.AddHeadRow();
ViewBag.gridTable = tab.GetHead() + Pagination.GetPage(pager, tableId, "5,8,10,15");
return View();
}
#endregion
#region
public ActionResult PurposeMemoAdd()
{
IList<SelectListItem> list = OperationUtil.GetItemFromEnum<WX.CRM.Model.Enum.EnumPurposeMemoType>();
ViewBag.SaleMemoType = list;
return View(new ORD_PURPOSEMEMO());
}
[HttpPost]
public JsonResult PurposeMemoCreate(ORD_PURPOSEMEMO model)
{
model.INNERUSERID = UserId;
model.CTIME = DateTime.Now;
decimal eid = InnerUserHelper.Instance.GetEidByUserId(model.INNERUSERID) ?? 0;
var todayRecord = todaterecord.GetMode(model.RESID, eid, model.CTIME.Value);
if (todayRecord != null)
{
model.CALLTIME = todayRecord.TIMESTART;
model.CALLTIMEEND = todayRecord.TIMESTART.HasValue ? todayRecord.TIMESTART.Value.AddSeconds(Convert.ToDouble(todayRecord.TIMELENGTH ?? 0)) : (DateTime?)null;
model.RECORDID = todayRecord.RECORDID;
model.COID = todayRecord.COID;
}
bool result = purposeMemoBiz.Create(ref errors, model);
if (result)
{
//更新资源最后工单标识和时间
res_Distribute_BLL.UpdateCacheResCountActiveFlag(model.RESID, model.CTIME.Value);
}
//#region 资源查看状态
//try
//{
// allocateQ.ViewMyRes(model.RESID, UserId);
//}
//catch (Exception ex)
//{
// LogHelper.Error("修改资源查看状态报错客户ID" + model.RESID + "员工ID" + UserId.ToString() + ";" + ex);
//}
//#endregion
//if (Request.Form["CKTask"] != null && Request.Form["CKTask"] == "on")
//{
// DateTime time = GetTime(Request.Form["TxtDate"], Request.Form["HourDDL"], Request.Form["MinuteDDL"]);
// //添加任务
//}
return JsonHandler.InsertMessage(errors, result);
}
#endregion
#region
public ActionResult ServiceMemoAdd()
{
IList<SelectListItem> list = OperationUtil.GetItemFromEnum<WX.CRM.Model.Enum.EnumServiceMemoType>();
ViewBag.SaleMemoType = list;
return View(new ORD_SERVICEMEMO());
}
[HttpPost]
public JsonResult ServiceMemoCreate(ORD_SERVICEMEMO model, ORD_SERVICEMEMO_EXT ext)
{
model.INNERUSERID = UserId;
model.CTIME = DateTime.Now;
decimal eid = InnerUserHelper.Instance.GetEidByUserId(model.INNERUSERID) ?? 0;
var todayRecord = todaterecord.GetMode(model.RESID, eid, model.CTIME.Value);
if (todayRecord != null)
{
model.CALLTIME = todayRecord.TIMESTART;
model.CALLTIMEEND = todayRecord.TIMESTART.HasValue ? todayRecord.TIMESTART.Value.AddSeconds(Convert.ToDouble(todayRecord.TIMELENGTH ?? 0)) : (DateTime?)null;
model.RECORDID = todayRecord.RECORDID;
model.COID = todayRecord.COID;
}
bool result = serviceMemoBiz.Create(ref errors, model, ext);
if (result)
{
//更新资源最后工单标识和时间
res_Distribute_BLL.UpdateCacheResCountActiveFlag(model.RESID, model.CTIME.Value);
if (Utility.GetSettingOrNullByKey("HFSuccess") == model.MEMOSUBTYPEID.ToString())
res_Distribute_BLL.UpdateHFStatus(model.RESID,1);
if (Utility.GetSettingOrNullByKey("HFFail") == model.MEMOSUBTYPEID.ToString())
res_Distribute_BLL.UpdateHFStatus(model.RESID,2);
}
//#region 资源查看状态
//try
//{
// allocateQ.ViewMyRes(model.RESID, UserId);
//}
//catch (Exception ex)
//{
// LogHelper.Error("修改资源查看状态报错客户ID" + model.RESID + "员工ID" + UserId.ToString() + ";" + ex);
//}
//#endregion
//if (Request.Form["CKTask"] != null && Request.Form["CKTask"] == "on")
//{
// DateTime time = GetTime(Request.Form["TxtDate"], Request.Form["HourDDL"], Request.Form["MinuteDDL"]);
// //添加任务
//}
return JsonHandler.InsertMessage(errors, result);
}
#endregion
#region
public ActionResult SpecialMemoAdd()
{
IList<SelectListItem> list = OperationUtil.GetItemFromEnum<WX.CRM.Model.Enum.EnumSpecialMemoType>();
ViewBag.SaleMemoType = list;
return View(new ORD_SPECIALMEMO());
}
[HttpPost]
public JsonResult SpecialMemoCreate(ORD_SPECIALMEMO model)
{
model.INNERUSERID = UserId;
model.CTIME = DateTime.Now;
decimal eid = InnerUserHelper.Instance.GetEidByUserId(model.INNERUSERID) ?? 0;
var todayRecord = todaterecord.GetMode(model.RESID, eid, model.CTIME.Value);
if (todayRecord != null)
{
model.CALLTIME = todayRecord.TIMESTART;
model.CALLTIMEEND = todayRecord.TIMESTART.HasValue ? todayRecord.TIMESTART.Value.AddSeconds(Convert.ToDouble(todayRecord.TIMELENGTH ?? 0)) : (DateTime?)null;
model.RECORDID = todayRecord.RECORDID;
model.COID = todayRecord.COID;
}
bool result = specialMemoBiz.Create(ref errors, model);
if (result)
{
//更新资源最后工单标识和时间
res_Distribute_BLL.UpdateCacheResCountActiveFlag(model.RESID, model.CTIME.Value);
}
//#region 资源查看状态
//try
//{
// allocateQ.ViewMyRes(model.RESID, UserId);
//}
//catch (Exception ex)
//{
// LogHelper.Error("修改资源查看状态报错客户ID" + model.RESID + "员工ID" + UserId.ToString() + ";" + ex);
//}
//#endregion
//if (Request.Form["CKTask"] != null && Request.Form["CKTask"] == "on")
//{
// DateTime time = GetTime(Request.Form["TxtDate"], Request.Form["HourDDL"], Request.Form["MinuteDDL"]);
// //添加任务
//}
return JsonHandler.InsertMessage(errors, result);
}
#endregion
}
}