You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
177 lines
6.8 KiB
177 lines
6.8 KiB
using DBFactory;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
public partial class FrmIoCONTROLTask : Form
|
|
{//20151120
|
|
DBOperator dbo = CStaticClass.dbo;
|
|
|
|
private static FrmIoCONTROLTask _formInstance;
|
|
public static FrmIoCONTROLTask FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmIoCONTROLTask();
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
|
|
public FrmIoCONTROLTask()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
button_Refresh_Click(null, EventArgs.Empty);
|
|
|
|
}
|
|
|
|
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if ((e.ColumnIndex >= 0) && (e.RowIndex >= 0) && (e.Button == MouseButtons.Right))
|
|
{
|
|
dataGridView1.ClearSelection();
|
|
dataGridView1.Rows[e.RowIndex].Selected = true;
|
|
dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
|
|
|
}
|
|
}
|
|
|
|
private void tsmEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView1.RowCount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.tbUserID.Text = this.dataGridView1.CurrentRow.Cells["调度任务索引"].Value.ToString() + "";
|
|
this.tbMaxCount.Text = this.dataGridView1.CurrentRow.Cells["任务状态"].Value.ToString() + "";
|
|
//this.tbExeMaxCount.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|
}
|
|
|
|
private void btSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (tbUserID.Text == "")
|
|
{
|
|
|
|
MessageBox.Show("请先选定要修改的记录!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (MessageBox.Show("确定调度任务号" + tbUserID.Text + ",报告完成???", "", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
|
|
{
|
|
string sql = string.Format("update AGV_TASK set AGV_TASK_STATUS = 5 where FID = {0}", tbUserID.Text);
|
|
|
|
int i_ret = dbo.ExecuteSql(sql);
|
|
if (i_ret == 1)
|
|
{
|
|
MessageBox.Show("保存成功!", "操作提示:");
|
|
button_Refresh_Click(null, EventArgs.Empty);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("保存失败!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void FrmIoCONTROLTask_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
_formInstance = null;
|
|
}
|
|
|
|
|
|
|
|
private void button_Refresh_Click(object sender, EventArgs e)
|
|
{
|
|
StringBuilder sql = new StringBuilder();
|
|
sql.Append(" select ");
|
|
sql.Append(" CONTROL_ID as 调度任务索引 ");
|
|
sql.Append(" ,RELATIVE_CONTROL_ID as 管理任务号 ");
|
|
sql.Append(" ,MANAGE_ID as 管理任务索引 ");
|
|
sql.Append(" ,STOCK_BARCODE as 托盘条码 ");
|
|
//sql.Append(" ,MANAGE_TASK_TYPE as 管理任务类型编码 ");
|
|
//sql.Append(" ,CONTROL_TASK_TYPE as 控制任务类型编码 ");
|
|
sql.Append(" ,CONTROL_TASK_LEVEL as 优先级 ");
|
|
sql.Append(" ,START_WAREHOUSE_CODE as 起始位 ");
|
|
sql.Append(" ,START_DEVICE_CODE as 起始站台或者货位编码 ");
|
|
//sql.Append(" ,END_WAREHOUSE_CODE as 终止仓库编码 ");
|
|
sql.Append(" ,END_DEVICE_CODE as 终止位 ");
|
|
sql.Append(" ,CASE CONTROL_STATUS WHEN 0 THEN '等待执行' WHEN 900 THEN '任务删除' WHEN 999 THEN '任务完成' ELSE '执行中'END as 任务状态 ");
|
|
//sql.Append(" ,ERROR_TEXT as 设备故障信息 ");
|
|
sql.Append(" ,CONTROL_BEGIN_TIME as 开始时间 ");
|
|
sql.Append(" ,CONTROL_END_TIME as 结束时间 ");
|
|
//sql.Append(" ,CONTROL_REMARK as 备注视觉识别任务作为taskNo临时存储 ");
|
|
//sql.Append(" ,CONTORL_BATCH as 物料编号 ");
|
|
sql.Append(" ,CASE WORK_MODE WHEN 0 THEN '缠膜'ELSE '不缠膜'END as 是否缠膜 ");
|
|
sql.Append(" ,GOODS_BARCODE as 物料SN码 ");
|
|
sql.Append(" ,GOODS_NUM as 码垛数量 ");
|
|
sql.Append(" ,CONTROL_FLAG as 是否抽检 ");
|
|
sql.Append(" ,WMS_TASKTYPE as 顺序出库 ");
|
|
//sql.Append(" ,taskflag as 接口任务标志 ");
|
|
sql.Append(" ,packingLengtht as 物料长 ");
|
|
sql.Append(" ,packingWidth as 物料宽 ");
|
|
sql.Append(" ,packingHigh as 物料高 ");
|
|
sql.Append(" ,ReturnedStatus as 以回传状态 ");
|
|
sql.Append(" ,DEVICE_CODE as 入库托盘 ");
|
|
sql.Append(" ");
|
|
sql.Append(" from IO_CONTROL ");
|
|
DataView dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
|
this.dataGridView1.DataSource = dv;
|
|
}
|
|
|
|
private void BtDel_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (tbUserID.Text == "")
|
|
{
|
|
|
|
MessageBox.Show("请先选定要删除的记录!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (MessageBox.Show("确定删除调度任务号" + tbUserID.Text + "???", "", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
|
|
{
|
|
string sql = $"delete from IO_CONTROL where CONTROL_ID = {tbUserID.Text};";
|
|
|
|
int i_ret = dbo.ExecuteSql(sql);
|
|
if (i_ret >= 1)
|
|
{
|
|
MessageBox.Show("删除成功!", "操作提示:");
|
|
button_Refresh_Click(null, EventArgs.Empty);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("删除失败!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
}
|
|
}
|