Browse Source

沿用老的。

master
yibo 8 years ago
parent
commit
6f814e99f5
1 changed files with 2 additions and 32 deletions
  1. +2
    -32
      WeighAndGrading/GradeFrom.cs

+ 2
- 32
WeighAndGrading/GradeFrom.cs View File

@ -52,7 +52,7 @@ namespace WeighAndGrading
SerialPort weightPort;
int maxIndex = 0;
ConcurrentQueue<GradeAndWeight_Detail> noLivestockList;
BackgroundWorker tangWork, maoWork, detailWork;
Thread syncWork;
Thread syncToServer;
#region weightNeed
@ -71,7 +71,6 @@ namespace WeighAndGrading
maoGridView.AutoGenerateColumns = false;
maoGridView.DataSource = null;
historyGrid.AutoGenerateColumns = false;
InitBackGroundWorker();
if (!Directory.Exists(DATA_PATH))
Directory.CreateDirectory(DATA_PATH);
connection = ButcherAppContext.Context.UserConfig.Connection;
@ -86,31 +85,9 @@ namespace WeighAndGrading
syncWork.Abort();
if (syncToServer != null && syncToServer.IsAlive)
syncToServer.Abort();
if (tangWork != null && tangWork.IsBusy)
tangWork.CancelAsync();
if (maoWork != null && maoWork.IsBusy)
maoWork.CancelAsync();
if (detailWork != null && detailWork.IsBusy)
detailWork.CancelAsync();
};
}
void InitBackGroundWorker()
{
tangWork = new BackgroundWorker() { WorkerSupportsCancellation = true };
tangWork.DoWork += delegate { BindTangGridFortangList(); };
tangWork.RunWorkerCompleted += delegate { BindTangGrid(); };
maoWork = new BackgroundWorker();
maoWork.DoWork += delegate { BindMaoGridFortangList(); };
maoWork.RunWorkerCompleted += BindMaoGrid();
detailWork = new BackgroundWorker();
//detailWork.DoWork += GetDetailData();
//detailWork.RunWorkerCompleted += BindDetailGrid();
}
GradeAndWeight_Detail modifyDetail;
void JiBieButtonClick(Button btn)
{
@ -254,12 +231,6 @@ namespace WeighAndGrading
BindDetailGrid();
if (details.Any())
maxIndex = details.First().Index;
if (tangWork.CancellationPending)
tangWork.RunWorkerAsync();
else
tangWork.CancelAsync();
if (syncWork == null || !syncWork.IsAlive)
{
syncWork = new Thread(Sync);
@ -389,7 +360,6 @@ namespace WeighAndGrading
{
maoList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, false);
}
}
catch (TimeoutException) { }
}
@ -400,9 +370,9 @@ namespace WeighAndGrading
}
}
void BindMaoGrid()
{
maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList();
if (maoEntity == null && maoGridView.CurrentRow != null)
{


Loading…
Cancel
Save