schangxiang@126.com
2025-09-01 92fea996bf287e90c590cb30c0b1aac5969d0f17
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
using sunui.forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace WMS.UI.WORK
{
    public partial class taskChild : Form
    {
        public taskChild(string taskid)
        {
            InitializeComponent();
            dataGridView1.AutoGenerateColumns = false;
            CheckForIllegalCrossThreadCalls = false;
            findData(taskid);
 
        }
        private void findData(string taskid)
        {
            try
            {
                var childTask = FLogin.wcsWcf.findTaskChild(taskid);
                if (childTask.status == 200)
                {
                    dataGridView1.DataSource = childTask.date;
                    this.Text = "任务id:" + taskid + "子任务";
                }
                else
                {
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, childTask.msg);
                    ms.Show();
                }
            }
            catch (Exception)
            {
 
            }
 
 
        }
 
        private void taskChild_Load(object sender, EventArgs e)
        {
 
        }
        /// <summary>重发任务
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dataGridView1.Columns[e.ColumnIndex].Name == "retry")
                {
                    int i = dataGridView1.CurrentRow.Index;
                    if (dataGridView1.Rows[i].Cells["taskId"].Value == null)
                    {
                        WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "任务号不能为空");
                        ms.Show();
                        return;
                    }
                    string taskId = dataGridView1.Rows[i].Cells["taskId"].Value.ToString();
                    string sourcePlace = dataGridView1.Rows[i].Cells["sourcePlace"].Value.ToString();
                    string toPlace = dataGridView1.Rows[i].Cells["toPlace"].Value.ToString();
                    string taskInfo = dataGridView1.Rows[i].Cells["taskInfo"].Value.ToString();
                    string res = "";
                    if (taskInfo == "AGV任务")
                    {
                        res = FLogin.wcsWcf.AgvTaskReSend(Convert.ToInt64(taskId), sourcePlace, toPlace);
                    }
                    else
                    {
                        res = FLogin.wcsWcf.srmTaskReSend(Convert.ToInt64(taskId), sourcePlace, toPlace, 2, false);
                    }
                    if (res == "")
                    {
                        WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(1, "重发成功");
                        ms.Show();
                    }
                    else
                    {
                        WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, res);
                        ms.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "参数不全不能重发");
                ms.Show();
            }
        }
 
        private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            SolidBrush b = new SolidBrush(this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor);
            e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.dataGridView1.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);
 
        }
    }
}