屠宰场客户端
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.

91 lines
2.0 KiB

using BO.BO.Bill;
using BO.Utils;
using BO.Utils.BillRpc;
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 OutHouseView
{
public partial class OutHouseFrom : Form, IAfterLogin
{
#region IAfterLogin
public List<string> RoleName
{
get
{
return new List<string>() { "收购业务.赶猪出圈" };
}
}
public Form Generate()
{
return this;
}
#endregion
private delegate void InvokeHandler();
List<OutHouseObj> orderList;
Thread syncThread;
public OutHouseFrom()
{
InitializeComponent();
orderGrid.AutoGenerateColumns = false;
orderGrid.DataSource = null;
this.FormClosing += delegate
{
if (syncThread != null && syncThread.IsAlive)
syncThread.Abort();
};
}
private void closeBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void OutHouseFrom_Load(object sender, EventArgs e)
{
syncThread = new Thread(SyncTask);
syncThread.Start();
}
private void SyncTask()
{
while (true)
{
this.Invoke(new InvokeHandler(delegate()
{
BindOrderGrid();
}));
Thread.Sleep(5000);
}
}
private void BindOrderGrid()
{
orderList = OrderDetailRpc.GetUnFinishList("OutHouse");
orderGrid.DataSource = orderList.OrderBy(x => x.Order).ToList();
orderGrid.Refresh();
}
private void orderGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex < orderGrid.ColumnCount - 1)
return;
var id = (long)orderGrid.CurrentRow.Cells["C_ID"].Value;
OrderDetailRpc.SetOrderFinish(id, "OutHouse");
BindOrderGrid();
}
}
}