Exemplo n.º 1
0
 /// <summary>
 /// 5元找零
 /// </summary>
 /// <param name="count"></param>
 /// <returns>1元的张数</returns>
 public static int Charge5(int count)
 {
     if (count > 0)
     {
         Log.In("5元找零个数->" + count);
         for (var i = 1; i <= count; i++)
         {
             CoinChargeAnswer answer = coin5Com.Charge();
             if (answer == CoinChargeAnswer.OK)
             {
                 s_m5--;
                 chargeItems.Add(ChargeMoneyType.M5);
                 if (OnCharging != null)
                 {
                     OnCharging(null, ChargeMoneyType.M5);
                 }
             }
             else
             {
                 if (OnHopperEmpty != null)
                 {
                     OnHopperEmpty(null, ChargeMoneyType.M5);
                 }
                 break;
             }
         }
     }
     if (s_m5 > 0)
     {
         //5元钱不够,使用1元进行补
         var temp = s_m5 * 5;
         return(temp);
     }
     return(0);
 }
Exemplo n.º 2
0
 private static int Charge1(int count)
 {
     if (count > 0)
     {
         Log.In("1元找零个数->" + count);
         for (int i = 1; i <= count; i++)
         {
             CoinChargeAnswer answer = coin1Com.Charge();
             if (answer == CoinChargeAnswer.OK)
             {
                 s_m1--;
                 chargeItems.Add(ChargeMoneyType.M1);
                 if (OnCharging != null)
                 {
                     OnCharging(null, ChargeMoneyType.M1);
                 }
             }
             else
             {
                 if (OnHopperEmpty != null)
                 {
                     OnHopperEmpty(null, ChargeMoneyType.M1);
                 }
                 break;
             }
         }
     }
     return(s_m1);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 5元找零
 /// </summary>
 /// <param name="count"></param>
 /// <returns>1元的张数</returns>
 public static void Charge5(int count)
 {
     if (coin5Com == null)
     {
         Log.Out("5元找零未初始化");
         return;
     }
     if (count > 0)
     {
         Log.In("5元找零个数->" + count);
         for (var i = 1; i <= count; i++)
         {
             CoinChargeAnswer answer = coin5Com.Charge();
             if (answer == CoinChargeAnswer.OK)
             {
                 s_m5--;
                 chargeItems.Add(ChargeMoneyType.M5);
                 if (OnCharging != null)
                 {
                     OnCharging(null, ChargeMoneyType.M5);
                 }
             }
             else
             {
                 if (OnHopperEmpty != null)
                 {
                     OnHopperEmpty(null, ChargeMoneyType.M5);
                 }
                 break;
             }
         }
         Log.In("5找零结束");
     }
 }