Com.Aote.ObjectTools.ICCardObj.CSellGas C# (CSharp) Method

CSellGas() public method

public CSellGas ( ) : void
return void
        public void CSellGas() {
            if (PriceDate != null)
            {
                PriceDate = PriceDate.Substring(0, 10);
                PriceDate = PriceDate.Replace("-", "");
            }
            if (SellDate != null)
            {
                SellDate = SellDate.Substring(0, 10);
                SellDate = SellDate.Replace("-", "");
            }
            //购气次数加1
            BuyTimes++;
            var openRen = GetSellEvent("Open").Open(0);
            if (openRen != 0) {
                GetSellEvent("Close").Close();
                Error = "打开串口失败!";
                MessageBox.Show(Error);
                return;
            }

            var pricenow = PriceNow * 100;
            var pricenew = PriceNew * 100;
            var money = Money * 100;
            var pricemodify = 1;
            //如果是无线表,需要先设置数据
            if (FactoryId == 13 || FactoryId == 14 || FactoryId == 15 || FactoryId == 16)
            {
                var r = GetSellEvent("SaveWxPara").SaveWxPara(money, pricenow, pricemodify, pricenew, PriceDate);
            }
            //售气成功返回true,失败false;
            var sellRen = GetSellEvent("SellGas").SellGas(Gas, BuyTimes, SellDate);
            GetSellEvent("Close").Close();
            if (sellRen) {
                State = State.End;
                OnCompleted(null);
            }
            else {
                State = State.Error;
                Error = "售气不成功!";
                MessageBox.Show(Error);
            }
        }
        #endregion