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)
{
}
/// 重发任务
///
///
///
///
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "retry")
{
int i = dataGridView1.CurrentRow.Index;
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);
}
}
}