|
|
@ -355,131 +355,141 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void InsertSegmentProduction(ClientGoodsSet_Detail detail, decimal weight) |
|
|
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 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++) |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
entity.GoodsType = detail.GoodsType; |
|
|
|
|
|
entity.NoTotalCode = detail.NoTotalCode; |
|
|
|
|
|
if (detail.SelectedIdentify != null) |
|
|
{ |
|
|
{ |
|
|
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; |
|
|
|
|
|
entity.GoodsType = detail.GoodsType; |
|
|
|
|
|
entity.NoTotalCode = detail.NoTotalCode; |
|
|
|
|
|
if (detail.SelectedIdentify != null) |
|
|
|
|
|
{ |
|
|
|
|
|
entity.Identify = detail.SelectedIdentify.Identify; |
|
|
|
|
|
entity.IdentifyRemark = detail.SelectedIdentify.Remark; |
|
|
|
|
|
} |
|
|
|
|
|
if (!string.IsNullOrEmpty(statisticNumberBox.Text)) |
|
|
|
|
|
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); |
|
|
|
|
|
|
|
|
entity.Identify = detail.SelectedIdentify.Identify; |
|
|
|
|
|
entity.IdentifyRemark = detail.SelectedIdentify.Remark; |
|
|
|
|
|
} |
|
|
|
|
|
if (!string.IsNullOrEmpty(statisticNumberBox.Text)) |
|
|
|
|
|
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); |
|
|
|
|
|
|
|
|
TotalCode thisTotal = null; |
|
|
|
|
|
ColorButton thisPanel; |
|
|
|
|
|
bool rebuild = false; |
|
|
|
|
|
if (entity.GoodsType == 0) |
|
|
|
|
|
|
|
|
TotalCode thisTotal = null; |
|
|
|
|
|
ColorButton thisPanel; |
|
|
|
|
|
bool rebuild = false; |
|
|
|
|
|
if (entity.GoodsType == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
entity.TotalCode_ID = _freshTotalCode.ID; |
|
|
|
|
|
thisTotal = _freshTotalCode; |
|
|
|
|
|
thisPanel = _freshPanel; |
|
|
|
|
|
if (_totalCode == null || _totalCode.GoodsType != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var bt in codeButtons) |
|
|
{ |
|
|
{ |
|
|
entity.TotalCode_ID = _freshTotalCode.ID; |
|
|
|
|
|
thisTotal = _freshTotalCode; |
|
|
|
|
|
thisPanel = _freshPanel; |
|
|
|
|
|
if (_totalCode == null || _totalCode.GoodsType != 0) |
|
|
|
|
|
|
|
|
if (bt.Selected) |
|
|
{ |
|
|
{ |
|
|
foreach (var bt in codeButtons) |
|
|
|
|
|
{ |
|
|
|
|
|
if (bt.Selected) |
|
|
|
|
|
{ |
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
_codePanel = _freshPanel; |
|
|
|
|
|
_codePanel.Selected = true; |
|
|
|
|
|
_codePanel.Invalidate(); |
|
|
|
|
|
_totalCode = _freshTotalCode; |
|
|
|
|
|
rebuild = true; |
|
|
|
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if (entity.GoodsType == 1 && entity.NoTotalCode) |
|
|
|
|
|
|
|
|
_codePanel = _freshPanel; |
|
|
|
|
|
_codePanel.Selected = true; |
|
|
|
|
|
_codePanel.Invalidate(); |
|
|
|
|
|
_totalCode = _freshTotalCode; |
|
|
|
|
|
rebuild = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if (entity.GoodsType == 1 && entity.NoTotalCode) |
|
|
|
|
|
{ |
|
|
|
|
|
entity.TotalCode_ID = _stayTotalCode.ID; |
|
|
|
|
|
thisTotal = _stayTotalCode; |
|
|
|
|
|
thisPanel = _stayPanel; |
|
|
|
|
|
if (_totalCode == null || _totalCode.GoodsType != 1 || !_totalCode.NoTotalCode) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var bt in codeButtons) |
|
|
{ |
|
|
{ |
|
|
entity.TotalCode_ID = _stayTotalCode.ID; |
|
|
|
|
|
thisTotal = _stayTotalCode; |
|
|
|
|
|
thisPanel = _stayPanel; |
|
|
|
|
|
if (_totalCode == null || _totalCode.GoodsType != 1 || !_totalCode.NoTotalCode) |
|
|
|
|
|
|
|
|
if (bt.Selected) |
|
|
{ |
|
|
{ |
|
|
foreach (var bt in codeButtons) |
|
|
|
|
|
{ |
|
|
|
|
|
if (bt.Selected) |
|
|
|
|
|
{ |
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
_codePanel = _stayPanel; |
|
|
|
|
|
_codePanel.Selected = true; |
|
|
|
|
|
_codePanel.Invalidate(); |
|
|
|
|
|
_totalCode = _stayTotalCode; |
|
|
|
|
|
rebuild = true; |
|
|
|
|
|
|
|
|
bt.Selected = false; |
|
|
|
|
|
bt.Invalidate(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
if (_totalCode == null || _codePanel == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(string.Format("请先选择总码!")); |
|
|
|
|
|
} |
|
|
|
|
|
if (_totalCode.GoodsType == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(string.Format("只有鲜品才可以选择鲜品总码!")); |
|
|
|
|
|
} |
|
|
|
|
|
else if (_totalCode.GoodsType == 1 && _totalCode.NoTotalCode) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(string.Format("冻品只有暂存区产品才能选择暂存区!")); |
|
|
|
|
|
} |
|
|
|
|
|
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("只有鲜品才可以选择鲜品总码!")); |
|
|
|
|
|
} |
|
|
|
|
|
else if (_totalCode.GoodsType == 1 && _totalCode.NoTotalCode) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception(string.Format("冻品只有暂存区产品才能选择暂存区!")); |
|
|
|
|
|
} |
|
|
|
|
|
entity.TotalCode_ID = _totalCode.ID; |
|
|
|
|
|
thisTotal = _totalCode; |
|
|
|
|
|
thisPanel = _codePanel; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
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(rebuild){ |
|
|
|
|
|
BindflowLayoutPanel(thisPanel, thisTotal); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var c = initSegmentBt(entity, thisPanel, thisTotal); |
|
|
|
|
|
|
|
|
|
|
|
flowLayoutPanel4.Controls.Add(c); |
|
|
|
|
|
flowLayoutPanel4.Controls.SetChildIndex(c, 0); |
|
|
|
|
|
|
|
|
|
|
|
historyList.Insert(0, entity); |
|
|
|
|
|
|
|
|
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 (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)
|
|
|
|
|
|
// historyList.RemoveAt(30);
|
|
|
|
|
|
if (barPrintCheck.Checked) |
|
|
|
|
|
|
|
|
//if (historyList.Count > 30)
|
|
|
|
|
|
// historyList.RemoveAt(30);
|
|
|
|
|
|
if (barPrintCheck.Checked) |
|
|
|
|
|
{ |
|
|
|
|
|
var template = config.Template; |
|
|
|
|
|
string cd = null; |
|
|
|
|
|
if (detail.GoodsType.HasValue) |
|
|
|
|
|
{ |
|
|
|
|
|
if (detail.GoodsType == 0) |
|
|
|
|
|
template = "SegmentProductionPrint.html"; |
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
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); |
|
|
|
|
|
|
|
|
cd = detail.Goods_CustomerDefine; |
|
|
|
|
|
template = "SegmentProductionPrint1.html"; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
NotAuto.SegmentProductionPrint.Print(entity, batchDate, template, cd); |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); |
|
|
|
|
|
thd.Start(entity); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
GoodsLabel.Text = detail.Goods_Name; |
|
|
|
|
|
|
|
|
|
|
|
var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); |
|
|
|
|
|
thd.Start(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SegmentProduction current; |
|
|
SegmentProduction current; |
|
|
@ -741,16 +751,25 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
if (historyList.Count == 0) |
|
|
if (historyList.Count == 0) |
|
|
throw new Exception("请先选择要补打的记录"); |
|
|
throw new Exception("请先选择要补打的记录"); |
|
|
SegmentProduction item; |
|
|
SegmentProduction item; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (current != null) |
|
|
if (current != null) |
|
|
item = current; |
|
|
|
|
|
|
|
|
item = current; |
|
|
else |
|
|
else |
|
|
item = historyList.First(); |
|
|
|
|
|
|
|
|
item = historyList.First(); |
|
|
var template = config.Template; |
|
|
var template = config.Template; |
|
|
var goodsType = SegmentProductionBL.GetGoodsType(item.Goods_ID); |
|
|
|
|
|
if (goodsType.HasValue) |
|
|
|
|
|
template = goodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html"; |
|
|
|
|
|
NotAuto.SegmentProductionPrint.Print(item, batchDate, template); |
|
|
|
|
|
|
|
|
var goodsInfo = SegmentProductionBL.GetGoodsInfo(item.Goods_ID); |
|
|
|
|
|
string cd = null; |
|
|
|
|
|
if (goodsInfo != null && goodsInfo.Item1.HasValue) |
|
|
|
|
|
{ |
|
|
|
|
|
if (goodsInfo.Item1 == 0) |
|
|
|
|
|
template = "SegmentProductionPrint.html"; |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
cd = goodsInfo.Item2; |
|
|
|
|
|
template = "SegmentProductionPrint1.html"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
NotAuto.SegmentProductionPrint.Print(item, batchDate, template, cd); |
|
|
var log = new SegmentLog(item.BarCode, "补打"); |
|
|
var log = new SegmentLog(item.BarCode, "补打"); |
|
|
log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", item.Goods_Name, item.Weight); |
|
|
log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", item.Goods_Name, item.Weight); |
|
|
SegmentProductionBL.InsertLog(log); |
|
|
SegmentProductionBL.InsertLog(log); |
|
|
|