diff --git a/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs b/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs index fbea778..c580a54 100644 --- a/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs +++ b/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs @@ -18,6 +18,6 @@ namespace BO.BO.Bill public int Already { get; set; } - public bool Finish { get { return Number == Already; } set { } } + public bool Finish { get; set; } } } diff --git a/BO/Utils/BillRpc/GradeAndWeightRpc.cs b/BO/Utils/BillRpc/GradeAndWeightRpc.cs index 051a9ec..6cf733a 100644 --- a/BO/Utils/BillRpc/GradeAndWeightRpc.cs +++ b/BO/Utils/BillRpc/GradeAndWeightRpc.cs @@ -13,10 +13,10 @@ namespace BO.Utils.BillRpc { static JavaScriptSerializer serializer = new JavaScriptSerializer(); - public static List GetGradeAndWeightList(DateTime date) + public static List GetGradeAndWeightList(DateTime date, long? maxID = null) { const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetGradeAndWeightList"; - var result = RpcFacade.Call(method, date); + var result = RpcFacade.Call(method, date, maxID); return serializer.Deserialize>(result); } @@ -34,10 +34,16 @@ namespace BO.Utils.BillRpc detail.ID = RpcFacade.Call(method, serializer.Serialize(detail)); } - public static void UpdateLivestock(long id, long liveStockID,string liveStockName) + public static void UpdateLivestock(long id, long liveStockID, string liveStockName) { const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/UpdateLivestock"; RpcFacade.Call(method, id, liveStockID, liveStockName); } + + public static void SetGradeFinish(long orderDetailID, short technics) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/SetGradeFinish"; + RpcFacade.Call(method, orderDetailID, technics); + } } } diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs index b6dea56..b931166 100644 --- a/WeighAndGrading/GradeFrom.Designer.cs +++ b/WeighAndGrading/GradeFrom.Designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = 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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = 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(); this.label1 = new System.Windows.Forms.Label(); this.syncBtn = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); @@ -63,6 +63,14 @@ this.queryBtn = new System.Windows.Forms.Button(); this.saiXuanBtn = new System.Windows.Forms.Button(); 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_Index = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Order = 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.isPrintCheckBox = new System.Windows.Forms.CheckBox(); this.printBtn = new System.Windows.Forms.Button(); @@ -70,26 +78,19 @@ this.lblChengZhong = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.dataGridView = new BWP.WinFormControl.UDataGridView(); - this.D_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Technics_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.butcherTimeInput = new BWP.WinFormControl.UDatePicker(); this.closeBtn = new System.Windows.Forms.Button(); this.configBtn = new System.Windows.Forms.Button(); this.stateLabel = new System.Windows.Forms.Label(); this.modifyPanel = new System.Windows.Forms.Panel(); this.cancelBtn = new System.Windows.Forms.Button(); - 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_Order = 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.D_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_Technics_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_FinishBtn = new System.Windows.Forms.DataGridViewButtonColumn(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -126,7 +127,7 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 15F); - this.label2.Location = new System.Drawing.Point(413, 131); + this.label2.Location = new System.Drawing.Point(511, 131); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(109, 20); this.label2.TabIndex = 5; @@ -136,7 +137,7 @@ // this.orderLabel.AutoSize = true; this.orderLabel.Font = new System.Drawing.Font("宋体", 15F); - this.orderLabel.Location = new System.Drawing.Point(518, 131); + this.orderLabel.Location = new System.Drawing.Point(616, 131); this.orderLabel.Name = "orderLabel"; this.orderLabel.Size = new System.Drawing.Size(19, 20); this.orderLabel.TabIndex = 6; @@ -146,7 +147,7 @@ // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("宋体", 15F); - this.label4.Location = new System.Drawing.Point(577, 131); + this.label4.Location = new System.Drawing.Point(675, 131); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(109, 20); this.label4.TabIndex = 7; @@ -156,7 +157,7 @@ // this.alreadyLabel.AutoSize = true; this.alreadyLabel.Font = new System.Drawing.Font("宋体", 15F); - this.alreadyLabel.Location = new System.Drawing.Point(692, 131); + this.alreadyLabel.Location = new System.Drawing.Point(776, 131); this.alreadyLabel.Name = "alreadyLabel"; this.alreadyLabel.Size = new System.Drawing.Size(19, 20); this.alreadyLabel.TabIndex = 8; @@ -165,27 +166,27 @@ // groupBox1 // this.groupBox1.Controls.Add(this.ttPanel); - this.groupBox1.Location = new System.Drawing.Point(407, 175); + this.groupBox1.Location = new System.Drawing.Point(505, 175); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(390, 330); + this.groupBox1.Size = new System.Drawing.Size(294, 330); this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; this.groupBox1.Text = "烫褪"; // // ttPanel // - this.ttPanel.Location = new System.Drawing.Point(13, 36); + this.ttPanel.Location = new System.Drawing.Point(12, 36); this.ttPanel.Name = "ttPanel"; - this.ttPanel.Size = new System.Drawing.Size(367, 276); + this.ttPanel.Size = new System.Drawing.Size(270, 276); this.ttPanel.TabIndex = 0; // // groupBox2 // this.groupBox2.Controls.Add(this.label11); this.groupBox2.Controls.Add(this.mbPanel); - this.groupBox2.Location = new System.Drawing.Point(407, 525); + this.groupBox2.Location = new System.Drawing.Point(505, 525); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(390, 330); + this.groupBox2.Size = new System.Drawing.Size(294, 330); this.groupBox2.TabIndex = 10; this.groupBox2.TabStop = false; this.groupBox2.Text = "毛剥"; @@ -202,9 +203,9 @@ // // mbPanel // - this.mbPanel.Location = new System.Drawing.Point(13, 37); + this.mbPanel.Location = new System.Drawing.Point(12, 37); this.mbPanel.Name = "mbPanel"; - this.mbPanel.Size = new System.Drawing.Size(367, 276); + this.mbPanel.Size = new System.Drawing.Size(270, 276); this.mbPanel.TabIndex = 1; // // groupBox3 @@ -398,17 +399,17 @@ this.historyGrid.AllowUserToDeleteRows = false; this.historyGrid.AllowUserToResizeColumns = false; this.historyGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.historyGrid.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle23.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_ID, @@ -424,14 +425,78 @@ this.historyGrid.Name = "historyGrid"; this.historyGrid.ReadOnly = true; this.historyGrid.RowHeadersVisible = false; - dataGridViewCellStyle25.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle25; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle4; this.historyGrid.RowTemplate.Height = 40; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.historyGrid.Size = new System.Drawing.Size(426, 571); this.historyGrid.TabIndex = 0; 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_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_Order + // + this.H_Order.DataPropertyName = "Order"; + this.H_Order.HeaderText = "顺序"; + this.H_Order.Name = "H_Order"; + this.H_Order.ReadOnly = true; + this.H_Order.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 = 65; + // + // H_Time + // + this.H_Time.DataPropertyName = "Time"; + this.H_Time.HeaderText = "时间"; + this.H_Time.Name = "H_Time"; + this.H_Time.ReadOnly = true; + // // enableWeight // this.enableWeight.AutoCheck = false; @@ -492,7 +557,7 @@ // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("宋体", 15F); - this.label10.Location = new System.Drawing.Point(413, 171); + this.label10.Location = new System.Drawing.Point(511, 171); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(49, 20); this.label10.TabIndex = 32; @@ -504,17 +569,17 @@ this.dataGridView.AllowUserToDeleteRows = false; this.dataGridView.AllowUserToResizeColumns = false; this.dataGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle26.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.dataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle26; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.dataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; this.dataGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle27.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle27.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle27.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle27.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle27.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle27; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.D_OrderDetail_ID, @@ -522,65 +587,19 @@ this.D_Order, this.D_Technics_Name, this.D_Number, - this.D_Already}); + this.D_Already, + this.D_FinishBtn}); this.dataGridView.Location = new System.Drawing.Point(12, 175); - this.dataGridView.MultiSelect = false; this.dataGridView.Name = "dataGridView"; this.dataGridView.ReadOnly = true; this.dataGridView.RowHeadersVisible = false; - dataGridViewCellStyle28.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle28; - this.dataGridView.RowTemplate.Height = 30; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView.RowTemplate.Height = 40; this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridView.Size = new System.Drawing.Size(364, 517); + this.dataGridView.Size = new System.Drawing.Size(469, 517); this.dataGridView.TabIndex = 4; - // - // D_OrderDetail_ID - // - this.D_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; - this.D_OrderDetail_ID.HeaderText = "OrderDetail_ID"; - this.D_OrderDetail_ID.Name = "D_OrderDetail_ID"; - this.D_OrderDetail_ID.ReadOnly = true; - this.D_OrderDetail_ID.Visible = false; - // - // D_Finish - // - this.D_Finish.DataPropertyName = "Finish"; - this.D_Finish.HeaderText = "Finish"; - this.D_Finish.Name = "D_Finish"; - this.D_Finish.ReadOnly = true; - this.D_Finish.Visible = false; - // - // D_Order - // - this.D_Order.DataPropertyName = "Order"; - this.D_Order.HeaderText = "屠宰顺序"; - this.D_Order.Name = "D_Order"; - this.D_Order.ReadOnly = true; - // - // D_Technics_Name - // - this.D_Technics_Name.DataPropertyName = "Technics_Name"; - this.D_Technics_Name.HeaderText = "工艺"; - this.D_Technics_Name.Name = "D_Technics_Name"; - this.D_Technics_Name.ReadOnly = true; - this.D_Technics_Name.Width = 80; - // - // D_Number - // - this.D_Number.DataPropertyName = "Number"; - this.D_Number.HeaderText = "头数"; - this.D_Number.Name = "D_Number"; - this.D_Number.ReadOnly = true; - this.D_Number.Width = 80; - // - // D_Already - // - this.D_Already.DataPropertyName = "Already"; - this.D_Already.HeaderText = "已宰"; - this.D_Already.Name = "D_Already"; - this.D_Already.ReadOnly = true; - this.D_Already.Width = 80; + this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick); // // butcherTimeInput // @@ -652,69 +671,60 @@ this.cancelBtn.UseVisualStyleBackColor = true; this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); // - // 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 + // D_OrderDetail_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; + this.D_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; + this.D_OrderDetail_ID.HeaderText = "OrderDetail_ID"; + this.D_OrderDetail_ID.Name = "D_OrderDetail_ID"; + this.D_OrderDetail_ID.ReadOnly = true; + this.D_OrderDetail_ID.Visible = false; // - // H_Index + // D_Finish // - 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; + this.D_Finish.DataPropertyName = "Finish"; + this.D_Finish.HeaderText = "Finish"; + this.D_Finish.Name = "D_Finish"; + this.D_Finish.ReadOnly = true; + this.D_Finish.Visible = false; // - // H_Order + // D_Order // - this.H_Order.DataPropertyName = "Order"; - this.H_Order.HeaderText = "顺序"; - this.H_Order.Name = "H_Order"; - this.H_Order.ReadOnly = true; - this.H_Order.Width = 65; + this.D_Order.DataPropertyName = "Order"; + this.D_Order.HeaderText = "屠宰顺序"; + this.D_Order.Name = "D_Order"; + this.D_Order.ReadOnly = true; // - // H_Technics + // D_Technics_Name // - 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; + this.D_Technics_Name.DataPropertyName = "Technics_Name"; + this.D_Technics_Name.HeaderText = "工艺"; + this.D_Technics_Name.Name = "D_Technics_Name"; + this.D_Technics_Name.ReadOnly = true; + this.D_Technics_Name.Width = 80; // - // H_Livestock_Name + // D_Number // - 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; + this.D_Number.DataPropertyName = "Number"; + this.D_Number.HeaderText = "头数"; + this.D_Number.Name = "D_Number"; + this.D_Number.ReadOnly = true; + this.D_Number.Width = 80; // - // H_Weight + // D_Already // - this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle24.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle24; - this.H_Weight.HeaderText = "重量"; - this.H_Weight.Name = "H_Weight"; - this.H_Weight.ReadOnly = true; - this.H_Weight.Width = 65; + this.D_Already.DataPropertyName = "Already"; + this.D_Already.HeaderText = "已宰"; + this.D_Already.Name = "D_Already"; + this.D_Already.ReadOnly = true; + this.D_Already.Width = 80; // - // H_Time + // D_FinishBtn // - this.H_Time.DataPropertyName = "Time"; - this.H_Time.HeaderText = "时间"; - this.H_Time.Name = "H_Time"; - this.H_Time.ReadOnly = true; + this.D_FinishBtn.HeaderText = "完毕"; + this.D_FinishBtn.Name = "D_FinishBtn"; + this.D_FinishBtn.ReadOnly = true; + this.D_FinishBtn.Text = "完毕"; + this.D_FinishBtn.UseColumnTextForButtonValue = true; // // GradeFrom // @@ -805,12 +815,6 @@ private BWP.WinFormControl.UDatePicker endDataInput; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button closeBtn; - private System.Windows.Forms.DataGridViewTextBoxColumn D_OrderDetail_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Finish; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Order; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Technics_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Number; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Already; private System.Windows.Forms.Button configBtn; private System.Windows.Forms.Label stateLabel; private System.Windows.Forms.Panel modifyPanel; @@ -823,5 +827,12 @@ private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; + private System.Windows.Forms.DataGridViewTextBoxColumn D_OrderDetail_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn D_Finish; + private System.Windows.Forms.DataGridViewTextBoxColumn D_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn D_Technics_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn D_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn D_Already; + private System.Windows.Forms.DataGridViewButtonColumn D_FinishBtn; } } \ No newline at end of file diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index 75e6bfc..ab4314b 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -39,9 +39,6 @@ namespace WeighAndGrading int maxIndex = 0; readonly ConcurrentQueue tempList = new ConcurrentQueue(); - // readonly ConcurrentQueue _detailQueue = new ConcurrentQueue(); - //readonly ConcurrentQueue _weightQueue = new ConcurrentQueue(); - #region weightNeed private IDataFormat _dataFormat; private Thread _inQueryThread, _outQueryThread; @@ -51,21 +48,8 @@ namespace WeighAndGrading private const int WmUpdDisplayMessage = 0x0500 + 2; private string _displayValue; - // private int _mainHandle; #endregion - //int MainHandle - //{ - // get - // { - // if (_mainHandle == 0) - // { - // _mainHandle = WinApiSendMessage.FindWindow(null, this.Text); - // } - // return _mainHandle; - // } - //} - public GradeFrom() { InitializeComponent(); @@ -75,43 +59,13 @@ namespace WeighAndGrading historyGrid.AutoGenerateColumns = false; AddLivestockBtn(); weightPort = new SerialPort(); - // syncWegithThread = new Thread(SyncTask) { IsBackground = true }; this.FormClosing += delegate { - //if (syncWegithThread.IsAlive) - //syncWegithThread.Abort(); if (_inQueryThread != null && _inQueryThread.IsAlive) DisableWeight(); }; } - //private void SyncTask() - //{ - // while (_mainProcessIsRun) - // { - // if (_detailQueue.Any() && _weightQueue.Any()) - // { - // long id; - // decimal weight; - // if (_detailQueue.TryDequeue(out id) && _weightQueue.TryDequeue(out weight)) - // { - // GradeAndWeightRpc.FillDetailWeight(id, weight); - // var first = details.FirstOrDefault(x => x.ID == id); - // if (first != null) - // { - // first.Weight = weight; - // this.Invoke(new InvokeHandler(delegate() - // { - // historyGrid.Refresh(); - // })); - // } - // } - // } - // else - // Thread.Sleep(1000); - // } - //} - GradeAndWeight_Detail modifyDetail; void AddLivestockBtn() @@ -202,6 +156,7 @@ namespace WeighAndGrading var date = butcherTimeInput.Date.Value; list = GradeAndWeightRpc.GetGradeAndWeightList(date); BindDataGrid(); + dataGridView.Refresh(); details = GradeAndWeightRpc.GetDetails(date, date, null, -1); BindDetailGrid(); if (details.Any()) @@ -216,20 +171,7 @@ namespace WeighAndGrading if ((bool)row.Cells["D_Finish"].Value) row.DefaultCellStyle.BackColor = Color.YellowGreen; } - - var selectRows = GetEnableTopTowRows(); - if (selectRows.Any()) - { - var first = selectRows.First().DataBoundItem as GradeAndWeight; - orderLabel.Text = first.Order.ToString(); - alreadyLabel.Text = first.Already.ToString(); - } - else - { - orderLabel.Text = alreadyLabel.Text = string.Empty; - dataGridView.ClearSelection(); - } - dataGridView.Refresh(); + dataGridView.ClearSelection(); } void BindDetailGrid() @@ -240,14 +182,6 @@ namespace WeighAndGrading historyGrid.Refresh(); } - //void BindSelectColor(GradeAndWeight entity) - //{ - // if (entity.Finish) - // dataGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(204, 51, 51); - // else - // dataGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(66, 163, 218); - //} - private void printBtn_Click(object sender, EventArgs e) { var entity = new PrintEntity(); @@ -269,32 +203,8 @@ namespace WeighAndGrading new GradeSettingFrom().ShowDialog(); } - List GetEnableTopTowRows() - { - var result = new List(); - if (dataGridView.Rows.Count == 0) - return result; - string top = string.Empty; - for (var i = 0; i <= dataGridView.Rows.Count - 1; i++) - { - var row = dataGridView.Rows[i]; - if ((bool)row.Cells["D_Finish"].Value) - break; - var tv = row.Cells["D_Technics_Name"].Value.ToString(); - if (tv != top) - { - row.Selected = true; - result.Add(row); - if (result.Count == 2) - break; - } - top = tv; - - if (i == 2) - break; - } - return result; - } + GradeAndWeight tangEntity; + GradeAndWeight maoEntity; #region weightNeed void OpenSerialPort() @@ -420,7 +330,6 @@ namespace WeighAndGrading AddWeightDetail(decimal.Parse(_displayValue)); })); } - //WinApiSendMessage.SendMessage(MainHandle, WmUpdDisplayMessage, 0, 0); } } catch (Exception) @@ -435,9 +344,7 @@ namespace WeighAndGrading void DisableWeight() { _mainProcessIsRun = false; - //if (syncWegithThread != null && syncWegithThread.IsAlive) - // syncWegithThread.Abort(); - WeightValue = 0; + lblChengZhong.Text = string.Format(format, 0); format = "{0:0.00}"; Thread.Sleep(10); if (_inQueryThread.IsAlive) @@ -464,37 +371,11 @@ namespace WeighAndGrading OpenSerialPort(); _mainProcessIsRun = true; ReadData(); - //if (syncWegithThread != null && !syncWegithThread.IsAlive) - // syncWegithThread.Start(); } else DisableWeight(); enableWeight.CheckState = enableWeight.Checked ? CheckState.Unchecked : CheckState.Checked; } - - decimal? WeightValue - { - get - { - if (!string.IsNullOrEmpty(lblChengZhong.Text)) - return decimal.Parse(lblChengZhong.Text); - return null; - } - set { lblChengZhong.Text = string.Format(format, value); } - } - - //protected override void DefWndProc(ref Message m) - //{ - // switch (m.Msg) - // { - // case WmUpdDisplayMessage: - // lblChengZhong.Text = _displayValue; - // break; - // default: - // base.DefWndProc(ref m); - // break; - // } - //} #endregion static object _obj = new object(); @@ -503,16 +384,10 @@ namespace WeighAndGrading { lock (_obj) { - var selectRows = GetEnableTopTowRows(); - if (selectRows.Count == 0) - throw new Exception("没有可定级的数据记录了"); - // var livestock = (CTuple)btn.Tag; + var currentRow = livestock.Item3 == 0 ? tangEntity : maoEntity; var tech = livestock.Item3 == 0 ? "烫褪" : "毛剥"; - var targetRow = selectRows.FirstOrDefault(x => x.Cells["D_Technics_Name"].Value.ToString() == tech); - if (targetRow == null) - throw new Exception(string.Format("没有 {0} 的数据可操作", tech)); - var currentRow = targetRow.DataBoundItem as GradeAndWeight; - + if (currentRow == null) + throw new Exception(string.Format("请先选择 {0} 的数据", tech)); GradeAndWeight_Detail first; if (tempList.TryPeek(out first) && first.Livestock_ID == 0) @@ -546,8 +421,9 @@ namespace WeighAndGrading BindDetailGrid(); } currentRow.Already = currentRow.Already + 1; - - BindDataGrid(); + orderLabel.Text = currentRow.Order.ToString(); + alreadyLabel.Text = currentRow.Already.ToString(); + dataGridView.Refresh(); } } @@ -593,5 +469,77 @@ namespace WeighAndGrading stateLabel.Text = string.Format("您正在修改序号为 {0} 的等级", modifyDetail.Index); modifyPanel.Show(); } + + + DataGridViewRow tangRow; + DataGridViewRow maoRow; + private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + var entity = dataGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (entity.Technics_Name == "烫褪") + { + if (tangRow != null) + { + if ((bool)tangRow.Cells["D_Finish"].Value) + tangRow.DefaultCellStyle.BackColor = Color.YellowGreen; + else + tangRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.BackColor; + } + tangRow = dataGridView.CurrentRow; + tangRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.SelectionBackColor; + tangEntity = entity; + } + else + { + if (maoRow != null) + { + if ((bool)maoRow.Cells["D_Finish"].Value) + maoRow.DefaultCellStyle.BackColor = Color.YellowGreen; + else + maoRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.BackColor; + } + maoRow = dataGridView.CurrentRow; + maoRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.SelectionBackColor; + maoEntity = entity; + } + + if (e.ColumnIndex != dataGridView.ColumnCount - 1) + return; + if (entity.Finish) + return; + entity.Finish = true; + short technics = 1; + if (entity.Technics_Name == "烫褪") + technics = 0; + GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, technics); + BindDataGrid(); + if (technics == 0) + { + FindRowSetSelected(maoEntity); + tangEntity = null; + } + else + { + FindRowSetSelected(tangEntity); + maoEntity = null; + } + dataGridView.Refresh(); + } + + void FindRowSetSelected(GradeAndWeight tag) + { + if (tag == null) + return; + foreach (DataGridViewRow row in dataGridView.Rows) + { + if ((long)row.Cells["D_OrderDetail_ID"].Value == tag.OrderDetail_ID && (string)row.Cells["D_Technics_Name"].Value == tag.Technics_Name) + { + row.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.SelectionBackColor; + return; + } + } + } } } diff --git a/WeighAndGrading/GradeFrom.resx b/WeighAndGrading/GradeFrom.resx index b2035e3..28fc019 100644 --- a/WeighAndGrading/GradeFrom.resx +++ b/WeighAndGrading/GradeFrom.resx @@ -159,4 +159,7 @@ True + + True + \ No newline at end of file