|
|
|
@ -90,7 +90,8 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
if (checkInStoreState != null && checkInStoreState.IsAlive) |
|
|
|
checkInStoreState.Abort(); |
|
|
|
} |
|
|
|
public WeightDetails mCache; |
|
|
|
public WeightDetails mCache; |
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e) |
|
|
|
{ |
|
|
|
base.OnLoad(e); |
|
|
|
@ -120,7 +121,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
mCache.Cache.Remove(v); |
|
|
|
} |
|
|
|
wDic = mCache.Cache; |
|
|
|
|
|
|
|
_freshTotalCode = SegmentProductionBL.InitFreshTotalCode(); |
|
|
|
} |
|
|
|
|
|
|
|
void LoadBind() |
|
|
|
@ -213,32 +214,46 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
{ |
|
|
|
bTag.Label.Text = string.Format("{0}-0", item.EachNumber.Value); |
|
|
|
} |
|
|
|
ClientGoodsSet_Detail g = item; |
|
|
|
bTag.Button.Click += delegate |
|
|
|
{ |
|
|
|
if (batchID == null) |
|
|
|
throw new Exception("请先选择批次"); |
|
|
|
if (_totalCode == null || _codePanel == null) |
|
|
|
if (batchID == null) { |
|
|
|
MessageBox.Show("请先选择批次!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (g.GoodsType == 1) |
|
|
|
{ |
|
|
|
throw new Exception(string.Format("请先选择总码!")); |
|
|
|
if (_totalCode == null || _codePanel == null) |
|
|
|
{ |
|
|
|
MessageBox.Show("请先选择总码!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var weight = uWeightControl1.Weight; |
|
|
|
#if DEBUG
|
|
|
|
if (weight == 0) |
|
|
|
weight = (item.StandardWeightLow ?? 4.0m) + 0.1m; |
|
|
|
weight = (g.StandardWeightLow ?? 4.0m) + 0.1m; |
|
|
|
#endif
|
|
|
|
if (weight == 0) |
|
|
|
throw new Exception("重量不能为0"); |
|
|
|
if (item.StandardWeight.HasValue) |
|
|
|
{ |
|
|
|
MessageBox.Show("重量不能为0"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (g.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; |
|
|
|
if (weight < (g.StandardWeightLow ?? 0) || weight > (g.StandardWeightUp ?? 0)) |
|
|
|
{ |
|
|
|
MessageBox.Show(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", g.StandardWeightLow, g.StandardWeightUp)); |
|
|
|
return; |
|
|
|
} |
|
|
|
weight = g.StandardWeight.Value; |
|
|
|
} |
|
|
|
List<decimal> l = null; |
|
|
|
if (wDic.ContainsKey(item.Goods_ID)) |
|
|
|
if (wDic.ContainsKey(g.Goods_ID)) |
|
|
|
{ |
|
|
|
l = wDic[item.Goods_ID]; |
|
|
|
if (l.Count >= item.EachNumber.Value) |
|
|
|
l = wDic[g.Goods_ID]; |
|
|
|
if (l.Count >= g.EachNumber.Value) |
|
|
|
{ |
|
|
|
l.Clear(); |
|
|
|
} |
|
|
|
@ -246,13 +261,13 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
wDic.Add(item.Goods_ID, l = new List<decimal>() { weight }); |
|
|
|
wDic.Add(g.Goods_ID, l = new List<decimal>() { weight }); |
|
|
|
} |
|
|
|
bTag.Label.MinCount = l.Count(); |
|
|
|
if (l.Count >= item.EachNumber.Value) |
|
|
|
if (l.Count >= g.EachNumber.Value) |
|
|
|
{ |
|
|
|
weight = l.Sum(x => x); |
|
|
|
InsertSegmentProduction(item, weight); |
|
|
|
InsertSegmentProduction(g, weight); |
|
|
|
} |
|
|
|
mCache.Cache = wDic; |
|
|
|
XmlUtil.SerializerObjToFile(mCache); |
|
|
|
@ -261,9 +276,9 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
bTag.Label.Click += delegate |
|
|
|
{ |
|
|
|
List<decimal> l = new List<decimal>(0); |
|
|
|
if (wDic.ContainsKey(item.Goods_ID)) |
|
|
|
if (wDic.ContainsKey(g.Goods_ID)) |
|
|
|
{ |
|
|
|
l = wDic[item.Goods_ID]; |
|
|
|
l = wDic[g.Goods_ID]; |
|
|
|
} |
|
|
|
new WeightView(this, bTag).ShowDialog(); |
|
|
|
}; |
|
|
|
@ -327,13 +342,33 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
entity.WorkUnit_ID = config.WorkUnitID; |
|
|
|
entity.ProductBatch_ID = batchID.Value; |
|
|
|
entity.StandardPic = detail.StandardPic; |
|
|
|
entity.GoodsType = detail.GoodsType; |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(statisticNumberBox.Text)) |
|
|
|
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); |
|
|
|
if (_totalCode == null || _codePanel==null) |
|
|
|
|
|
|
|
TotalCode thisTotal = null; |
|
|
|
CodePanel thisPanel; |
|
|
|
if (entity.GoodsType == 0) |
|
|
|
{ |
|
|
|
throw new Exception(string.Format("请先选择总码!" )); |
|
|
|
entity.TotalCode_ID = _freshTotalCode.ID; |
|
|
|
thisTotal = _freshTotalCode; |
|
|
|
thisPanel = _freshPanel; |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
entity.TotalCode_ID = _totalCode.ID; |
|
|
|
|
|
|
|
SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); |
|
|
|
entity.Goods_Code = detail.Goods_Code; |
|
|
|
entity.Goods_Name = detail.Goods_Name; |
|
|
|
@ -341,7 +376,7 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
entity.MainUnit = detail.MainUnit; |
|
|
|
entity.ShotPrintName = detail.ShotPrintName; |
|
|
|
|
|
|
|
_codePanel.Add(initSegmentBt(entity, _codePanel,_totalCode),true); |
|
|
|
thisPanel.Add(initSegmentBt(entity, thisPanel, thisTotal), true); |
|
|
|
|
|
|
|
historyList.Insert(0, entity); |
|
|
|
|
|
|
|
@ -448,10 +483,18 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
codeButtons.Clear(); |
|
|
|
foreach (var item in allCode) |
|
|
|
{ |
|
|
|
if (deleteList.Contains(item.ID)) |
|
|
|
if (item.GoodsType == 0) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
continue; |
|
|
|
if (deleteList.Contains(item.ID)) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var details = historyList.Where(x => x.TotalCode_ID == item.ID); |
|
|
|
var n = new CodePanel(); |
|
|
|
AddCodeButton(n, item); |
|
|
|
@ -468,12 +511,10 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
//this.Invoke(new Action(() =>
|
|
|
|
//{
|
|
|
|
{ |
|
|
|
if (netStateWatch1.NetState) |
|
|
|
SegmentProductionBL.UploadSegmentInfo(); |
|
|
|
//}));
|
|
|
|
|
|
|
|
} |
|
|
|
catch { } |
|
|
|
Thread.Sleep(2000); |
|
|
|
@ -698,7 +739,9 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
} |
|
|
|
|
|
|
|
CodePanel _codePanel; |
|
|
|
CodePanel _freshPanel; |
|
|
|
TotalCode _totalCode; |
|
|
|
TotalCode _freshTotalCode; |
|
|
|
private void colorButton1_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
var n = new CodePanel(); |
|
|
|
@ -707,13 +750,19 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
allCode.Insert(0, tCode); |
|
|
|
AddCodeButton(n, tCode,true); |
|
|
|
flowLayoutPanel3.Controls.Add(n); |
|
|
|
flowLayoutPanel3.Controls.SetChildIndex(n, 0); |
|
|
|
flowLayoutPanel3.Controls.SetChildIndex(n, 1); |
|
|
|
} |
|
|
|
|
|
|
|
private void AddCodeButton(CodePanel n, TotalCode tCode,bool add=false) |
|
|
|
{ |
|
|
|
n.Button.Tag = tCode; |
|
|
|
n.Button.Text = tCode.ShortCode; |
|
|
|
if (tCode.GoodsType == 0) |
|
|
|
{ |
|
|
|
n.Button.Text ="鲜品"; |
|
|
|
_freshPanel = n; |
|
|
|
} |
|
|
|
else |
|
|
|
n.Button.Text = tCode.ShortCode; |
|
|
|
n.Button.Click += delegate |
|
|
|
{ |
|
|
|
|
|
|
|
|