From e419b4d6ada98a4de7ef3f1b6bd46fffa71f6d30 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Wed, 28 Feb 2018 11:11:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=88=86=E5=89=B2=E7=A7=B0=E9=87=8D?= =?UTF-8?q?=20=E6=8C=82=E8=B5=B7=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BO/Utils/AfterLoginUtil.cs | 2 +- SegmentationWeight/QieDanDialog.Designer.cs | 131 +++++++++++++++++ SegmentationWeight/QieDanDialog.cs | 46 ++++++ SegmentationWeight/QieDanDialog.resx | 126 ++++++++++++++++ .../Rpc/Dto/SegmentationWeightRecord.cs | 1 + .../Rpc/SegmentationWeightRecordRpc.cs | 44 ++++-- SegmentationWeight/SegmentationWeight.csproj | 9 ++ .../SegmentationWeightForm.Designer.cs | 134 +++++++++++------- SegmentationWeight/SegmentationWeightForm.cs | 94 +++++++++--- 9 files changed, 501 insertions(+), 86 deletions(-) create mode 100644 SegmentationWeight/QieDanDialog.Designer.cs create mode 100644 SegmentationWeight/QieDanDialog.cs create mode 100644 SegmentationWeight/QieDanDialog.resx diff --git a/BO/Utils/AfterLoginUtil.cs b/BO/Utils/AfterLoginUtil.cs index fb6a555..8dbd2c4 100644 --- a/BO/Utils/AfterLoginUtil.cs +++ b/BO/Utils/AfterLoginUtil.cs @@ -83,7 +83,7 @@ namespace BO.Utils var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", item.Item2)); #endif if (!File.Exists(filePath)) - throw new Exception("相关模块不存在"); + continue; var formType = typeof(IAfterLogin); foreach (var type in Assembly.LoadFile(filePath).GetTypes()) { diff --git a/SegmentationWeight/QieDanDialog.Designer.cs b/SegmentationWeight/QieDanDialog.Designer.cs new file mode 100644 index 0000000..dc86ce2 --- /dev/null +++ b/SegmentationWeight/QieDanDialog.Designer.cs @@ -0,0 +1,131 @@ +namespace SegmentationWeight +{ + partial class QieDanDialog + { + /// + /// 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 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(); + this.detailGridView1 = new BWP.WinFormControl.UDataGridView(); + this.closeBtn = new System.Windows.Forms.Button(); + this.Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DeleteBtn = new System.Windows.Forms.DataGridViewButtonColumn(); + ((System.ComponentModel.ISupportInitialize)(this.detailGridView1)).BeginInit(); + this.SuspendLayout(); + // + // detailGridView1 + // + this.detailGridView1.AllowUserToAddRows = false; + this.detailGridView1.AllowUserToDeleteRows = false; + this.detailGridView1.AllowUserToResizeColumns = false; + this.detailGridView1.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.detailGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.detailGridView1.BackgroundColor = System.Drawing.Color.White; + 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.detailGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.detailGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.detailGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Goods_Name, + this.DeleteBtn}); + this.detailGridView1.Location = new System.Drawing.Point(12, 12); + this.detailGridView1.MultiSelect = false; + this.detailGridView1.Name = "detailGridView1"; + this.detailGridView1.ReadOnly = true; + this.detailGridView1.RowHeadersVisible = false; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.detailGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.detailGridView1.RowTemplate.Height = 60; + this.detailGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.detailGridView1.Size = new System.Drawing.Size(854, 444); + this.detailGridView1.TabIndex = 6; + this.detailGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.detailGridView1_CellContentClick); + // + // closeBtn + // + this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); + this.closeBtn.Location = new System.Drawing.Point(382, 479); + this.closeBtn.Name = "closeBtn"; + this.closeBtn.Size = new System.Drawing.Size(108, 41); + this.closeBtn.TabIndex = 5; + this.closeBtn.Text = "关闭"; + this.closeBtn.UseVisualStyleBackColor = true; + this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); + // + // Goods_Name + // + this.Goods_Name.DataPropertyName = "Goods_Name"; + this.Goods_Name.HeaderText = "存货"; + this.Goods_Name.Name = "Goods_Name"; + this.Goods_Name.ReadOnly = true; + this.Goods_Name.Width = 400; + // + // DeleteBtn + // + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.DeleteBtn.DefaultCellStyle = dataGridViewCellStyle3; + this.DeleteBtn.HeaderText = "切回"; + this.DeleteBtn.Name = "DeleteBtn"; + this.DeleteBtn.ReadOnly = true; + this.DeleteBtn.Text = "切回"; + this.DeleteBtn.UseColumnTextForButtonValue = true; + this.DeleteBtn.Width = 220; + // + // QieDanDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(878, 532); + this.ControlBox = false; + this.Controls.Add(this.detailGridView1); + this.Controls.Add(this.closeBtn); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Name = "QieDanDialog"; + this.Text = "所有挂起"; + ((System.ComponentModel.ISupportInitialize)(this.detailGridView1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private BWP.WinFormControl.UDataGridView detailGridView1; + private System.Windows.Forms.Button closeBtn; + private System.Windows.Forms.DataGridViewTextBoxColumn Goods_Name; + private System.Windows.Forms.DataGridViewButtonColumn DeleteBtn; + } +} \ No newline at end of file diff --git a/SegmentationWeight/QieDanDialog.cs b/SegmentationWeight/QieDanDialog.cs new file mode 100644 index 0000000..5a6c36c --- /dev/null +++ b/SegmentationWeight/QieDanDialog.cs @@ -0,0 +1,46 @@ +using SegmentationWeight.Rpc; +using SegmentationWeight.Rpc.Dto; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SegmentationWeight +{ + public partial class QieDanDialog : Form + { + public QieDanDialog() + { + InitializeComponent(); + detailGridView1.AutoGenerateColumns = false; + var details = SegmentationWeightRecordRpc.GetInstance().GetTodayGroupFlagList(); + detailGridView1.DataSource = null; + detailGridView1.DataSource = details; + detailGridView1.Refresh(); + } + + public string GroupFlag { get; set; } + + private void closeBtn_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void detailGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + if (e.ColumnIndex != detailGridView1.ColumnCount - 1) + return; + var entity = detailGridView1.CurrentRow.DataBoundItem as SegmentationWeightRecord; + GroupFlag = entity.GroupFlag; + DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/SegmentationWeight/QieDanDialog.resx b/SegmentationWeight/QieDanDialog.resx new file mode 100644 index 0000000..da15c60 --- /dev/null +++ b/SegmentationWeight/QieDanDialog.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs index 5fd4b47..c7075b8 100644 --- a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs +++ b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs @@ -27,6 +27,7 @@ namespace SegmentationWeight.Rpc.Dto public string CardBarCode{ get; set; }//放产品的车的条码 public string BiaoShi { get; set; } public string ProductBatch { get; set; } + public string GroupFlag { get; set; } public override string GetDtoJson() { var config = new MapperConfiguration(cfg => { diff --git a/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs b/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs index b5b9df4..9b532de 100644 --- a/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs +++ b/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs @@ -68,25 +68,27 @@ namespace SegmentationWeight.Rpc } - public BindingList GetTodayList() + public BindingList GetTodayList(string flag) { - return GetListByDate(DateTime.Today); + return GetListByDate(DateTime.Today, flag); } - public BindingList GetListByDate(DateTime date) + public BindingList GetListByDate(DateTime date, string flag) { - var bindList=new BindingList(); - var list=new List(); + var bindList = new BindingList(); + var list = new List(); var query = new DmoQuery(typeof(SegmentationWeightRecord)); query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime", date.Date)); query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", date.Date.AddDays(1))); - query.Where.Conditions.Add(DQCondition.EQ("IsDeleted",false)); - query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID",false)); + query.Where.Conditions.Add(DQCondition.EQ("IsDeleted", false)); + if (!string.IsNullOrEmpty(flag)) + query.Where.Conditions.Add(DQCondition.EQ("GroupFlag", flag)); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", false)); using (var session = LocalDmoSession.New()) { - list= session.ExecuteList(query).Cast().ToList(); + list = session.ExecuteList(query).Cast().ToList(); } foreach (SegmentationWeightRecord record in list) { @@ -95,16 +97,38 @@ namespace SegmentationWeight.Rpc return bindList; } + + public static int GetTodayTotalCount(DateTime date) { var query = new DQueryDom(new JoinAlias(typeof(SegmentationWeightRecord))); query.Columns.Add(DQSelectColumn.Count()); - query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime",date.Date)); - query.Where.Conditions.Add(DQCondition.LessThan("CreateTime",date.Date.AddDays(1)));; + query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime", date.Date)); + query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", date.Date.AddDays(1))); ; using (var session = LocalDmoSession.New()) { return Convert.ToInt32(session.ExecuteScalar(query)); } } + + public BindingList GetTodayGroupFlagList() + { + var bindList = new BindingList(); + var query = new DQueryDom(new JoinAlias(typeof(SegmentationWeightRecord))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.Between("CreateTime", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 29)), DQCondition.EQ("IsDeleted", false), DQCondition.IsNotNull(DQExpression.Field("GroupFlag")))); + query.Columns.Add(DQSelectColumn.Field("Goods_Name")); + query.Columns.Add(DQSelectColumn.Field("GroupFlag")); + query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name")); + query.GroupBy.Expressions.Add(DQExpression.Field("GroupFlag")); + using (var session = LocalDmoSession.New()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + bindList.Add(new SegmentationWeightRecord { Goods_Name = (string)reader[0], GroupFlag = (string)reader[1] }); + } + } + return bindList; + } } } diff --git a/SegmentationWeight/SegmentationWeight.csproj b/SegmentationWeight/SegmentationWeight.csproj index 9b39fc3..a59cba2 100644 --- a/SegmentationWeight/SegmentationWeight.csproj +++ b/SegmentationWeight/SegmentationWeight.csproj @@ -63,6 +63,12 @@ + + Form + + + QieDanDialog.cs + @@ -93,6 +99,9 @@ + + QieDanDialog.cs + SegmentationWeightForm.cs diff --git a/SegmentationWeight/SegmentationWeightForm.Designer.cs b/SegmentationWeight/SegmentationWeightForm.Designer.cs index 761b9a8..f880c7b 100644 --- a/SegmentationWeight/SegmentationWeightForm.Designer.cs +++ b/SegmentationWeight/SegmentationWeightForm.Designer.cs @@ -28,12 +28,14 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = 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(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.panel1 = new System.Windows.Forms.Panel(); + this.qieDanBtn = new System.Windows.Forms.Button(); + this.guaQiBtn = new System.Windows.Forms.Button(); this.btnEnablePrint = new System.Windows.Forms.Button(); this.btnEnableWeight = new System.Windows.Forms.Button(); this.btnEnd = new System.Windows.Forms.Button(); @@ -109,13 +111,15 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Size = new System.Drawing.Size(1117, 587); + this.splitContainer1.Size = new System.Drawing.Size(1202, 587); this.splitContainer1.SplitterDistance = 128; this.splitContainer1.SplitterWidth = 1; this.splitContainer1.TabIndex = 0; // // panel1 // + this.panel1.Controls.Add(this.qieDanBtn); + this.panel1.Controls.Add(this.guaQiBtn); this.panel1.Controls.Add(this.btnEnablePrint); this.panel1.Controls.Add(this.btnEnableWeight); this.panel1.Controls.Add(this.btnEnd); @@ -128,9 +132,33 @@ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1115, 126); + this.panel1.Size = new System.Drawing.Size(1200, 126); this.panel1.TabIndex = 2; // + // qieDanBtn + // + this.qieDanBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.qieDanBtn.Font = new System.Drawing.Font("宋体", 14F); + this.qieDanBtn.Location = new System.Drawing.Point(923, 28); + this.qieDanBtn.Name = "qieDanBtn"; + this.qieDanBtn.Size = new System.Drawing.Size(75, 60); + this.qieDanBtn.TabIndex = 43; + this.qieDanBtn.Text = "切单"; + this.qieDanBtn.UseVisualStyleBackColor = true; + this.qieDanBtn.Click += new System.EventHandler(this.qieDanBtn_Click); + // + // guaQiBtn + // + this.guaQiBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.guaQiBtn.Font = new System.Drawing.Font("宋体", 14F); + this.guaQiBtn.Location = new System.Drawing.Point(822, 28); + this.guaQiBtn.Name = "guaQiBtn"; + this.guaQiBtn.Size = new System.Drawing.Size(75, 60); + this.guaQiBtn.TabIndex = 42; + this.guaQiBtn.Text = "挂起"; + this.guaQiBtn.UseVisualStyleBackColor = true; + this.guaQiBtn.Click += new System.EventHandler(this.guaQiBtn_Click); + // // btnEnablePrint // this.btnEnablePrint.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -158,7 +186,7 @@ this.btnEnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnEnd.Enabled = false; this.btnEnd.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnEnd.Location = new System.Drawing.Point(689, 28); + this.btnEnd.Location = new System.Drawing.Point(719, 28); this.btnEnd.Name = "btnEnd"; this.btnEnd.Size = new System.Drawing.Size(75, 60); this.btnEnd.TabIndex = 40; @@ -170,7 +198,7 @@ // this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnStart.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnStart.Location = new System.Drawing.Point(585, 28); + this.btnStart.Location = new System.Drawing.Point(615, 28); this.btnStart.Name = "btnStart"; this.btnStart.Size = new System.Drawing.Size(75, 60); this.btnStart.TabIndex = 40; @@ -207,7 +235,7 @@ this.panel3.Controls.Add(this.label5); this.panel3.Controls.Add(this.cbxWorkShop); this.panel3.Controls.Add(this.label4); - this.panel3.Location = new System.Drawing.Point(797, 5); + this.panel3.Location = new System.Drawing.Point(1004, 5); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(191, 114); this.panel3.TabIndex = 34; @@ -321,8 +349,8 @@ this.splitContainer2.Panel2.Controls.Add(this.btnRePrint); this.splitContainer2.Panel2.Controls.Add(this.uDataGridView1); this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel1); - this.splitContainer2.Size = new System.Drawing.Size(1117, 458); - this.splitContainer2.SplitterDistance = 729; + this.splitContainer2.Size = new System.Drawing.Size(1202, 458); + this.splitContainer2.SplitterDistance = 784; this.splitContainer2.SplitterWidth = 1; this.splitContainer2.TabIndex = 0; // @@ -330,7 +358,7 @@ // this.btnGoodsSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnGoodsSet.Location = new System.Drawing.Point(628, 16); + this.btnGoodsSet.Location = new System.Drawing.Point(683, 16); this.btnGoodsSet.Name = "btnGoodsSet"; this.btnGoodsSet.Size = new System.Drawing.Size(95, 50); this.btnGoodsSet.TabIndex = 34; @@ -346,7 +374,7 @@ this.flpGoods.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.flpGoods.Location = new System.Drawing.Point(4, 87); this.flpGoods.Name = "flpGoods"; - this.flpGoods.Size = new System.Drawing.Size(719, 369); + this.flpGoods.Size = new System.Drawing.Size(774, 369); this.flpGoods.TabIndex = 1; // // flpClass @@ -356,7 +384,7 @@ this.flpClass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.flpClass.Location = new System.Drawing.Point(4, 4); this.flpClass.Name = "flpClass"; - this.flpClass.Size = new System.Drawing.Size(604, 76); + this.flpClass.Size = new System.Drawing.Size(659, 76); this.flpClass.TabIndex = 0; // // btnSumbit @@ -401,20 +429,20 @@ this.uDataGridView1.AllowUserToDeleteRows = false; this.uDataGridView1.AllowUserToResizeColumns = false; this.uDataGridView1.AllowUserToResizeRows = false; - dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.uDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.uDataGridView1.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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18; + 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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.uDataGridView1.ColumnHeadersHeight = 40; this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -427,12 +455,12 @@ this.uDataGridView1.Name = "uDataGridView1"; this.uDataGridView1.ReadOnly = true; this.uDataGridView1.RowHeadersVisible = false; - dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle20; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4; this.uDataGridView1.RowTemplate.Height = 40; this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.uDataGridView1.Size = new System.Drawing.Size(395, 295); + this.uDataGridView1.Size = new System.Drawing.Size(437, 295); this.uDataGridView1.TabIndex = 1; // // 序号 @@ -465,8 +493,8 @@ // 重量 // this.重量.DataPropertyName = "Weight"; - dataGridViewCellStyle19.Format = "#0.##"; - this.重量.DefaultCellStyle = dataGridViewCellStyle19; + dataGridViewCellStyle3.Format = "#0.##"; + this.重量.DefaultCellStyle = dataGridViewCellStyle3; this.重量.HeaderText = "重量"; this.重量.Name = "重量"; this.重量.ReadOnly = true; @@ -482,7 +510,7 @@ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41.77215F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 68F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 58F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 91F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 99F)); this.tableLayoutPanel1.Controls.Add(this.lblGoodsName, 0, 1); this.tableLayoutPanel1.Controls.Add(this.label8, 0, 0); this.tableLayoutPanel1.Controls.Add(this.label3, 1, 1); @@ -503,7 +531,7 @@ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(398, 98); + this.tableLayoutPanel1.Size = new System.Drawing.Size(440, 98); this.tableLayoutPanel1.TabIndex = 0; // // lblGoodsName @@ -514,7 +542,7 @@ this.lblGoodsName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblGoodsName.Location = new System.Drawing.Point(4, 33); this.lblGoodsName.Name = "lblGoodsName"; - this.lblGoodsName.Size = new System.Drawing.Size(95, 31); + this.lblGoodsName.Size = new System.Drawing.Size(115, 31); this.lblGoodsName.TabIndex = 0; this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -526,7 +554,7 @@ this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label8.Location = new System.Drawing.Point(4, 1); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(95, 31); + this.label8.Size = new System.Drawing.Size(115, 31); this.label8.TabIndex = 0; this.label8.Text = "产品"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -537,9 +565,9 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label3.Location = new System.Drawing.Point(106, 33); + this.label3.Location = new System.Drawing.Point(126, 33); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(67, 31); + this.label3.Size = new System.Drawing.Size(81, 31); this.label3.TabIndex = 0; this.label3.Text = "重量"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -550,9 +578,9 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(106, 65); + this.label2.Location = new System.Drawing.Point(126, 65); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(67, 32); + this.label2.Size = new System.Drawing.Size(81, 32); this.label2.TabIndex = 0; this.label2.Text = "数量"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -563,9 +591,9 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label7.Location = new System.Drawing.Point(308, 1); + this.label7.Location = new System.Drawing.Point(342, 1); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(86, 31); + this.label7.Size = new System.Drawing.Size(94, 31); this.label7.TabIndex = 0; this.label7.Text = "剩余"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -576,7 +604,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(249, 1); + this.label9.Location = new System.Drawing.Point(283, 1); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(52, 31); this.label9.TabIndex = 0; @@ -589,7 +617,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblPlanWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblPlanWeight.Location = new System.Drawing.Point(180, 33); + this.lblPlanWeight.Location = new System.Drawing.Point(214, 33); this.lblPlanWeight.Name = "lblPlanWeight"; this.lblPlanWeight.Size = new System.Drawing.Size(62, 31); this.lblPlanWeight.TabIndex = 0; @@ -601,7 +629,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblNumber.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblNumber.Location = new System.Drawing.Point(249, 65); + this.lblNumber.Location = new System.Drawing.Point(283, 65); this.lblNumber.Name = "lblNumber"; this.lblNumber.Size = new System.Drawing.Size(52, 32); this.lblNumber.TabIndex = 0; @@ -613,7 +641,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblWeight.Location = new System.Drawing.Point(249, 33); + this.lblWeight.Location = new System.Drawing.Point(283, 33); this.lblWeight.Name = "lblWeight"; this.lblWeight.Size = new System.Drawing.Size(52, 31); this.lblWeight.TabIndex = 0; @@ -625,7 +653,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblPlanNumber.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblPlanNumber.Location = new System.Drawing.Point(180, 65); + this.lblPlanNumber.Location = new System.Drawing.Point(214, 65); this.lblPlanNumber.Name = "lblPlanNumber"; this.lblPlanNumber.Size = new System.Drawing.Size(62, 32); this.lblPlanNumber.TabIndex = 0; @@ -637,7 +665,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(180, 1); + this.label1.Location = new System.Drawing.Point(214, 1); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(62, 31); this.label1.TabIndex = 0; @@ -650,9 +678,9 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblLeftWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblLeftWeight.Location = new System.Drawing.Point(308, 33); + this.lblLeftWeight.Location = new System.Drawing.Point(342, 33); this.lblLeftWeight.Name = "lblLeftWeight"; - this.lblLeftWeight.Size = new System.Drawing.Size(86, 31); + this.lblLeftWeight.Size = new System.Drawing.Size(94, 31); this.lblLeftWeight.TabIndex = 0; this.lblLeftWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -662,9 +690,9 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblLeftNumber.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblLeftNumber.Location = new System.Drawing.Point(308, 65); + this.lblLeftNumber.Location = new System.Drawing.Point(342, 65); this.lblLeftNumber.Name = "lblLeftNumber"; - this.lblLeftNumber.Size = new System.Drawing.Size(86, 32); + this.lblLeftNumber.Size = new System.Drawing.Size(94, 32); this.lblLeftNumber.TabIndex = 0; this.lblLeftNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -676,7 +704,7 @@ this.lblGoodsSpec.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblGoodsSpec.Location = new System.Drawing.Point(4, 65); this.lblGoodsSpec.Name = "lblGoodsSpec"; - this.lblGoodsSpec.Size = new System.Drawing.Size(95, 32); + this.lblGoodsSpec.Size = new System.Drawing.Size(115, 32); this.lblGoodsSpec.TabIndex = 0; this.lblGoodsSpec.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -684,7 +712,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1117, 587); + this.ClientSize = new System.Drawing.Size(1202, 587); this.Controls.Add(this.splitContainer1); this.MinimizeBox = false; this.Name = "SegmentationWeightForm"; @@ -760,5 +788,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn 条码; private System.Windows.Forms.DataGridViewTextBoxColumn 产品; private System.Windows.Forms.DataGridViewTextBoxColumn 重量; + private System.Windows.Forms.Button qieDanBtn; + private System.Windows.Forms.Button guaQiBtn; } } \ No newline at end of file diff --git a/SegmentationWeight/SegmentationWeightForm.cs b/SegmentationWeight/SegmentationWeightForm.cs index 652169e..05a26f6 100644 --- a/SegmentationWeight/SegmentationWeightForm.cs +++ b/SegmentationWeight/SegmentationWeightForm.cs @@ -379,7 +379,7 @@ namespace SegmentationWeight { if (string.IsNullOrEmpty(str)) str = "0"; - this.Invoke(new Action(delegate () + this.Invoke(new Action(delegate() { lblChengZhong.Text = string.Format(format, decimal.Parse(str)); if (str != "0") @@ -395,7 +395,7 @@ namespace SegmentationWeight decimal num = 0; if (decimal.TryParse(str, out num)) { - this.Invoke(new Action(delegate () + this.Invoke(new Action(delegate() { lblChengZhong.Text = string.Format(format, num); })); @@ -404,7 +404,7 @@ namespace SegmentationWeight } if (WeighAvgControl.TryGetValue(out num)) { - this.Invoke(new Action(delegate () + this.Invoke(new Action(delegate() { //lblChengZhong.Text = string.Format(format, num); if (str != "0") @@ -511,9 +511,10 @@ namespace SegmentationWeight { mAllWeightRecords = GetAllWeightRecords(); } + private BindingList GetAllWeightRecords() { - var list = SegmentationWeightRecordRpc.GetInstance().GetTodayList(); + var list = SegmentationWeightRecordRpc.GetInstance().GetTodayList(null); var resList = new BindingList(); foreach (SegmentationWeightRecord record in list) @@ -610,7 +611,7 @@ namespace SegmentationWeight lblGoodsName.Text = set.Goods_Name; lblGoodsSpec.Text = set.Goods_Spec; _selectGoodsID = set.Goods_ID; - + //添加记录 var record = GetRecordBySet(set); //当有标准重量的时候 必须符合范围 并且按标准重量打印 @@ -620,11 +621,11 @@ namespace SegmentationWeight var islow = set.StandardWeightLow.HasValue && record.Weight < set.StandardWeightLow.Value; if (isup) { - UMessageBox.Show("不能高于重量限制:"+set.StandardWeightUp.Value.ToString("F2"), "超上限提示", 3); + UMessageBox.Show("不能高于重量限制:" + set.StandardWeightUp.Value.ToString("F2"), "超上限提示", 3); } if (islow) { - UMessageBox.Show("不能低于重量限制:" + set.StandardWeightLow.Value.ToString("F2"), "低下限提示",3); + UMessageBox.Show("不能低于重量限制:" + set.StandardWeightLow.Value.ToString("F2"), "低下限提示", 3); } if (isup || islow) { @@ -662,12 +663,12 @@ namespace SegmentationWeight void PrintGoodsEntity(SegmentationWeightRecord record) { var entity = CreatePrintEntity(record); -//#if DEBUG + //#if DEBUG SegmentationWeightPrint.Print(entity); -//#endif -//#if !DEBUG -// SegmentationWeightPrint.Print5050(entity); -//#endif + //#endif + //#if !DEBUG + // SegmentationWeightPrint.Print5050(entity); + //#endif } @@ -752,7 +753,7 @@ namespace SegmentationWeight private SegmentationWeightRecord GetRecordBySet(SegmentationWeightGoodSet set) { - if (cbxWorkUnit.SelectedValue==null) + if (cbxWorkUnit.SelectedValue == null) { throw new Exception("请选择工作单元"); } @@ -803,6 +804,11 @@ namespace SegmentationWeight private bool _alreadyStart = false; private void btnStart_Click(object sender, EventArgs e) + { + Start(); + } + + void Start() { _alreadyStart = true; btnStart.Enabled = false; @@ -813,6 +819,11 @@ namespace SegmentationWeight } private void btnEnd_Click(object sender, EventArgs e) + { + ReStart(true); + } + + void ReStart(bool end) { _alreadyStart = false; _selectGoodsID = 0; @@ -824,13 +835,26 @@ namespace SegmentationWeight if (mWeightRecords.Count > 0) { - var endBarcode = GetEndBarCode(); - foreach (SegmentationWeightRecord record in mWeightRecords) + if (end) { - record.CardBarCode = endBarcode; - LocalDmoSession.Update(record, "CardBarCode"); + var endBarcode = GetEndBarCode(); + foreach (SegmentationWeightRecord record in mWeightRecords) + { + record.CardBarCode = endBarcode; + record.GroupFlag = null; + LocalDmoSession.Update(record, "CardBarCode", "GroupFlag"); + } + PrintEnd(endBarcode); + } + else + { + var guid = Guid.NewGuid().ToString(); + foreach (SegmentationWeightRecord record in mWeightRecords) + { + record.GroupFlag = guid; + LocalDmoSession.Update(record, "GroupFlag"); + } } - PrintEnd(endBarcode); //清空记录 mWeightRecords.Clear(); } @@ -839,7 +863,6 @@ namespace SegmentationWeight btnEnd.Enabled = false; btnEnd.BackColor = SystemColors.Control; btnStart.BackColor = Color.ForestGreen; - } private void PrintEnd(string barcode) @@ -933,7 +956,7 @@ namespace SegmentationWeight if (record != null) { LocalDmoSession.SaveDelete(record.ID); - + uDataGridView1.Rows.Remove(row); uDataGridView1.Refresh(); uDataGridView1.CurrentCell = null; @@ -956,10 +979,10 @@ namespace SegmentationWeight { if (SegmentationWeightRecordRpc.GetInstance().IsSyncSucessed()) { - var id=RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/CreateTodayB3OutputBill" ); - if(id>0) + var id = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/CreateTodayB3OutputBill"); + if (id > 0) { - MessageBox.Show("同步完成,创建产出单:"+id); + MessageBox.Show("同步完成,创建产出单:" + id); } else if (id == -1) { @@ -990,5 +1013,30 @@ namespace SegmentationWeight btnSumbit.Enabled = true; } } + + private void guaQiBtn_Click(object sender, EventArgs e) + { + ReStart(false); + } + + private void qieDanBtn_Click(object sender, EventArgs e) + { + var dialog = new QieDanDialog(); + if (dialog.ShowDialog() == DialogResult.OK) + { + Start(); + var list = SegmentationWeightRecordRpc.GetInstance().GetTodayList(dialog.GroupFlag); + mWeightRecords = list; + if (list.Any()) + { + var set = list.Last(); + lblGoodsName.Text = set.Goods_Name; + lblGoodsSpec.Text = set.Goods_Spec; + _selectGoodsID = set.Goods_ID; + mIsNeedRefreshPlan = true; + RefreshUi(); + } + } + } } }