diff --git a/BO/Utils/AfterLoginUtil.cs b/BO/Utils/AfterLoginUtil.cs index b05ac37..db8d05d 100644 --- a/BO/Utils/AfterLoginUtil.cs +++ b/BO/Utils/AfterLoginUtil.cs @@ -28,7 +28,8 @@ namespace BO.Utils new Tuple("掉猪处理员",@"C:\BwpB3Project\src\B3ButcherManageClient\DropPigReOrder\bin\Debug\DropPigReOrder"), new Tuple("配货员",@"D:\BWP\BWPB3\src\B3ButcherManageClient\Distribution\bin\Debug\Distribution"), new Tuple("分割称重",@"C:\B3\src\B3ButcherManageClient\SegmentationWeight\bin\Debug\SegmentationWeight"), - new Tuple("分割入库",@"C:\B3\src\B3ButcherManageClient\SegmentationInStore\bin\Debug\SegmentationInStore") + new Tuple("分割入库",@"C:\B3\src\B3ButcherManageClient\SegmentationInStore\bin\Debug\SegmentationInStore"), + new Tuple("定级校验",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"), }; #else static List> roleToAssemblies = new List>() @@ -41,6 +42,7 @@ namespace BO.Utils new Tuple("掉猪处理员",@"DropPigReOrder"), new Tuple("分割称重",@"SegmentationWeight"), new Tuple("分割入库",@"SegmentationInStore"), + new Tuple("定级校验",@"WeighAndGrading"), }; #endif diff --git a/ButcherManageClient/Login.cs b/ButcherManageClient/Login.cs index 64edf37..381ab36 100644 --- a/ButcherManageClient/Login.cs +++ b/ButcherManageClient/Login.cs @@ -34,6 +34,9 @@ namespace ButcherManageClient InitializeComponent(); userNameTxt.Text = ButcherAppContext.Context.UserConfig.UserName; pwdTxt.Text = ""; +#if DEBUG + pwdTxt.Text = "123"; +#endif } private void settingBtn_Click(object sender, EventArgs e) @@ -65,9 +68,9 @@ namespace ButcherManageClient throw new Exception("离线状态请保持与上次用户名一致"); ButcherAppContext.Context.UserConfig.Connection = false; } -// var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role); -// var form = AfterLoginUtil.CreateForm("分割入库"); - var form = AfterLoginUtil.CreateForm("分割称重"); + var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role); + //var form = AfterLoginUtil.CreateForm("分割入库"); + // var form = AfterLoginUtil.CreateForm("分割称重"); if (form == null) throw new Exception("权限不符"); form.FormClosing += delegate { SubFormClosing(); }; diff --git a/WeighAndGrading/DataConfirm.cs b/WeighAndGrading/DataConfirm.cs index 709c95f..8d7bd0d 100644 --- a/WeighAndGrading/DataConfirm.cs +++ b/WeighAndGrading/DataConfirm.cs @@ -20,11 +20,11 @@ namespace WeighAndGrading { List leftList; List weightList; - public DataConfirm() + public DataConfirm(DateTime date) { InitializeComponent(); - uDatePicker1.Date = DateTime.Today; + uDatePicker1.Date = date; orderGridView.AutoGenerateColumns = false; weightGrid.AutoGenerateColumns = false; AddLivestockBtn(); diff --git a/WeighAndGrading/DataViewForm.Designer.cs b/WeighAndGrading/DataViewForm.Designer.cs new file mode 100644 index 0000000..e5a14b8 --- /dev/null +++ b/WeighAndGrading/DataViewForm.Designer.cs @@ -0,0 +1,853 @@ +namespace WeighAndGrading +{ + partial class DataViewForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Technics_Name = 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.butcherTimeInput = new BWP.WinFormControl.UDatePicker(); + this.stateLabel = new System.Windows.Forms.Label(); + this.modifyPanel = new System.Windows.Forms.Panel(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.discontPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataConfirmBtn = new System.Windows.Forms.Button(); + this.vScrollBar2 = new System.Windows.Forms.VScrollBar(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.tangScrollBar = new System.Windows.Forms.VScrollBar(); + this.ttPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.lblTangTui = new System.Windows.Forms.Label(); + this.tangGridView = new BWP.WinFormControl.UDataGridView(); + this.T_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.alreadyLabel = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.orderLabel = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.syncBtn = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.label12 = new System.Windows.Forms.Label(); + this.historyGrid = new BWP.WinFormControl.UDataGridView(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.keyPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.label3 = new System.Windows.Forms.Label(); + this.maoScrollBar = new System.Windows.Forms.VScrollBar(); + this.maoGridView = new BWP.WinFormControl.UDataGridView(); + this.M_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.lblMaoBo = new System.Windows.Forms.Label(); + this.dropPigBtn = new System.Windows.Forms.Button(); + this.discontBtn = new System.Windows.Forms.Button(); + this.statePic = new System.Windows.Forms.PictureBox(); + this.printBtn = new System.Windows.Forms.Button(); + this.isPrintCheckBox = new System.Windows.Forms.CheckBox(); + this.withOkPanel = new System.Windows.Forms.Panel(); + this.numberInput = new System.Windows.Forms.TextBox(); + this.SaveBtn = new System.Windows.Forms.Button(); + this.flagLabel = new System.Windows.Forms.Label(); + this.modifyPanel.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.historyGrid)).BeginInit(); + this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.maoGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.statePic)).BeginInit(); + this.withOkPanel.SuspendLayout(); + this.SuspendLayout(); + // + // 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_IsDrop + // + this.H_IsDrop.DataPropertyName = "IsDrop"; + this.H_IsDrop.HeaderText = "IsDrop"; + this.H_IsDrop.Name = "H_IsDrop"; + this.H_IsDrop.ReadOnly = true; + this.H_IsDrop.Visible = false; + // + // H_Technics + // + this.H_Technics.DataPropertyName = "Technics"; + this.H_Technics.HeaderText = "Technics"; + this.H_Technics.Name = "H_Technics"; + this.H_Technics.ReadOnly = true; + this.H_Technics.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_Name + // + this.H_Technics_Name.DataPropertyName = "Technics_Name"; + this.H_Technics_Name.HeaderText = "工艺"; + this.H_Technics_Name.Name = "H_Technics_Name"; + this.H_Technics_Name.ReadOnly = true; + this.H_Technics_Name.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 = 110; + // + // H_Weight + // + this.H_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle12.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle12; + 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"; + dataGridViewCellStyle13.Format = "HH:mm:ss"; + dataGridViewCellStyle13.NullValue = null; + this.H_Time.DefaultCellStyle = dataGridViewCellStyle13; + this.H_Time.HeaderText = "时间"; + this.H_Time.Name = "H_Time"; + this.H_Time.ReadOnly = true; + // + // butcherTimeInput + // + this.butcherTimeInput.BackColor = System.Drawing.Color.White; + this.butcherTimeInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.butcherTimeInput.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0); + this.butcherTimeInput.Font = new System.Drawing.Font("宋体", 15F); + this.butcherTimeInput.Location = new System.Drawing.Point(116, 31); + this.butcherTimeInput.Name = "butcherTimeInput"; + this.butcherTimeInput.Size = new System.Drawing.Size(133, 30); + this.butcherTimeInput.TabIndex = 44; + this.butcherTimeInput.Text = "2017/09/05"; + this.butcherTimeInput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.butcherTimeInput.Type = BWP.WinFormControl.DateTimeType.Date; + // + // stateLabel + // + this.stateLabel.AutoSize = true; + this.stateLabel.Font = new System.Drawing.Font("宋体", 15F); + this.stateLabel.ForeColor = System.Drawing.Color.Blue; + this.stateLabel.Location = new System.Drawing.Point(-1, 19); + this.stateLabel.Name = "stateLabel"; + this.stateLabel.Size = new System.Drawing.Size(249, 20); + this.stateLabel.TabIndex = 35; + this.stateLabel.Text = "您正在修改序号为 1000 的"; + // + // modifyPanel + // + this.modifyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.modifyPanel.Controls.Add(this.flagLabel); + this.modifyPanel.Controls.Add(this.withOkPanel); + this.modifyPanel.Controls.Add(this.cancelBtn); + this.modifyPanel.Controls.Add(this.stateLabel); + this.modifyPanel.Location = new System.Drawing.Point(827, 615); + this.modifyPanel.Name = "modifyPanel"; + this.modifyPanel.Size = new System.Drawing.Size(596, 57); + this.modifyPanel.TabIndex = 60; + this.modifyPanel.Visible = false; + // + // cancelBtn + // + this.cancelBtn.Font = new System.Drawing.Font("宋体", 15F); + this.cancelBtn.ForeColor = System.Drawing.Color.Red; + this.cancelBtn.Location = new System.Drawing.Point(489, 8); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(102, 43); + this.cancelBtn.TabIndex = 36; + this.cancelBtn.Text = "取消"; + this.cancelBtn.UseVisualStyleBackColor = true; + this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); + // + // discontPanel + // + this.discontPanel.Location = new System.Drawing.Point(1355, 115); + this.discontPanel.Name = "discontPanel"; + this.discontPanel.Size = new System.Drawing.Size(71, 479); + this.discontPanel.TabIndex = 57; + // + // H_SID + // + this.H_SID.DataPropertyName = "SID"; + this.H_SID.HeaderText = "SID"; + this.H_SID.Name = "H_SID"; + this.H_SID.ReadOnly = true; + this.H_SID.Visible = false; + // + // dataConfirmBtn + // + this.dataConfirmBtn.Font = new System.Drawing.Font("宋体", 15F); + this.dataConfirmBtn.Location = new System.Drawing.Point(1321, 16); + this.dataConfirmBtn.Name = "dataConfirmBtn"; + this.dataConfirmBtn.Size = new System.Drawing.Size(102, 54); + this.dataConfirmBtn.TabIndex = 67; + this.dataConfirmBtn.Text = "数据校验"; + this.dataConfirmBtn.UseVisualStyleBackColor = true; + this.dataConfirmBtn.Click += new System.EventHandler(this.dataConfirmBtn_Click); + // + // vScrollBar2 + // + this.vScrollBar2.Location = new System.Drawing.Point(479, 36); + this.vScrollBar2.Name = "vScrollBar2"; + this.vScrollBar2.Size = new System.Drawing.Size(40, 450); + this.vScrollBar2.TabIndex = 52; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.tangScrollBar); + this.groupBox1.Controls.Add(this.ttPanel); + this.groupBox1.Controls.Add(this.lblTangTui); + this.groupBox1.Controls.Add(this.tangGridView); + this.groupBox1.Location = new System.Drawing.Point(16, 108); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(783, 344); + this.groupBox1.TabIndex = 50; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "烫褪"; + // + // tangScrollBar + // + this.tangScrollBar.Location = new System.Drawing.Point(373, 36); + this.tangScrollBar.Name = "tangScrollBar"; + this.tangScrollBar.Size = new System.Drawing.Size(40, 286); + this.tangScrollBar.TabIndex = 51; + // + // ttPanel + // + this.ttPanel.Location = new System.Drawing.Point(431, 35); + this.ttPanel.Name = "ttPanel"; + this.ttPanel.Size = new System.Drawing.Size(337, 287); + this.ttPanel.TabIndex = 0; + // + // lblTangTui + // + this.lblTangTui.AutoSize = true; + this.lblTangTui.Font = new System.Drawing.Font("宋体", 15F); + this.lblTangTui.Location = new System.Drawing.Point(6, -1); + this.lblTangTui.Name = "lblTangTui"; + this.lblTangTui.Size = new System.Drawing.Size(49, 20); + this.lblTangTui.TabIndex = 32; + this.lblTangTui.Text = "烫褪"; + // + // tangGridView + // + this.tangGridView.AllowUserToAddRows = false; + this.tangGridView.AllowUserToDeleteRows = false; + this.tangGridView.AllowUserToResizeColumns = false; + this.tangGridView.AllowUserToResizeRows = false; + dataGridViewCellStyle14.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle14; + this.tangGridView.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15; + this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.T_OrderDetail_ID, + this.T_Finish, + this.T_Order, + this.T_Number, + this.T_Already}); + this.tangGridView.Location = new System.Drawing.Point(10, 36); + this.tangGridView.MultiSelect = false; + this.tangGridView.Name = "tangGridView"; + this.tangGridView.ReadOnly = true; + this.tangGridView.RowHeadersVisible = false; + dataGridViewCellStyle16.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle16.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.Black; + this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle16; + this.tangGridView.RowTemplate.Height = 65; + this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.tangGridView.Size = new System.Drawing.Size(363, 286); + this.tangGridView.TabIndex = 4; + this.tangGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellClick); + // + // T_OrderDetail_ID + // + this.T_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; + this.T_OrderDetail_ID.HeaderText = "OrderDetail_ID"; + this.T_OrderDetail_ID.Name = "T_OrderDetail_ID"; + this.T_OrderDetail_ID.ReadOnly = true; + this.T_OrderDetail_ID.Visible = false; + // + // T_Finish + // + this.T_Finish.DataPropertyName = "Finish"; + this.T_Finish.HeaderText = "Finish"; + this.T_Finish.Name = "T_Finish"; + this.T_Finish.ReadOnly = true; + this.T_Finish.Visible = false; + // + // T_Order + // + this.T_Order.DataPropertyName = "Order"; + this.T_Order.HeaderText = "屠宰顺序"; + this.T_Order.Name = "T_Order"; + this.T_Order.ReadOnly = true; + this.T_Order.Width = 120; + // + // T_Number + // + this.T_Number.DataPropertyName = "Number"; + this.T_Number.HeaderText = "头数"; + this.T_Number.Name = "T_Number"; + this.T_Number.ReadOnly = true; + this.T_Number.Width = 115; + // + // T_Already + // + this.T_Already.DataPropertyName = "Already"; + this.T_Already.HeaderText = "已宰"; + this.T_Already.Name = "T_Already"; + this.T_Already.ReadOnly = true; + this.T_Already.Width = 115; + // + // alreadyLabel + // + this.alreadyLabel.AutoSize = true; + this.alreadyLabel.Font = new System.Drawing.Font("宋体", 15F); + this.alreadyLabel.Location = new System.Drawing.Point(700, 29); + this.alreadyLabel.Name = "alreadyLabel"; + this.alreadyLabel.Size = new System.Drawing.Size(19, 20); + this.alreadyLabel.TabIndex = 49; + this.alreadyLabel.Text = "0"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(599, 29); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(109, 20); + this.label4.TabIndex = 48; + this.label4.Text = "已宰头数:"; + // + // orderLabel + // + this.orderLabel.AutoSize = true; + this.orderLabel.Font = new System.Drawing.Font("宋体", 15F); + this.orderLabel.Location = new System.Drawing.Point(548, 29); + this.orderLabel.Name = "orderLabel"; + this.orderLabel.Size = new System.Drawing.Size(19, 20); + this.orderLabel.TabIndex = 47; + this.orderLabel.Text = "0"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(443, 29); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(109, 20); + this.label2.TabIndex = 46; + this.label2.Text = "屠宰顺序:"; + // + // syncBtn + // + this.syncBtn.Font = new System.Drawing.Font("宋体", 15F); + this.syncBtn.Location = new System.Drawing.Point(274, 25); + this.syncBtn.Name = "syncBtn"; + this.syncBtn.Size = new System.Drawing.Size(102, 43); + this.syncBtn.TabIndex = 45; + this.syncBtn.Text = "同步数据"; + this.syncBtn.UseVisualStyleBackColor = true; + this.syncBtn.Click += new System.EventHandler(this.syncBtn_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 15F); + this.label1.Location = new System.Drawing.Point(12, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(109, 20); + this.label1.TabIndex = 43; + this.label1.Text = "宰杀日期:"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.vScrollBar2); + this.groupBox3.Controls.Add(this.label12); + this.groupBox3.Controls.Add(this.historyGrid); + this.groupBox3.Location = new System.Drawing.Point(826, 108); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(520, 500); + this.groupBox3.TabIndex = 52; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "记录"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("宋体", 15F); + this.label12.Location = new System.Drawing.Point(5, -1); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(49, 20); + this.label12.TabIndex = 32; + this.label12.Text = "记录"; + // + // historyGrid + // + this.historyGrid.AllowUserToAddRows = false; + this.historyGrid.AllowUserToDeleteRows = false; + this.historyGrid.AllowUserToResizeColumns = false; + this.historyGrid.AllowUserToResizeRows = false; + dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17; + this.historyGrid.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18; + this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.H_SID, + this.H_Livestock_ID, + this.H_IsDrop, + this.H_Technics, + this.H_Index, + this.H_Order, + this.H_Technics_Name, + this.H_Livestock_Name, + this.H_Weight, + this.H_Time}); + this.historyGrid.Location = new System.Drawing.Point(1, 36); + this.historyGrid.MultiSelect = false; + this.historyGrid.Name = "historyGrid"; + this.historyGrid.ReadOnly = true; + this.historyGrid.RowHeadersVisible = false; + dataGridViewCellStyle19.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle19.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle19.SelectionForeColor = System.Drawing.Color.Black; + this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle19; + this.historyGrid.RowTemplate.Height = 55; + this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.historyGrid.Size = new System.Drawing.Size(478, 450); + this.historyGrid.TabIndex = 0; + this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.maoScrollBar); + this.groupBox2.Controls.Add(this.maoGridView); + this.groupBox2.Controls.Add(this.mbPanel); + this.groupBox2.Location = new System.Drawing.Point(16, 470); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(783, 353); + this.groupBox2.TabIndex = 51; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "毛剥"; + // + // keyPanel + // + this.keyPanel.Location = new System.Drawing.Point(827, 681); + this.keyPanel.Name = "keyPanel"; + this.keyPanel.Size = new System.Drawing.Size(596, 155); + this.keyPanel.TabIndex = 43; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(6, -1); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(49, 20); + this.label3.TabIndex = 52; + this.label3.Text = "毛剥"; + // + // maoScrollBar + // + this.maoScrollBar.Location = new System.Drawing.Point(373, 35); + this.maoScrollBar.Name = "maoScrollBar"; + this.maoScrollBar.Size = new System.Drawing.Size(40, 298); + this.maoScrollBar.TabIndex = 52; + // + // maoGridView + // + this.maoGridView.AllowUserToAddRows = false; + this.maoGridView.AllowUserToDeleteRows = false; + this.maoGridView.AllowUserToResizeColumns = false; + this.maoGridView.AllowUserToResizeRows = false; + dataGridViewCellStyle20.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle20; + this.maoGridView.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle21.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle21; + this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.M_OrderDetail_ID, + this.M_Finish, + this.M_Order, + this.M_Number, + this.M_Already}); + this.maoGridView.Location = new System.Drawing.Point(10, 35); + this.maoGridView.MultiSelect = false; + this.maoGridView.Name = "maoGridView"; + this.maoGridView.ReadOnly = true; + this.maoGridView.RowHeadersVisible = false; + dataGridViewCellStyle22.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle22.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle22.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle22.SelectionForeColor = System.Drawing.Color.Black; + this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle22; + this.maoGridView.RowTemplate.Height = 65; + this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal; + this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.maoGridView.Size = new System.Drawing.Size(363, 298); + this.maoGridView.TabIndex = 33; + this.maoGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellClick); + // + // M_OrderDetail_ID + // + this.M_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; + this.M_OrderDetail_ID.HeaderText = "OrderDetail_ID"; + this.M_OrderDetail_ID.Name = "M_OrderDetail_ID"; + this.M_OrderDetail_ID.ReadOnly = true; + this.M_OrderDetail_ID.Visible = false; + // + // M_Finish + // + this.M_Finish.DataPropertyName = "Finish"; + this.M_Finish.HeaderText = "Finish"; + this.M_Finish.Name = "M_Finish"; + this.M_Finish.ReadOnly = true; + this.M_Finish.Visible = false; + // + // M_Order + // + this.M_Order.DataPropertyName = "Order"; + this.M_Order.HeaderText = "屠宰顺序"; + this.M_Order.Name = "M_Order"; + this.M_Order.ReadOnly = true; + this.M_Order.Width = 120; + // + // M_Number + // + this.M_Number.DataPropertyName = "Number"; + this.M_Number.HeaderText = "头数"; + this.M_Number.Name = "M_Number"; + this.M_Number.ReadOnly = true; + this.M_Number.Width = 115; + // + // M_Already + // + this.M_Already.DataPropertyName = "Already"; + this.M_Already.HeaderText = "已宰"; + this.M_Already.Name = "M_Already"; + this.M_Already.ReadOnly = true; + this.M_Already.Width = 115; + // + // mbPanel + // + this.mbPanel.Location = new System.Drawing.Point(431, 35); + this.mbPanel.Name = "mbPanel"; + this.mbPanel.Size = new System.Drawing.Size(337, 298); + this.mbPanel.TabIndex = 1; + // + // lblMaoBo + // + this.lblMaoBo.AutoSize = true; + this.lblMaoBo.Font = new System.Drawing.Font("宋体", 15F); + this.lblMaoBo.Location = new System.Drawing.Point(22, 469); + this.lblMaoBo.Name = "lblMaoBo"; + this.lblMaoBo.Size = new System.Drawing.Size(49, 20); + this.lblMaoBo.TabIndex = 56; + this.lblMaoBo.Text = "毛剥"; + // + // dropPigBtn + // + this.dropPigBtn.Font = new System.Drawing.Font("宋体", 15F); + this.dropPigBtn.Location = new System.Drawing.Point(1185, 16); + this.dropPigBtn.Name = "dropPigBtn"; + this.dropPigBtn.Size = new System.Drawing.Size(102, 54); + this.dropPigBtn.TabIndex = 64; + this.dropPigBtn.Text = "掉猪"; + this.dropPigBtn.UseVisualStyleBackColor = true; + this.dropPigBtn.Click += new System.EventHandler(this.dropPigBtn_Click); + // + // discontBtn + // + this.discontBtn.Font = new System.Drawing.Font("宋体", 15F); + this.discontBtn.Location = new System.Drawing.Point(1052, 16); + this.discontBtn.Name = "discontBtn"; + this.discontBtn.Size = new System.Drawing.Size(102, 54); + this.discontBtn.TabIndex = 61; + this.discontBtn.Text = "扣重项"; + this.discontBtn.UseVisualStyleBackColor = true; + this.discontBtn.Click += new System.EventHandler(this.discontBtn_Click); + // + // statePic + // + this.statePic.ErrorImage = null; + this.statePic.InitialImage = null; + this.statePic.Location = new System.Drawing.Point(817, 42); + this.statePic.Name = "statePic"; + this.statePic.Size = new System.Drawing.Size(30, 30); + this.statePic.TabIndex = 62; + this.statePic.TabStop = false; + // + // printBtn + // + this.printBtn.Font = new System.Drawing.Font("宋体", 15F); + this.printBtn.Location = new System.Drawing.Point(922, 16); + this.printBtn.Name = "printBtn"; + this.printBtn.Size = new System.Drawing.Size(102, 54); + this.printBtn.TabIndex = 54; + this.printBtn.Text = "打印选中"; + this.printBtn.UseVisualStyleBackColor = true; + this.printBtn.Click += new System.EventHandler(this.printBtn_Click); + // + // isPrintCheckBox + // + this.isPrintCheckBox.AutoSize = true; + this.isPrintCheckBox.Font = new System.Drawing.Font("宋体", 15F); + this.isPrintCheckBox.Location = new System.Drawing.Point(808, 12); + this.isPrintCheckBox.Name = "isPrintCheckBox"; + this.isPrintCheckBox.Size = new System.Drawing.Size(108, 24); + this.isPrintCheckBox.TabIndex = 68; + this.isPrintCheckBox.Text = "打印条码"; + this.isPrintCheckBox.UseVisualStyleBackColor = true; + // + // withOkPanel + // + this.withOkPanel.Controls.Add(this.numberInput); + this.withOkPanel.Controls.Add(this.SaveBtn); + this.withOkPanel.Location = new System.Drawing.Point(294, 4); + this.withOkPanel.Name = "withOkPanel"; + this.withOkPanel.Size = new System.Drawing.Size(192, 48); + this.withOkPanel.TabIndex = 53; + // + // numberInput + // + this.numberInput.Font = new System.Drawing.Font("宋体", 15F); + this.numberInput.ForeColor = System.Drawing.Color.Red; + this.numberInput.Location = new System.Drawing.Point(4, 9); + this.numberInput.Name = "numberInput"; + this.numberInput.Size = new System.Drawing.Size(72, 30); + this.numberInput.TabIndex = 40; + // + // SaveBtn + // + this.SaveBtn.Font = new System.Drawing.Font("宋体", 15F); + this.SaveBtn.ForeColor = System.Drawing.Color.Red; + this.SaveBtn.Location = new System.Drawing.Point(86, 3); + this.SaveBtn.Name = "SaveBtn"; + this.SaveBtn.Size = new System.Drawing.Size(102, 43); + this.SaveBtn.TabIndex = 39; + this.SaveBtn.Text = "确定"; + this.SaveBtn.UseVisualStyleBackColor = true; + // + // flagLabel + // + this.flagLabel.AutoSize = true; + this.flagLabel.Font = new System.Drawing.Font("宋体", 15F); + this.flagLabel.ForeColor = System.Drawing.Color.Red; + this.flagLabel.Location = new System.Drawing.Point(242, 19); + this.flagLabel.Name = "flagLabel"; + this.flagLabel.Size = new System.Drawing.Size(49, 20); + this.flagLabel.TabIndex = 53; + this.flagLabel.Text = "信息"; + // + // DataViewForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1438, 845); + this.Controls.Add(this.keyPanel); + this.Controls.Add(this.isPrintCheckBox); + this.Controls.Add(this.printBtn); + this.Controls.Add(this.butcherTimeInput); + this.Controls.Add(this.modifyPanel); + this.Controls.Add(this.dropPigBtn); + this.Controls.Add(this.statePic); + this.Controls.Add(this.discontPanel); + this.Controls.Add(this.discontBtn); + this.Controls.Add(this.dataConfirmBtn); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.alreadyLabel); + this.Controls.Add(this.label4); + this.Controls.Add(this.orderLabel); + this.Controls.Add(this.label2); + this.Controls.Add(this.syncBtn); + this.Controls.Add(this.label1); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.lblMaoBo); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "DataViewForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "数据实时校验"; + this.modifyPanel.ResumeLayout(false); + this.modifyPanel.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.historyGrid)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.maoGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.statePic)).EndInit(); + this.withOkPanel.ResumeLayout(false); + this.withOkPanel.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn H_IsDrop; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Index; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; + private BWP.WinFormControl.UDatePicker butcherTimeInput; + private System.Windows.Forms.Label stateLabel; + private System.Windows.Forms.Panel modifyPanel; + private System.Windows.Forms.Button cancelBtn; + private System.Windows.Forms.FlowLayoutPanel discontPanel; + private System.Windows.Forms.DataGridViewTextBoxColumn H_SID; + private System.Windows.Forms.Button dataConfirmBtn; + private System.Windows.Forms.VScrollBar vScrollBar2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.VScrollBar tangScrollBar; + private System.Windows.Forms.FlowLayoutPanel ttPanel; + private System.Windows.Forms.Label lblTangTui; + private BWP.WinFormControl.UDataGridView tangGridView; + private System.Windows.Forms.Label alreadyLabel; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label orderLabel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button syncBtn; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label12; + private BWP.WinFormControl.UDataGridView historyGrid; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.VScrollBar maoScrollBar; + private BWP.WinFormControl.UDataGridView maoGridView; + private System.Windows.Forms.FlowLayoutPanel mbPanel; + private System.Windows.Forms.Label lblMaoBo; + private System.Windows.Forms.Button dropPigBtn; + private System.Windows.Forms.Button discontBtn; + private System.Windows.Forms.PictureBox statePic; + private System.Windows.Forms.Button printBtn; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.DataGridViewTextBoxColumn T_OrderDetail_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Finish; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Already; + private System.Windows.Forms.DataGridViewTextBoxColumn M_OrderDetail_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Finish; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Already; + private System.Windows.Forms.CheckBox isPrintCheckBox; + private System.Windows.Forms.FlowLayoutPanel keyPanel; + private System.Windows.Forms.Panel withOkPanel; + private System.Windows.Forms.TextBox numberInput; + private System.Windows.Forms.Button SaveBtn; + private System.Windows.Forms.Label flagLabel; + } +} \ No newline at end of file diff --git a/WeighAndGrading/DataViewForm.cs b/WeighAndGrading/DataViewForm.cs new file mode 100644 index 0000000..a022e79 --- /dev/null +++ b/WeighAndGrading/DataViewForm.cs @@ -0,0 +1,770 @@ +using BO; +using BO.BO.BaseInfo; +using BO.BO.Bill; +using BO.Utils; +using BO.Utils.BillRpc; +using BWP.WinFormControl; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WeighAndGrading +{ + enum ModifyType + { + None = 0, + Tech = 1, + Index = 2, + Order = 3, + Weight = 4 + } + + public partial class DataViewForm : Form, IAfterLogin + { + #region IAfterLogin + public string RoleName + { + get { return "定级校验"; } + } + + public Form Generate() + { + if (string.IsNullOrEmpty(ButcherAppContext.Context.UrlConfig.OfflineSqlConnection)) + throw new Exception("请先设置离线数据库并保存"); + if (!LocalDmoSession.ConnectionTest()) + throw new Exception("离线数据库连接失败"); + return this; + } + #endregion + + ModifyType modifyType = ModifyType.None; + private delegate void InvokeHandler(); + public const string DATA_PATH = "G_A_W_Data"; + const short TANG_TECH = 0; + const short MAO_TECH = 1; + List tangList; + List maoList; + BindingList details; + string discontPath = Path.Combine(DATA_PATH, "Disconts.xml"); + + bool connection = false; + bool onWorking = false; + Thread syncTangGrid, syncMaoGrid, syncDetailGrid; + + public DataViewForm() + { + InitializeComponent(); + butcherTimeInput.Date = DateTime.Today; + tangGridView.AutoGenerateColumns = false; + tangGridView.DataSource = null; + maoGridView.AutoGenerateColumns = false; + maoGridView.DataSource = null; + historyGrid.AutoGenerateColumns = false; + historyGrid.DataSource = null; + tangList = new List(); + maoList = new List(); + if (!Directory.Exists(DATA_PATH)) + Directory.CreateDirectory(DATA_PATH); + connection = ButcherAppContext.Context.UserConfig.Connection; + AddLivestockBtn(); + BuildDiscontPanel(true); + AddKeyPad(); + this.FormClosing += delegate + { + if (syncTangGrid != null && syncTangGrid.IsAlive) + syncTangGrid.Abort(); + if (syncMaoGrid != null && syncMaoGrid.IsAlive) + syncMaoGrid.Abort(); + if (syncDetailGrid != null && syncDetailGrid.IsAlive) + syncDetailGrid.Abort(); + }; + } + + private void AddKeyPad() + { + for (var i = 1; i < 10; i++) + { + var btn = new Button() { Name = "_" + i, Text = i.ToString(), Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 8 }, Font = new Font("宋体", 15) }; + btn.Click += (sender, e) => + { + numberInput.Text += btn.Text; + }; + keyPanel.Controls.Add(btn); + } + var zero = new Button() { Name = "_0", Text = "0", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 8 }, Font = new Font("宋体", 15) }; + zero.Click += (sender, e) => + { + if (!string.IsNullOrEmpty(numberInput.Text)) + numberInput.Text += "0"; + }; + keyPanel.Controls.Add(zero); + var dot = new Button() { Name = "_dot", Text = ".", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 8 }, Font = new Font("宋体", 15) }; + dot.Click += (sender, e) => + { + if (!string.IsNullOrEmpty(numberInput.Text)) + numberInput.Text += "."; + }; + keyPanel.Controls.Add(dot); + var back = new Button() { Name = "_back", Text = "←", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 8 }, Font = new Font("宋体", 15) }; + back.Click += (sender, e) => + { + if (!string.IsNullOrEmpty(numberInput.Text)) + numberInput.Text = numberInput.Text.Substring(0, numberInput.Text.Length - 1); + }; + keyPanel.Controls.Add(back); + + var clear = new Button() { Name = "_clear", Text = "清空", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 8 }, Font = new Font("宋体", 15) }; + clear.Click += (sender, e) => + { + numberInput.Text = null; + }; + keyPanel.Controls.Add(clear); + + SetMargin(keyPanel, 7); + } + + GradeAndWeight_Detail modifyDetail; + void JiBieButtonClick(Button btn) + { + if (details == null) + { + MessageBox.Show("请先同步数据"); + return; + } + try + { + btn.Enabled = false; + Application.DoEvents(); + + var livestockTag = btn.Tag as CTuple; + var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; + + if (modifyDetail == null) + { + StartPrintEntity(tech, null); + } + else + { + UpdateDetial(modifyDetail, livestockTag); + cancelBtn_Click(btn, EventArgs.Empty); + } + } + catch { throw; } + finally + { + btn.Enabled = true; + } + } + + void UpdateDetial(GradeAndWeight_Detail detail, CTuple btnTag) + { + detail.Livestock_ID = btnTag.Item1; + detail.Livestock_Name = btnTag.Item2; + detail.Technics = btnTag.Item3; + detail.Technics_Name = detail.Technics == 0 ? "烫褪" : "毛剥"; + var current = btnTag.Item3 == 0 ? tangEntity : maoEntity; + if (current != null) + { + detail.Order = current.Order; + detail.OrderDetail_ID = current.OrderDetail_ID; + } + var updateFileNames = new List { "Order", "OrderDetail_ID", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name" }; + LocalGradeAndWeightBL.Update(detail, updateFileNames.ToArray()); + } + + void AddLivestockBtn() + { + var livestocks = new List>(); + var fileName = Path.Combine(DATA_PATH, "Livestocks.xml"); + if (connection) + { + livestocks = BaseInfoRpcUtil.GetLivestockList(); + XmlUtil.SerializerObjToFile(livestocks, fileName); + } + else + livestocks = XmlUtil.DeserializeFromFile>>(fileName); + foreach (var item in livestocks) + { + var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(90, 75), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 18) }; + + btn.Click += (sender, e) => + { + JiBieButtonClick(sender as Button); + }; + if (item.Item3 == TANG_TECH) + { + ttPanel.Controls.Add(btn); + } + else + { + mbPanel.Controls.Add(btn); + } + } + SetMargin(ttPanel, 3); + SetMargin(mbPanel, 3); + } + + void SetMargin(FlowLayoutPanel panel, int prerRowNumber) + { + for (var i = 0; i < panel.Controls.Count; i++) + { + var c = panel.Controls[i]; + if (i % prerRowNumber == 0)//left + c.Margin = new Padding(0, c.Margin.Top, c.Margin.Right, c.Margin.Bottom); + if ((i + 1) % prerRowNumber == 0)//right + c.Margin = new Padding(c.Margin.Left, c.Margin.Top, 0, c.Margin.Bottom); + if (i < prerRowNumber)//firstRow + c.Margin = new Padding(c.Margin.Left, 0, c.Margin.Right, c.Margin.Bottom); + } + } + + private void syncBtn_Click(object sender, EventArgs e) + { + details = LocalGradeAndWeightBL.GetDetails(butcherTimeInput.Date.Value, 50); + ThreadStartOrAbort(ref syncTangGrid, RefreshTangData); + ThreadStartOrAbort(ref syncMaoGrid, RefreshMaoData); + ThreadStartOrAbort(ref syncDetailGrid, RefreshDetailData); + ChangeSyncBtnState(); + } + + void ThreadStartOrAbort(ref Thread thread, ThreadStart task) + { + if (thread == null || !thread.IsAlive) + { + thread = new Thread(task); + thread.Start(); + } + else + { + thread.Abort(); + } + } + + void ChangeSyncBtnState() + { + onWorking = !onWorking; + butcherTimeInput.Enabled = !onWorking; + if (onWorking) + { + syncBtn.BackColor = Color.FromArgb(15, 215, 107); + syncBtn.ForeColor = Color.White; + } + else + { + syncBtn.BackColor = Color.FromKnownColor(KnownColor.Control); + syncBtn.ForeColor = Color.FromKnownColor(KnownColor.ControlText); + } + } + + void RefreshTangData() + { + while (true) + { + GetLeftList(ref tangList, true); + this.Invoke(new InvokeHandler(delegate + { + BindTangGrid(); + })); + Thread.Sleep(5000); + } + } + + void RefreshMaoData() + { + while (true) + { + GetLeftList(ref maoList, false); + this.Invoke(new InvokeHandler(delegate + { + BindMaoGrid(); + })); + Thread.Sleep(5000); + } + } + + void RefreshDetailData() + { + while (true) + { + details = LocalGradeAndWeightBL.GetDetails(butcherTimeInput.Date.Value, 50); + this.Invoke(new InvokeHandler(delegate + { + BindDetailGrid(); + })); + Thread.Sleep(3000); + } + } + + void GetLeftList(ref List list, bool tang) + { + VerifyConnection(); + if (connection) + { + try + { + list = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, tang); + } + catch (TimeoutException) { } + } + } + + + void BindTangGrid() + { + tangGridView.DataSource = tangList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); + if (tangEntity == null && tangGridView.CurrentRow != null) + { + tangEntity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; + } + foreach (DataGridViewRow row in tangGridView.Rows) + { + if ((bool)row.Cells["T_Finish"].Value) + row.DefaultCellStyle.BackColor = Color.YellowGreen; + if (tangEntity != null && tangEntity.OrderDetail_ID == (long)row.Cells["T_OrderDetail_ID"].Value) + { + tangEntity = row.DataBoundItem as GradeAndWeight; + if (tangEntity.Finish) + row.DefaultCellStyle.BackColor = Color.Yellow; + else + row.DefaultCellStyle.BackColor = tangGridView.RowsDefaultCellStyle.SelectionBackColor; + } + } + InitTangScrollBar(); + tangGridView.ClearSelection(); + try + { + if (tangRoll != -1) + tangGridView.FirstDisplayedScrollingRowIndex = tangRoll; + } + catch + { + tangRoll = -1; + } + tangGridView.Refresh(); + } + + void BindMaoGrid() + { + maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); + if (maoEntity == null && maoGridView.CurrentRow != null) + { + maoEntity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; + } + foreach (DataGridViewRow row in maoGridView.Rows) + { + if ((bool)row.Cells["M_Finish"].Value) + row.DefaultCellStyle.BackColor = Color.YellowGreen; + if (maoEntity != null && maoEntity.OrderDetail_ID == (long)row.Cells["M_OrderDetail_ID"].Value) + { + maoEntity = row.DataBoundItem as GradeAndWeight; + if (maoEntity.Finish) + row.DefaultCellStyle.BackColor = Color.Yellow; + else + row.DefaultCellStyle.BackColor = maoGridView.RowsDefaultCellStyle.SelectionBackColor; + } + } + InitMaoScrollBar(); + maoGridView.ClearSelection(); + try + { + if (maoRoll != -1) + maoGridView.FirstDisplayedScrollingRowIndex = maoRoll; + } + catch + { + maoRoll = -1; + } + maoGridView.Refresh(); + } + + void BindDetailGrid() + { + historyGrid.DataSource = details; + foreach (DataGridViewRow row in historyGrid.Rows) + { + if ((bool)row.Cells["H_IsDrop"].Value) + row.DefaultCellStyle.BackColor = Color.Red; + if (modifyDetail != null && modifyDetail.SID == (long)row.Cells["H_SID"].Value) + { + modifyDetail = row.DataBoundItem as GradeAndWeight_Detail; + row.DefaultCellStyle.BackColor = maoGridView.RowsDefaultCellStyle.SelectionBackColor; + } + } + InitDetailScrollBar(); + historyGrid.ClearSelection(); + try + { + if (rightRoll != -1) + historyGrid.FirstDisplayedScrollingRowIndex = rightRoll; + } + catch + { + rightRoll = -1; + } + historyGrid.Refresh(); + } + + void StartPrintEntity(string gongyijibie, int? index) + { + if (!isPrintCheckBox.Checked) + { + return; + } + if (string.IsNullOrWhiteSpace(gongyijibie)) + { + return; + } + var entity = CreatePrintEntity(gongyijibie, index); + WeightGradePrint.Print(entity); + } + + PrintEntity CreatePrintEntity(string jibie, int? index) + { + string goodsName; + if (jibie == "烫褪") + { + goodsName = "dpbt"; //"带皮白条"; + } + else + { + goodsName = "qpbt"; //"去皮白条"; + } + + var entity = new PrintEntity(); + entity.AccountingUnit_Name = "青岛万福集团股份有限公司"; + entity.Goods_Name = goodsName; + entity.Date = DateTime.Today; + entity.Checker = ""; + entity.StoreCondition = "0-4℃"; + entity.Place = "青岛莱西市"; + entity.TelNumber = "0532-88488888"; + + int maxindex; + if (index == null) + { + maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(butcherTimeInput.Date.Value); + maxindex++; + } + else + { + maxindex = index.Value; + } + + string indexCode = maxindex.ToString("D6"); + + entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode); + // entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress+"?code={0}&name={1}", entity.BarCode, goodsName); + entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code={0}", entity.BarCode); + + return entity; + } + + private void printBtn_Click(object sender, EventArgs e) + { + if (modifyDetail == null) + { + return; + } + StartPrintEntity(modifyDetail.Technics_Name, modifyDetail.Index); + cancelBtn_Click(sender, EventArgs.Empty); + } + + private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex < 0) + return; + var label = "级别"; + switch (e.ColumnIndex) + { + case 4: + modifyType = ModifyType.Index; + label = "序号"; + break; + case 5: + modifyType = ModifyType.Order; + label = "顺序"; + break; + case 8: + modifyType = ModifyType.Weight; + label = "重量"; + break; + default: + break; + } + var currentRow = historyGrid.CurrentRow.DataBoundItem as GradeAndWeight_Detail; + if (modifyDetail != null) + { + foreach (DataGridViewRow row in historyGrid.Rows) + { + if (modifyDetail.SID == (long)row.Cells["H_SID"].Value) + { + row.DefaultCellStyle.BackColor = historyGrid.RowsDefaultCellStyle.BackColor; + break; + } + } + } + modifyDetail = currentRow; + historyGrid.Refresh(); + stateLabel.Text = string.Format("您正在修改序号为 {0} 的", modifyDetail.Index); + flagLabel.Text = label; + if (label != "级别") + withOkPanel.Show(); + else + withOkPanel.Hide(); + modifyPanel.Show(); + } + + private void tangGridView_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + if (e.ColumnIndex == tangGridView.Columns.Count - 1) + return; + var entity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (tangEntity != null) + { + foreach (DataGridViewRow row in tangGridView.Rows) + { + if (tangEntity.OrderDetail_ID == (long)row.Cells["T_OrderDetail_ID"].Value) + { + row.DefaultCellStyle.BackColor = tangEntity.Finish ? Color.YellowGreen : tangGridView.RowsDefaultCellStyle.BackColor; + break; + } + } + } + tangEntity = entity; + tangGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = tangEntity.Finish ? Color.Yellow : tangGridView.RowsDefaultCellStyle.SelectionBackColor; + tangGridView.Refresh(); + } + + private void maoGridView_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + if (e.ColumnIndex == maoGridView.Columns.Count - 1) + return; + var entity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (maoEntity != null) + { + foreach (DataGridViewRow row in maoGridView.Rows) + { + if (maoEntity.OrderDetail_ID == (long)row.Cells["M_OrderDetail_ID"].Value) + { + row.DefaultCellStyle.BackColor = maoEntity.Finish ? Color.YellowGreen : maoGridView.RowsDefaultCellStyle.BackColor; + break; + } + } + } + maoEntity = entity; + maoGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = maoEntity.Finish ? Color.Yellow : maoGridView.RowsDefaultCellStyle.SelectionBackColor; + maoGridView.Refresh(); + } + + private void discontBtn_Click(object sender, EventArgs e) + { + if (new BodyDiscontSetting().ShowDialog() == DialogResult.OK) + BuildDiscontPanel(false); + } + + Button disBtn = null; + void BuildDiscontPanel(bool firstLoad) + { + var disconts = new List(); + if (!firstLoad) + VerifyConnection(); + if (connection) + { + disconts = GradeAndWeightRpc.GetBodyDiscontItem(); + XmlUtil.SerializerObjToFile(disconts, discontPath); + } + else + disconts = XmlUtil.DeserializeFromFile>(discontPath); + + disconts = disconts.Where(x => x.Discont > 0).OrderBy(x => x.ID).ToList(); + discontPanel.Controls.Clear(); + foreach (var item in disconts) + { + var btn = new Button() { Name = "_D" + item.ID, Text = item.Name, Tag = item.Discont, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Bottom = 30 }, Font = new Font("宋体", 15) }; + btn.Click += (sender, e) => + { + if (modifyDetail == null) + { + if (disBtn != btn) + { + disBtn = btn; + } + else + disBtn = null; + } + else + { + modifyDetail.Weight = (modifyDetail.Weight ?? 0) - Convert.ToDecimal(btn.Tag); + LocalGradeAndWeightBL.Update(modifyDetail, "Weight"); + cancelBtn_Click(sender, EventArgs.Empty); + } + }; + discontPanel.Controls.Add(btn); + } + } + + private void dropPigBtn_Click(object sender, EventArgs e) + { + if (modifyDetail == null) + { + UMessageBox.Show("请先选择要设置为掉猪的行", "错误"); + return; + } + else + { + modifyDetail.IsDrop = !modifyDetail.IsDrop; + LocalGradeAndWeightBL.Update(modifyDetail, "IsDrop"); + cancelBtn_Click(sender, EventArgs.Empty); + } + } + + private void dataConfirmBtn_Click(object sender, EventArgs e) + { + new DataConfirm(butcherTimeInput.Date.Value).ShowDialog(); + } + + GradeAndWeight tangEntity; + GradeAndWeight maoEntity; + private void cancelBtn_Click(object sender, EventArgs e) + { + foreach (DataGridViewRow row in historyGrid.Rows) + { + if (modifyDetail.SID == (long)row.Cells["H_SID"].Value) + { + row.DefaultCellStyle.BackColor = historyGrid.RowsDefaultCellStyle.BackColor; + break; + } + } + modifyType = ModifyType.None; + numberInput.Text = string.Empty; + historyGrid.Refresh(); + modifyDetail = null; + if (withOkPanel.Visible) + withOkPanel.Hide(); + modifyPanel.Hide(); + } + + Color btnUnSelectForeColor = SystemColors.ControlText; + Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225); + void SetBtnUnCheck(Button btn) + { + btn.BackColor = btnUnSelectBackColor; + btn.ForeColor = btnUnSelectForeColor; + } + + #region scrollBar + int tangRoll = -1; + private void InitTangScrollBar() + { + tangScrollBar.Maximum = (tangGridView.RowCount - tangGridView.DisplayedRowCount(false) + 30) * tangGridView.RowTemplate.Height; + tangScrollBar.Minimum = 0; + tangScrollBar.SmallChange = tangGridView.RowTemplate.Height; + tangScrollBar.LargeChange = tangGridView.RowTemplate.Height * 30; + this.tangScrollBar.Scroll += (sender, e) => + { + tangRoll = e.NewValue / tangGridView.RowTemplate.Height; + tangGridView.FirstDisplayedScrollingRowIndex = tangRoll; + }; + } + + int maoRoll = -1; + private void InitMaoScrollBar() + { + maoScrollBar.Maximum = (maoGridView.RowCount - maoGridView.DisplayedRowCount(false) + 30) * maoGridView.RowTemplate.Height; + maoScrollBar.Minimum = 0; + maoScrollBar.SmallChange = maoGridView.RowTemplate.Height; + maoScrollBar.LargeChange = maoGridView.RowTemplate.Height * 30; + maoScrollBar.Scroll += (sender, e) => + { + maoRoll = e.NewValue / maoGridView.RowTemplate.Height; + maoGridView.FirstDisplayedScrollingRowIndex = maoRoll; + }; + } + + int rightRoll = -1; + private void InitDetailScrollBar() + { + 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) => + { + rightRoll = e.NewValue / historyGrid.RowTemplate.Height; + historyGrid.FirstDisplayedScrollingRowIndex = rightRoll; + }; + } + #endregion + + bool? last = null; + void VerifyConnection() + { + connection = LoginRpcUtil.TestConnection(); + if (last == connection) + return; + var png = "stop.png"; + if (connection) + png = "working.png"; + var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll"); + var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png); + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + statePic.Image = Image.FromStream(s); + statePic.Refresh(); + })); + } + else + { + statePic.Image = Image.FromStream(s); + statePic.Refresh(); + } + + last = connection; + } + + private void SaveBtn_Click(object sender, EventArgs e) + { + if (modifyDetail == null) + return; + if (modifyType < ModifyType.Index) + return; + decimal number = 0; + if (!decimal.TryParse(numberInput.Text.Trim(), out number)) + throw new Exception("输入数据格式不正确"); + switch (modifyType) + { + case ModifyType.Index: + modifyDetail.Index = (int)number; + LocalGradeAndWeightBL.Update(modifyDetail, "Index"); + break; + case ModifyType.Order: + modifyDetail.Order = (int)number; + LocalGradeAndWeightBL.Update(modifyDetail, "Order"); + break; + case ModifyType.Weight: + modifyDetail.Weight = number; + LocalGradeAndWeightBL.Update(modifyDetail, "Weight"); + break; + default: + break; + } + cancelBtn_Click(sender, e); + } + } +} diff --git a/WeighAndGrading/DataViewForm.resx b/WeighAndGrading/DataViewForm.resx new file mode 100644 index 0000000..efd0570 --- /dev/null +++ b/WeighAndGrading/DataViewForm.resx @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index cb3d009..dfe6219 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -1053,7 +1053,7 @@ namespace WeighAndGrading private void dataConfirmBtn_Click(object sender, EventArgs e) { - new DataConfirm().ShowDialog(); + new DataConfirm(butcherTimeInput.Date.Value).ShowDialog(); } readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255); diff --git a/WeighAndGrading/WeighAndGrading.csproj b/WeighAndGrading/WeighAndGrading.csproj index c862b38..99847ba 100644 --- a/WeighAndGrading/WeighAndGrading.csproj +++ b/WeighAndGrading/WeighAndGrading.csproj @@ -61,6 +61,12 @@ DataConfirm.cs + + Form + + + DataViewForm.cs + Form @@ -89,6 +95,9 @@ DataConfirm.cs + + DataViewForm.cs + GradeFrom.cs