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<object> GetDataSource(int pageIndex, int pageSize, out string msg, out int totalNum, out int currentPage)
|
{
|
|
|
var tasks = MainTaskViewService.GetInstance().QueryByParam(new QueryParam
|
{
|
Search = new Dictionary<string, object> { { "MaterialCode", tbMaterial.Text } },
|
Filter = new Dictionary<string, object> { { "TaskType", ddlTasktype.SelectedValue }, { "Status", ddlStatus.SelectedValue } },
|
Geqd = new Dictionary<string, object> { { "SendTime", dpSendTime.SelectedDate } },
|
Ltd = new Dictionary<string, object> { { "DecompositionTime", ((DateTime)dpDecompositionTime.SelectedDate).AddDays(1) } },
|
PageIndex = pageIndex,
|
PageSize = pageSize
|
}, out msg, out totalNum, out currentPage);
|
|
var res = new List<object>();
|
|
tasks.ForEach(x => res.Add(x));
|
|
return res;
|
}
|
|
|
// <summary>
|
/// 改变分解状态的显示信息
|
/// </summary>
|
/// <param name="workLabel"></param>
|
/// <returns></returns>
|
protected string GetStatus(object Status)
|
{
|
|
if (Status == null)
|
{
|
Status = 0;
|
}
|
return ((EMainTaskStatus)Status).ToString();
|
}
|
|
/// <summary>
|
/// 改变TaskType显示信息
|
/// </summary>
|
/// <param name="workLabel"></param>
|
/// <returns></returns>
|
protected string GetTaskType(object taskType)
|
{
|
return ((EMainTaskType)taskType).ToString();
|
}
|
|
/// <summary>
|
/// 改变优先级显示信息
|
/// </summary>
|
/// <param name="priority"></param>
|
/// <returns></returns>
|
protected string GetPriority(object priority)
|
{
|
return ((EMainTaskPriority)priority).ToString();
|
}
|
|
|
|
//批量修改优先级
|
protected override void ChangePriority(List<int> ids, int enable, out string msg)
|
{
|
MainTaskService.GetInstance().ChangePriority(ids, enable, out msg);
|
WriteLog("主任务优先级更改" + msg, "任务查看");
|
}
|
|
//批量撤销
|
protected override void Delete(List<int> 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<string, object> { { "MaterialCode", tbMaterial.Text } },
|
Filter = new Dictionary<string, object> { { "TaskType", ddlTasktype.SelectedValue }, { "Status", ddlStatus.SelectedValue } },
|
Geqd = new Dictionary<string, object> { { "SendTime", dpSendTime.SelectedDate } },
|
Ltd = new Dictionary<string, object> { { "DecompositionTime", ((DateTime)dpDecompositionTime.SelectedDate).AddDays(1) } },
|
}, out msg);
|
|
|
var datas = new List<object>();
|
tasks.ForEach(x => datas.Add(x));
|
var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Name", "主任务查看" } } }, out msg);
|
var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary<string, List<object>> { { "主任务查看", datas } }, out msg);
|
Session["ExcelPath"] = path;
|
|
}
|
|
protected override FineUIPro.Timer GetTimer()
|
{
|
return timer1;
|
}
|
|
/// <summary>
|
/// 清除删除任务
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void btnClar_Click(object sender, EventArgs e)
|
{
|
string msg = "";
|
List<int> ids = GetSelectedDataKeyIDs(MainTaskGrid);
|
MainTaskService.GetInstance().Delete(ids, out msg);
|
if (string.IsNullOrEmpty(msg))
|
{
|
msg = "清除成功!";
|
|
}
|
WriteLog("主任务清除" + msg, "任务查看");
|
Alert.Show(msg);
|
Query(1);
|
}
|
|
|
|
|
}
|
}
|