diff --git a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs index 90bf249..97a7741 100644 --- a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs +++ b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs @@ -47,7 +47,11 @@ namespace ButcherFactory.BO [ReferenceTo(typeof(Goods), "ShotPrintName")] [Join("Goods_ID", "ID")] - public string ShotPrintName { get; set; } + public string ShotPrintName { get; set; } + + [ReferenceTo(typeof(Goods), "EachNumber")] + [Join("Goods_ID", "ID")] + public int? EachNumber { get; set; } public decimal? StandardWeight { get; set; } diff --git a/ButcherFactory.BO/BaseInfo/Goods.cs b/ButcherFactory.BO/BaseInfo/Goods.cs index 0675e49..9854f71 100644 --- a/ButcherFactory.BO/BaseInfo/Goods.cs +++ b/ButcherFactory.BO/BaseInfo/Goods.cs @@ -24,6 +24,7 @@ namespace ButcherFactory.BO public short? GoodsType { get; set; } - public string ShotPrintName { get; set; } + public string ShotPrintName { get; set; } + public int? EachNumber { get; set; } } } diff --git a/ButcherFactory.BO/Bill/SegmentProduction.cs b/ButcherFactory.BO/Bill/SegmentProduction.cs index 19f573a..71da01d 100644 --- a/ButcherFactory.BO/Bill/SegmentProduction.cs +++ b/ButcherFactory.BO/Bill/SegmentProduction.cs @@ -149,4 +149,13 @@ namespace ButcherFactory.BO } } } + + + public class WeightDetail + { + public int No { get; set; } + + public decimal Weight { get; set; } + + } } diff --git a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs index b5876bc..ad6ff3c 100644 --- a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs +++ b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs @@ -70,7 +70,8 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("GoodsType", detail)); query.Columns.Add(DQSelectColumn.Field("StandardPic", detail)); query.Columns.Add(DQSelectColumn.Field("MainUnit", detail)); - query.Columns.Add(DQSelectColumn.Field("ShotPrintName", detail)); + query.Columns.Add(DQSelectColumn.Field("ShotPrintName", detail)); + query.Columns.Add(DQSelectColumn.Field("EachNumber", detail)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create(main, "ID")); query.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "ID")); @@ -94,7 +95,8 @@ namespace ButcherFactory.BO.LocalBL entity.GoodsType = (short?)reader[8]; entity.StandardPic = (bool)reader[9]; entity.MainUnit = (string)reader[10]; - entity.ShotPrintName = (string)reader[11]; + entity.ShotPrintName = (string)reader[11]; + entity.EachNumber = (int?)reader[12]; if (result.ContainsKey(key)) result[key].Add(entity); else diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index 0106ca7..136a9c1 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -36,10 +36,7 @@ False - ..\..\..\tsref\Debug\BwpClientPrint.dll - - - ..\..\WinFormControl\HidLibrary\bin\Release\HidLibrary.dll + ..\ButcherFactory.Login\bin\Debug\BwpClientPrint.dll @@ -78,6 +75,9 @@ CarcassSaleOutReadForm.cs + + Component + Component @@ -96,6 +96,12 @@ Component + + UserControl + + + UserControl1.cs + @@ -199,12 +205,6 @@ InStoreSummaryView.cs - - Form - - - SegmentInStoreForm.cs - @@ -237,6 +237,12 @@ ViewTaskForm.cs + + Form + + + WeightView.cs + Form @@ -336,6 +342,9 @@ InfoBox.cs + + UserControl1.cs + WeightControl.cs @@ -382,9 +391,6 @@ InStoreSummaryView.cs - - SegmentInStoreForm.cs - SegmentPickUpForm.cs @@ -400,6 +406,9 @@ ViewTaskForm.cs + + WeightView.cs + SegmentProductionForm.cs diff --git a/ButcherFactory.Form/Controls/CircleButton.cs b/ButcherFactory.Form/Controls/CircleButton.cs new file mode 100644 index 0000000..a826476 --- /dev/null +++ b/ButcherFactory.Form/Controls/CircleButton.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Forms; + +namespace ButcherFactory.Controls +{ + public class CircleButton : System.Windows.Forms.Button + { + public CircleButton() + { + + this.SetStyle(ControlStyles.AllPaintingInWmPaint | + ControlStyles.DoubleBuffer | + ControlStyles.UserPaint, true); + this.ForeColor = Color.White; + this.BackColor = Color.DeepSkyBlue; + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); + path.AddEllipse(2, 2, this.Width - 6, this.Height - 6); + Graphics g = e.Graphics; + g.DrawEllipse(new Pen(Color.Black, 2), 2, 2, Width - 6, Height - 6); + Region = new Region(path); + } + + private int _minCount = 0; + public int MinCount + { + get { return _minCount; } + set { + if (value > _maxCount) + { + value = 1; + } + _minCount = value; + this.Text = string.Format("{0}-{1}", _maxCount, _minCount); + } + } + + private int _maxCount = 1; + public int MaxCount + { + get { return _maxCount; } + set { + _maxCount = value; + this.Text = string.Format("{0}-{1}", _minCount, _minCount); + } + } + } + + +} diff --git a/ButcherFactory.Form/Controls/ColorButton.cs b/ButcherFactory.Form/Controls/ColorButton.cs index 9688b1b..cd8398d 100644 --- a/ButcherFactory.Form/Controls/ColorButton.cs +++ b/ButcherFactory.Form/Controls/ColorButton.cs @@ -11,7 +11,7 @@ using WinFormControl; namespace ButcherFactory.Controls { - class ColorButton : System.Windows.Forms.Button + public class ColorButton : System.Windows.Forms.Button { public ColorButton() { diff --git a/ButcherFactory.Form/Controls/UserControl1.Designer.cs b/ButcherFactory.Form/Controls/UserControl1.Designer.cs new file mode 100644 index 0000000..11e2d42 --- /dev/null +++ b/ButcherFactory.Form/Controls/UserControl1.Designer.cs @@ -0,0 +1,75 @@ +namespace ButcherFactory.Controls +{ + partial class ButtonTag + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.Label = new ButcherFactory.Controls.CircleButton(); + this.Button = new ButcherFactory.Controls.ColorButton(); + this.SuspendLayout(); + // + // Tag + // + this.Label.BackColor = System.Drawing.Color.DeepSkyBlue; + this.Label.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Label.ForeColor = System.Drawing.Color.White; + this.Label.Location = new System.Drawing.Point(111, 0); + this.Label.Name = "Tag"; + this.Label.Size = new System.Drawing.Size(36, 33); + this.Label.TabIndex = 1; + this.Label.UseVisualStyleBackColor = false; + // + // Button + // + this.Button.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); + this.Button.ForeColor = System.Drawing.Color.White; + this.Button.Location = new System.Drawing.Point(0, 0); + this.Button.Name = "Button"; + this.Button.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.Button.Size = new System.Drawing.Size(140, 90); + this.Button.TabIndex = 2; + this.Button.UseVisualStyleBackColor = false; + // + // ButtonTag + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.Label); + this.Controls.Add(this.Button); + this.Name = "ButtonTag"; + this.Size = new System.Drawing.Size(147, 90); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public ColorButton Button; + public CircleButton Label; + } +} diff --git a/ButcherFactory.Form/Controls/UserControl1.cs b/ButcherFactory.Form/Controls/UserControl1.cs new file mode 100644 index 0000000..efcf7b9 --- /dev/null +++ b/ButcherFactory.Form/Controls/UserControl1.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ButcherFactory.Controls +{ + public partial class ButtonTag : UserControl + { + public ButtonTag() + { + InitializeComponent(); + } + } +} diff --git a/ButcherFactory.Form/Controls/UserControl1.resx b/ButcherFactory.Form/Controls/UserControl1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ButcherFactory.Form/Controls/UserControl1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs b/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs index 03628dd..a495bf6 100644 --- a/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs +++ b/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs @@ -38,7 +38,7 @@ namespace ButcherFactory.SegmentInStore_ BindingList unInstoreList; BindingList exceptionList; BindingList backStoreList; - private static Scanner1902 _scanner; + private static Scanner1902 _scanner; long? storeID; bool isBack = false; diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index aa94ece..a7e0b9c 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -168,19 +168,85 @@ namespace ButcherFactory.SegmentProductionAuto_ } Color goodsColor = Color.FromArgb(250, 120, 24); - string groupKey = string.Empty; - void GroupGoodsSetClick(object sender, EventArgs e) - { - flowLayoutPanel2.Controls.Clear(); - var groupBtn = sender as ColorButton; - groupKey = groupBtn.Text; - var arr = goodsSetDic[groupKey]; - foreach (var item in arr) - { - var btn = new ColorButton() { Width = 140, Height = 90, Text = item.Goods_Name, Tag = item, Font = new Font("黑体", 15, FontStyle.Bold), BackColor = Color.Black, Margin = new Padding(20, 10, 20, 35), PlaySound = true, ForeColor = Color.White }; - btn.Click += GoodsBtnClick; - flowLayoutPanel2.Controls.Add(btn); - } + string groupKey = string.Empty; + public Dictionary> wDic = new Dictionary>(); + void GroupGoodsSetClick(object sender, EventArgs e) + { + flowLayoutPanel2.Controls.Clear(); + var groupBtn = sender as ColorButton; + groupKey = groupBtn.Text; + var arr = goodsSetDic[groupKey]; + int i = 0; + foreach (var item in arr) + { + var bTag = new ButtonTag(); + if ((item.EachNumber ?? 0) > 0) + { + bTag.Label.MaxCount = item.EachNumber.Value; + bTag.Label.Text = string.Format("{0}-0", item.EachNumber.Value); + bTag.Button.Click += delegate + { + if (batchID == null) + throw new Exception("请先选择批次"); + var weight = uWeightControl1.Weight; + if (weight == 0) + throw new Exception("重量不能为0"); + if (item.StandardWeight.HasValue) + { + if (weight < (item.StandardWeightLow ?? 0) || weight > (item.StandardWeightUp ?? 0)) + throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", item.StandardWeightLow, item.StandardWeightUp)); + weight = item.StandardWeight.Value; + } + List l = null; + if (wDic.ContainsKey(item.Goods_ID)) + { + l = wDic[item.Goods_ID]; + if (l.Count >= item.EachNumber.Value) + { + l.Clear(); + } + l.Add(weight); + } + else + { + wDic.Add(item.Goods_ID, l = new List() { weight }); + } + bTag.Label.MinCount = l.Count(); + if (l.Count >= item.EachNumber.Value) + { + weight = l.Sum(x => x); + InsertSegmentProduction(item, weight); + } + }; + + bTag.Label.Click += delegate + { + List l = new List(0); + if (wDic.ContainsKey(item.Goods_ID)) + { + l = wDic[item.Goods_ID]; + } + new WeightView(this, bTag).ShowDialog(); + }; + } + else + { + bTag.Label.Visible = false; + bTag.Button.Click += GoodsBtnClick; + } + + bTag.Button.Tag = item; + bTag.Button.Text = item.Goods_Name; + bTag.Button.Font = new Font("黑体", 15, FontStyle.Bold); + bTag.Button.BackColor = Color.Black; + bTag.Button.Margin = new Padding(20, 10, 20, 35); + bTag.Button.PlaySound = true; + bTag.Button.ForeColor = Color.White; + bTag.Button.Width = 140; + bTag.Button.Height = 90; + flowLayoutPanel2.Controls.Add(bTag); + i++; + } } void GoodsBtnClick(object sender, EventArgs e) @@ -189,58 +255,63 @@ namespace ButcherFactory.SegmentProductionAuto_ throw new Exception("请先选择批次"); var btn = sender as ColorButton; var detail = btn.Tag as ClientGoodsSet_Detail; - var weight = uWeightControl1.Weight; - if (weight == 0) - throw new Exception("重量不能为0"); - if (detail.StandardWeight.HasValue) - { - if (weight < (detail.StandardWeightLow ?? 0) || weight > (detail.StandardWeightUp ?? 0)) - throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); - weight = detail.StandardWeight.Value; - } - var pics = int.Parse(numberInput.Text); - if (pics <= 0) - pics = 1; - else if (pics > 50) - pics = 50; - SegmentProduction entity = null; - for (var i = 0; i < pics; i++) + var weight = uWeightControl1.Weight; + if (weight == 0) + throw new Exception("重量不能为0"); + if (detail.StandardWeight.HasValue) { - entity = new SegmentProduction(); - entity.Goods_ID = detail.Goods_ID; - entity.Weight = weight; - entity.WorkUnit_ID = config.WorkUnitID; - entity.ProductBatch_ID = batchID.Value; - entity.StandardPic = detail.StandardPic; - if (!string.IsNullOrEmpty(statisticNumberBox.Text)) - entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); - SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); - entity.Goods_Code = detail.Goods_Code; - entity.Goods_Name = detail.Goods_Name; - entity.Goods_Spec = detail.Goods_Spec; - entity.MainUnit = detail.MainUnit; - entity.ShotPrintName = detail.ShotPrintName; + if (weight < (detail.StandardWeightLow ?? 0) || weight > (detail.StandardWeightUp ?? 0)) + throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); + weight = detail.StandardWeight.Value; + } + InsertSegmentProduction(detail, weight); + } - historyList.Insert(0, entity); - if (historyList.Count > 30) - historyList.RemoveAt(30); - if (barPrintCheck.Checked) + private void InsertSegmentProduction(ClientGoodsSet_Detail detail, decimal weight) + { + var pics = int.Parse(numberInput.Text); + if (pics <= 0) + pics = 1; + else if (pics > 50) + pics = 50; + SegmentProduction entity = null; + for (var i = 0; i < pics; i++) { - var template = config.Template; - if (detail.GoodsType.HasValue) - template = detail.GoodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html"; - NotAuto.SegmentProductionPrint.Print(entity, batchDate, template); - var log = new SegmentLog(entity.BarCode, "打印"); - log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight); - SegmentProductionBL.InsertLog(log); + entity = new SegmentProduction(); + entity.Goods_ID = detail.Goods_ID; + entity.Weight = weight; + entity.WorkUnit_ID = config.WorkUnitID; + entity.ProductBatch_ID = batchID.Value; + entity.StandardPic = detail.StandardPic; + if (!string.IsNullOrEmpty(statisticNumberBox.Text)) + entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); + SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); + entity.Goods_Code = detail.Goods_Code; + entity.Goods_Name = detail.Goods_Name; + entity.Goods_Spec = detail.Goods_Spec; + entity.MainUnit = detail.MainUnit; + entity.ShotPrintName = detail.ShotPrintName; + + historyList.Insert(0, entity); + if (historyList.Count > 30) + historyList.RemoveAt(30); + if (barPrintCheck.Checked) + { + var template = config.Template; + if (detail.GoodsType.HasValue) + template = detail.GoodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html"; + NotAuto.SegmentProductionPrint.Print(entity, batchDate, template); + var log = new SegmentLog(entity.BarCode, "打印"); + log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight); + SegmentProductionBL.InsertLog(log); + } } - } - GoodsLabel.Text = detail.Goods_Name; - historyDataGrid.FirstDisplayedScrollingRowIndex = 0; - historyDataGrid.ClearSelection(); - historyDataGrid.Refresh(); - var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); - thd.Start(entity); + GoodsLabel.Text = detail.Goods_Name; + historyDataGrid.FirstDisplayedScrollingRowIndex = 0; + historyDataGrid.ClearSelection(); + historyDataGrid.Refresh(); + var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); + thd.Start(entity); } void RefreshTask(object obj) diff --git a/ButcherFactory.Form/SegmentProductionAuto_/WeightView.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/WeightView.Designer.cs new file mode 100644 index 0000000..311b475 --- /dev/null +++ b/ButcherFactory.Form/SegmentProductionAuto_/WeightView.Designer.cs @@ -0,0 +1,148 @@ +namespace ButcherFactory.SegmentProductionAuto_ +{ + partial class WeightView + { + /// + /// 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.taskGrid = new WinFormControl.UDataGridView(); + this.label1 = new System.Windows.Forms.Label(); + this.I_No = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.I_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.deleteBtn = new ButcherFactory.Controls.ColorButton(); + ((System.ComponentModel.ISupportInitialize)(this.taskGrid)).BeginInit(); + this.SuspendLayout(); + // + // taskGrid + // + this.taskGrid.AllowUserToAddRows = false; + this.taskGrid.AllowUserToDeleteRows = false; + this.taskGrid.AllowUserToResizeColumns = false; + this.taskGrid.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.taskGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.taskGrid.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.taskGrid.BackgroundColor = System.Drawing.Color.White; + this.taskGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; + 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.taskGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.taskGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.taskGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.I_No, + this.I_Weight}); + this.taskGrid.Location = new System.Drawing.Point(12, 63); + this.taskGrid.MultiSelect = false; + this.taskGrid.Name = "taskGrid"; + this.taskGrid.ReadOnly = true; + this.taskGrid.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.taskGrid.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.taskGrid.RowTemplate.Height = 23; + this.taskGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.taskGrid.Size = new System.Drawing.Size(263, 184); + this.taskGrid.TabIndex = 13; + this.taskGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.taskGrid_CellContentClick); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.ForeColor = System.Drawing.Color.Red; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(17, 18); + this.label1.TabIndex = 14; + this.label1.Text = " "; + // + // I_No + // + this.I_No.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.I_No.DataPropertyName = "No"; + this.I_No.FillWeight = 150F; + this.I_No.HeaderText = "序号"; + this.I_No.Name = "I_No"; + this.I_No.ReadOnly = true; + // + // I_Weight + // + this.I_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle3.Format = "#0.######"; + this.I_Weight.DefaultCellStyle = dataGridViewCellStyle3; + this.I_Weight.HeaderText = "重量"; + this.I_Weight.Name = "I_Weight"; + this.I_Weight.ReadOnly = true; + this.I_Weight.Width = 120; + // + // deleteBtn + // + this.deleteBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.deleteBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25))))); + this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F); + this.deleteBtn.ForeColor = System.Drawing.Color.White; + this.deleteBtn.Location = new System.Drawing.Point(164, 16); + this.deleteBtn.Name = "deleteBtn"; + this.deleteBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); + this.deleteBtn.Size = new System.Drawing.Size(111, 41); + this.deleteBtn.TabIndex = 24; + this.deleteBtn.Text = "删除"; + this.deleteBtn.UseVisualStyleBackColor = false; + this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click); + // + // WeightView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(287, 259); + this.Controls.Add(this.deleteBtn); + this.Controls.Add(this.label1); + this.Controls.Add(this.taskGrid); + this.Name = "WeightView"; + this.Text = "称重明细"; + ((System.ComponentModel.ISupportInitialize)(this.taskGrid)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private WinFormControl.UDataGridView taskGrid; + private System.Windows.Forms.DataGridViewTextBoxColumn I_No; + private System.Windows.Forms.DataGridViewTextBoxColumn I_Weight; + private System.Windows.Forms.Label label1; + private Controls.ColorButton deleteBtn; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/WeightView.cs b/ButcherFactory.Form/SegmentProductionAuto_/WeightView.cs new file mode 100644 index 0000000..9c14544 --- /dev/null +++ b/ButcherFactory.Form/SegmentProductionAuto_/WeightView.cs @@ -0,0 +1,123 @@ +using ButcherFactory.BO; +using ButcherFactory.Controls; +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.SegmentProductionAuto_ +{ + public partial class WeightView : Form + { + BindingList list; + ClientGoodsSet_Detail goods; + + private SegmentProductionAutoForm form; + + private ButtonTag bTag; + public WeightView() + { + InitializeComponent(); + taskGrid.RowPrePaint += uDataGridView1_RowPrePaint; + taskGrid.CellPainting += uDataGridView1_CellPainting; + + } + + public WeightView(SegmentProductionAutoForm form, ButtonTag bTag) + : this() + { + + this.bTag = bTag; + this.form = form; + goods = ((ClientGoodsSet_Detail)bTag.Button.Tag); + + label1.Text = goods.Goods_Name; + list = new BindingList(); + + var l = new List(0); + if (form.wDic.ContainsKey(goods.Goods_ID)) + { + l = form.wDic[goods.Goods_ID]; + } + int i = 1; + foreach (var item in l) + { + list.Add(new WeightDetail { No = i, Weight = item }); + i++; + } + } + + private void uDataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) + { + //if (e.RowIndex == taskGrid.Rows.Count - 1) + //{ + // var row = taskGrid.Rows[e.RowIndex]; + // row.DefaultCellStyle.SelectionForeColor = Color.Black; + // row.DefaultCellStyle.BackColor = Color.Khaki; + // row.DefaultCellStyle.SelectionBackColor = Color.Khaki; + //} + } + + private void uDataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) + { + var last = taskGrid.Rows.Count - 1; + if (e.RowIndex == last) + { + if (e.ColumnIndex == 0) + { + + } + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + + taskGrid.DataSource = list; + taskGrid.Refresh(); + } + + private void CloseBtn_Click(object sender, EventArgs e) + { + this.Close(); + } + private void taskGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void deleteBtn_Click(object sender, EventArgs e) + { + var row = taskGrid.SelectedRows; + if (row.Count == 0) + return; + if (MessageBox.Show("确定删除选中记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK) + return; + var tag = taskGrid.SelectedRows[0].DataBoundItem as WeightDetail; + if (form.wDic.ContainsKey(goods.Goods_ID)) + { + var l = form.wDic[goods.Goods_ID]; + l.RemoveAt(tag.No - 1); + bTag.Label.MinCount = l.Count; + } + list.Remove(tag); + int i = 1; + foreach (var item in list) + { + item.No = i; + i++; + } + taskGrid.DataSource = list; + taskGrid.ClearSelection(); + + taskGrid.Refresh(); + } + } +} diff --git a/ButcherFactory.Form/SegmentProductionAuto_/WeightView.resx b/ButcherFactory.Form/SegmentProductionAuto_/WeightView.resx new file mode 100644 index 0000000..f6cfbe3 --- /dev/null +++ b/ButcherFactory.Form/SegmentProductionAuto_/WeightView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ButcherFactory.Login/ButcherFactory.Login.csproj b/ButcherFactory.Login/ButcherFactory.Login.csproj index e9c1272..6fcbe0f 100644 --- a/ButcherFactory.Login/ButcherFactory.Login.csproj +++ b/ButcherFactory.Login/ButcherFactory.Login.csproj @@ -94,6 +94,10 @@ {b258c523-269c-4ed7-ab71-7196d5d2ef65} ButcherFactory.BO + + {2485631b-624c-43e0-9287-86fa1c8485fc} + ButcherFactory.Form +