/// <summary> /// 充值补贴 /// </summary> /// <param name="p_intMoney"></param> /// <returns></returns> public override bool RechargeSubsidize(decimal p_dboMoney) { int l_intBlock = m_intSectorNo * 4 + 8; int l_intMoney = (int)(p_dboMoney * 100.00M); return(JocatDevice.AddCardMoney(m_intComPort, l_intBlock, l_intMoney)); }
public override bool WriteInitSubzVal(decimal dMoney) { byte bSection = 2; int iCardPieceNo = EquipmentGeneral.GetCardSectionPieceList()[bSection][0]; JocatDevice.CleanCardMoney(1, iCardPieceNo); return(JocatDevice.AddCardMoney(1, iCardPieceNo, (int)(dMoney * 100))); }
/// <summary> /// 设置电话区密码 /// </summary> //public void InitPhoneSector() //{ // JocatDevice.SetCardPassword(m_intComPort, "10", m_strPhonePassword); //} /// <summary> /// 设置用水收集卡 /// </summary> public void ResetWaterCollectCard() { //设置读卡器密码 JocatDevice.SetReaderPassWord(m_intComPort, m_strWaterCollectCardPW); //写入资料 JocatDevice.WriteCard(m_intComPort, "9", 2, m_strCollectionNormal + m_strCollectionNormal); }
/// <summary> /// 读取采集卡数据 /// </summary> /// <param name="p_decWater"></param> /// <param name="p_decMachine"></param> public void ReadCollectCardInfo(out decimal p_decWater, out decimal p_decMachine) { p_decWater = 0; p_decMachine = 0; string l_strData = JocatDevice.ReadCard(m_intComPort, "9", 1); string l_strWater = l_strData.Substring(0, 8); string l_strMachine = l_strData.Substring(16, 2); p_decWater = EquipmentGeneral.HexMoneyToDouble(l_strData.Substring(0, 8)); p_decMachine = EquipmentGeneral.HexMoneyToDouble(l_strData.Substring(16, 2)); }
/// <summary> /// 取得卡用户编号 /// </summary> /// <returns></returns> public override int GetCardNo() { try { byte bSection = 0; return(JocatDevice.ReadCardNo(m_intComPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][0])); } catch { return(0); } }
public override PaymentCard GetUserBasicInfos() { byte bSection = 0; PaymentCard cardInfo = JocatDevice.GetUserBasicInfos(this.m_intComPort, bSection); if (cardInfo != null) { //SetWriterPassword(string.Empty.PadLeft(12, 'F')); cardInfo.MACID = GetMacID(); //SetWriterPassword(this._strWriterPwd); } return(cardInfo); }
/// <summary> /// 设置热水管理卡 /// </summary> public void SetWaterAdminCard(string p_strPassword, int p_intPreUse, int p_intDailyUse, decimal p_decPrice) { //设置读卡器密码 JocatDevice.SetReaderPassWord(m_intComPort, m_strAdminPassword); string l_strCRC = "FFFF9E10"; string l_strPreUse = EquipmentGeneral.IntToHexInSorting(p_intPreUse, 4); string l_strDailyUse = EquipmentGeneral.IntToHexInSorting(p_intDailyUse, 4); string l_strPrice = EquipmentGeneral.IntToHexInSorting(Convert.ToInt32(p_decPrice * 100), 4); string l_strAdmin = p_strPassword + l_strPreUse + l_strDailyUse + l_strPrice + l_strCRC; //写入数据 JocatDevice.WriteCard(m_intComPort, "9", 2, l_strAdmin + l_strAdmin); }
/// <summary> /// 取得机器时间 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override DateTime GetDeviceDateTime(int p_intDeviceNo) { string machinesDateTime = JocatDevice.GetMachineTime(ComPort, BaudRate, p_intDeviceNo); DateTime machinesTime; try { machinesTime = Convert.ToDateTime(machinesDateTime); } catch (Exception ex) { throw ex; } return(machinesTime); }
/// <summary> /// 设置卡片密码 /// </summary> /// <param name="p_intSector">当参数值为“99”时,设置所有扇区的密码</param> /// <param name="p_strPassword">密码</param> /// <returns></returns> public override bool SetCardPassword(int p_intSector, string p_strPassword) { bool l_blnReturn = false; if (p_intSector == 0) { l_blnReturn = JocatDevice.SetCardPassword(this.ComPort, p_strPassword); } else if (p_intSector <= 16) { l_blnReturn = JocatDevice.SetCardPassword(this.ComPort, p_intSector.ToString(), p_strPassword); } else { l_blnReturn = JocatDevice.SetCardAllBlockPassword(this.ComPort, p_strPassword); } return(l_blnReturn); }
/// <summary> /// 取得MAC地址 /// </summary> /// <returns></returns> public override string GetMacID() { try { //string strPwd = this._strWriterPwd; //SetWriterPassword(string.Empty.PadLeft(12, 'F')); string strMacID = JocatDevice.ReadCard(m_intComPort, "0", 1); //SetWriterPassword(strPwd); return(strMacID); } catch { return(string.Empty); } }
/// <summary> /// 设置水表管理卡 /// </summary> /// <param name="watermeterPassword">水表消费密码</param> /// <param name="amountInEach">单次用水限额</param> /// <param name="amountInDay">日用水限额</param> /// <param name="unitPrice">每升价格</param> /// <returns></returns> public override bool SetWatermeterAdminCard(int port, string paymentPassword, int eachTimeMaxinumNumber, int dailyMaxinumNumber, decimal unitPrice) { byte bSection = 2; bool isSccess = false; string strPiece = EquipmentGeneral.GetCardSectionPieceList()[bSection][1].ToString(); string l_strEachAmount = EquipmentGeneral.IntToHexInSorting(eachTimeMaxinumNumber, 4); string l_strMaxAmount = EquipmentGeneral.IntToHexInSorting(dailyMaxinumNumber, 4); decimal fUPrice = unitPrice * 100; int uPrice = Convert.ToInt32(fUPrice); string l_strUnitPrice = EquipmentGeneral.IntToHexInSorting(uPrice, 4); string l_strWaterInfo = paymentPassword + l_strEachAmount + l_strMaxAmount + l_strUnitPrice + "FFFF"; l_strWaterInfo = l_strWaterInfo + DataConvert.GetCRC16Code(l_strWaterInfo); isSccess = JocatDevice.WriteCard(port, strPiece, 2, l_strWaterInfo + l_strWaterInfo); return(isSccess); }
/// <summary> /// 设置亲情号码资料 /// </summary> /// <param name="p_strPhoneInfo">亲情号码卡信息</param> /// <param name="p_lisPhones">亲情号码</param> /// <returns></returns> public bool WriteFamilyPhones(string p_strPhoneInfo, List <string> p_lisPhones) { byte bSection = 10; Dictionary <byte, List <byte> > dicSection = EquipmentGeneral.GetCardSectionPieceList(); string l_strPhoneInfo = p_strPhoneInfo + "FFFFFFFFFFFFFFFFFFFFFF"; string l_strPhoneNo1 = FormatPhoneNo(p_lisPhones[0], p_lisPhones[1]); string l_strPhoneNo2 = FormatPhoneNo(p_lisPhones[2], p_lisPhones[3]); if (l_strPhoneInfo.Length != 32) { throw new Exception("亲情号码卡信息格式不正确。"); } if ((l_strPhoneNo1 + l_strPhoneNo2).Length != 64) { throw new Exception("亲情号码格式不正确。"); } return(JocatDevice.WriteCard(m_intComPort, dicSection[bSection][0].ToString(), 3, l_strPhoneInfo + l_strPhoneNo1 + l_strPhoneNo2)); }
/// <summary> /// 读卡资料 /// </summary> /// <returns></returns> public override PaymentCard ReadCard() { try { byte bSection = 0; var l_objCardInfo = JocatDevice.ReadCard(m_intComPort, EquipmentGeneral.GetCardSectionPieceList()[bSection][0], this._strWriterPwd); //List<string> l_lisPhones = new List<string>(); //string l_strPhoneInfo = ""; //ReadFamilyPhones(out l_strPhoneInfo, out l_lisPhones); //l_objCardInfo.FamilyPhoneInfo = l_strPhoneInfo; //l_objCardInfo.FamilyPhoneNum = l_lisPhones; return(l_objCardInfo); } catch (Exception Ex) { throw Ex; } }
/// <summary> /// 读取亲情电话信息 /// </summary> /// <param name="p_strPhineInfo"></param> /// <param name="p_lisPhones"></param> private void ReadFamilyPhones(out string p_strPhineInfo, out List <string> p_lisPhones) { p_strPhineInfo = ""; p_lisPhones = new List <string>(); byte bSection = 10; Dictionary <byte, List <byte> > dicSection = EquipmentGeneral.GetCardSectionPieceList(); try { string l_strPhoneInfo = JocatDevice.ReadCard(m_intComPort, dicSection[bSection][0].ToString(), 3); p_strPhineInfo = ((char)Convert.ToByte(l_strPhoneInfo.Substring(0, 2), 16)).ToString() + l_strPhoneInfo.Substring(2, 8); p_lisPhones.Add(CollapsePhoneNo(l_strPhoneInfo.Substring(32, 16).Replace("F", ""))); p_lisPhones.Add(CollapsePhoneNo(l_strPhoneInfo.Substring(48, 16).Replace("F", ""))); p_lisPhones.Add(CollapsePhoneNo(l_strPhoneInfo.Substring(64, 16).Replace("F", ""))); p_lisPhones.Add(CollapsePhoneNo(l_strPhoneInfo.Substring(80, 16).Replace("F", ""))); } catch { throw new Exception("读取亲情号码信息失败。"); } }
/// <summary> /// 清除消费资料 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override bool CleanPaymentInfo(int p_intDeviceNo) { return(JocatDevice.CleanPaymentInfo(ComPort, BaudRate, p_intDeviceNo)); }
/// <summary> /// 取得消费资料 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override List <PaymentInfo> GetPaymentInfo(int p_intDeviceNo) { try { //取得消费记录数 int l_intRecordNum = GetPaymentNum(p_intDeviceNo); //Thread.Sleep(3000); //如果未能连接到机械 if (l_intRecordNum == 0) { string data = JocatDevice.GetPaymentInfo(ComPort, BaudRate, p_intDeviceNo, 0); return(new List <PaymentInfo>()); } if (l_intRecordNum == -1) { return(null); } List <PaymentInfo> l_lisReturn = new List <PaymentInfo>(); string l_strData = ""; for (int i = 0; i < l_intRecordNum; i = i + m_intPaymentDataNum) { //l_strData = JocatDevice.GetPaymentInfo(ComPort, BaudRate, p_intDeviceNo, i); l_strData = JocatDevice.GetPaymentInfo(int.Parse(ComPort.ToString()), int.Parse(BaudRate.ToString()), int.Parse(p_intDeviceNo.ToString()), i); if (l_strData == "85" || l_strData == "86") { i = i - m_intPaymentDataNum; continue; } if (l_strData.Length % 52 != 0) { i = i - m_intPaymentDataNum; continue; } int l_intSeed = 0; string l_strPaymentInfo = ""; //此处有可能遇到l_strData的值为85的情况 bool signSuccess = true; List <PaymentInfo> l_tmpPaymentInfos = new List <PaymentInfo>(); while (l_intSeed < l_strData.Length) { l_strPaymentInfo = l_strData.Substring(l_intSeed, 52); try { l_tmpPaymentInfos.Add(EncodePaymentInfo(l_strPaymentInfo)); } catch (Exception Ex) { signSuccess = false; break; } l_intSeed = l_intSeed + 52; } if (signSuccess) { l_lisReturn.AddRange(l_tmpPaymentInfos); } else { //捕抓机台返回的错误数据,使循环返回对上一次序列重新取数。 i = i - m_intPaymentDataNum; } if ((i + m_intPaymentDataNum) > l_intRecordNum) { Thread.Sleep(3000); break; } Thread.Sleep(3000); } return(l_lisReturn); } catch (Exception) { throw; } }
/// <summary> /// 取得消费总金额 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override double GetPaymentMoney(int p_intDeviceNo) { return(JocatDevice.GetMacPaymentMoney(ComPort, BaudRate, p_intDeviceNo)); }
/// <summary> /// 取得消费记录条数 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override int GetPaymentNum(int p_intDeviceNo) { return(JocatDevice.GetRecordNum(ComPort, BaudRate, p_intDeviceNo)); }
/// <summary> /// 设置机器消费密码 /// </summary> /// <param name="p_intDeviceNo"></param> /// <param name="p_strOldPassword"></param> /// <param name="p_strNewPassword"></param> /// <returns></returns> public override bool SetDevicePassword(int p_intDeviceNo, string p_strOldPassword, string p_strNewPassword) { return(JocatDevice.SetMachinePassword(ComPort, BaudRate, p_intDeviceNo, p_strOldPassword, p_strNewPassword)); }
public override decimal GetSubzVal() { byte bSection = 2; return(JocatDevice.GetPosVal(this.m_intComPort, bSection)); }
/// <summary> /// 同步机器时间 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override bool SyncDeviceDateTime(int p_intDeviceNo) { return(JocatDevice.SetMachineTime(ComPort, BaudRate, p_intDeviceNo)); }
/// <summary> /// 移除挂失卡 /// </summary> /// <param name="p_intDeviceNo"></param> /// <param name="p_intCardNo"></param> /// <returns></returns> public override bool RemoveLossCard(int p_intDeviceNo, int p_intCardNo) { return(JocatDevice.RemoveLossCard(ComPort, BaudRate, p_intDeviceNo, p_intCardNo)); }
/// <summary> /// 写卡资料 /// </summary> /// <param name="p_objCard"></param> /// <returns></returns> public override bool WriteCard(PaymentCard p_objCard) { return(JocatDevice.WriteCardInfo(m_intComPort, p_objCard)); }
public override bool WriteInitUserBasicInfo(PaymentCard payCard) { byte bSection = 0; return(JocatDevice.WriteCardBasicInfo(this.ComPort, bSection, payCard)); }
public override bool WriteInitContactPhone(string strContactInfo, List <string> listPhoneNums) { byte bSection = 10; return(JocatDevice.WritePhoneList(this.ComPort, bSection, strContactInfo, listPhoneNums)); }
/// <summary> /// 设置管理卡 /// </summary> /// <param name="p_intDeviceNo"></param> /// <param name="p_intCardNo"></param> /// <returns></returns> public override bool SetAdminCard(int p_intDeviceNo, int p_intCardNo) { return(JocatDevice.SetAdminCard(ComPort, BaudRate, p_intDeviceNo, p_intCardNo)); }
/// <summary> /// 设置机号 /// </summary> /// <param name="p_intOldDeviceNo"></param> /// <param name="p_intNewDeviceNo"></param> /// <returns></returns> public override bool SetDeviceNo(int p_intOldDeviceNo, int p_intNewDeviceNo) { return(JocatDevice.SetMachineNo(ComPort, BaudRate, p_intOldDeviceNo, p_intNewDeviceNo)); }
/// <summary> /// 清除挂失卡 /// </summary> /// <param name="p_intDeviceNo"></param> /// <returns></returns> public override bool CleanLossCard(int p_intDeviceNo) { return(JocatDevice.CleanLossCard(ComPort, BaudRate, p_intDeviceNo)); }
/// <summary> /// 设置最大消费金额 /// </summary> /// <param name="p_intDeviceNo"></param> /// <param name="p_intMoney"></param> /// <returns></returns> public override bool SetMaxPayMoney(int p_intDeviceNo, int p_intMoney) { return(JocatDevice.SetPaymentMaxAmount(ComPort, BaudRate, p_intDeviceNo, p_intMoney)); }
public override List <string> GetPhoneNumList() { byte bSection = 10; return(JocatDevice.GetPhoneNumList(this.m_intComPort, bSection)); }