Exemplo n.º 1
0
 /// <summary>
 /// 重設空白票券
 /// </summary>
 /// <param name="AccessType"></param>
 /// <param name="AplyNo"></param>
 private void ResetBillViewModel(string AccessType, string AplyNo = null)
 {
     Cache.Invalidate(CacheList.BILLTempData);
     Cache.Invalidate(CacheList.BILLDayData);
     if (AplyNo.IsNullOrWhiteSpace())
     {
         var data = (TreasuryAccessViewModel)Cache.Get(CacheList.TreasuryAccessViewData);
         if (AccessType == Ref.AccessProjectTradeType.P.ToString())
         {
             Cache.Set(CacheList.BILLTempData, new List <BillViewModel>());
             Cache.Set(CacheList.BILLDayData, SetBillTakeOutViewModelGroup((List <BillViewModel>)Bill.GetDayData(data.vAplyUnit)));
         }
         if (AccessType == Ref.AccessProjectTradeType.G.ToString())
         {
             var _data  = (List <BillViewModel>)Bill.GetDayData(data.vAplyUnit, "1");//只抓庫存
             var _data2 = (List <BillViewModel>)Bill.GetDayData(data.vAplyUnit);
             _data2 = GetOut(_data2);
             _data2.AddRange(_data.ModelConvert <BillViewModel, BillViewModel>());
             Cache.Set(CacheList.BILLTempData, SetBillViewRowNum(_data));
             Cache.Set(CacheList.BILLDayData, SetBillTakeOutViewModelGroup(_data2));
         }
     }
     else
     {
         var _data       = (List <BillViewModel>)Bill.GetTempData(AplyNo);
         var _data2      = (List <BillViewModel>)Bill.GetDayData(null, null, AplyNo);
         var _AccessType = TreasuryAccess.GetAccessType(AplyNo);
         if (_AccessType == Ref.AccessProjectTradeType.P.ToString())
         {
             Cache.Set(CacheList.BILLTempData, SetBillViewRowNum(_data));
             Cache.Set(CacheList.BILLDayData, SetBillTakeOutViewModelGroup(_data2));
         }
         if (_AccessType == Ref.AccessProjectTradeType.G.ToString())
         {
             Cache.Set(CacheList.BILLTempData, SetBillViewRowNum(_data));
             Cache.Set(CacheList.BILLDayData, SetBillTakeOutViewModelGroup(_data2));
         }
     }
 }