//发卡 /* 民用发卡 * cardid:卡号 * alarm:告警气量 * constant:表常数 * amount:气量 * metertype:表型 * user_type:用户类型 * money:金额 * pricenow:当前单价 */ public bool MYInitCard(string cardid, int alarm, int constant, int amount, int metertype, int user_type, double money, double pricenow, int pricemodify, double pricenew, string pricedate, string selldate) { //日期转换格式:yyyymmdd if (PriceDate != null) { PriceDate = PriceDate.Substring(0, 10); PriceDate = PriceDate.Replace("-", ""); } if (SellDate != null) { SellDate = SellDate.Substring(0, 10); SellDate = SellDate.Replace("-", ""); } //打开串口,检查卡 var openRen = GetEvent("Open").Open(0); if (openRen != 0) { GetEvent("Close").Close(); OpenErrorTip(openRen); } //发卡,如果是无线表,需要先设置参数 if (metertype == 13 || metertype == 14 || metertype == 15 || metertype == 16) { GetEvent("SaveWxPara").SaveWxPara(money, pricenow, pricemodify, pricenew, pricedate); } //发卡 var initRen = GetEvent("Init").Init(cardid, alarm, metertype, constant, amount, user_type); GetEvent("Close").Close(); if (initRen) { State = State.End; return(true); } else { State = State.Error; Error = "发卡不成功!'"; return(false); } }
void Update() { if (Input.GetMouseButtonDown(1)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 8)) { Debug.Log(hit.collider.gameObject.GetComponent <SellDate>().on_pise); } } if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 8)) { SellDate _sell = hit.collider.gameObject.GetComponent <SellDate>(); switch (step) { case Step.SERECT: select_pieces = _sell.on_pise; if (select_pieces != null) { if (select_pieces.team_number == control_team) { if (!select_pieces.is_siege) { setUiStatus(select_pieces); select_pieces.OnMoveArea(); step++; GamaManager.Instance.command_list.SetInteractable(CommandList.Command.CANCEL, true); } } } break; case Step.MOVE: if (_sell.is_movable) { moveSell = _sell.sell; if (GamaManager.Instance.castles.CastleAdjacent(moveSell, select_pieces.team_number)) { GamaManager.Instance.command_list.SetInteractable(CommandList.Command.SIEGE, true); } select_pieces.OnAttackArea(moveSell); GamaManager.Instance.command_list.SetInteractable(CommandList.Command.ATTACK, true); GamaManager.Instance.command_list.SetInteractable(CommandList.Command.END, true); step++; GamaManager.Instance.Board.allMovableOff(); } GamaManager.Instance.Board.allMovableOff(); break; case Step.ACTIVITY: break; } } } }
//补卡 card_id, meter_type, times, metre_con, warn_gas, pricenow, pricemodify, pricenew, pricedate, selldate public void MakeUp() { //如果是化解,不允许补购气卡 if (FactoryId == 1 || FactoryId == 2 || FactoryId == 11 || FactoryId == 12) { Error = "华捷不允许补购气卡!"; MessageBox.Show(Error); return; } var cpuselldate = SellDate; var cpupricedate = PriceDate; if (PriceDate != null) { PriceDate = PriceDate.Substring(0, 10); PriceDate = PriceDate.Replace("-", ""); } if (SellDate != null) { SellDate = SellDate.Substring(0, 10); SellDate = SellDate.Replace("-", ""); } // alert("card_id:" + card_id + ",meter_type:" + meter_type + ",times:" + times +",metre_con:" + metre_con + ",warn_gas:" + warn_gas + ",pricenow" + pricenow // + ",pricemodify:" + pricemodify + ",pricenew:" + pricenew + ",pricedate:" + pricedate); var gas = 0; var cus_type = 0; var money = 0; var openRen = GetEvent("Open").Open(0); if (openRen == 0) { GetEvent("Close").Close(); GetSellEvent("Open").Open(0); bool cardren; if (FactoryId == 13 || FactoryId == 14 || FactoryId == 15 || FactoryId == 16) { GetSellEvent("SaveWxPara").SaveWxPara(money, PriceNow, PriceModify, PriceNew, PriceDate); } if (FactoryId == 14 || FactoryId == 16) { var firstCard = CardId.Substring(0, 2); CardId = CardId.Substring(2, 10); cardren = GetSellEvent("SaveOldCard").SaveOldCard(CardId, FactoryId, gas, BuyTimes, cus_type, firstCard, Alarm, firstCard, 0, 0); } else { cardren = GetSellEvent("SaveOldCard").SaveOldCard(CardId, FactoryId, gas, BuyTimes, cus_type, MetreCon, Alarm, MetreCon, 0, 0); } GetSellEvent("Close").Close(); if (cardren) { State = State.End; OnCompleted(null); } else { State = State.Error; Error = "补卡不成功!'"; MessageBox.Show(Error); } } else if (openRen == 1) { GetEvent("Close").Close(); Error = "卡没有插入!"; MessageBox.Show(Error); } else if (openRen == 2) { GetEvent("Close").Close(); Error = "硬件连接错误:线没连接或读卡器有问题或计算机串口坏!"; MessageBox.Show(Error); } else if (openRen == 3) { GetEvent("Close").Close(); Error = "密码错误!"; MessageBox.Show(Error); } //补cpu卡 else if (openRen == 4) { var NewRemnant = 1000; var FirstAlarmV = 1000; var SecondAlamV = 2000; var xs = 1; var consumerlevel = 11; GetEvent("Close").Close(); //MakeUpCpu(card_id, FirstAlarmV, SecondAlamV, NewRemnant, consumerlevel, cus_type, pricedate, xs, cpupricedate, times, money, cpuselldate); } }