schangxiang@126.com
2025-09-17 60dd1afc3e8f94aa1b23211b6738d35b47294382
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
using System;
using System.Collections.Generic;
using iWareCommon.Common.Entity;
using iWareExcel.EXCEL.Service;
using iWareWms.Code.Excel.Service;
 
using FineUIPro;
using iWareDataCore.TASK.Service;
using iWareDataCore.TASK.EnumType;
 
namespace iWareWms.View.Task
{
    public partial class TASKPartTaskView : PageBase
    {
        protected override Grid GetGrid()
        {
            return TaskPartGrid;
        }
 
 
        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 partTasks = PartTaskViewService.GetInstance().QueryByParam(new QueryParam
            {
                Search = new Dictionary<string, object> { { "TaskNo", tbMaintaskno.Text}, { "MaterialCode", tbMaterial.Text } },
                Filter = new Dictionary<string, object> { { "IsFinished", ddlTaskIsfinish.SelectedValue } },
                Geqd = new Dictionary<string, object> { { "CreateTime", dpCreateTime.SelectedDate } },
                Ltd = new Dictionary<string, object> { { "CreateTime", dpEndCreateTime.SelectedDate } },
                PageIndex = pageIndex,
                PageSize = pageSize
            }, out msg, out totalNum, out currentPage);
 
            var res = new List<object>();
 
            partTasks.ForEach(x => res.Add(x));
 
            return res;
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var today = DateTime.Today;
                dpCreateTime.SelectedDate = today.AddDays(-6);
                dpEndCreateTime.SelectedDate = today.AddDays(1);
                Query(1);
            }
        }
        //批量撤销
        protected override void Delete(List<int> ids, out string msg)
        {
 
            PartTaskService.GetInstance().Delete(ids, out msg);
            WriteLog("分解任务清除" + msg, "任务查看");
        }
        /// <summary>
        /// 改变优先级显示信息
        /// </summary>
        /// <param name="priority"></param>
        /// <returns></returns>
        protected string GetPriority(object priority)
        {
            return ((EMainTaskPriority)priority).ToString();
        }
 
        protected override Window GetWindow()
        {
            return Window2;
        }
 
        protected override void GetPath(object userName)
        {
            string msg;
            var partTasks = PartTaskViewService.GetInstance().QueryByParam(new QueryParam
            {
                Search = new Dictionary<string, object> { { "TaskNo", tbMaintaskno.Text }, { "MaterialCode", tbMaterial.Text } },
                Filter = new Dictionary<string, object> { { "IsFinished", ddlTaskIsfinish.SelectedValue } },
                Geqd = new Dictionary<string, object> { { "CreateTime", dpCreateTime.SelectedDate } },
                Ltd = new Dictionary<string, object> { { "CreateTime", ((DateTime)dpEndCreateTime.SelectedDate).AddDays(1) } },
 
            }, out msg);
 
            var datas = new List<object>();
            partTasks.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 Timer GetTimer()
        {
            return timer1;
        }
 
        protected void TaskPartGrid_RowCommand(object sender, GridCommandEventArgs e)
        {
            var grid = GetGrid();
 
            if (grid == null)
            {
                return;
            }
            int id = Convert.ToInt32(grid.DataKeys[e.RowIndex][0].ToString());
            if (e.CommandName == "Finish")
            {
                string msg;
                PartTaskService.GetInstance().FinishPartTask(id, out msg);
                Alert.ShowInTop(string.IsNullOrEmpty(msg) ? "强制完成成功!" : msg);
                if (string.IsNullOrEmpty(msg))
                {
                    msg = "强制完成成功!";
                    Query(1);
                    
                }
                WriteLog("分解任务" + id + msg, "任务查看");
            }
            if (e.CommandName == "Reset")
            {
                string msg;
                PartTaskService.GetInstance().ResetPartTask(id, out msg);
                Alert.ShowInTop(string.IsNullOrEmpty(msg) ? "任务重置成功!" : msg);
                if (string.IsNullOrEmpty(msg))
                {
                    msg = "强制完成成功!";
                    Query(1);
                }
                WriteLog("分解任务" + id + msg, "任务查看");
            }
 
        }
    }
}