|
|
|
@ -348,12 +348,29 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); |
|
|
|
|
|
|
|
TotalCode thisTotal = null; |
|
|
|
CodePanel thisPanel; |
|
|
|
ColorButton thisPanel; |
|
|
|
bool rebuild = false; |
|
|
|
if (entity.GoodsType == 0) |
|
|
|
{ |
|
|
|
entity.TotalCode_ID = _freshTotalCode.ID; |
|
|
|
thisTotal = _freshTotalCode; |
|
|
|
thisPanel = _freshPanel; |
|
|
|
if (_totalCode.GoodsType != 0) |
|
|
|
{ |
|
|
|
foreach (var bt in codeButtons) |
|
|
|
{ |
|
|
|
if (bt.Selected) |
|
|
|
{ |
|
|
|
bt.Selected = false; |
|
|
|
bt.Invalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
_codePanel = _freshPanel; |
|
|
|
_codePanel.Selected = true; |
|
|
|
_codePanel.Invalidate(); |
|
|
|
_totalCode = _freshTotalCode; |
|
|
|
rebuild=true; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -375,9 +392,15 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
entity.Goods_Spec = detail.Goods_Spec; |
|
|
|
entity.MainUnit = detail.MainUnit; |
|
|
|
entity.ShotPrintName = detail.ShotPrintName; |
|
|
|
|
|
|
|
thisPanel.Add(initSegmentBt(entity, thisPanel, thisTotal), true); |
|
|
|
if(rebuild){ |
|
|
|
BindflowLayoutPanel(thisPanel, thisTotal); |
|
|
|
} |
|
|
|
|
|
|
|
var c = initSegmentBt(entity, thisPanel, thisTotal); |
|
|
|
|
|
|
|
flowLayoutPanel4.Controls.Add(c); |
|
|
|
flowLayoutPanel4.Controls.SetChildIndex(c, 0); |
|
|
|
|
|
|
|
historyList.Insert(0, entity); |
|
|
|
|
|
|
|
if (historyList.Count > 30) |
|
|
|
@ -401,7 +424,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
|
|
|
|
SegmentProduction current; |
|
|
|
ColorButton _labelBt; |
|
|
|
private ColorButton initSegmentBt(SegmentProduction entity, CodePanel parent, TotalCode tCode) |
|
|
|
private ColorButton initSegmentBt(SegmentProduction entity, ColorButton parent, TotalCode tCode) |
|
|
|
{ |
|
|
|
var bt = new ColorButton() { Text = entity.ShortCode }; |
|
|
|
bt.Tag = entity; |
|
|
|
@ -422,11 +445,11 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
GoodsLabel.Text = entity.Goods_Name; |
|
|
|
if (_codePanel != null) |
|
|
|
{ |
|
|
|
_codePanel.Button.Selected = false; |
|
|
|
_codePanel.Button.Invalidate(); |
|
|
|
_codePanel. Selected = false; |
|
|
|
_codePanel. Invalidate(); |
|
|
|
} |
|
|
|
parent.Button.Selected = true; |
|
|
|
parent.Button.Invalidate(); |
|
|
|
parent .Selected = true; |
|
|
|
parent. Invalidate(); |
|
|
|
_totalCode = tCode; |
|
|
|
_codePanel = parent; |
|
|
|
} |
|
|
|
@ -481,6 +504,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
{ |
|
|
|
flowLayoutPanel3.Controls.Clear(); |
|
|
|
codeButtons.Clear(); |
|
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
|
foreach (var item in allCode) |
|
|
|
{ |
|
|
|
if (item.GoodsType == 0) |
|
|
|
@ -494,14 +518,10 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var details = historyList.Where(x => x.TotalCode_ID == item.ID); |
|
|
|
var n = new CodePanel(); |
|
|
|
|
|
|
|
var n = new ColorButton(); |
|
|
|
AddCodeButton(n, item); |
|
|
|
foreach (var seg in details) |
|
|
|
{ |
|
|
|
n.Add(initSegmentBt(seg,n,item)); |
|
|
|
} |
|
|
|
|
|
|
|
flowLayoutPanel3.Controls.Add(n); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -549,24 +569,42 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
foreach (var item2 in groupByTotal) |
|
|
|
{ |
|
|
|
var d = item2.FirstOrDefault(); |
|
|
|
|
|
|
|
//鲜品不删除总码
|
|
|
|
if (d.GoodsType == 0) |
|
|
|
{ |
|
|
|
if (_freshPanel != null) |
|
|
|
{ |
|
|
|
var list=new List<ColorButton>(); |
|
|
|
foreach (var t in item2) |
|
|
|
{ |
|
|
|
_freshPanel.RemoveBar(t.BarCode); |
|
|
|
} |
|
|
|
foreach (ColorButton item in flowLayoutPanel4.Controls) |
|
|
|
{ |
|
|
|
var tagItem = (SegmentProduction)item.Tag; |
|
|
|
if (tagItem.BarCode == t.BarCode) |
|
|
|
{ |
|
|
|
list.Add(item) ; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (var item in list) |
|
|
|
{ |
|
|
|
flowLayoutPanel4.Controls.Remove(item); |
|
|
|
} |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key); |
|
|
|
if (f != null) |
|
|
|
{ |
|
|
|
flowLayoutPanel3.Controls.Remove(f.Parent); |
|
|
|
flowLayoutPanel3.Controls.Remove(f); |
|
|
|
codeButtons.Remove(f); |
|
|
|
} |
|
|
|
if (_codePanel != null && _totalCode.ID == item2.Key) |
|
|
|
{ |
|
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var item in tag) |
|
|
|
@ -661,9 +699,14 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
MessageBox.Show("总码下已有条码,不允许直接删除总码"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (_totalCode.GoodsType == 0) |
|
|
|
{ |
|
|
|
MessageBox.Show("鲜品总码不允许删除"); |
|
|
|
return; |
|
|
|
} |
|
|
|
SegmentProductionBL.DeleteTotalCode(_totalCode); |
|
|
|
allCode.Remove(_totalCode); |
|
|
|
codeButtons.Remove(_codePanel.Button); |
|
|
|
codeButtons.Remove(_codePanel ); |
|
|
|
foreach (var item in deleteList) |
|
|
|
{ |
|
|
|
historyList.Remove(item); |
|
|
|
@ -676,9 +719,10 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
if (allCode.Count > 0) |
|
|
|
{ |
|
|
|
_totalCode = allCode[0]; |
|
|
|
_codePanel = (CodePanel)flowLayoutPanel3.Controls[0]; |
|
|
|
_codePanel.Button.Selected = true; |
|
|
|
_codePanel.Button.Invalidate(); |
|
|
|
_codePanel = (ColorButton)flowLayoutPanel3.Controls[0]; |
|
|
|
_codePanel.Selected = true; |
|
|
|
_codePanel.Invalidate(); |
|
|
|
BindflowLayoutPanel(_codePanel, _totalCode); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -750,37 +794,39 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
CodePanel _codePanel; |
|
|
|
CodePanel _freshPanel; |
|
|
|
|
|
|
|
ColorButton _codePanel; |
|
|
|
ColorButton _freshPanel; |
|
|
|
TotalCode _totalCode; |
|
|
|
TotalCode _freshTotalCode; |
|
|
|
|
|
|
|
private void colorButton1_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
var n = new CodePanel(); |
|
|
|
var n = new ColorButton(); |
|
|
|
|
|
|
|
var tCode = SegmentProductionBL.InsertTotalCode(new TotalCode()); |
|
|
|
allCode.Insert(0, tCode); |
|
|
|
AddCodeButton(n, tCode,true); |
|
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
|
flowLayoutPanel3.Controls.Add(n); |
|
|
|
flowLayoutPanel3.Controls.SetChildIndex(n, 1); |
|
|
|
} |
|
|
|
|
|
|
|
private void AddCodeButton(CodePanel n, TotalCode tCode,bool add=false) |
|
|
|
private void AddCodeButton(ColorButton n, TotalCode tCode, bool add = false) |
|
|
|
{ |
|
|
|
n.Button.Tag = tCode; |
|
|
|
n .Tag = tCode; |
|
|
|
if (tCode.GoodsType == 0) |
|
|
|
{ |
|
|
|
n.Button.Text ="鲜品"; |
|
|
|
n .Text ="鲜品"; |
|
|
|
_freshPanel = n; |
|
|
|
} |
|
|
|
else |
|
|
|
n.Button.Text = tCode.ShortCode; |
|
|
|
n.Button.Click += delegate |
|
|
|
n .Text = tCode.ShortCode; |
|
|
|
n .Click += delegate |
|
|
|
{ |
|
|
|
|
|
|
|
n.Button.Selected = !n.Button.Selected; |
|
|
|
if (n.Button.Selected) |
|
|
|
n .Selected = !n.Selected; |
|
|
|
if (n .Selected) |
|
|
|
{ |
|
|
|
current = null; |
|
|
|
_codePanel = n; |
|
|
|
@ -791,15 +837,18 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
_labelBt.Invalidate(); |
|
|
|
} |
|
|
|
_labelBt = null; |
|
|
|
|
|
|
|
BindflowLayoutPanel(n, tCode); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
|
_codePanel = null; |
|
|
|
_totalCode = null; |
|
|
|
} |
|
|
|
foreach (var bt in codeButtons) |
|
|
|
{ |
|
|
|
if (bt.Text != n.Button.Text && bt.Selected) |
|
|
|
if (bt.Text != n.Text && bt.Selected) |
|
|
|
{ |
|
|
|
bt.Selected = false; |
|
|
|
bt.Invalidate(); |
|
|
|
@ -810,7 +859,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
if (add) |
|
|
|
{ |
|
|
|
_codePanel = n; |
|
|
|
n.Button.Selected = true; |
|
|
|
n .Selected = true; |
|
|
|
_totalCode = tCode; |
|
|
|
foreach (var bt in codeButtons) |
|
|
|
{ |
|
|
|
@ -821,7 +870,27 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
codeButtons.Add(n.Button); |
|
|
|
n.BackColor = Color.LightGray; |
|
|
|
n.Font = new Font("黑体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
|
|
|
n.ForeColor = Color.Black; |
|
|
|
// n.Location = new Point(3, 3);
|
|
|
|
//n.Name = "Button";
|
|
|
|
n.SelectedColor = Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); |
|
|
|
n.Size = new Size(99, 40); |
|
|
|
//n.TabIndex = 1;
|
|
|
|
n.UseVisualStyleBackColor = false; |
|
|
|
|
|
|
|
codeButtons.Add(n ); |
|
|
|
} |
|
|
|
|
|
|
|
private void BindflowLayoutPanel(ColorButton tButton, TotalCode tCode) |
|
|
|
{ |
|
|
|
var details = historyList.Where(x => x.TotalCode_ID == tCode.ID); |
|
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
|
foreach (var d in details) |
|
|
|
{ |
|
|
|
flowLayoutPanel4.Controls.Add(initSegmentBt(d, tButton, tCode)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void colorButton2_Click(object sender, EventArgs e) |
|
|
|
@ -844,5 +913,14 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
log.Message = string.Format("总码:{0} ", dmos[0].TotalCode_Code); |
|
|
|
SegmentProductionBL.InsertLog(log); |
|
|
|
} |
|
|
|
|
|
|
|
private void colorButton3_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
var msg= SegmentProductionBL.UploadSegmentInfo(true); |
|
|
|
if (!string.IsNullOrEmpty(msg)) |
|
|
|
{ |
|
|
|
MessageBox.Show(msg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |