diff --git a/BO/BO/Dtos/ClientGoodsSetDto.cs b/BO/BO/Dtos/ClientGoodsSetDto.cs index 3dcb624..5910a11 100644 --- a/BO/BO/Dtos/ClientGoodsSetDto.cs +++ b/BO/BO/Dtos/ClientGoodsSetDto.cs @@ -17,6 +17,10 @@ namespace BO.BO.Dtos public string Goods_Spec { get; set; } public decimal Goods_MainUnitRatio { get; set; }//主辅换算主单位比例 - public decimal? Goods_AllowableError { get; set; }//允许误差 + + public decimal? StandardWeight { get; set; } + public decimal? StandardWeightUp { get; set; } + public decimal? StandardWeightLow { get; set; } + } } diff --git a/BO/BO/Dtos/ClientGoodsSetDtoExt.cs b/BO/BO/Dtos/ClientGoodsSetDtoExt.cs index cc8d688..643c00f 100644 --- a/BO/BO/Dtos/ClientGoodsSetDtoExt.cs +++ b/BO/BO/Dtos/ClientGoodsSetDtoExt.cs @@ -19,7 +19,9 @@ namespace BO.BO.Dtos t.Goods_Code = dto.Goods_Code; t.Goods_Spec = dto.Goods_Spec; t.Goods_MainUnitRatio = dto.Goods_MainUnitRatio; - t.Goods_AllowableError = dto.Goods_AllowableError; + t.StandardWeight = dto.StandardWeight; + t.StandardWeightUp = dto.StandardWeightUp; + t.StandardWeightLow = dto.StandardWeightLow; return t; } } diff --git a/SegmentationWeight/SegmentationWeightForm.cs b/SegmentationWeight/SegmentationWeightForm.cs index 4556420..decba7f 100644 --- a/SegmentationWeight/SegmentationWeightForm.cs +++ b/SegmentationWeight/SegmentationWeightForm.cs @@ -609,21 +609,45 @@ namespace SegmentationWeight lblGoodsName.Text = set.Goods_Name; lblGoodsSpec.Text = set.Goods_Spec; _selectGoodsID = set.Goods_ID; - mIsNeedRefreshPlan = true;//todo 这里可以完善 + //添加记录 var record = GetRecordBySet(set); - var id = LocalDmoSession.Insert(record); - record.ID = id; - - record.Index = mAllWeightRecords.Count + 1; - mAllWeightRecords.Insert(0, record); - mWeightRecords.Insert(0, record); + //当有标准重量的时候 必须符合范围 并且按标准重量打印 + if (set.StandardWeight.HasValue) + { + if (set.StandardWeightUp.HasValue && record.Weight > set.StandardWeightUp.Value) + { + MessageBox.Show("当前重量:"+record.Weight+" 不允许大于标准重量上限:"+ set.StandardWeightUp.Value); + } + if (set.StandardWeightLow.HasValue && record.Weight < set.StandardWeightLow.Value) + { + MessageBox.Show("当前重量:" + record.Weight + " 不允许小于标准重量下限:" + set.StandardWeightLow.Value); + } + else + { + mIsNeedRefreshPlan = true;//todo 这里可以完善 + record.Weight = set.StandardWeight.Value; + } + } + else + { + mIsNeedRefreshPlan = true;//todo 这里可以完善 + } - RefreshUi(); - if (_enablePrint) + if (mIsNeedRefreshPlan) { - PrintGoodsEntity(record); + var id = LocalDmoSession.Insert(record); + record.ID = id; + record.Index = mAllWeightRecords.Count + 1; + mAllWeightRecords.Insert(0, record); + mWeightRecords.Insert(0, record); + RefreshUi(); + if (_enablePrint) + { + PrintGoodsEntity(record); + } } + btn.BackColor = SystemColors.Control; Application.DoEvents(); } diff --git a/SegmentationWeight/SegmentationWeightGoodsSetForm.cs b/SegmentationWeight/SegmentationWeightGoodsSetForm.cs index 2d919d3..9f2c65a 100644 --- a/SegmentationWeight/SegmentationWeightGoodsSetForm.cs +++ b/SegmentationWeight/SegmentationWeightGoodsSetForm.cs @@ -30,45 +30,53 @@ namespace SegmentationWeight // CheckAddCreateConfig(); mLocaList = XmlUtil.DeserializeFromFile>(SegmentationWeightGoodsSetFileName); - var fromRpclist = ClientGoodsSetRpc.GetList(); - foreach (ClientGoodsSetDto rpcSet in fromRpclist) + if (LoginRpcUtil.TestConnection(1000)) { - var set = new SegmentationWeightGoodSet(); - set.Name = rpcSet.Name; - set.Goods_ID = rpcSet.Goods_ID; - set.Goods_Name = rpcSet.Goods_Name; - set.Goods_Code = rpcSet.Goods_Code; - set.Goods_Spec = rpcSet.Goods_Spec; - - var fd = mLocaList.FirstOrDefault(x => x.Goods_ID == set.Goods_ID); - if (fd != null) + var fromRpclist = ClientGoodsSetRpc.GetList(); + foreach (ClientGoodsSetDto rpcSet in fromRpclist) { - fd.Name = set.Name; - fd.Goods_Name = set.Goods_Name; - fd.Goods_Code = set.Goods_Code; - fd.Goods_Spec = set.Goods_Spec; + var set = new SegmentationWeightGoodSet(); + set.Name = rpcSet.Name; + set.Goods_ID = rpcSet.Goods_ID; + set.Goods_Name = rpcSet.Goods_Name; + set.Goods_Code = rpcSet.Goods_Code; + set.Goods_Spec = rpcSet.Goods_Spec; + set.StandardWeight = rpcSet.StandardWeight; + set.StandardWeightUp = rpcSet.StandardWeightUp; + set.StandardWeightLow = rpcSet.StandardWeightLow; + var fd = mLocaList.FirstOrDefault(x => x.Goods_ID == set.Goods_ID); + if (fd != null) + { + fd.Name = set.Name; + fd.Goods_Name = set.Goods_Name; + fd.Goods_Code = set.Goods_Code; + fd.Goods_Spec = set.Goods_Spec; + fd.StandardWeight = rpcSet.StandardWeight; + fd.StandardWeightUp = rpcSet.StandardWeightUp; + fd.StandardWeightLow = rpcSet.StandardWeightLow; + } + else + { + mLocaList.Add(set); + } } - else + var localist = mLocaList.ToList(); + var removeList = new List(); + foreach (SegmentationWeightGoodSet segmentationWeightGoodSet in localist) { - mLocaList.Add(set); + if (fromRpclist.All(x => x.Goods_ID != segmentationWeightGoodSet.Goods_ID)) + { + removeList.Add(segmentationWeightGoodSet); + } } - } - var localist = mLocaList.ToList(); - var removeList=new List(); - foreach (SegmentationWeightGoodSet segmentationWeightGoodSet in localist) - { - if (fromRpclist.All(x => x.Goods_ID != segmentationWeightGoodSet.Goods_ID)) + + foreach (SegmentationWeightGoodSet set in removeList) { - removeList.Add(segmentationWeightGoodSet); + mLocaList.Remove(set); } + XmlUtil.SerializerObjToFile(mLocaList, SegmentationWeightGoodsSetFileName); } - foreach (SegmentationWeightGoodSet set in removeList) - { - mLocaList.Remove(set); - } - XmlUtil.SerializerObjToFile(mLocaList, SegmentationWeightGoodsSetFileName); - InitControl(); }