diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index fecedae..ea30f6a 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -213,23 +213,23 @@ namespace ButcherFactory.SegmentProductionAuto_ if (batchID == null) { MessageBox.Show("请先选择批次!"); return; - } - if (g.GoodsType == 1) + } + if (g.GoodsType == 1 && !g.NoTotalCode) { - if (_totalCode == null || _codePanel == null) - { - MessageBox.Show("请先选择总码!"); - return; - } + if (_totalCode == null || _codePanel == null) + { + MessageBox.Show("请先选择总码!"); + return; + } } - var weight = uWeightControl1.Weight; //#if DEBUG // if (weight == 0) // weight = (g.StandardWeightLow ?? 4.0m) + 0.1m; //#endif if (weight == 0) - { + { + //weight = 10; MessageBox.Show("重量不能为0"); return; } @@ -304,8 +304,8 @@ namespace ButcherFactory.SegmentProductionAuto_ var detail = btn.Tag as ClientGoodsSet_Detail; var weight = uWeightControl1.Weight; //#if DEBUG -// if (weight == 0) -// weight = (detail.StandardWeightLow ?? 4.0m) + 0.1m; + // if (weight == 0) + // weight = (detail.StandardWeightLow ?? 4.0m) + 0.1m; //#endif if (weight == 0) throw new Exception("重量不能为0"); @@ -349,7 +349,7 @@ namespace ButcherFactory.SegmentProductionAuto_ entity.TotalCode_ID = _freshTotalCode.ID; thisTotal = _freshTotalCode; thisPanel = _freshPanel; - if (_totalCode.GoodsType != 0) + if (_totalCode == null || _totalCode.GoodsType != 0) { foreach (var bt in codeButtons) { @@ -371,7 +371,7 @@ namespace ButcherFactory.SegmentProductionAuto_ entity.TotalCode_ID = _stayTotalCode.ID; thisTotal = _stayTotalCode; thisPanel = _stayPanel; - if (_totalCode.GoodsType != 1 || !_totalCode.NoTotalCode) + if (_totalCode == null || _totalCode.GoodsType != 1 || !_totalCode.NoTotalCode) { foreach (var bt in codeButtons) { @@ -398,6 +398,10 @@ namespace ButcherFactory.SegmentProductionAuto_ { 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;