protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Bind(); // 绑定页面下拉数据 } CallBack = Request.QueryString["CallBack"]; var accountId = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(accountId)) { thisAccount = new CompanyBLL().GetCompany(long.Parse(accountId)); } var contractId = Request.QueryString["contract_id"]; if (!string.IsNullOrEmpty(contractId)) { thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contractId)); } var insProId = Request.QueryString["insProId"]; if (!string.IsNullOrEmpty(insProId)) { insPro = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId)); if (insPro != null && insPro.account_id != null) { thisAccount = new CompanyBLL().GetCompany((long)insPro.account_id); } } var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); var isCopyString = Request.QueryString["isCopy"]; if (string.IsNullOrEmpty(isCopyString)) { isAdd = false; } else { isCopy = true; } if (!IsPostBack) { cate_id.ClearSelection(); cate_id.SelectedValue = thisTicket.cate_id.ToString(); this.ticket_type_id.SelectedValue = thisTicket.ticket_type_id.ToString(); this.status_id.SelectedValue = thisTicket.status_id.ToString(); if (isCopy) { this.status_id.ClearSelection(); this.status_id.SelectedValue = ((int)DicEnum.TICKET_STATUS.NEW).ToString(); } if (thisTicket.priority_type_id != null) { priority_type_id.SelectedValue = thisTicket.priority_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.source_type_id != null) { source_type_id.SelectedValue = thisTicket.source_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.sla_id != null) { sla_id.SelectedValue = thisTicket.sla_id.ToString(); } if (thisTicket.department_id != null) { department_id.SelectedValue = thisTicket.department_id.ToString(); } } ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { foreach (var item in otherResList) { if (item.resource_id != null && item.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)item.resource_id, (long)item.role_id); if (resDepList != null && resDepList.Count > 0) { ticketResIds += resDepList[0].id + ","; } } } if (ticketResIds != "") { ticketResIds = ticketResIds.Substring(0, ticketResIds.Length - 1); } } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } #region 时间轴显示相关 工单备注类型获取 var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } #endregion entryList = new sdk_work_entry_dal().GetList(thisTicket.id); } } var ticket_type_id = Request.QueryString["ticket_type_id"]; if (!string.IsNullOrEmpty(ticket_type_id)) { this.ticket_type_id.ClearSelection(); this.ticket_type_id.SelectedValue = ticket_type_id; } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { try { var ticketIds = Request.QueryString["ticketIds"]; var sdDal = new sdk_task_dal(); if (!string.IsNullOrEmpty(ticketIds)) { ticketList = sdDal.GetTicketByIds(ticketIds); } if (ticketList != null && ticketList.Count > 0) { if (ticketList.Count == 1) { isSingle = true; } else { isSingle = false; } thisTicket = ticketList[0]; } else { Response.Write("<script>alert('未查询到相关工单信息!');window.close();</script>"); return; } var udfBLL = new UserDefinedFieldsBLL(); if (thisTicket == null) { Response.Write("<script>alert('未查询到相关工单信息!');window.close();</script>"); } else { thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); thisUser = new sys_resource_dal().FindNoDeleteById(LoginUserId); #region 获取相关属性是否可以更改 if (ticketList.Any(_ => _.id != thisTicket.id)) { isManyTitle = true; } else { isManyTitle = false; } if (ticketList.Any(_ => _.id != thisTicket.id)) { isManydesc = true; } else { isManydesc = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.department_id != thisTicket.department_id)) { isManyDep = true; } else { isManyDep = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.issue_type_id != thisTicket.issue_type_id)) { isManyissType = true; } else { isManyissType = false; } if (ticketList.Any(_ => _.id != thisTicket.id && (_.owner_resource_id != thisTicket.owner_resource_id && _.role_id != thisTicket.role_id))) { isManyPri = true; } else { isManyPri = false; if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { thisPriRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); thisRole = new sys_role_dal().FindNoDeleteById((long)thisTicket.role_id); var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; } } } if (ticketList.Any(_ => _.id != thisTicket.id && _.cate_id != thisTicket.cate_id)) { isManyTicketCate = true; } else { isManyTicketCate = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.estimated_hours != thisTicket.estimated_hours)) { isManyEstHour = true; } else { isManyEstHour = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.estimated_end_time != thisTicket.estimated_end_time)) { isManyDueTime = true; } else { isManyDueTime = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.account_id != thisTicket.account_id)) { isManyAccount = true; } else { isManyAccount = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.contract_id != thisTicket.contract_id)) { isManyContract = true; } else { isManyContract = false; if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } } if (ticketList.Any(_ => _.id != thisTicket.id && _.status_id != thisTicket.status_id)) { isManyStatus = true; } else { isManyStatus = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.service_id != thisTicket.service_id)) { isManySerivce = true; } else { isManySerivce = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.priority_type_id != thisTicket.priority_type_id)) { isManyPrio = true; } else { isManyPrio = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.cost_code_id != thisTicket.cost_code_id)) { isManyWork = true; } else { isManyWork = false; if (thisTicket.cost_code_id != null) { thisWorkType = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } } if (ticketList.Any(_ => _.id != thisTicket.id && _.sub_issue_type_id != thisTicket.sub_issue_type_id)) { isManySubIssType = true; } else { isManySubIssType = false; } // protected bool isManyStatus; #endregion udfValue = udfBLL.GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, udfTaskPara); if (udfTaskPara != null && udfTaskPara.Count > 0) { foreach (var udfTask in udfTaskPara) { var thisValue = ""; if (udfValue.FirstOrDefault(_ => _.id == udfTask.id) != null) { thisValue = udfValue.FirstOrDefault(_ => _.id == udfTask.id).value.ToString(); } var count = new UserDefinedFieldsBLL().GetSameValueCount(DicEnum.UDF_CATE.TASK, ticketIds, udfTask.col_name, thisValue.ToString()); if (count > 1 && (!isSingle)) { udfValue.FirstOrDefault(_ => _.id == udfTask.id).value = "多个值-保持不变"; } } } var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { foreach (var item in otherResList) { if (item.resource_id != null && item.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)item.resource_id, (long)item.role_id); if (resDepList != null && resDepList.Count > 0) { ticketResIds += resDepList[0].id + ","; } } } if (ticketResIds != "") { ticketResIds = ticketResIds.Substring(0, ticketResIds.Length - 1); } } } if (IsPostBack) { var stDal = new sdk_task_dal(); var ticBll = new TicketBLL(); var accBll = new CompanyBLL(); var notiResIds = new System.Text.StringBuilder(); foreach (var tic in ticketList) { var ticket = stDal.FindNoDeleteById(tic.id); if (ticket == null) { continue; } var user = UserInfoBLL.GetUserInfo(LoginUserId); #region 获取相关参数 #region 标题,描述,队列,主负责人 var pageTitle = ticket.title; if (!isManyTitle) { pageTitle = Request.Form["title"]; } var pageDesc = ticket.description; if (!isManydesc) { pageDesc = Request.Form["description"]; } var pageDepIdString = Request.Form["department_id"]; var pagePriResIdString = Request.Form["pri_res"]; if (string.IsNullOrEmpty(pageDepIdString) && string.IsNullOrEmpty(pagePriResIdString)) { Response.Write("<script>alert('队列和主负责人请填写其中一项!');</script>"); return; } long?pageDepId; if (!string.IsNullOrEmpty(pageDepIdString) && pageDepIdString != "0") { pageDepId = long.Parse(pageDepIdString); } else if (string.IsNullOrEmpty(pageDepIdString)) { pageDepId = null; } else { pageDepId = ticket.department_id; } long?pagePriResId; if (!string.IsNullOrEmpty(pagePriResIdString) && pagePriResIdString != "0") { pagePriResId = long.Parse(pagePriResIdString); } else if (string.IsNullOrEmpty(pagePriResIdString)) { pagePriResId = null; } else { pagePriResId = ticket.owner_resource_id; } #endregion #region 种类,预估时间,到期时间,合同名称 var pageCateId = ticket.cate_id; var pageCateIdString = Request.Form["ticket_cate"]; if (!string.IsNullOrEmpty(pageCateIdString) && pageCateIdString != "0") { pageCateId = int.Parse(pageCateIdString); } else if (string.IsNullOrEmpty(pagePriResIdString)) { Response.Write("<script>alert('请选择工单种类!');</script>"); return; } else { pageCateId = ticket.cate_id; } var estHours = ticket.estimated_hours; var pageEstHours = Request.Form["est_hours"]; if (!string.IsNullOrEmpty(pageEstHours) && pageEstHours.Trim() != "多个值-保持不变") { estHours = decimal.Parse(pageEstHours); } var dueTime = ticket.estimated_end_time; var pageDueTime = Request.Form["due_time"]; if (!string.IsNullOrEmpty(pageDueTime) && pageDueTime.Trim() != "多个值-保持不变") { dueTime = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(pageDueTime)); } var contractName = ticket.contract_id; var pageContract = Request.Form["contractName"]; if (!string.IsNullOrEmpty(pageContract) && pageContract != "0") { contractName = long.Parse(pageContract); } else if (string.IsNullOrEmpty(pageContract)) { contractName = null; } #endregion #region 状态,服务包,优先级,工作类型,问题类型,子问题类型 var pageStatusId = ticket.status_id; var pageStuatusIdString = Request.Form["statusId"]; if (!string.IsNullOrEmpty(pageStuatusIdString) && pageStuatusIdString != "0") { pageStatusId = int.Parse(pageStuatusIdString); } else if (string.IsNullOrEmpty(pageStuatusIdString)) { Response.Write("<script>alert('请选择工单状态!');</script>"); return; } var pageServiceId = ticket.service_id; var pageServiceIdString = Request.Form["serviceId"]; if (!string.IsNullOrEmpty(pageServiceIdString) && pageServiceIdString != "0") { pageServiceId = int.Parse(pageServiceIdString); } else if (string.IsNullOrEmpty(pageServiceIdString)) { pageServiceId = null; } var pagePrioId = ticket.priority_type_id; var pagePrioIdString = Request.Form["priorityId"]; if (!string.IsNullOrEmpty(pagePrioIdString) && pagePrioIdString != "0") { pagePrioId = int.Parse(pagePrioIdString); } else if (string.IsNullOrEmpty(pagePrioIdString)) { Response.Write("<script>alert('请选择工单优先级!');</script>"); return; } var workTypeId = ticket.cost_code_id; var pageWorkTypeId = Request.Form["workTypeId"]; if (!string.IsNullOrEmpty(pageWorkTypeId) && pageWorkTypeId != "0") { workTypeId = long.Parse(pageWorkTypeId); } else if (string.IsNullOrEmpty(pageWorkTypeId)) { contractName = null; } var pageIssId = ticket.issue_type_id; var pageIssIdString = Request.Form["IssueType"]; if (!string.IsNullOrEmpty(pageIssIdString) && pageIssIdString != "0") { pageIssId = int.Parse(pageIssIdString); } else if (string.IsNullOrEmpty(pageIssIdString)) { Response.Write("<script>alert('请选择问题类型!');</script>"); return; } var pageSubIssId = ticket.sub_issue_type_id; var pageSubIssIdString = Request.Form["SubIssueType"]; if (!string.IsNullOrEmpty(pageSubIssIdString) && pageSubIssIdString != "0") { pageSubIssId = int.Parse(pageSubIssIdString); } else if (string.IsNullOrEmpty(pageSubIssIdString)) { Response.Write("<script>alert('请选择子问题类型!');</script>"); return; } #endregion #region 自定义字段相关 var thisUdfValue = udfBLL.GetUdfValue(DicEnum.UDF_CATE.TASK, tic.id, udfTaskPara); if (udfTaskPara != null && udfTaskPara.Count > 0) { var list = new List <UserDefinedFieldValue>(); foreach (var udf in udfTaskPara) { var new_udf = new UserDefinedFieldValue() { id = udf.id }; var thisvv = Request.Form[udf.id.ToString()]; if (udf.data_type == (int)DicEnum.UDF_DATA_TYPE.LIST) { if (thisvv == "0") { new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id) == null ? "" : thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value; } else { new_udf.value = thisvv == "" ? null : thisvv; } } else { if (thisvv == "多个值-保持不变") { new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id) == null ? "" : thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value; } else { new_udf.value = thisvv == "" ? null : thisvv; } } list.Add(new_udf); } udfBLL.UpdateUdfValue(DicEnum.UDF_CATE.TASK, udfTaskPara, ticket.id, list, user, DicEnum.OPER_LOG_OBJ_CATE.PROJECT_TASK); } #endregion #endregion #region 修改工单 ticket.title = pageTitle; ticket.description = pageDesc; ticket.department_id = pageDepId; long?roleId = null; if (pagePriResId != null) { var resDep = new sys_resource_department_dal().FindById((long)pagePriResId); if (resDep != null) { pagePriResId = resDep.resource_id; roleId = resDep.role_id; } else { pagePriResId = null; roleId = null; } } ticket.owner_resource_id = pagePriResId; ticket.role_id = roleId; ticket.cate_id = pageCateId; ticket.estimated_hours = estHours; ticket.estimated_end_time = dueTime; ticket.contract_id = contractName; ticket.status_id = pageStatusId; ticket.service_id = pageServiceId; ticket.priority_type_id = pagePrioId; ticket.cost_code_id = workTypeId; ticket.issue_type_id = pageIssId; ticket.sub_issue_type_id = pageSubIssId; ticBll.EditTicket(ticket, LoginUserId); #endregion #region 生成备注 ticBll.AddModifyTicketNote(ticket.id, LoginUserId); #endregion #region 单个工单时 修改其他员工相关 if (isSingle) { var OtherResId = Request.Form["OtherResId"]; ticBll.TicketResManage(ticket.id, OtherResId, LoginUserId); } #endregion #region 获取需要发送邮件的员工的Id if (CkPriRes.Checked && ticket.owner_resource_id != null) { notiResIds.Append(ticket.owner_resource_id + ","); } if (CKcreate.Checked) { notiResIds.Append(ticket.create_user_id + ","); } if (CKaccMan.Checked) { var thisAccount = accBll.GetCompany(ticket.account_id); if (thisAccount != null && thisAccount.resource_id != null) { notiResIds.Append(thisAccount.resource_id + ","); } } #endregion } #region 通知相关 if (CCMe.Checked) { notiResIds.Append(LoginUserId + ","); } var resIds = Request.Form["resIds"]; if (!string.IsNullOrEmpty(resIds)) { notiResIds.Append(resIds + ","); } var notify_id = Request.Form["notify_id"]; if (!string.IsNullOrEmpty(notify_id) && notify_id != "0") { } #endregion ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('保存成功');self.opener.location.reload();window.close();</script>"); } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "!');window.close();</script>"); } }
/// <summary> /// div追加 /// </summary> private void AddImgHtml(long?parent_id, List <sdk_task> taskList, string no, StringBuilder htmlInfo) { var subList = taskList.Where(_ => _.parent_id == parent_id).ToList(); if (subList != null && subList.Count > 0) { subList = subList.OrderBy(_ => _.sort_order).ToList(); var srDal = new sys_resource_dal(); var strDal = new sdk_task_resource_dal(); foreach (var sub in subList) { var thisNo = ""; if (!string.IsNullOrEmpty(no)) { thisNo += no + "." + (subList.IndexOf(sub) + 1); } else { thisNo = (subList.IndexOf(sub) + 1).ToString(); } var thisBeginDate = Tools.Date.DateHelper.ConvertStringToDateTime((long)sub.estimated_begin_time); var diffDays = GetDateDiffMonth(start_date, thisBeginDate, "day"); // 开始时间距离最开始时间距离 var thisDays = GetDateDiffMonth(start_date, DateTime.Now, "day"); var proDays = GetDateDiffMonth(thisBeginDate, Tools.Date.DateHelper.ConvertStringToDateTime((long)sub.estimated_end_time), "day"); // 项目持续的时间 proDays += 1; // var thisDays = GetDateDiffMonth(start_date, DateTime.Now, "day"); // 开始时间距离今天的距离 double noeDaysWidth = 0; double leftWidth = 0; double thisDivWidth = 0; switch (type) { case "day": noeDaysWidth = thisDays * (DayWidth + 10) + 0.8 * (DayWidth + 10); leftWidth = diffDays * (DayWidth + 10); thisDivWidth = proDays * (DayWidth + 10); break; case "week": noeDaysWidth = (thisDays + 1) * DayWidth + 0.5 * thisDays; leftWidth = diffDays * DayWidth; thisDivWidth = proDays * DayWidth; break; case "month": noeDaysWidth = (thisDays + 1) * DayWidth; leftWidth = diffDays * DayWidth; thisDivWidth = proDays * DayWidth; break; } var teamInfo = ""; // 展示团队负责人和团队人数等信息 var typeBar = ""; // 根据不同类型展示不同class, var title = ""; // 展示task 名字 开始时间,结束时间,持续时间等 if (sub.owner_resource_id != null) { var thisResouse = srDal.FindNoDeleteById((long)sub.owner_resource_id); if (thisResouse != null) { teamInfo += thisResouse.name; } } var taskTeamList = strDal.GetTaskResByTaskId(sub.id); if (taskTeamList != null && taskTeamList.Count > 0) { teamInfo += "(" + taskTeamList.Count + ")"; } switch (sub.type_id) { case (int)DTO.DicEnum.TASK_TYPE.PROJECT_ISSUE: typeBar = "Gantt_General Gantt_issueBar"; break; case (int)DTO.DicEnum.TASK_TYPE.PROJECT_PHASE: typeBar = "Gantt_General Gantt_phaseBar"; break; case (int)DTO.DicEnum.TASK_TYPE.PROJECT_TASK: typeBar = "Gantt_General Gantt_overrun Gantt_taskBar"; break; default: break; } title += sub.title + " "; var thisStartDate = Tools.Date.DateHelper.ConvertStringToDateTime((long)sub.estimated_begin_time); title += "(" + thisBeginDate.ToString("yyyy-MM-dd"); title += " -- " + Tools.Date.DateHelper.ConvertStringToDateTime((long)sub.estimated_end_time).ToString("yyyy-MM-dd") + ") "; if (sub.estimated_duration != null) { title += "- " + sub.estimated_duration + "天"; } // todo 前驱任务相关处理 htmlInfo.Append($"<div class='Gantt_divTableRow' id='inner_{thisNo}'><img src = '../Images/todayBarIndicator.png' class='Gantt_TodayBar' style='left: {noeDaysWidth}px;'><div id='{sub.id}' class='{typeBar}' style='width:{thisDivWidth}px; left:{leftWidth}px;' title='{title}' ><span class='Gantt_leftCorner' style='background-position: 0 -32px;'></span><div class='Gantt_Completed' style='width:100%;'></div><span class='Gantt_rightCorner' style='background-position: 0 -110px;'></span><span class='Gantt_overflow Gantt_userInfo'>{teamInfo}</span></div></div>"); pageTaskList.Add(sub); AddImgHtml(sub.id, taskList, thisNo, htmlInfo); } } }
/// <summary> /// 拖拽后修改服务预定 /// </summary> public bool EditServiceCall(long callId, long?oldResId, long newResId, long?roleId, string startTime, decimal duraHours, long userId) { var tBLL = new TicketBLL(); var sscDal = new sdk_service_call_dal(); var thisCall = sscDal.FindNoDeleteById(callId); if (thisCall == null) { return(false); } var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); var oldStartDate = Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time); var newStartDate = DateTime.Parse(startTime); thisCall.start_time = Tools.Date.DateHelper.ToUniversalTimeStamp(newStartDate); thisCall.end_time = thisCall.start_time + (long)(duraHours * 60 * 60 * 1000); thisCall.update_time = timeNow; thisCall.update_user_id = userId; var oldSer = sscDal.FindNoDeleteById(callId); sscDal.Update(thisCall); OperLogBLL.OperLogUpdate <sdk_service_call>(thisCall, oldSer, thisCall.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL, "编辑服务预定"); if (oldResId != newResId && roleId == null) { return(false); } var ssctrDal = new sdk_service_call_task_resource_dal(); var ssctDal = new sdk_service_call_task_dal(); if (oldResId != newResId) { var thisDep = new sys_resource_department_dal().GetResDepByResAndRole(newResId, (long)roleId); if (thisDep == null || thisDep.Count == 0) { return(false); } if (oldResId != null) { var oldResList = ssctrDal.GetResByCallRes(callId, (long)oldResId); oldResList.ForEach(_ => { ssctrDal.SoftDelete(_, userId); OperLogBLL.OperLogDelete <sdk_service_call_task_resource>(_, _.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL_RESOURCE, "删除服务预定负责人"); }); } var thisCallTicket = stDal.GetTciketByCall(callId); if (thisCallTicket != null && thisCallTicket.Count > 0) { var strDal = new sdk_task_resource_dal(); thisCallTicket.ForEach(_ => { // 为服务预定添加该负责人 var thisCallTask = ssctDal.GetSingTaskCall(callId, _.id); if (thisCallTask != null) { var resList = ssctrDal.GetTaskResList(thisCallTask.id); if (!resList.Any(r => r.resource_id == newResId)) { var ssct = new sdk_service_call_task_resource() { id = ssctrDal.GetNextIdCom(), create_time = timeNow, create_user_id = userId, resource_id = newResId, service_call_task_id = thisCallTask.id, update_time = timeNow, update_user_id = userId, }; ssctrDal.Insert(ssct); OperLogBLL.OperLogAdd <sdk_service_call_task_resource>(ssct, ssct.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL_RESOURCE, "新增服务预定负责人"); } } // 为工单团队添加负责人 if (!tBLL.IsHasRes(_.id, newResId)) { var item = new sdk_task_resource() { id = strDal.GetNextIdCom(), task_id = _.id, role_id = roleId, resource_id = newResId, department_id = (int)thisDep[0].department_id, create_user_id = userId, update_user_id = userId, create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), }; strDal.Insert(item); OperLogBLL.OperLogAdd <sdk_task_resource>(item, item.id, userId, DicEnum.OPER_LOG_OBJ_CATE.PROJECT_TASK_RESOURCE, "新增工单分配对象"); } }); } } return(true); }
protected void Page_Load(object sender, EventArgs e) { try { var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { isAdd = false; thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + taskId, LoginUserId); ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } entryList = new sdk_work_entry_dal().GetList(thisTicket.id); var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { ticketResList = new List <sys_resource_department>(); var srdDal = new sys_resource_department_dal(); foreach (var resRole in otherResList) { if (resRole.resource_id == null || resRole.role_id == null) { continue; } var thisResDep = srdDal.GetResDepByResAndRole((long)resRole.resource_id, (long)resRole.role_id); if (thisResDep != null && thisResDep.Count > 0) { ticketResList.Add(thisResDep[0]); } } } if (thisTicket.service_id != null) { thisService = new ivt_service_dal().FindNoDeleteById((long)thisTicket.service_id); if (thisService == null) { thisServiceBun = new ivt_service_bundle_dal().FindNoDeleteById((long)thisTicket.service_id); } } createRes = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } ticketOther = new sdk_task_other_dal().GetTicketOther(thisTicket.id); ticketOtherList = new sdk_task_other_person_dal().GetTicketOther(thisTicket.id); } } var ticketIds = Request.QueryString["ids"]; if (!string.IsNullOrEmpty(ticketIds)) { pageTicketList = new sdk_task_dal().GetTicketByIds(ticketIds); } if (thisTicket == null) { Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>"); return; } var history = new sys_windows_history() { title = "工单:" + thisTicket.no + ":" + thisTicket.title, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }