diff --git a/ButcherFactory.BO/Bill/WeightCountEntity.cs b/ButcherFactory.BO/Bill/WeightCountEntity.cs
index adcf854..ced4275 100644
--- a/ButcherFactory.BO/Bill/WeightCountEntity.cs
+++ b/ButcherFactory.BO/Bill/WeightCountEntity.cs
@@ -18,6 +18,10 @@ namespace ButcherFactory.BO.Bill
public long? ProductBatch_ID { get; set; }
+ public decimal? GrossWeight { get; set; }
+
+ public decimal? Discont { get; set; }
+
public decimal? Weight { get; set; }
[DbColumn(DefaultValue = 1)]
diff --git a/ButcherFactory.BO/LocalBL/WeightCountEntityBL.cs b/ButcherFactory.BO/LocalBL/WeightCountEntityBL.cs
index 5c74e1f..af317c4 100644
--- a/ButcherFactory.BO/LocalBL/WeightCountEntityBL.cs
+++ b/ButcherFactory.BO/LocalBL/WeightCountEntityBL.cs
@@ -25,6 +25,8 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("RowIndex"));
query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
query.Columns.Add(DQSelectColumn.Field("Number"));
+ query.Columns.Add(DQSelectColumn.Field("GrossWeight"));
+ query.Columns.Add(DQSelectColumn.Field("Discont"));
query.Columns.Add(DQSelectColumn.Field("Weight"));
//query.Columns.Add(DQSelectColumn.Field("CreateTime"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
@@ -46,7 +48,9 @@ namespace ButcherFactory.BO.LocalBL
entity.RowIndex = (int)reader[1];
entity.Goods_Name = (string)reader[2];
entity.Number = (int)reader[3];
- entity.Weight = (decimal?)reader[4];
+ entity.GrossWeight = (decimal?)reader[4];
+ entity.Discont = (decimal?)reader[5];
+ entity.Weight = (decimal?)reader[6];
//entity.CreateTime = (DateTime)reader[5];
list.Add(entity);
}
diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj
index fd4c3fc..7dc96c1 100644
--- a/ButcherFactory.Form/ButcherFactory.Form.csproj
+++ b/ButcherFactory.Form/ButcherFactory.Form.csproj
@@ -272,6 +272,13 @@
+
+
+ Form
+
+
+ DiscontWeightSetDialog.cs
+
Form
@@ -381,6 +388,9 @@
SegmentStockUpForm.cs
+
+ DiscontWeightSetDialog.cs
+
WeightCountForm.cs
diff --git a/ButcherFactory.Form/WeightCount_/DiscontSetting.cs b/ButcherFactory.Form/WeightCount_/DiscontSetting.cs
new file mode 100644
index 0000000..7b96b45
--- /dev/null
+++ b/ButcherFactory.Form/WeightCount_/DiscontSetting.cs
@@ -0,0 +1,33 @@
+using ButcherFactory.BO.Utils;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace ButcherFactory.WeightCount_
+{
+ public class DiscontSetting
+ {
+ public string Name { get; set; }
+
+ public decimal Standard { get; set; }
+
+ public int Number { get; set; }
+
+ [XmlIgnore]
+ public decimal Weight { get { return Standard * Number; } }
+
+ public static BindingList Load()
+ {
+ return XmlUtil.DeserializeFromFile>("Config\\DiscontSetting.xml");
+ }
+
+ public static void Save(BindingList list)
+ {
+ XmlUtil.SerializerObjToFile(list, "Config\\DiscontSetting.xml");
+ }
+ }
+}
diff --git a/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.Designer.cs b/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.Designer.cs
new file mode 100644
index 0000000..f188131
--- /dev/null
+++ b/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.Designer.cs
@@ -0,0 +1,288 @@
+namespace ButcherFactory.WeightCount_
+{
+ partial class DiscontWeightSetDialog
+ {
+ ///
+ /// 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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DiscontWeightSetDialog));
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
+ this.uLabel2 = new WinFormControl.ULabel();
+ this.nameBox = new System.Windows.Forms.TextBox();
+ this.discontBox = new System.Windows.Forms.TextBox();
+ this.uLabel1 = new WinFormControl.ULabel();
+ this.addBtn = new WinFormControl.UButton();
+ this.mGrid = new WinFormControl.UDataGridView();
+ this.uLabel3 = new WinFormControl.ULabel();
+ this.totalLbl = new WinFormControl.ULabel();
+ this.okBtn = new WinFormControl.UButton();
+ this.U_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.U_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.U_Standard = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.U_NumberEdit = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.mGrid)).BeginInit();
+ this.SuspendLayout();
+ //
+ // uLabel2
+ //
+ this.uLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.uLabel2.AutoSize = true;
+ this.uLabel2.BackColor = System.Drawing.Color.Transparent;
+ this.uLabel2.Font = new System.Drawing.Font("宋体", 15F);
+ this.uLabel2.Location = new System.Drawing.Point(35, 29);
+ this.uLabel2.Name = "uLabel2";
+ this.uLabel2.Size = new System.Drawing.Size(89, 20);
+ this.uLabel2.TabIndex = 17;
+ this.uLabel2.Text = "扣重项:";
+ //
+ // nameBox
+ //
+ this.nameBox.Font = new System.Drawing.Font("宋体", 15F);
+ this.nameBox.Location = new System.Drawing.Point(119, 26);
+ this.nameBox.Name = "nameBox";
+ this.nameBox.Size = new System.Drawing.Size(144, 30);
+ this.nameBox.TabIndex = 18;
+ //
+ // discontBox
+ //
+ this.discontBox.Font = new System.Drawing.Font("宋体", 15F);
+ this.discontBox.Location = new System.Drawing.Point(378, 26);
+ this.discontBox.Name = "discontBox";
+ this.discontBox.Size = new System.Drawing.Size(144, 30);
+ this.discontBox.TabIndex = 20;
+ //
+ // uLabel1
+ //
+ this.uLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.uLabel1.AutoSize = true;
+ this.uLabel1.BackColor = System.Drawing.Color.Transparent;
+ this.uLabel1.Font = new System.Drawing.Font("宋体", 15F);
+ this.uLabel1.Location = new System.Drawing.Point(294, 29);
+ this.uLabel1.Name = "uLabel1";
+ this.uLabel1.Size = new System.Drawing.Size(89, 20);
+ this.uLabel1.TabIndex = 19;
+ this.uLabel1.Text = "标准重:";
+ //
+ // addBtn
+ //
+ this.addBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.addBtn.AsClicked = false;
+ this.addBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("addBtn.BackgroundImage")));
+ this.addBtn.EnableGroup = false;
+ this.addBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
+ this.addBtn.FlatAppearance.BorderSize = 0;
+ this.addBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.addBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.addBtn.ForeColor = System.Drawing.Color.Black;
+ this.addBtn.Location = new System.Drawing.Point(550, 22);
+ this.addBtn.Name = "addBtn";
+ this.addBtn.PlaySound = false;
+ this.addBtn.SelfControlEnable = false;
+ this.addBtn.Size = new System.Drawing.Size(111, 34);
+ this.addBtn.SoundType = WinFormControl.SoundType.Click;
+ this.addBtn.TabIndex = 26;
+ this.addBtn.Text = "添加";
+ this.addBtn.UseVisualStyleBackColor = true;
+ this.addBtn.WithStataHode = false;
+ this.addBtn.Click += new System.EventHandler(this.addBtn_Click);
+ //
+ // mGrid
+ //
+ this.mGrid.AllowUserToAddRows = false;
+ this.mGrid.AllowUserToDeleteRows = false;
+ this.mGrid.AllowUserToResizeColumns = false;
+ this.mGrid.AllowUserToResizeRows = false;
+ dataGridViewCellStyle26.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.mGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle26;
+ this.mGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.mGrid.BackgroundColor = System.Drawing.Color.White;
+ dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle27.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle27.ForeColor = System.Drawing.Color.White;
+ dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.mGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle27;
+ this.mGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.mGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.U_Number,
+ this.U_Name,
+ this.U_Standard,
+ this.U_NumberEdit,
+ this.U_Weight});
+ this.mGrid.Location = new System.Drawing.Point(36, 87);
+ this.mGrid.MultiSelect = false;
+ this.mGrid.Name = "mGrid";
+ this.mGrid.ReadOnly = true;
+ this.mGrid.RowHeadersVisible = false;
+ dataGridViewCellStyle30.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle30.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.mGrid.RowsDefaultCellStyle = dataGridViewCellStyle30;
+ this.mGrid.RowTemplate.Height = 60;
+ this.mGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.mGrid.Size = new System.Drawing.Size(631, 358);
+ this.mGrid.TabIndex = 27;
+ this.mGrid.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.mGrid_CellMouseClick);
+ this.mGrid.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.mGrid_CellPainting);
+ //
+ // uLabel3
+ //
+ this.uLabel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.uLabel3.AutoSize = true;
+ this.uLabel3.BackColor = System.Drawing.Color.Transparent;
+ this.uLabel3.Font = new System.Drawing.Font("宋体", 15F);
+ this.uLabel3.Location = new System.Drawing.Point(127, 482);
+ this.uLabel3.Name = "uLabel3";
+ this.uLabel3.Size = new System.Drawing.Size(89, 20);
+ this.uLabel3.TabIndex = 28;
+ this.uLabel3.Text = "总扣重:";
+ //
+ // totalLbl
+ //
+ this.totalLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.totalLbl.AutoSize = true;
+ this.totalLbl.BackColor = System.Drawing.Color.Transparent;
+ this.totalLbl.Font = new System.Drawing.Font("宋体", 15F);
+ this.totalLbl.ForeColor = System.Drawing.Color.Red;
+ this.totalLbl.Location = new System.Drawing.Point(222, 482);
+ this.totalLbl.Name = "totalLbl";
+ this.totalLbl.Size = new System.Drawing.Size(19, 20);
+ this.totalLbl.TabIndex = 29;
+ this.totalLbl.Text = "0";
+ //
+ // okBtn
+ //
+ this.okBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.okBtn.AsClicked = false;
+ this.okBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("okBtn.BackgroundImage")));
+ this.okBtn.EnableGroup = false;
+ this.okBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
+ this.okBtn.FlatAppearance.BorderSize = 0;
+ this.okBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.okBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.okBtn.ForeColor = System.Drawing.Color.Black;
+ this.okBtn.Location = new System.Drawing.Point(378, 475);
+ this.okBtn.Name = "okBtn";
+ this.okBtn.PlaySound = false;
+ this.okBtn.SelfControlEnable = false;
+ this.okBtn.Size = new System.Drawing.Size(111, 34);
+ this.okBtn.SoundType = WinFormControl.SoundType.Click;
+ this.okBtn.TabIndex = 30;
+ this.okBtn.Text = "确定";
+ this.okBtn.UseVisualStyleBackColor = true;
+ this.okBtn.WithStataHode = false;
+ this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
+ //
+ // U_Number
+ //
+ this.U_Number.HeaderText = "Number";
+ this.U_Number.Name = "U_Number";
+ this.U_Number.ReadOnly = true;
+ this.U_Number.Visible = false;
+ //
+ // U_Name
+ //
+ this.U_Name.DataPropertyName = "Name";
+ this.U_Name.HeaderText = "扣重项";
+ this.U_Name.Name = "U_Name";
+ this.U_Name.ReadOnly = true;
+ this.U_Name.Width = 180;
+ //
+ // U_Standard
+ //
+ this.U_Standard.DataPropertyName = "Standard";
+ dataGridViewCellStyle28.Format = "#0.##";
+ this.U_Standard.DefaultCellStyle = dataGridViewCellStyle28;
+ this.U_Standard.HeaderText = "标准重";
+ this.U_Standard.Name = "U_Standard";
+ this.U_Standard.ReadOnly = true;
+ this.U_Standard.Width = 120;
+ //
+ // U_NumberEdit
+ //
+ this.U_NumberEdit.HeaderText = "数量";
+ this.U_NumberEdit.Name = "U_NumberEdit";
+ this.U_NumberEdit.ReadOnly = true;
+ this.U_NumberEdit.Width = 200;
+ //
+ // U_Weight
+ //
+ this.U_Weight.DataPropertyName = "Weight";
+ dataGridViewCellStyle29.Format = "#0.######";
+ this.U_Weight.DefaultCellStyle = dataGridViewCellStyle29;
+ this.U_Weight.HeaderText = "扣重";
+ this.U_Weight.Name = "U_Weight";
+ this.U_Weight.ReadOnly = true;
+ this.U_Weight.Width = 120;
+ //
+ // DiscontWeightSetDialog
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.White;
+ this.ClientSize = new System.Drawing.Size(695, 537);
+ this.Controls.Add(this.okBtn);
+ this.Controls.Add(this.totalLbl);
+ this.Controls.Add(this.uLabel3);
+ this.Controls.Add(this.mGrid);
+ this.Controls.Add(this.addBtn);
+ this.Controls.Add(this.discontBox);
+ this.Controls.Add(this.uLabel1);
+ this.Controls.Add(this.nameBox);
+ this.Controls.Add(this.uLabel2);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "DiscontWeightSetDialog";
+ this.Text = "扣重设置";
+ ((System.ComponentModel.ISupportInitialize)(this.mGrid)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private WinFormControl.ULabel uLabel2;
+ private System.Windows.Forms.TextBox nameBox;
+ private System.Windows.Forms.TextBox discontBox;
+ private WinFormControl.ULabel uLabel1;
+ private WinFormControl.UButton addBtn;
+ private WinFormControl.UDataGridView mGrid;
+ private WinFormControl.ULabel uLabel3;
+ private WinFormControl.ULabel totalLbl;
+ private WinFormControl.UButton okBtn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Number;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Name;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Standard;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_NumberEdit;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
+ }
+}
\ No newline at end of file
diff --git a/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.cs b/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.cs
new file mode 100644
index 0000000..1091b2a
--- /dev/null
+++ b/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.cs
@@ -0,0 +1,150 @@
+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 ButcherFactory.WeightCount_
+{
+ public partial class DiscontWeightSetDialog : Form
+ {
+ BindingList list;
+
+ public DiscontWeightSetDialog()
+ {
+ InitializeComponent();
+
+ this.Load += DiscontWeightSetDialog_Load;
+ }
+
+ void DiscontWeightSetDialog_Load(object sender, EventArgs e)
+ {
+ list = DiscontSetting.Load();
+ mGrid.DataSource = list;
+ mGrid.Refresh();
+ BindTotalLbl();
+ }
+
+ private void addBtn_Click(object sender, EventArgs e)
+ {
+ var name = nameBox.Text.Trim();
+ if (string.IsNullOrEmpty(name))
+ throw new Exception("请输入扣重项");
+ if (list.Any(x => x.Name == name))
+ throw new Exception("名称已存在");
+ decimal discont;
+ if (!decimal.TryParse(discontBox.Text.Trim(), out discont))
+ throw new Exception("标准重输入不正确");
+ if (discont == 0)
+ throw new Exception("标准值不能为0");
+
+
+ list.Insert(0, new DiscontSetting { Name = name, Standard = discont, Number = 0 });
+ mGrid.Refresh();
+ }
+
+ private void okBtn_Click(object sender, EventArgs e)
+ {
+ DiscontSetting.Save(list);
+ DialogResult = DialogResult.OK;
+ }
+
+ SolidBrush btnBrush = new SolidBrush(Color.LightBlue);
+
+ private void mGrid_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
+ {
+ if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
+ {
+ if (this.mGrid.Columns[e.ColumnIndex].HeaderText == "数量")
+ {
+ StringFormat sf = StringFormat.GenericDefault.Clone() as StringFormat;//设置重绘入单元格的字体样式
+ sf.FormatFlags = StringFormatFlags.DisplayFormatControl;
+ sf.Alignment = StringAlignment.Center;
+ sf.LineAlignment = StringAlignment.Center;
+ sf.Trimming = StringTrimming.EllipsisCharacter;
+
+ e.PaintBackground(e.CellBounds, false);//重绘边框
+ var entity = this.mGrid.Rows[e.RowIndex].DataBoundItem as DiscontSetting;
+ //设置要写入字体的大小
+ System.Drawing.Font myFont = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ SizeF sizeDel = e.Graphics.MeasureString("-", myFont);
+ SizeF sizeMod = e.Graphics.MeasureString(entity.Number.ToString(), myFont);
+ SizeF sizeLook = e.Graphics.MeasureString("+", myFont);
+
+ float fDel = sizeDel.Width / (sizeDel.Width + sizeMod.Width + sizeLook.Width); //
+ float fMod = sizeMod.Width / (sizeDel.Width + sizeMod.Width + sizeLook.Width);
+ float fLook = sizeLook.Width / (sizeDel.Width + sizeMod.Width + sizeLook.Width);
+
+ //设置每个“按钮的边界”
+ RectangleF rectDel = new RectangleF(e.CellBounds.Left, e.CellBounds.Top, e.CellBounds.Width * fDel, e.CellBounds.Height);
+ RectangleF rectMod = new RectangleF(rectDel.Right, e.CellBounds.Top, e.CellBounds.Width * fMod, e.CellBounds.Height);
+ RectangleF rectLook = new RectangleF(rectMod.Right, e.CellBounds.Top, e.CellBounds.Width * fLook, e.CellBounds.Height);
+ e.Graphics.FillRectangles(btnBrush, new RectangleF[] { rectDel });
+ e.Graphics.DrawString("-", myFont, Brushes.Black, rectDel, sf); //绘制“按钮”
+ e.Graphics.DrawString(entity.Number.ToString(), myFont, Brushes.Black, rectMod, sf);
+ e.Graphics.FillRectangles(btnBrush, new RectangleF[] { rectLook });
+ e.Graphics.DrawString("+", myFont, Brushes.Black, rectLook, sf);
+ e.Handled = true;
+ }
+ }
+ }
+
+ private void mGrid_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
+ {
+ if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
+ {
+ Point curPosition = e.Location;//当前鼠标在当前单元格中的坐标
+ if (this.mGrid.Columns[e.ColumnIndex].HeaderText == "数量")
+ {
+ Graphics g = this.mGrid.CreateGraphics();
+ System.Drawing.Font myFont = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+
+ var entity = this.mGrid.Rows[e.RowIndex].DataBoundItem as DiscontSetting;
+
+ SizeF sizeDel = g.MeasureString("-", myFont);
+ SizeF sizeMod = g.MeasureString(entity.Number.ToString(), myFont);
+ SizeF sizeLook = g.MeasureString("+", myFont);
+ float fDel = sizeDel.Width / (sizeDel.Width + sizeMod.Width + sizeLook.Width);
+ float fMod = sizeMod.Width / (sizeDel.Width + sizeMod.Width + sizeLook.Width);
+ float fLook = sizeLook.Width / (sizeDel.Width + sizeMod.Width + sizeLook.Width);
+
+ Rectangle rectTotal = new Rectangle(0, 0, this.mGrid.Columns[e.ColumnIndex].Width, this.mGrid.Rows[e.RowIndex].Height);
+ RectangleF rectDel = new RectangleF(rectTotal.Left, rectTotal.Top, rectTotal.Width * fDel, rectTotal.Height);
+ RectangleF rectMod = new RectangleF(rectDel.Right, rectTotal.Top, rectTotal.Width * fMod, rectTotal.Height);
+ RectangleF rectLook = new RectangleF(rectMod.Right, rectTotal.Top, rectTotal.Width * fLook, rectTotal.Height);
+
+ //判断当前鼠标在哪个“按钮”范围内
+ if (rectDel.Contains(curPosition))//-
+ SubStract(entity);
+ else if (rectLook.Contains(curPosition))//+
+ Add(entity);
+ }
+ }
+ }
+
+ private void SubStract(DiscontSetting entity)
+ {
+ if (entity.Number == 0)
+ return;
+ entity.Number -= 1;
+ mGrid.Refresh();
+ BindTotalLbl();
+ }
+
+ private void Add(DiscontSetting entity)
+ {
+ entity.Number += 1;
+ mGrid.Refresh();
+ BindTotalLbl();
+ }
+
+ void BindTotalLbl()
+ {
+ totalLbl.Text = string.Format("{0:#0.##}", list.Sum(x => x.Weight));
+ }
+ }
+}
diff --git a/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.resx b/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.resx
new file mode 100644
index 0000000..38efc1b
--- /dev/null
+++ b/ButcherFactory.Form/WeightCount_/DiscontWeightSetDialog.resx
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
+ goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg
+ KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
+
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
+ goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg
+ KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
+
+
+
\ No newline at end of file
diff --git a/ButcherFactory.Form/WeightCount_/WeightCountForm.Designer.cs b/ButcherFactory.Form/WeightCount_/WeightCountForm.Designer.cs
index 6139ccc..fd09063 100644
--- a/ButcherFactory.Form/WeightCount_/WeightCountForm.Designer.cs
+++ b/ButcherFactory.Form/WeightCount_/WeightCountForm.Designer.cs
@@ -28,28 +28,29 @@
///
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 dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = 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 dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WeightCountForm));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
- this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.historyDataGrid = new WinFormControl.UDataGridView();
- this.H_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.uLabel4 = new WinFormControl.ULabel();
this.storeSelect = new System.Windows.Forms.ComboBox();
this.uLabel5 = new WinFormControl.ULabel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.discontBtn = new WinFormControl.UButton();
this.typeBtn = new WinFormControl.UButton();
+ this.uLabel7 = new WinFormControl.ULabel();
this.uLabel6 = new WinFormControl.ULabel();
this.numSetBtn = new WinFormControl.UButton();
this.productBatchSelect = new System.Windows.Forms.ComboBox();
@@ -62,14 +63,23 @@
this.uLabel1 = new WinFormControl.ULabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.needSubmitGrid = new WinFormControl.UDataGridView();
+ this.numFlowPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.submitBtn = new WinFormControl.UButton();
+ this.uLabel3 = new WinFormControl.ULabel();
this.U_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.U_GrossWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.U_Discont = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.numFlowPanel = new System.Windows.Forms.FlowLayoutPanel();
- this.submitBtn = new WinFormControl.UButton();
- this.uLabel3 = new WinFormControl.ULabel();
+ this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_GrossWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Discont = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@@ -80,59 +90,29 @@
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).BeginInit();
this.SuspendLayout();
//
- // H_Weight
- //
- this.H_Weight.DataPropertyName = "Weight";
- dataGridViewCellStyle17.Format = "#0.######";
- this.H_Weight.DefaultCellStyle = dataGridViewCellStyle17;
- this.H_Weight.HeaderText = "重量";
- this.H_Weight.Name = "H_Weight";
- this.H_Weight.ReadOnly = true;
- //
- // H_Goods_Name
- //
- this.H_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.H_Goods_Name.DataPropertyName = "Goods_Name";
- this.H_Goods_Name.HeaderText = "产品名称";
- this.H_Goods_Name.Name = "H_Goods_Name";
- this.H_Goods_Name.ReadOnly = true;
- //
- // H_RowIndex
- //
- this.H_RowIndex.DataPropertyName = "RowIndex";
- this.H_RowIndex.HeaderText = "序号";
- this.H_RowIndex.Name = "H_RowIndex";
- this.H_RowIndex.ReadOnly = true;
- //
- // H_ID
- //
- this.H_ID.DataPropertyName = "ID";
- this.H_ID.HeaderText = "ID";
- this.H_ID.Name = "H_ID";
- this.H_ID.ReadOnly = true;
- this.H_ID.Visible = false;
- //
// historyDataGrid
//
this.historyDataGrid.AllowUserToAddRows = false;
this.historyDataGrid.AllowUserToDeleteRows = false;
this.historyDataGrid.AllowUserToResizeColumns = false;
this.historyDataGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18;
+ dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.historyDataGrid.BackgroundColor = System.Drawing.Color.White;
this.historyDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
- dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle19.Font = new System.Drawing.Font("宋体", 12F);
- dataGridViewCellStyle19.ForeColor = System.Drawing.Color.White;
- dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19;
+ dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
+ dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID,
this.H_RowIndex,
this.H_Goods_Name,
this.H_Number,
+ this.H_GrossWeight,
+ this.H_Discont,
this.H_Weight});
this.historyDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.historyDataGrid.Location = new System.Drawing.Point(5, 19);
@@ -140,30 +120,23 @@
this.historyDataGrid.Name = "historyDataGrid";
this.historyDataGrid.ReadOnly = true;
this.historyDataGrid.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.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle20;
+ dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.historyDataGrid.RowTemplate.Height = 23;
this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.historyDataGrid.Size = new System.Drawing.Size(590, 158);
+ this.historyDataGrid.Size = new System.Drawing.Size(683, 158);
this.historyDataGrid.TabIndex = 2;
//
- // H_Number
- //
- this.H_Number.DataPropertyName = "Number";
- this.H_Number.HeaderText = "数量";
- this.H_Number.Name = "H_Number";
- this.H_Number.ReadOnly = true;
- //
// flowLayoutPanel1
//
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.flowLayoutPanel1.Location = new System.Drawing.Point(627, -1);
+ this.flowLayoutPanel1.Location = new System.Drawing.Point(710, -1);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
- this.flowLayoutPanel1.Size = new System.Drawing.Size(680, 521);
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(597, 521);
this.flowLayoutPanel1.TabIndex = 4;
//
// groupBox2
@@ -176,7 +149,7 @@
this.groupBox2.Location = new System.Drawing.Point(11, 324);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(5);
- this.groupBox2.Size = new System.Drawing.Size(600, 182);
+ this.groupBox2.Size = new System.Drawing.Size(693, 182);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
//
@@ -189,7 +162,7 @@
this.uLabel4.Name = "uLabel4";
this.uLabel4.Size = new System.Drawing.Size(80, 18);
this.uLabel4.TabIndex = 1;
- this.uLabel4.Text = "历史领料";
+ this.uLabel4.Text = "历史明细";
//
// storeSelect
//
@@ -227,7 +200,9 @@
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent;
+ this.splitContainer1.Panel1.Controls.Add(this.discontBtn);
this.splitContainer1.Panel1.Controls.Add(this.typeBtn);
+ this.splitContainer1.Panel1.Controls.Add(this.uLabel7);
this.splitContainer1.Panel1.Controls.Add(this.uLabel6);
this.splitContainer1.Panel1.Controls.Add(this.storeSelect);
this.splitContainer1.Panel1.Controls.Add(this.uLabel5);
@@ -250,6 +225,29 @@
this.splitContainer1.SplitterDistance = 86;
this.splitContainer1.TabIndex = 3;
//
+ // discontBtn
+ //
+ this.discontBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.discontBtn.AsClicked = false;
+ this.discontBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("discontBtn.BackgroundImage")));
+ this.discontBtn.EnableGroup = false;
+ this.discontBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
+ this.discontBtn.FlatAppearance.BorderSize = 0;
+ this.discontBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.discontBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.discontBtn.ForeColor = System.Drawing.Color.Black;
+ this.discontBtn.Location = new System.Drawing.Point(540, 46);
+ this.discontBtn.Name = "discontBtn";
+ this.discontBtn.PlaySound = false;
+ this.discontBtn.SelfControlEnable = false;
+ this.discontBtn.Size = new System.Drawing.Size(111, 34);
+ this.discontBtn.SoundType = WinFormControl.SoundType.Click;
+ this.discontBtn.TabIndex = 25;
+ this.discontBtn.Text = "0";
+ this.discontBtn.UseVisualStyleBackColor = true;
+ this.discontBtn.WithStataHode = false;
+ this.discontBtn.Click += new System.EventHandler(this.discontBtn_Click);
+ //
// typeBtn
//
this.typeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -261,7 +259,7 @@
this.typeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.typeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.typeBtn.ForeColor = System.Drawing.Color.Black;
- this.typeBtn.Location = new System.Drawing.Point(696, 46);
+ this.typeBtn.Location = new System.Drawing.Point(758, 46);
this.typeBtn.Name = "typeBtn";
this.typeBtn.PlaySound = false;
this.typeBtn.SelfControlEnable = false;
@@ -272,13 +270,25 @@
this.typeBtn.WithStataHode = false;
this.typeBtn.Click += new System.EventHandler(this.typeBtn_Click);
//
+ // uLabel7
+ //
+ this.uLabel7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.uLabel7.AutoSize = true;
+ this.uLabel7.BackColor = System.Drawing.Color.Transparent;
+ this.uLabel7.Font = new System.Drawing.Font("宋体", 15F);
+ this.uLabel7.Location = new System.Drawing.Point(475, 53);
+ this.uLabel7.Name = "uLabel7";
+ this.uLabel7.Size = new System.Drawing.Size(69, 20);
+ this.uLabel7.TabIndex = 24;
+ this.uLabel7.Text = "扣重:";
+ //
// uLabel6
//
this.uLabel6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.uLabel6.AutoSize = true;
this.uLabel6.BackColor = System.Drawing.Color.Transparent;
this.uLabel6.Font = new System.Drawing.Font("宋体", 15F);
- this.uLabel6.Location = new System.Drawing.Point(595, 53);
+ this.uLabel6.Location = new System.Drawing.Point(657, 53);
this.uLabel6.Name = "uLabel6";
this.uLabel6.Size = new System.Drawing.Size(109, 20);
this.uLabel6.TabIndex = 24;
@@ -414,7 +424,7 @@
this.groupBox1.Location = new System.Drawing.Point(11, 13);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
- this.groupBox1.Size = new System.Drawing.Size(600, 305);
+ this.groupBox1.Size = new System.Drawing.Size(693, 305);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
//
@@ -424,37 +434,81 @@
this.needSubmitGrid.AllowUserToDeleteRows = false;
this.needSubmitGrid.AllowUserToResizeColumns = false;
this.needSubmitGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle21;
+ dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.needSubmitGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White;
this.needSubmitGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
- dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle22.Font = new System.Drawing.Font("宋体", 12F);
- dataGridViewCellStyle22.ForeColor = System.Drawing.Color.White;
- dataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle22;
+ dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
+ dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.U_ID,
this.U_RowIndex,
this.U_Goods_Name,
this.U_Number,
+ this.U_GrossWeight,
+ this.U_Discont,
this.U_Weight});
this.needSubmitGrid.Location = new System.Drawing.Point(5, 57);
this.needSubmitGrid.MultiSelect = false;
this.needSubmitGrid.Name = "needSubmitGrid";
this.needSubmitGrid.ReadOnly = true;
this.needSubmitGrid.RowHeadersVisible = false;
- dataGridViewCellStyle24.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle24.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
- this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle24;
+ dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle12;
this.needSubmitGrid.RowTemplate.Height = 30;
this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.needSubmitGrid.Size = new System.Drawing.Size(590, 240);
+ this.needSubmitGrid.Size = new System.Drawing.Size(683, 240);
this.needSubmitGrid.TabIndex = 16;
//
+ // numFlowPanel
+ //
+ this.numFlowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+ this.numFlowPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
+ this.numFlowPanel.Location = new System.Drawing.Point(143, 13);
+ this.numFlowPanel.Name = "numFlowPanel";
+ this.numFlowPanel.Size = new System.Drawing.Size(545, 41);
+ this.numFlowPanel.TabIndex = 15;
+ //
+ // submitBtn
+ //
+ this.submitBtn.AsClicked = false;
+ this.submitBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("submitBtn.BackgroundImage")));
+ this.submitBtn.EnableGroup = false;
+ this.submitBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
+ this.submitBtn.FlatAppearance.BorderSize = 0;
+ this.submitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.submitBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.submitBtn.ForeColor = System.Drawing.Color.Black;
+ this.submitBtn.Location = new System.Drawing.Point(11, 20);
+ this.submitBtn.Name = "submitBtn";
+ this.submitBtn.PlaySound = false;
+ this.submitBtn.SelfControlEnable = false;
+ this.submitBtn.Size = new System.Drawing.Size(111, 34);
+ this.submitBtn.SoundType = WinFormControl.SoundType.Click;
+ this.submitBtn.TabIndex = 11;
+ this.submitBtn.Text = "提 交";
+ this.submitBtn.UseVisualStyleBackColor = true;
+ this.submitBtn.WithStataHode = false;
+ this.submitBtn.Click += new System.EventHandler(this.submitBtn_Click);
+ //
+ // uLabel3
+ //
+ this.uLabel3.AutoSize = true;
+ this.uLabel3.BackColor = System.Drawing.Color.White;
+ this.uLabel3.Font = new System.Drawing.Font("宋体", 13F);
+ this.uLabel3.Location = new System.Drawing.Point(8, 0);
+ this.uLabel3.Name = "uLabel3";
+ this.uLabel3.Size = new System.Drawing.Size(80, 18);
+ this.uLabel3.TabIndex = 0;
+ this.uLabel3.Text = "称重明细";
+ //
// U_ID
//
this.U_ID.DataPropertyName = "ID";
@@ -485,56 +539,89 @@
this.U_Number.Name = "U_Number";
this.U_Number.ReadOnly = true;
//
+ // U_GrossWeight
+ //
+ this.U_GrossWeight.DataPropertyName = "GrossWeight";
+ dataGridViewCellStyle9.Format = "#0.######";
+ this.U_GrossWeight.DefaultCellStyle = dataGridViewCellStyle9;
+ this.U_GrossWeight.HeaderText = "毛重";
+ this.U_GrossWeight.Name = "U_GrossWeight";
+ this.U_GrossWeight.ReadOnly = true;
+ //
+ // U_Discont
+ //
+ this.U_Discont.DataPropertyName = "Discont";
+ dataGridViewCellStyle10.Format = "#0.######";
+ this.U_Discont.DefaultCellStyle = dataGridViewCellStyle10;
+ this.U_Discont.HeaderText = "扣重";
+ this.U_Discont.Name = "U_Discont";
+ this.U_Discont.ReadOnly = true;
+ //
// U_Weight
//
this.U_Weight.DataPropertyName = "Weight";
- dataGridViewCellStyle23.Format = "#0.######";
- this.U_Weight.DefaultCellStyle = dataGridViewCellStyle23;
- this.U_Weight.HeaderText = "重量";
+ dataGridViewCellStyle11.Format = "#0.######";
+ this.U_Weight.DefaultCellStyle = dataGridViewCellStyle11;
+ this.U_Weight.HeaderText = "净重";
this.U_Weight.Name = "U_Weight";
this.U_Weight.ReadOnly = true;
//
- // numFlowPanel
+ // H_ID
//
- this.numFlowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
- this.numFlowPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
- this.numFlowPanel.Location = new System.Drawing.Point(143, 13);
- this.numFlowPanel.Name = "numFlowPanel";
- this.numFlowPanel.Size = new System.Drawing.Size(452, 41);
- this.numFlowPanel.TabIndex = 15;
+ this.H_ID.DataPropertyName = "ID";
+ this.H_ID.HeaderText = "ID";
+ this.H_ID.Name = "H_ID";
+ this.H_ID.ReadOnly = true;
+ this.H_ID.Visible = false;
//
- // submitBtn
+ // H_RowIndex
//
- this.submitBtn.AsClicked = false;
- this.submitBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("submitBtn.BackgroundImage")));
- this.submitBtn.EnableGroup = false;
- this.submitBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
- this.submitBtn.FlatAppearance.BorderSize = 0;
- this.submitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.submitBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.submitBtn.ForeColor = System.Drawing.Color.Black;
- this.submitBtn.Location = new System.Drawing.Point(11, 20);
- this.submitBtn.Name = "submitBtn";
- this.submitBtn.PlaySound = false;
- this.submitBtn.SelfControlEnable = false;
- this.submitBtn.Size = new System.Drawing.Size(111, 34);
- this.submitBtn.SoundType = WinFormControl.SoundType.Click;
- this.submitBtn.TabIndex = 11;
- this.submitBtn.Text = "提 交";
- this.submitBtn.UseVisualStyleBackColor = true;
- this.submitBtn.WithStataHode = false;
- this.submitBtn.Click += new System.EventHandler(this.submitBtn_Click);
+ this.H_RowIndex.DataPropertyName = "RowIndex";
+ this.H_RowIndex.HeaderText = "序号";
+ this.H_RowIndex.Name = "H_RowIndex";
+ this.H_RowIndex.ReadOnly = true;
//
- // uLabel3
+ // H_Goods_Name
//
- this.uLabel3.AutoSize = true;
- this.uLabel3.BackColor = System.Drawing.Color.White;
- this.uLabel3.Font = new System.Drawing.Font("宋体", 13F);
- this.uLabel3.Location = new System.Drawing.Point(8, 0);
- this.uLabel3.Name = "uLabel3";
- this.uLabel3.Size = new System.Drawing.Size(80, 18);
- this.uLabel3.TabIndex = 0;
- this.uLabel3.Text = "领料明细";
+ this.H_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.H_Goods_Name.DataPropertyName = "Goods_Name";
+ this.H_Goods_Name.HeaderText = "产品名称";
+ this.H_Goods_Name.Name = "H_Goods_Name";
+ this.H_Goods_Name.ReadOnly = true;
+ //
+ // H_Number
+ //
+ this.H_Number.DataPropertyName = "Number";
+ this.H_Number.HeaderText = "数量";
+ this.H_Number.Name = "H_Number";
+ this.H_Number.ReadOnly = true;
+ //
+ // H_GrossWeight
+ //
+ this.H_GrossWeight.DataPropertyName = "GrossWeight";
+ dataGridViewCellStyle3.Format = "#0.######";
+ this.H_GrossWeight.DefaultCellStyle = dataGridViewCellStyle3;
+ this.H_GrossWeight.HeaderText = "毛重";
+ this.H_GrossWeight.Name = "H_GrossWeight";
+ this.H_GrossWeight.ReadOnly = true;
+ //
+ // H_Discont
+ //
+ this.H_Discont.DataPropertyName = "Discont";
+ dataGridViewCellStyle4.Format = "#0.######";
+ this.H_Discont.DefaultCellStyle = dataGridViewCellStyle4;
+ this.H_Discont.HeaderText = "扣重";
+ this.H_Discont.Name = "H_Discont";
+ this.H_Discont.ReadOnly = true;
+ //
+ // H_Weight
+ //
+ this.H_Weight.DataPropertyName = "Weight";
+ dataGridViewCellStyle5.Format = "#0.######";
+ this.H_Weight.DefaultCellStyle = dataGridViewCellStyle5;
+ this.H_Weight.HeaderText = "重量";
+ this.H_Weight.Name = "H_Weight";
+ this.H_Weight.ReadOnly = true;
//
// WeightCountForm
//
@@ -564,12 +651,7 @@
#endregion
- private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
- private System.Windows.Forms.DataGridViewTextBoxColumn H_Goods_Name;
- private System.Windows.Forms.DataGridViewTextBoxColumn H_RowIndex;
- private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
private WinFormControl.UDataGridView historyDataGrid;
- private System.Windows.Forms.DataGridViewTextBoxColumn H_Number;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.GroupBox groupBox2;
private WinFormControl.ULabel uLabel4;
@@ -587,15 +669,26 @@
private WinFormControl.ULabel uLabel1;
private System.Windows.Forms.GroupBox groupBox1;
private WinFormControl.UDataGridView needSubmitGrid;
- private System.Windows.Forms.DataGridViewTextBoxColumn U_ID;
- private System.Windows.Forms.DataGridViewTextBoxColumn U_RowIndex;
- private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name;
- private System.Windows.Forms.DataGridViewTextBoxColumn U_Number;
- private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
private System.Windows.Forms.FlowLayoutPanel numFlowPanel;
private WinFormControl.UButton submitBtn;
private WinFormControl.ULabel uLabel3;
private WinFormControl.ULabel uLabel6;
private WinFormControl.UButton typeBtn;
+ private WinFormControl.UButton discontBtn;
+ private WinFormControl.ULabel uLabel7;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_RowIndex;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Goods_Name;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Number;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_GrossWeight;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Discont;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_RowIndex;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Number;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_GrossWeight;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Discont;
+ private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
}
}
\ No newline at end of file
diff --git a/ButcherFactory.Form/WeightCount_/WeightCountForm.cs b/ButcherFactory.Form/WeightCount_/WeightCountForm.cs
index d2fcc56..5f6d0d6 100644
--- a/ButcherFactory.Form/WeightCount_/WeightCountForm.cs
+++ b/ButcherFactory.Form/WeightCount_/WeightCountForm.cs
@@ -38,6 +38,7 @@ namespace ButcherFactory.WeightCount_
BindingList needSubmitedList;
BindingList historyList;
WeightCountConfig config;
+ decimal discontWeight;
long? batchID;
@@ -78,9 +79,9 @@ namespace ButcherFactory.WeightCount_
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
+ BindDiscontWeight();
var initTask = new Thread(LoadBind);
initTask.Start();
-
uploadData = new Thread(UpLoadLocalData);
uploadData.Start();
}
@@ -128,7 +129,9 @@ namespace ButcherFactory.WeightCount_
var c = sender as UButton;
var entity = new WeightCountEntity();
entity.RowIndex = GetRowIndex();
- entity.Weight = uWeightControl1.Weight;
+ entity.GrossWeight= uWeightControl1.Weight;
+ entity.Discont = discontWeight;
+ entity.Weight = (entity.GrossWeight ?? 0) - discontWeight;
entity.Goods_ID = (long)c.Tag;
entity.Goods_Name = c.Text;
entity.ProductBatch_ID = batchID;
@@ -279,5 +282,17 @@ namespace ButcherFactory.WeightCount_
typeBtn.Text = config.ProduceOut ? "产出" : "入库";
BindGrid();
}
+
+ private void discontBtn_Click(object sender, EventArgs e)
+ {
+ if (new DiscontWeightSetDialog().ShowDialog() == DialogResult.OK)
+ BindDiscontWeight();
+ }
+
+ void BindDiscontWeight()
+ {
+ discontWeight = DiscontSetting.Load().Sum(x => x.Weight);
+ discontBtn.Text = string.Format("{0:#0.##}", discontWeight);
+ }
}
}
diff --git a/ButcherFactory.Form/WeightCount_/WeightCountForm.resx b/ButcherFactory.Form/WeightCount_/WeightCountForm.resx
index f49205f..5ccf0ae 100644
--- a/ButcherFactory.Form/WeightCount_/WeightCountForm.resx
+++ b/ButcherFactory.Form/WeightCount_/WeightCountForm.resx
@@ -123,7 +123,21 @@
True
+
+ True
+
+
+ True
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
+ goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg
+ KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
+
+
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
@@ -154,6 +168,12 @@
True
+
+ True
+
+
+ True
+
True