diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index af4b3ee..f71cac4 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -37,7 +37,8 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("MainUnit")); query.Columns.Add(DQSelectColumn.Field("TotalCode_ID")); query.Columns.Add(DQSelectColumn.Field("TotalCode_Code")); - query.Columns.Add(DQSelectColumn.Field("CreateTime")); + query.Columns.Add(DQSelectColumn.Field("CreateTime")); + query.Columns.Add(DQSelectColumn.Field("GoodsType")); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("InStored", false), DQCondition.EQ("Delete", false), DQCondition.EQ("Submited", submited))); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); if (submited) @@ -70,6 +71,7 @@ namespace ButcherFactory.BO.LocalBL entity.TotalCode_ID = (long)reader[13]; entity.TotalCode_Code = (string)reader[14]; entity.CreateTime = (DateTime)reader[15]; + entity.GoodsType = (short?)reader[16]; list.Add(entity); } } diff --git a/ButcherFactory.Form/Controls/CodePanel.cs b/ButcherFactory.Form/Controls/CodePanel.cs index bc983e3..6d53838 100644 --- a/ButcherFactory.Form/Controls/CodePanel.cs +++ b/ButcherFactory.Form/Controls/CodePanel.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ButcherFactory.BO; namespace ButcherFactory.Controls { @@ -26,5 +27,23 @@ namespace ButcherFactory.Controls flowLayoutPanel1.Controls.SetChildIndex(v, 0); } } + + internal void RemoveBar(string barCode) + { + ColorButton target = null; + foreach (ColorButton item in flowLayoutPanel1.Controls) + { + var tag = (SegmentProduction)item.Tag; + if (tag.BarCode == barCode) + { + target = item; + break; + } + } + if (target != null) + { + flowLayoutPanel1.Controls.Remove(target); + } + } } } diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index c50bf74..354727b 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -513,10 +513,11 @@ namespace ButcherFactory.SegmentProductionAuto_ try { if (netStateWatch1.NetState) - SegmentProductionBL.UploadSegmentInfo(); - + SegmentProductionBL.UploadSegmentInfo(); + } + catch { + } - catch { } Thread.Sleep(2000); } } @@ -547,13 +548,25 @@ namespace ButcherFactory.SegmentProductionAuto_ var groupByTotal = tag.GroupBy(x => x.TotalCode_ID); foreach (var item2 in groupByTotal) { + var d = item2.FirstOrDefault(); + //鲜品不删除总码 + if (d.GoodsType == 0) + { + if (_freshPanel != null) + { + foreach (var t in item2) + { + _freshPanel.RemoveBar(t.BarCode); + } + } + continue; + } var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key); if (f != null) { flowLayoutPanel3.Controls.Remove(f.Parent); codeButtons.Remove(f); - } - + } } foreach (var item in tag)