Ejemplo n.º 1
0
 public void DeleteWareInfoByClick(WareOutDetailType wareOutDetailType)
 {
     WareOutDetailTypeSource.Remove(wareOutDetailType);
     for (int i = 0; i < WareOutDetailTypeSource.Count; i++)
     {
         WareOutDetailTypeSource[i].Name = $"第{i + 1}车";
     }
 }
Ejemplo n.º 2
0
        public void SaveWareType()
        {
            UserContext.RfidReadProvider.OnDataReceived -= RfidReadProvider_OnDataReceived;
            if (WareOutDetailSource.FirstOrDefault(_ => _.RfidCount > 0) == null)
            {
                MessageBox.Show("请先匹配物料类型");
                return;
            }
            var totalCount = WareOutDetailSource.Sum(_ => _.RfidCount);

            if (totalCount != TotalCount || totalCount == 0)
            {
                MessageBox.Show("识别数量与匹配数量不一致,请检查物料绑定情况");
                return;
            }
            WareOutDetailType wareOutDetail = new WareOutDetailType();

            wareOutDetail.Name       = $"第{(WareOutDetailTypeSource.Count + 1).ToString()}车";
            wareOutDetail.TotalCount = totalCount;
            wareOutDetail.Details    = new ObservableCollection <WareOutDetailBaseVM>();
            wareOutDetail.Rfids      = Rfids.ToArray().ToList();
            Rfids.Clear();
            TotalCount = 0;
            foreach (var detail in WareOutDetailSource)
            {
                if (detail.RfidCount == 0)
                {
                    continue;
                }
                WareOutDetailBaseVM vm = new WareOutDetailBaseVM();
                vm.WareTypeName = detail.WareTypeName;
                vm.WareTypeId   = detail.WareTypeId;
                vm.RfidCount    = detail.RfidCount;
                wareOutDetail.Details.Add(vm);
                detail.RfidCount = 0;
            }
            WareOutDetailTypeSource.Add(wareOutDetail);
        }