FrmDisableTray.cs
3.9 KB
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 OnlineStore.Common;
using OnlineStore.DeviceLibrary;
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 OnlineStore.AssemblyLine
{
partial class FrmDisableTray : FrmBase
{
public FrmDisableTray()
{
InitializeComponent();
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmDisableTray_Load(object sender, EventArgs e)
{
LoadList();
}
private void LoadList()
{
dataGridView1.Rows.Clear();
List<TrayDisableInfo> list = TrayDisableManager.GetDisableList();
foreach (TrayDisableInfo t in list)
{
DataGridViewRow view = new DataGridViewRow();
view.CreateCells(dataGridView1);
view.Cells[Column_trayNum.Index].Value = t.TrayCode;
view.Cells[Column_DeviceName.Index].Value = t.DDeviceName;
view.Cells[Column_describle.Index].Value = t.DDescribe;
view.Cells[Column_datetime.Index].Value =t.DisableTime.ToString("yyyy-MM-dd HH:mm:ss");
TrayInfo tray = TrayManager.GetTrayInfo(t.TrayCode);
string trayInfo = "";
if (tray.InOrOutStore.Equals(0))
{
trayInfo = "空托盘";
}
else if (tray.InOrOutStore.Equals(1))
{
if (tray.InoutPar.InStoreNg)
{
trayInfo = $"入库NG[{tray.InoutPar.NgMsg}][{tray.InoutPar.WareCode}][{tray.InoutPar.PosId}]";
}
else
{
trayInfo = $"入库[{tray.InoutPar.WareCode}][{tray.InoutPar.PosId}]";
}
}
else if (tray.InOrOutStore.Equals(2))
{
trayInfo = $"出库[{tray.InoutPar.WareCode}][{tray.InoutPar.PosId}]";
}
view.Cells[Column_TrayInfo.Index].Value = trayInfo;
dataGridView1.Rows.Add(view);
}
lblTrayInfo.Text = "";
}
private void btnrefresh_Click(object sender, EventArgs e)
{
LoadList();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1 && e.ColumnIndex >= 0)
{
string name = this.dataGridView1.Columns[e.ColumnIndex].Name;
int num = Convert.ToInt32( this.dataGridView1.Rows[e.RowIndex].Cells[Column_trayNum.Index].Value);
int rowIndex = e.RowIndex;
if (name.Equals(this.Column_Del.Name))
{
DialogResult dialogResult = MessageBox.Show("确定启用托盘【"+num+"】?", "提示?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dialogResult.Equals(DialogResult.OK))
{
LogUtil.info("用户手动启用托盘【" + num + "】");
TrayDisableManager.RemoveDisable(num);
this.dataGridView1.Rows.RemoveAt(rowIndex);
lblTrayInfo.Text = "";
}
}
}
}
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count > 0)
{
DataGridViewRow row = dataGridView1.SelectedRows[0];
int num = Convert.ToInt32(row.Cells[Column_trayNum.Index].Value);
TrayInfo tray = TrayManager.GetTrayInfo(num);
lblTrayInfo.Text = tray.ToStr();
}
}
}
}