Browse Source

更新。

master
yibo 8 years ago
parent
commit
13cca3096c
7 changed files with 210 additions and 92 deletions
  1. +2
    -0
      BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
  2. +2
    -2
      ButcherWeight/WeightContext.cs
  3. BIN
      Setup/Release/Setup.msi
  4. +2
    -2
      WeighAndGrading/GradeContext.cs
  5. +107
    -75
      WeighAndGrading/GradeFrom.Designer.cs
  6. +94
    -13
      WeighAndGrading/GradeFrom.cs
  7. +3
    -0
      WeighAndGrading/GradeFrom.resx

+ 2
- 0
BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs View File

@ -10,6 +10,8 @@ namespace BO.BO.Bill
{ {
public long ID { get; set; } public long ID { get; set; }
public bool ReadWeight { get; set; }
public long? OrderDetail_ID { get; set; } public long? OrderDetail_ID { get; set; }
public int Index { get; set; } public int Index { get; set; }


+ 2
- 2
ButcherWeight/WeightContext.cs View File

@ -12,10 +12,10 @@ namespace ButcherWeight
public static class WeightContext public static class WeightContext
{ {
//#if debug //#if debug
//private static string loginConfigPath = @"C:\BwpB3Project\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\WeightSetting.xml";
private static string loginConfigPath = @"C:\BwpB3Project\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\WeightSetting.xml";
//#endif //#endif
//#if !debug //#if !debug
private static string loginConfigPath = Application.StartupPath + "\\WeightSetting.xml";
//private static string loginConfigPath = Application.StartupPath + "\\WeightSetting.xml";
//#endif //#endif
private static WeightSetting _config; private static WeightSetting _config;
public static WeightSetting Config public static WeightSetting Config


BIN
Setup/Release/Setup.msi View File


+ 2
- 2
WeighAndGrading/GradeContext.cs View File

@ -12,10 +12,10 @@ namespace WeighAndGrading
public static class GradeContext public static class GradeContext
{ {
//#if debug //#if debug
private static string loginConfigPath = @"C:\BwpB3Project\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\GradeConfig.xml";
//private static string loginConfigPath = @"C:\BwpB3Project\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\GradeConfig.xml";
//#endif //#endif
//#if !debug //#if !debug
//private static string loginConfigPath = Application.StartupPath + "\\GradeConfig.xml";
private static string loginConfigPath = Application.StartupPath + "\\GradeConfig.xml";
//#endif //#endif
private static GradeConfig _config; private static GradeConfig _config;
public static GradeConfig Config public static GradeConfig Config


+ 107
- 75
WeighAndGrading/GradeFrom.Designer.cs View File

@ -31,11 +31,11 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.syncBtn = new System.Windows.Forms.Button(); this.syncBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
@ -48,8 +48,17 @@
this.label11 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label();
this.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); this.mbPanel = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.vScrollBar2 = new System.Windows.Forms.VScrollBar();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.historyGrid = new BWP.WinFormControl.UDataGridView(); this.historyGrid = new BWP.WinFormControl.UDataGridView();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_ReadWeight = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.enableWeight = new System.Windows.Forms.CheckBox(); this.enableWeight = new System.Windows.Forms.CheckBox();
this.isPrintCheckBox = new System.Windows.Forms.CheckBox(); this.isPrintCheckBox = new System.Windows.Forms.CheckBox();
this.printBtn = new System.Windows.Forms.Button(); this.printBtn = new System.Windows.Forms.Button();
@ -73,13 +82,7 @@
this.cancelBtn = new System.Windows.Forms.Button(); this.cancelBtn = new System.Windows.Forms.Button();
this.discontBtn = new System.Windows.Forms.Button(); this.discontBtn = new System.Windows.Forms.Button();
this.discontPanel = new System.Windows.Forms.FlowLayoutPanel(); this.discontPanel = new System.Windows.Forms.FlowLayoutPanel();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -197,15 +200,23 @@
// //
// groupBox3 // groupBox3
// //
this.groupBox3.Controls.Add(this.vScrollBar2);
this.groupBox3.Controls.Add(this.label12); this.groupBox3.Controls.Add(this.label12);
this.groupBox3.Controls.Add(this.historyGrid); this.groupBox3.Controls.Add(this.historyGrid);
this.groupBox3.Location = new System.Drawing.Point(826, 175); this.groupBox3.Location = new System.Drawing.Point(826, 175);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(422, 680);
this.groupBox3.Size = new System.Drawing.Size(471, 680);
this.groupBox3.TabIndex = 11; this.groupBox3.TabIndex = 11;
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = "记录"; this.groupBox3.Text = "记录";
// //
// vScrollBar2
//
this.vScrollBar2.Location = new System.Drawing.Point(425, 36);
this.vScrollBar2.Name = "vScrollBar2";
this.vScrollBar2.Size = new System.Drawing.Size(40, 566);
this.vScrollBar2.TabIndex = 52;
//
// label12 // label12
// //
this.label12.AutoSize = true; this.label12.AutoSize = true;
@ -237,6 +248,7 @@
this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID, this.H_ID,
this.H_Livestock_ID, this.H_Livestock_ID,
this.H_ReadWeight,
this.H_Index, this.H_Index,
this.H_Technics, this.H_Technics,
this.H_Livestock_Name, this.H_Livestock_Name,
@ -251,11 +263,79 @@
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle5; this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle5;
this.historyGrid.RowTemplate.Height = 40; this.historyGrid.RowTemplate.Height = 40;
this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyGrid.Size = new System.Drawing.Size(409, 597);
this.historyGrid.Size = new System.Drawing.Size(423, 566);
this.historyGrid.TabIndex = 0; this.historyGrid.TabIndex = 0;
this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick); this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick);
// //
// H_ID
//
this.H_ID.DataPropertyName = "ID";
this.H_ID.HeaderText = "ID";
this.H_ID.Name = "H_ID";
this.H_ID.ReadOnly = true;
this.H_ID.Visible = false;
//
// H_Livestock_ID
//
this.H_Livestock_ID.HeaderText = "Livestock_ID";
this.H_Livestock_ID.Name = "H_Livestock_ID";
this.H_Livestock_ID.ReadOnly = true;
this.H_Livestock_ID.Visible = false;
//
// H_ReadWeight
//
this.H_ReadWeight.DataPropertyName = "ReadWeight";
this.H_ReadWeight.HeaderText = "";
this.H_ReadWeight.Name = "H_ReadWeight";
this.H_ReadWeight.ReadOnly = true;
this.H_ReadWeight.Width = 30;
//
// H_Index
//
this.H_Index.DataPropertyName = "Index";
this.H_Index.HeaderText = "序号";
this.H_Index.Name = "H_Index";
this.H_Index.ReadOnly = true;
this.H_Index.Width = 65;
//
// H_Technics
//
this.H_Technics.DataPropertyName = "Technics_Name";
this.H_Technics.HeaderText = "工艺";
this.H_Technics.Name = "H_Technics";
this.H_Technics.ReadOnly = true;
this.H_Technics.Width = 65;
//
// H_Livestock_Name
//
this.H_Livestock_Name.DataPropertyName = "Livestock_Name";
this.H_Livestock_Name.HeaderText = "级别";
this.H_Livestock_Name.Name = "H_Livestock_Name";
this.H_Livestock_Name.ReadOnly = true;
this.H_Livestock_Name.Width = 90;
//
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle3.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.H_Weight.HeaderText = "重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
this.H_Weight.Width = 70;
//
// H_Time
//
this.H_Time.DataPropertyName = "Time";
dataGridViewCellStyle4.Format = "MM/dd HH:mm";
dataGridViewCellStyle4.NullValue = null;
this.H_Time.DefaultCellStyle = dataGridViewCellStyle4;
this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
//
// enableWeight // enableWeight
// //
this.enableWeight.AutoCheck = false; this.enableWeight.AutoCheck = false;
@ -358,8 +438,9 @@
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle8; this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle8;
this.dataGridView.RowTemplate.Height = 40; this.dataGridView.RowTemplate.Height = 40;
this.dataGridView.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(469, 517);
this.dataGridView.Size = new System.Drawing.Size(443, 566);
this.dataGridView.TabIndex = 4; this.dataGridView.TabIndex = 4;
this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick); this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick);
// //
@ -443,7 +524,7 @@
// closeBtn // closeBtn
// //
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(1217, 12);
this.closeBtn.Location = new System.Drawing.Point(1270, 12);
this.closeBtn.Name = "closeBtn"; this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(102, 43); this.closeBtn.Size = new System.Drawing.Size(102, 43);
this.closeBtn.TabIndex = 33; this.closeBtn.TabIndex = 33;
@ -454,7 +535,7 @@
// configBtn // configBtn
// //
this.configBtn.Font = new System.Drawing.Font("宋体", 15F); this.configBtn.Font = new System.Drawing.Font("宋体", 15F);
this.configBtn.Location = new System.Drawing.Point(971, 12);
this.configBtn.Location = new System.Drawing.Point(1024, 12);
this.configBtn.Name = "configBtn"; this.configBtn.Name = "configBtn";
this.configBtn.Size = new System.Drawing.Size(102, 43); this.configBtn.Size = new System.Drawing.Size(102, 43);
this.configBtn.TabIndex = 34; this.configBtn.TabIndex = 34;
@ -498,7 +579,7 @@
// discontBtn // discontBtn
// //
this.discontBtn.Font = new System.Drawing.Font("宋体", 15F); this.discontBtn.Font = new System.Drawing.Font("宋体", 15F);
this.discontBtn.Location = new System.Drawing.Point(1095, 12);
this.discontBtn.Location = new System.Drawing.Point(1148, 12);
this.discontBtn.Name = "discontBtn"; this.discontBtn.Name = "discontBtn";
this.discontBtn.Size = new System.Drawing.Size(102, 43); this.discontBtn.Size = new System.Drawing.Size(102, 43);
this.discontBtn.TabIndex = 37; this.discontBtn.TabIndex = 37;
@ -508,76 +589,24 @@
// //
// discontPanel // discontPanel
// //
this.discontPanel.Location = new System.Drawing.Point(1258, 182);
this.discontPanel.Location = new System.Drawing.Point(1303, 182);
this.discontPanel.Name = "discontPanel"; this.discontPanel.Name = "discontPanel";
this.discontPanel.Size = new System.Drawing.Size(71, 656); this.discontPanel.Size = new System.Drawing.Size(71, 656);
this.discontPanel.TabIndex = 33; this.discontPanel.TabIndex = 33;
// //
// H_ID
// vScrollBar1
// //
this.H_ID.DataPropertyName = "ID";
this.H_ID.HeaderText = "ID";
this.H_ID.Name = "H_ID";
this.H_ID.ReadOnly = true;
this.H_ID.Visible = false;
//
// H_Livestock_ID
//
this.H_Livestock_ID.HeaderText = "Livestock_ID";
this.H_Livestock_ID.Name = "H_Livestock_ID";
this.H_Livestock_ID.ReadOnly = true;
this.H_Livestock_ID.Visible = false;
//
// H_Index
//
this.H_Index.DataPropertyName = "Index";
this.H_Index.HeaderText = "序号";
this.H_Index.Name = "H_Index";
this.H_Index.ReadOnly = true;
this.H_Index.Width = 65;
//
// H_Technics
//
this.H_Technics.DataPropertyName = "Technics_Name";
this.H_Technics.HeaderText = "工艺";
this.H_Technics.Name = "H_Technics";
this.H_Technics.ReadOnly = true;
this.H_Technics.Width = 65;
//
// H_Livestock_Name
//
this.H_Livestock_Name.DataPropertyName = "Livestock_Name";
this.H_Livestock_Name.HeaderText = "级别";
this.H_Livestock_Name.Name = "H_Livestock_Name";
this.H_Livestock_Name.ReadOnly = true;
this.H_Livestock_Name.Width = 90;
//
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle3.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.H_Weight.HeaderText = "重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
this.H_Weight.Width = 70;
//
// H_Time
//
this.H_Time.DataPropertyName = "Time";
dataGridViewCellStyle4.Format = "MM/dd HH:mm";
dataGridViewCellStyle4.NullValue = null;
this.H_Time.DefaultCellStyle = dataGridViewCellStyle4;
this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
this.H_Time.Width = 110;
this.vScrollBar1.Location = new System.Drawing.Point(455, 175);
this.vScrollBar1.Name = "vScrollBar1";
this.vScrollBar1.Size = new System.Drawing.Size(40, 566);
this.vScrollBar1.TabIndex = 51;
// //
// GradeFrom // GradeFrom
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1337, 865);
this.ClientSize = new System.Drawing.Size(1379, 865);
this.Controls.Add(this.vScrollBar1);
this.Controls.Add(this.discontPanel); this.Controls.Add(this.discontPanel);
this.Controls.Add(this.discontBtn); this.Controls.Add(this.discontBtn);
this.Controls.Add(this.modifyPanel); this.Controls.Add(this.modifyPanel);
@ -659,12 +688,15 @@
private System.Windows.Forms.DataGridViewButtonColumn D_FinishBtn; private System.Windows.Forms.DataGridViewButtonColumn D_FinishBtn;
private System.Windows.Forms.Button discontBtn; private System.Windows.Forms.Button discontBtn;
private System.Windows.Forms.FlowLayoutPanel discontPanel; private System.Windows.Forms.FlowLayoutPanel discontPanel;
private System.Windows.Forms.VScrollBar vScrollBar2;
private System.Windows.Forms.DataGridViewTextBoxColumn H_ID; private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID; private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
private System.Windows.Forms.DataGridViewCheckBoxColumn H_ReadWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Index; private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; private System.Windows.Forms.DataGridViewTextBoxColumn H_Time;
private System.Windows.Forms.VScrollBar vScrollBar1;
} }
} }

+ 94
- 13
WeighAndGrading/GradeFrom.cs View File

@ -37,7 +37,9 @@ namespace WeighAndGrading
List<GradeAndWeight_Detail> details; List<GradeAndWeight_Detail> details;
SerialPort weightPort; SerialPort weightPort;
int maxIndex = 0; int maxIndex = 0;
readonly ConcurrentQueue<GradeAndWeight_Detail> tempList = new ConcurrentQueue<GradeAndWeight_Detail>();
ConcurrentQueue<GradeAndWeight_Detail> noLivestockList = new ConcurrentQueue<GradeAndWeight_Detail>();
ConcurrentQueue<GradeAndWeight_Detail> noWeightList = new ConcurrentQueue<GradeAndWeight_Detail>();
#region weightNeed #region weightNeed
private IDataFormat _dataFormat; private IDataFormat _dataFormat;
@ -76,6 +78,11 @@ namespace WeighAndGrading
var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) => btn.Click += (sender, e) =>
{ {
if (details == null)
{
MessageBox.Show("请先同步数据");
return;
}
var livestockTag = btn.Tag as CTuple<long, string, short>; var livestockTag = btn.Tag as CTuple<long, string, short>;
if (modifyDetail == null) if (modifyDetail == null)
AddDetail(livestockTag); AddDetail(livestockTag);
@ -115,6 +122,16 @@ namespace WeighAndGrading
maoRow = FindRowSetSelected(maoEntity); maoRow = FindRowSetSelected(maoEntity);
dataGridView.Refresh(); dataGridView.Refresh();
details = GradeAndWeightRpc.GetDetails(date, 50); details = GradeAndWeightRpc.GetDetails(date, 50);
FillQueue();
BindDetailGrid();
if (details.Any())
maxIndex = details.First().Index;
}
void FillQueue()
{
noWeightList = new ConcurrentQueue<GradeAndWeight_Detail>();
noLivestockList = new ConcurrentQueue<GradeAndWeight_Detail>();
var stack = new Stack<GradeAndWeight_Detail>(); var stack = new Stack<GradeAndWeight_Detail>();
foreach (var item in details) foreach (var item in details)
{ {
@ -124,11 +141,13 @@ namespace WeighAndGrading
break; break;
} }
while (stack.Count > 0) while (stack.Count > 0)
tempList.Enqueue(stack.Pop());
BindDetailGrid();
if (details.Any())
maxIndex = details.First().Index;
{
var bottom = stack.Pop();
if (bottom.Weight == null)
noWeightList.Enqueue(bottom);
else
noLivestockList.Enqueue(bottom);
}
} }
void BindDataGrid() void BindDataGrid()
@ -139,6 +158,7 @@ namespace WeighAndGrading
if ((bool)row.Cells["D_Finish"].Value) if ((bool)row.Cells["D_Finish"].Value)
row.DefaultCellStyle.BackColor = Color.YellowGreen; row.DefaultCellStyle.BackColor = Color.YellowGreen;
} }
InitScrollBar1();
dataGridView.ClearSelection(); dataGridView.ClearSelection();
} }
@ -147,6 +167,7 @@ namespace WeighAndGrading
historyGrid.DataSource = null; historyGrid.DataSource = null;
if (details.Any()) if (details.Any())
historyGrid.DataSource = details; historyGrid.DataSource = details;
InitScrollBar2();
historyGrid.Refresh(); historyGrid.Refresh();
} }
@ -356,9 +377,9 @@ namespace WeighAndGrading
var tech = livestock.Item3 == 0 ? "烫褪" : "毛剥"; var tech = livestock.Item3 == 0 ? "烫褪" : "毛剥";
GradeAndWeight_Detail first; GradeAndWeight_Detail first;
if (tempList.TryPeek(out first) && first.Livestock_ID == 0)
if (noLivestockList.TryPeek(out first) && first.Livestock_ID == 0)
{ {
tempList.TryDequeue(out first);
noLivestockList.TryDequeue(out first);
if (currentRow != null) if (currentRow != null)
first.OrderDetail_ID = currentRow.OrderDetail_ID; first.OrderDetail_ID = currentRow.OrderDetail_ID;
first.Date = butcherTimeInput.Date.Value; first.Date = butcherTimeInput.Date.Value;
@ -387,7 +408,7 @@ namespace WeighAndGrading
details.RemoveAt(49); details.RemoveAt(49);
details.Insert(0, entity); details.Insert(0, entity);
GradeAndWeightRpc.UpdateOrInsertDetail(entity, true); GradeAndWeightRpc.UpdateOrInsertDetail(entity, true);
tempList.Enqueue(entity);
noWeightList.Enqueue(entity);
BindDetailGrid(); BindDetailGrid();
} }
if (currentRow != null) if (currentRow != null)
@ -411,10 +432,13 @@ namespace WeighAndGrading
{ {
weight -= (GradeContext.Config.Discont ?? 0); weight -= (GradeContext.Config.Discont ?? 0);
GradeAndWeight_Detail first; GradeAndWeight_Detail first;
if (tempList.TryPeek(out first) && first.Weight == null)
if (noWeightList.TryPeek(out first))
{ {
tempList.TryDequeue(out first);
first.Weight = (first.Weight ?? 0) + weight;
noWeightList.TryDequeue(out first);
if (first.Weight < 0)
first.Weight = (first.Weight ?? 0) + weight;
else
first.Weight = weight;
GradeAndWeightRpc.UpdateOrInsertDetail(first); GradeAndWeightRpc.UpdateOrInsertDetail(first);
historyGrid.Refresh(); historyGrid.Refresh();
} }
@ -430,7 +454,7 @@ namespace WeighAndGrading
details.RemoveAt(49); details.RemoveAt(49);
details.Insert(0, entity); details.Insert(0, entity);
GradeAndWeightRpc.UpdateOrInsertDetail(entity); GradeAndWeightRpc.UpdateOrInsertDetail(entity);
tempList.Enqueue(entity);
noLivestockList.Enqueue(entity);
BindDetailGrid(); BindDetailGrid();
} }
} }
@ -442,10 +466,42 @@ namespace WeighAndGrading
modifyPanel.Hide(); modifyPanel.Hide();
} }
GradeAndWeight_Detail lastCheckItem;
private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e) private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e)
{ {
if (e.RowIndex < 0) if (e.RowIndex < 0)
return; return;
if (e.ColumnIndex == 2)
{
if (lastCheckItem != null && lastCheckItem.ID != (long)historyGrid.Rows[e.RowIndex].Cells[0].Value)
lastCheckItem.ReadWeight = false;
lastCheckItem = historyGrid.Rows[e.RowIndex].DataBoundItem as GradeAndWeight_Detail;
lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight;
modifyDetail = null;
if (modifyPanel.Visible)
modifyPanel.Hide();
historyGrid.Refresh();
if (lastCheckItem.ReadWeight)
{
noWeightList = new ConcurrentQueue<GradeAndWeight_Detail>();
var stack = new Stack<GradeAndWeight_Detail>();
foreach (var item in details)
{
stack.Push(item);
if (item.ID == lastCheckItem.ID)
break;
}
while (stack.Count > 0)
noWeightList.Enqueue(stack.Pop());
}
else
{
FillQueue();
lastCheckItem = null;
}
return;
}
modifyDetail = historyGrid.Rows[e.RowIndex].DataBoundItem as GradeAndWeight_Detail; modifyDetail = historyGrid.Rows[e.RowIndex].DataBoundItem as GradeAndWeight_Detail;
stateLabel.Text = string.Format("您正在修改序号为 {0} 的信息", modifyDetail.Index); stateLabel.Text = string.Format("您正在修改序号为 {0} 的信息", modifyDetail.Index);
modifyPanel.Show(); modifyPanel.Show();
@ -548,5 +604,30 @@ namespace WeighAndGrading
discontPanel.Controls.Add(btn); discontPanel.Controls.Add(btn);
} }
} }
private void InitScrollBar1()
{
vScrollBar1.Maximum = (dataGridView.RowCount - dataGridView.DisplayedRowCount(false) + 30) * dataGridView.RowTemplate.Height;
vScrollBar1.Minimum = 0;
vScrollBar1.SmallChange = dataGridView.RowTemplate.Height;
vScrollBar1.LargeChange = dataGridView.RowTemplate.Height * 30;
this.vScrollBar1.Scroll += (sender, e) =>
{
dataGridView.FirstDisplayedScrollingRowIndex = e.NewValue / dataGridView.RowTemplate.Height;
Application.DoEvents();
};
}
private void InitScrollBar2()
{
vScrollBar2.Maximum = (historyGrid.RowCount - historyGrid.DisplayedRowCount(false) + 30) * historyGrid.RowTemplate.Height;
vScrollBar2.Minimum = 0;
vScrollBar2.SmallChange = historyGrid.RowTemplate.Height;
vScrollBar2.LargeChange = historyGrid.RowTemplate.Height * 30;
this.vScrollBar2.Scroll += (sender, e) =>
{
historyGrid.FirstDisplayedScrollingRowIndex = e.NewValue / historyGrid.RowTemplate.Height;
Application.DoEvents();
};
}
} }
} }

+ 3
- 0
WeighAndGrading/GradeFrom.resx View File

@ -123,6 +123,9 @@
<metadata name="H_Livestock_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="H_Livestock_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="H_ReadWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="H_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>


Loading…
Cancel
Save