Пример #1
0
        public static string CardNoToHex(int p_intCarNo, bool p_blnActive)
        {
            string l_strReturn = "";

            l_strReturn = EquipmentGeneral.IntToHexInSorting(p_intCarNo, 5);

            l_strReturn = l_strReturn.Insert(4, (p_blnActive) ? "8" : "0");

            return(l_strReturn);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        public override bool SetWatermeterAdminCard(int port, string paymentPassword, int eachTimeMaxinumNumber, int dailyMaxinumNumber, decimal unitPrice)
        {
            byte bSection  = 2;
            bool isSccess  = false;
            byte bPieceOne = EquipmentGeneral.GetCardSectionPieceList()[bSection][1];
            byte bPieceTwo = EquipmentGeneral.GetCardSectionPieceList()[bSection][2];

            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);

            if (l_strWaterInfo.Length != 32)
            {
                return(false);
            }

            if (!ReadCardsPrepare(bSection))
            {
                return(false);
            }
            byte[] arrData = YuChuanDevice.ChangeStrToHex(l_strWaterInfo);
            int    iRes    = YuChuanDevice.rf_write(bPieceOne, arrData);

            if (!ReadCardsPrepare(bSection))
            {
                return(false);
            }
            iRes = YuChuanDevice.rf_write(bPieceTwo, arrData);

            if (iRes == 0)
            {
                isSccess = true;
            }

            return(isSccess);
        }
Пример #4
0
        /// <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);
        }