using FineUIPro; using FineUIPro.iWareWms; using iWareCommon.Common.Entity; using iWareDataCore.TASK.EnumType; using iWareDataCore.TASK.Service; using iWareExcel.EXCEL.Service; using iWareWms.Code.Excel.Service; using System; using System.Collections.Generic; using iWareWms; namespace iWareWms.View.Task { public partial class MainTaskView : PageBase { protected override Grid GetGrid() { return MainTaskGrid; } protected override DropDownList GetPageSizeDropDownList() { return ddlPageSize; } protected override List GetDataSource(int pageIndex, int pageSize, out string msg, out int totalNum, out int currentPage) { var tasks = MainTaskViewService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "MaterialCode", tbMaterial.Text } }, Filter = new Dictionary { { "TaskType", ddlTasktype.SelectedValue }, { "Status", ddlStatus.SelectedValue } }, Geqd = new Dictionary { { "SendTime", dpSendTime.SelectedDate } }, Ltd = new Dictionary { { "DecompositionTime", ((DateTime)dpDecompositionTime.SelectedDate).AddDays(1) } }, PageIndex = pageIndex, PageSize = pageSize }, out msg, out totalNum, out currentPage); var res = new List(); tasks.ForEach(x => res.Add(x)); return res; } // /// 改变分解状态的显示信息 /// /// /// protected string GetStatus(object Status) { if (Status == null) { Status = 0; } return ((EMainTaskStatus)Status).ToString(); } /// /// 改变TaskType显示信息 /// /// /// protected string GetTaskType(object taskType) { return ((EMainTaskType)taskType).ToString(); } /// /// 改变优先级显示信息 /// /// /// protected string GetPriority(object priority) { return ((EMainTaskPriority)priority).ToString(); } //批量修改优先级 protected override void ChangePriority(List ids, int enable, out string msg) { MainTaskService.GetInstance().ChangePriority(ids, enable, out msg); WriteLog("主任务优先级更改" + msg, "任务查看"); } //批量撤销 protected override void Delete(List ids, out string msg) { MainTaskService.GetInstance().ChnageMainTaskStatus(ids, out msg); WriteLog("主任务优先级撤销" + msg, "任务查看"); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string name = GetIdentityName(); if (name == "admin") { btnClar.Hidden = false; } else { btnClar.Hidden = true; } //判断设置优先级是否选择了至少一项纪录 ResolveEnablePriorityButtonForGrid(MenuButton1, MainTaskGrid, 0); ResolveEnablePriorityButtonForGrid(MenuButton2, MainTaskGrid, 1); ResolveEnablePriorityButtonForGrid(MenuButton3, MainTaskGrid, 2); //判断删除复选框是否选择了至少一项纪录 ResolveDeleteButtonForGrid(Button3, MainTaskGrid); var today = DateTime.Today; dpSendTime.SelectedDate = today.AddDays(-6); dpDecompositionTime.SelectedDate = today; btnCreateTast.OnClientClick = Window1.GetShowReference("~/View/TASK/MainTaskView/NewMainTask.aspx", "新建任务"); Query(1); } } protected override Window GetWindow() { return Window2; } protected override void GetPath(object userName) { string msg; var tasks = MainTaskViewService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "MaterialCode", tbMaterial.Text } }, Filter = new Dictionary { { "TaskType", ddlTasktype.SelectedValue }, { "Status", ddlStatus.SelectedValue } }, Geqd = new Dictionary { { "SendTime", dpSendTime.SelectedDate } }, Ltd = new Dictionary { { "DecompositionTime", ((DateTime)dpDecompositionTime.SelectedDate).AddDays(1) } }, }, out msg); var datas = new List(); tasks.ForEach(x => datas.Add(x)); var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Name", "主任务查看" } } }, out msg); var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary> { { "主任务查看", datas } }, out msg); Session["ExcelPath"] = path; } protected override FineUIPro.Timer GetTimer() { return timer1; } /// /// 清除删除任务 /// /// /// protected void btnClar_Click(object sender, EventArgs e) { string msg = ""; List ids = GetSelectedDataKeyIDs(MainTaskGrid); MainTaskService.GetInstance().Delete(ids, out msg); if (string.IsNullOrEmpty(msg)) { msg = "清除成功!"; } WriteLog("主任务清除" + msg, "任务查看"); Alert.Show(msg); Query(1); } } }