|
|
@ -114,6 +114,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
} |
|
|
} |
|
|
wDic = mCache.Cache; |
|
|
wDic = mCache.Cache; |
|
|
_freshTotalCode = SegmentProductionBL.InitFreshTotalCode(); |
|
|
_freshTotalCode = SegmentProductionBL.InitFreshTotalCode(); |
|
|
|
|
|
_stayTotalCode = SegmentProductionBL.InitStayTotalCode(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void LoadBind() |
|
|
void LoadBind() |
|
|
@ -335,6 +336,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
entity.ProductBatch_ID = batchID.Value; |
|
|
entity.ProductBatch_ID = batchID.Value; |
|
|
entity.StandardPic = detail.StandardPic; |
|
|
entity.StandardPic = detail.StandardPic; |
|
|
entity.GoodsType = detail.GoodsType; |
|
|
entity.GoodsType = detail.GoodsType; |
|
|
|
|
|
entity.NoTotalCode = detail.NoTotalCode; |
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(statisticNumberBox.Text)) |
|
|
if (!string.IsNullOrEmpty(statisticNumberBox.Text)) |
|
|
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); |
|
|
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); |
|
|
@ -344,38 +346,61 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
bool rebuild = false; |
|
|
bool rebuild = false; |
|
|
if (entity.GoodsType == 0) |
|
|
if (entity.GoodsType == 0) |
|
|
{ |
|
|
{ |
|
|
entity.TotalCode_ID = _freshTotalCode.ID; |
|
|
|
|
|
thisTotal = _freshTotalCode; |
|
|
|
|
|
thisPanel = _freshPanel; |
|
|
|
|
|
if (_totalCode.GoodsType != 0) |
|
|
|
|
|
|
|
|
entity.TotalCode_ID = _freshTotalCode.ID; |
|
|
|
|
|
thisTotal = _freshTotalCode; |
|
|
|
|
|
thisPanel = _freshPanel; |
|
|
|
|
|
if (_totalCode.GoodsType != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var bt in codeButtons) |
|
|
{ |
|
|
{ |
|
|
foreach (var bt in codeButtons) |
|
|
|
|
|
{ |
|
|
|
|
|
if (bt.Selected) |
|
|
|
|
|
{ |
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
_codePanel = _freshPanel; |
|
|
|
|
|
_codePanel.Selected = true; |
|
|
|
|
|
_codePanel.Invalidate(); |
|
|
|
|
|
_totalCode = _freshTotalCode; |
|
|
|
|
|
rebuild=true; |
|
|
|
|
|
|
|
|
if (bt.Selected) |
|
|
|
|
|
{ |
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
_codePanel = _freshPanel; |
|
|
|
|
|
_codePanel.Selected = true; |
|
|
|
|
|
_codePanel.Invalidate(); |
|
|
|
|
|
_totalCode = _freshTotalCode; |
|
|
|
|
|
rebuild = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
|
|
|
|
|
|
else if (entity.GoodsType == 1 && entity.NoTotalCode == true) |
|
|
{ |
|
|
{ |
|
|
if (_totalCode == null || _codePanel == null) |
|
|
|
|
|
|
|
|
entity.TotalCode_ID = _stayTotalCode.ID; |
|
|
|
|
|
thisTotal = _stayTotalCode; |
|
|
|
|
|
thisPanel = _stayPanel; |
|
|
|
|
|
if (_totalCode.GoodsType != 1 || _totalCode.NoTotalCode != true) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var bt in codeButtons) |
|
|
{ |
|
|
{ |
|
|
throw new Exception(string.Format("请先选择总码!")); |
|
|
|
|
|
} |
|
|
|
|
|
if(_totalCode.GoodsType==0){ |
|
|
|
|
|
throw new Exception(string.Format("只有鲜品才可以选择鲜品总码!")); |
|
|
|
|
|
|
|
|
if (bt.Selected) |
|
|
|
|
|
{ |
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
entity.TotalCode_ID = _totalCode.ID; |
|
|
|
|
|
thisTotal = _totalCode; |
|
|
|
|
|
thisPanel = _codePanel; |
|
|
|
|
|
|
|
|
_codePanel = _stayPanel; |
|
|
|
|
|
_codePanel.Selected = true; |
|
|
|
|
|
_codePanel.Invalidate(); |
|
|
|
|
|
_totalCode = _stayTotalCode; |
|
|
|
|
|
rebuild = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
if (_totalCode == null || _codePanel == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(string.Format("请先选择总码!")); |
|
|
|
|
|
} |
|
|
|
|
|
if (_totalCode.GoodsType == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(string.Format("只有鲜品才可以选择鲜品总码!")); |
|
|
|
|
|
} |
|
|
|
|
|
entity.TotalCode_ID = _totalCode.ID; |
|
|
|
|
|
thisTotal = _totalCode; |
|
|
|
|
|
thisPanel = _codePanel; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); |
|
|
SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); |
|
|
@ -499,16 +524,16 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
foreach (var item in allCode) |
|
|
foreach (var item in allCode) |
|
|
{ |
|
|
{ |
|
|
if (item.GoodsType == 0) |
|
|
|
|
|
|
|
|
if (item.GoodsType == 0 || (item.GoodsType == 1 && item.NoTotalCode == true)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (deleteList.Contains(item.ID)) |
|
|
|
|
|
{ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (deleteList.Contains(item.ID)) |
|
|
|
|
|
{ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var n = new ColorButton(); |
|
|
var n = new ColorButton(); |
|
|
@ -561,31 +586,55 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
foreach (var item2 in groupByTotal) |
|
|
foreach (var item2 in groupByTotal) |
|
|
{ |
|
|
{ |
|
|
var d = item2.FirstOrDefault(); |
|
|
var d = item2.FirstOrDefault(); |
|
|
|
|
|
|
|
|
//鲜品不删除总码
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//鲜品不删除总码
|
|
|
if (d.GoodsType == 0) |
|
|
if (d.GoodsType == 0) |
|
|
{ |
|
|
{ |
|
|
if (_freshPanel != null) |
|
|
|
|
|
|
|
|
if (_freshPanel != null) |
|
|
|
|
|
{ |
|
|
|
|
|
var list = new List<ColorButton>(); |
|
|
|
|
|
foreach (var t in item2) |
|
|
{ |
|
|
{ |
|
|
var list=new List<ColorButton>(); |
|
|
|
|
|
foreach (var t in item2) |
|
|
|
|
|
|
|
|
foreach (ColorButton item in flowLayoutPanel4.Controls) |
|
|
|
|
|
{ |
|
|
|
|
|
var tagItem = (SegmentProduction)item.Tag; |
|
|
|
|
|
if (tagItem.BarCode == t.BarCode) |
|
|
{ |
|
|
{ |
|
|
foreach (ColorButton item in flowLayoutPanel4.Controls) |
|
|
|
|
|
{ |
|
|
|
|
|
var tagItem = (SegmentProduction)item.Tag; |
|
|
|
|
|
if (tagItem.BarCode == t.BarCode) |
|
|
|
|
|
{ |
|
|
|
|
|
list.Add(item) ; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
list.Add(item); |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
foreach (var item in list) |
|
|
|
|
|
{ |
|
|
|
|
|
flowLayoutPanel4.Controls.Remove(item); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
foreach (var item in list) |
|
|
|
|
|
{ |
|
|
|
|
|
flowLayoutPanel4.Controls.Remove(item); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
else if (d.GoodsType == 1 && d.NoTotalCode == true)//暂存区不删除总码
|
|
|
|
|
|
{ |
|
|
|
|
|
if (_stayPanel != null) |
|
|
|
|
|
{ |
|
|
|
|
|
var list = new List<ColorButton>(); |
|
|
|
|
|
foreach (var t in item2) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (ColorButton item in flowLayoutPanel4.Controls) |
|
|
|
|
|
{ |
|
|
|
|
|
var tagItem = (SegmentProduction)item.Tag; |
|
|
|
|
|
if (tagItem.BarCode == t.BarCode) |
|
|
|
|
|
{ |
|
|
|
|
|
list.Add(item); |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
foreach (var item in list) |
|
|
|
|
|
{ |
|
|
|
|
|
flowLayoutPanel4.Controls.Remove(item); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
continue; |
|
|
} |
|
|
} |
|
|
var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key); |
|
|
var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key); |
|
|
if (f != null) |
|
|
if (f != null) |
|
|
@ -706,8 +755,13 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
} |
|
|
} |
|
|
if (_totalCode.GoodsType == 0) |
|
|
if (_totalCode.GoodsType == 0) |
|
|
{ |
|
|
{ |
|
|
MessageBox.Show("鲜品总码不允许删除"); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
MessageBox.Show("鲜品总码不允许删除"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
else if (_totalCode.GoodsType == 1 && _totalCode.NoTotalCode == true) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBox.Show("暂存区总码不允许删除"); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
SegmentProductionBL.DeleteTotalCode(_totalCode); |
|
|
SegmentProductionBL.DeleteTotalCode(_totalCode); |
|
|
allCode.Remove(_totalCode); |
|
|
allCode.Remove(_totalCode); |
|
|
@ -802,8 +856,10 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
|
|
|
|
|
ColorButton _codePanel; |
|
|
ColorButton _codePanel; |
|
|
ColorButton _freshPanel; |
|
|
ColorButton _freshPanel; |
|
|
|
|
|
ColorButton _stayPanel; |
|
|
TotalCode _totalCode; |
|
|
TotalCode _totalCode; |
|
|
TotalCode _freshTotalCode; |
|
|
TotalCode _freshTotalCode; |
|
|
|
|
|
TotalCode _stayTotalCode; |
|
|
|
|
|
|
|
|
private void colorButton1_Click(object sender, EventArgs e) |
|
|
private void colorButton1_Click(object sender, EventArgs e) |
|
|
{ |
|
|
{ |
|
|
@ -814,7 +870,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
AddCodeButton(n, tCode,true); |
|
|
AddCodeButton(n, tCode,true); |
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
flowLayoutPanel4.Controls.Clear(); |
|
|
flowLayoutPanel3.Controls.Add(n); |
|
|
flowLayoutPanel3.Controls.Add(n); |
|
|
flowLayoutPanel3.Controls.SetChildIndex(n, 1); |
|
|
|
|
|
|
|
|
flowLayoutPanel3.Controls.SetChildIndex(n, 2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void AddCodeButton(ColorButton n, TotalCode tCode, bool add = false) |
|
|
private void AddCodeButton(ColorButton n, TotalCode tCode, bool add = false) |
|
|
@ -822,11 +878,16 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
n .Tag = tCode; |
|
|
n .Tag = tCode; |
|
|
if (tCode.GoodsType == 0) |
|
|
if (tCode.GoodsType == 0) |
|
|
{ |
|
|
{ |
|
|
n .Text ="鲜品"; |
|
|
|
|
|
_freshPanel = n; |
|
|
|
|
|
|
|
|
n.Text = "鲜品"; |
|
|
|
|
|
_freshPanel = n; |
|
|
|
|
|
} |
|
|
|
|
|
else if (tCode.GoodsType == 1 && tCode.NoTotalCode == true) |
|
|
|
|
|
{ |
|
|
|
|
|
n.Text = "暂存区"; |
|
|
|
|
|
_stayPanel = n; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
n .Text = tCode.ShortCode; |
|
|
|
|
|
|
|
|
n.Text = tCode.ShortCode; |
|
|
n .Click += delegate |
|
|
n .Click += delegate |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|