Browse Source

称重增加 上下限控制

master
luanhui 8 years ago
parent
commit
1e5be9eb31
4 changed files with 80 additions and 42 deletions
  1. +5
    -1
      BO/BO/Dtos/ClientGoodsSetDto.cs
  2. +3
    -1
      BO/BO/Dtos/ClientGoodsSetDtoExt.cs
  3. +34
    -10
      SegmentationWeight/SegmentationWeightForm.cs
  4. +38
    -30
      SegmentationWeight/SegmentationWeightGoodsSetForm.cs

+ 5
- 1
BO/BO/Dtos/ClientGoodsSetDto.cs View File

@ -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; }
}
}

+ 3
- 1
BO/BO/Dtos/ClientGoodsSetDtoExt.cs View File

@ -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;
}
}


+ 34
- 10
SegmentationWeight/SegmentationWeightForm.cs View File

@ -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();
}


+ 38
- 30
SegmentationWeight/SegmentationWeightGoodsSetForm.cs View File

@ -30,45 +30,53 @@ namespace SegmentationWeight
// CheckAddCreateConfig();
mLocaList = XmlUtil.DeserializeFromFile<List<SegmentationWeightGoodSet>>(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<SegmentationWeightGoodSet>();
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<SegmentationWeightGoodSet>();
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();
}


Loading…
Cancel
Save