Ejemplo n.º 1
0
        public void RunCommond(object[] param)
        {
            string driverVersion = this.TaxCardInstance.get_StateInfo().DriverVersion;
            string text1         = driverVersion.Substring(7, 2) + driverVersion.Substring(10, 6);
            bool   flag          = false;

            this.TaxCardInstance.get_SoftVersion().Equals("FWKP_V2.0_Svr_Client");
            if ((this.TaxCardInstance.get_QYLX().ISPTFP || this.TaxCardInstance.get_QYLX().ISZYFP) && (1 == this.TaxCardInstance.get_StateInfo().IsLockReached))
            {
                flag = true;
            }
            if ((this.TaxCardInstance.get_QYLX().ISHY || this.TaxCardInstance.get_QYLX().ISJDC) || (this.TaxCardInstance.get_QYLX().ISPTFPDZ || this.TaxCardInstance.get_QYLX().ISPTFPJSP))
            {
                for (int i = 0; i < this.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; i++)
                {
                    if (ShareMethods.IsZCInv(this.TaxCardInstance.get_StateInfo().InvTypeInfo[i].InvType) && (1 == this.TaxCardInstance.get_StateInfo().InvTypeInfo[i].IsLockTime))
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                this.errorOccur = true;
                this.errCode    = "L001";
                this.errMessage = "已到锁死期,无法领取主机分配的发票";
            }
            else if (!this.errorOccur)
            {
                if (!this.CheckBufferEmpty())
                {
                    byte fplx = Convert.ToByte(param[0].ToString());
                    this.ClearBuffer(fplx);
                    if (this.errorOccur)
                    {
                        return;
                    }
                }
                List <InvVolumeApp> reqList = new List <InvVolumeApp>();
                InvVolumeApp        item    = new InvVolumeApp {
                    InvType  = Convert.ToByte(param[0].ToString()),
                    TypeCode = param[1].ToString(),
                    HeadCode = Convert.ToUInt32(param[2].ToString()),
                    Number   = Convert.ToUInt16(param[3].ToString())
                };
                reqList.Add(item);
                this.ExecuteDownloadList(reqList);
            }
        }
Ejemplo n.º 2
0
        private List <InvVolumeApp> RequestListOutput(XmlDocument invList)
        {
            XmlNode             node  = invList.SelectSingleNode("//CODE");
            XmlNode             node2 = invList.SelectSingleNode("//MESS");
            List <InvVolumeApp> list  = new List <InvVolumeApp>();

            if (node.InnerText.Equals("0000"))
            {
                InvVolumeApp  locked  = null;
                InvVolumeApp  app2    = null;
                UnlockInvoice invoice = null;
                invoice = base.TaxCardInstance.NInvGetUnlockInvoice(0);
                if (!DownloadCommon.CheckEmpty(invoice.Buffer))
                {
                    locked = new InvVolumeApp {
                        InvType  = Convert.ToByte(invoice.get_Kind()),
                        TypeCode = invoice.get_TypeCode(),
                        HeadCode = Convert.ToUInt32(invoice.get_Number()),
                        Number   = Convert.ToUInt16(invoice.get_Count())
                    };
                }
                invoice = base.TaxCardInstance.NInvGetUnlockInvoice(11);
                if (!DownloadCommon.CheckEmpty(invoice.Buffer))
                {
                    app2 = new InvVolumeApp {
                        InvType  = Convert.ToByte(invoice.get_Kind()),
                        TypeCode = invoice.get_TypeCode(),
                        HeadCode = Convert.ToUInt32(invoice.get_Number()),
                        Number   = Convert.ToUInt16(invoice.get_Count())
                    };
                }
                foreach (XmlNode node4 in invList.SelectSingleNode("//DATA").ChildNodes)
                {
                    XmlElement element = (XmlElement)node4;
                    if (element.Name.Equals("FPMX"))
                    {
                        bool         flag   = false;
                        InvVolumeApp tarInv = new InvVolumeApp();
                        foreach (XmlNode node5 in element.ChildNodes)
                        {
                            if (node5.Name.Equals("FPZL"))
                            {
                                int item = Convert.ToByte(node5.InnerText);
                                if (-1 == this.availableType.IndexOf(item))
                                {
                                    flag = true;
                                    break;
                                }
                                tarInv.InvType = Convert.ToByte(node5.InnerText);
                            }
                            else if (node5.Name.Equals("LBDM"))
                            {
                                tarInv.TypeCode = node5.InnerText;
                            }
                            else if (node5.Name.Equals("QSHM"))
                            {
                                tarInv.HeadCode = Convert.ToUInt32(node5.InnerText);
                            }
                            else if (node5.Name.Equals("FPFS"))
                            {
                                tarInv.Number = Convert.ToUInt16(node5.InnerText);
                            }
                            else if (node5.Name.Equals("GMRQ"))
                            {
                                string   innerText = node5.InnerText;
                                int      year      = Convert.ToInt32(innerText.Substring(0, 4));
                                int      month     = Convert.ToInt32(innerText.Substring(4, 2));
                                int      day       = Convert.ToInt32(innerText.Substring(6, 2));
                                int      hour      = Convert.ToInt32(innerText.Substring(8, 2));
                                int      minute    = Convert.ToInt32(innerText.Substring(10, 2));
                                int      second    = Convert.ToInt32(innerText.Substring(12, 2));
                                DateTime time      = new DateTime(year, month, day, hour, minute, second);
                                tarInv.BuyDate = time;
                            }
                        }
                        if (!flag)
                        {
                            if (ShareMethods.IsHXInv(tarInv.InvType) && ((locked == null) || !DownloadCommon.CheckRepeat(locked, tarInv)))
                            {
                                list.Add(tarInv);
                            }
                            else if (ShareMethods.IsZCInv(tarInv.InvType) && ((app2 == null) || !DownloadCommon.CheckRepeat(app2, tarInv)))
                            {
                                list.Add(tarInv);
                            }
                        }
                    }
                }
                return(list);
            }
            MessageManager.ShowMsgBox(node.InnerText + ":" + node2);
            return(list);
        }
Ejemplo n.º 3
0
        private void RequestDownloadOutput(XmlDocument downInvXml)
        {
            XmlNode node  = downInvXml.SelectSingleNode("//CODE");
            XmlNode node2 = downInvXml.SelectSingleNode("//MESS");

            if (node.InnerText.Equals("0000"))
            {
                new List <InvVolumeApp>();
                XmlNodeList childNodes = downInvXml.SelectSingleNode("//DATA").ChildNodes;
                bool        flag       = false;
                bool        flag2      = false;
                string      innerText  = string.Empty;
                string      str2       = string.Empty;
                string      s          = string.Empty;
                string      str4       = string.Empty;
                foreach (XmlNode node4 in childNodes)
                {
                    XmlElement element = (XmlElement)node4;
                    if (element.Name.Equals("FPJS"))
                    {
                        flag = true;
                        foreach (XmlNode node5 in element.ChildNodes)
                        {
                            if (node5.Name.Equals("FPZL"))
                            {
                                innerText = node5.InnerText;
                            }
                            else if (node5.Name.Equals("FPJJSMW"))
                            {
                                s = node5.InnerText;
                            }
                        }
                    }
                    else if (element.Name.Equals("FPXZ"))
                    {
                        flag2 = true;
                        foreach (XmlNode node6 in element.ChildNodes)
                        {
                            if (node6.Name.Equals("FPZL"))
                            {
                                str2 = node6.InnerText;
                            }
                            else if (node6.Name.Equals("FPJMW"))
                            {
                                str4 = node6.InnerText;
                            }
                        }
                    }
                }
                if (flag)
                {
                    InvVolumeApp  item    = new InvVolumeApp();
                    int           type    = Convert.ToInt32(innerText);
                    UnlockInvoice invoice = this.TaxCardInstance.NInvGetUnlockInvoice(type);
                    if (this.TaxCardInstance.get_RetCode() != 0)
                    {
                        this.errorOccur = true;
                        this.errCode    = this.TaxCardInstance.get_ErrCode();
                        this.errMessage = MessageManager.GetMessageInfo(this.TaxCardInstance.get_ErrCode());
                        return;
                    }
                    item.InvType  = Convert.ToByte(invoice.get_Kind());
                    item.TypeCode = invoice.get_TypeCode();
                    item.HeadCode = Convert.ToUInt32(invoice.get_Number());
                    item.Number   = Convert.ToUInt16(invoice.get_Count());
                    byte[] buffer = Convert.FromBase64String(s);
                    this.TaxCardInstance.NInvWirteConfirmResult(type, buffer, buffer.Length);
                    if (this.TaxCardInstance.get_RetCode() != 0)
                    {
                        this.errorOccur = true;
                        this.errCode    = this.TaxCardInstance.get_ErrCode();
                        this.errMessage = MessageManager.GetMessageInfo(this.TaxCardInstance.get_ErrCode());
                        if (ShareMethods.IsHXInv(type))
                        {
                            this.zpErrTriger = true;
                            return;
                        }
                        if (ShareMethods.IsZCInv(type))
                        {
                            this.hjErrTriger = true;
                        }
                        return;
                    }
                    this.successList.Add(item);
                }
                if (flag2)
                {
                    int    num2    = Convert.ToInt32(str2);
                    byte[] buffer2 = Convert.FromBase64String(str4);
                    this.TaxCardInstance.InvRead("3", buffer2, buffer2.Length, Convert.ToInt32(num2));
                    if (this.TaxCardInstance.get_RetCode() != 0)
                    {
                        this.errorOccur = true;
                        this.errCode    = this.TaxCardInstance.get_ErrCode();
                        this.errMessage = MessageManager.GetMessageInfo(this.TaxCardInstance.get_ErrCode());
                        if (0x251d == this.TaxCardInstance.get_RetCode())
                        {
                            this.buffFull = true;
                        }
                        if (ShareMethods.IsHXInv(num2))
                        {
                            this.zpErrTriger = true;
                        }
                        else if (ShareMethods.IsZCInv(num2))
                        {
                            this.hjErrTriger = true;
                        }
                    }
                }
            }
            else
            {
                this.errorOccur  = true;
                this.errCode     = node.InnerText;
                this.errMessage  = node2.InnerText;
                this.zpErrTriger = true;
                this.hjErrTriger = true;
            }
        }
Ejemplo n.º 4
0
        private void ExecuteDownloadList(List <InvVolumeApp> reqList)
        {
            if (this.HasVehicleVolume(reqList))
            {
                UnlockInvoice invoice = this.TaxCardInstance.NInvGetUnlockInvoice(0x33);
                if (this.TaxCardInstance.get_RetCode() != 0)
                {
                    MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode());
                    return;
                }
                if (!DownloadCommon.CheckEmpty(invoice.Buffer) && (0x33 == invoice.get_Kind()))
                {
                    InvVolumeApp confirmVolumn = new InvVolumeApp {
                        InvType  = Convert.ToByte(invoice.get_Kind()),
                        TypeCode = invoice.get_TypeCode(),
                        HeadCode = Convert.ToUInt32(invoice.get_Number()),
                        Number   = Convert.ToUInt16(invoice.get_Count())
                    };
                    string xml = string.Empty;
                    if (HttpsSender.SendMsg("0020", this.RequestDownloadInput(null, confirmVolumn, Convert.ToBase64String(invoice.Buffer), true), ref xml) != 0)
                    {
                        MessageManager.ShowMsgBox(xml);
                        return;
                    }
                    XmlDocument downInvXml = new XmlDocument();
                    downInvXml.LoadXml(xml);
                    if (this.logFlag)
                    {
                        downInvXml.Save(this.logPath + @"\AllocateRequestDownloadOutput.xml");
                    }
                    this.RequestDownloadOutput(downInvXml);
                }
            }
            int num2 = 0;

            foreach (InvVolumeApp app2 in reqList)
            {
                if (this.buffFull)
                {
                    break;
                }
                num2++;
                if ((!ShareMethods.IsHXInv(app2.InvType) || !this.zpErrTriger) && (!ShareMethods.IsZCInv(app2.InvType) || !this.hjErrTriger))
                {
                    bool          flag;
                    UnlockInvoice invoice2 = new UnlockInvoice();
                    InvVolumeApp  locked   = new InvVolumeApp();
                    InvVolumeApp  tarInv   = app2;
                    invoice2 = this.TaxCardInstance.NInvGetUnlockInvoice(tarInv.InvType);
                    if (this.TaxCardInstance.get_RetCode() != 0)
                    {
                        MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode());
                        break;
                    }
                    bool flag2 = DownloadCommon.CheckEmpty(invoice2.Buffer);
                    if (flag2)
                    {
                        flag = false;
                    }
                    else
                    {
                        locked.InvType  = Convert.ToByte(invoice2.get_Kind());
                        locked.TypeCode = invoice2.get_TypeCode();
                        locked.HeadCode = Convert.ToUInt32(invoice2.get_Number());
                        locked.Number   = Convert.ToUInt16(invoice2.get_Count());
                        flag            = DownloadCommon.CheckRepeat(locked, tarInv);
                    }
                    if (flag)
                    {
                        tarInv = null;
                    }
                    if (flag2)
                    {
                        locked = null;
                    }
                    string str2 = string.Empty;
                    if (HttpsSender.SendMsg("0040", this.RequestDownloadInput(tarInv, locked, Convert.ToBase64String(invoice2.Buffer), true), ref str2) != 0)
                    {
                        MessageManager.ShowMsgBox(str2);
                        break;
                    }
                    XmlDocument document2 = new XmlDocument();
                    document2.LoadXml(str2);
                    if (this.logFlag)
                    {
                        document2.Save(this.logPath + @"\AllocateRequestDownloadOutput.xml");
                    }
                    this.RequestDownloadOutput(document2);
                    if (this.zpErrTriger || this.hjErrTriger)
                    {
                        break;
                    }
                    if (!flag && ((num2 == reqList.Count) || ((num2 != reqList.Count) && !this.CheckOneSystem(reqList[num2 - 1].InvType, reqList[num2].InvType))))
                    {
                        invoice2 = this.TaxCardInstance.NInvGetUnlockInvoice(tarInv.InvType);
                        Convert.ToByte(invoice2.get_Kind());
                        locked = new InvVolumeApp {
                            InvType  = Convert.ToByte(invoice2.get_Kind()),
                            TypeCode = invoice2.get_TypeCode(),
                            HeadCode = Convert.ToUInt32(invoice2.get_Number()),
                            Number   = Convert.ToUInt16(invoice2.get_Count())
                        };
                        if (HttpsSender.SendMsg("0040", this.RequestDownloadInput(null, locked, Convert.ToBase64String(invoice2.Buffer), true), ref str2) != 0)
                        {
                            MessageManager.ShowMsgBox(str2);
                            break;
                        }
                        XmlDocument document3 = new XmlDocument();
                        document3.LoadXml(str2);
                        if (this.logFlag)
                        {
                            document3.Save(this.logPath + @"\AllocateRequestDownloadOutputSingle.xml");
                        }
                        this.RequestDownloadOutput(document3);
                        if (this.zpErrTriger && this.hjErrTriger)
                        {
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void ExecuteDownloadList(List <InvVolumeApp> reqList)
        {
            int num = 0;

            foreach (InvVolumeApp app in reqList)
            {
                if (this.buffFull || this.webPartialError)
                {
                    break;
                }
                num++;
                if ((!ShareMethods.IsHXInv(app.InvType) || !this.zpErrTriger) && (!ShareMethods.IsZCInv(app.InvType) || !this.hjErrTriger))
                {
                    bool          flag;
                    UnlockInvoice invoice = new UnlockInvoice();
                    InvVolumeApp  locked  = new InvVolumeApp();
                    InvVolumeApp  tarInv  = app;
                    invoice = this.TaxCardInstance.NInvGetUnlockInvoice(tarInv.InvType);
                    if (this.TaxCardInstance.get_RetCode() != 0)
                    {
                        MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode());
                        break;
                    }
                    bool flag2 = DownloadCommon.CheckEmpty(invoice.Buffer);
                    if (flag2)
                    {
                        flag = false;
                    }
                    else
                    {
                        locked.InvType  = Convert.ToByte(invoice.get_Kind());
                        locked.TypeCode = invoice.get_TypeCode();
                        locked.HeadCode = Convert.ToUInt32(invoice.get_Number());
                        locked.Number   = Convert.ToUInt16(invoice.get_Count());
                        flag            = DownloadCommon.CheckRepeat(locked, tarInv);
                    }
                    if (flag)
                    {
                        tarInv = null;
                    }
                    if (flag2)
                    {
                        locked = null;
                    }
                    string xml = string.Empty;
                    if (HttpsSender.SendMsg("0020", this.RequestDownloadInput(tarInv, locked, Convert.ToBase64String(invoice.Buffer), false), ref xml) != 0)
                    {
                        MessageManager.ShowMsgBox(xml);
                        this.webCommunicationError = true;
                        break;
                    }
                    XmlDocument downInvXml = new XmlDocument();
                    downInvXml.LoadXml(xml);
                    if (this.logFlag)
                    {
                        downInvXml.Save(this.logPath + @"\RequestDownloadOutput.xml");
                    }
                    this.RequestDownloadOutput(downInvXml);
                    if (this.zpErrTriger && this.hjErrTriger)
                    {
                        break;
                    }
                    if (!flag && ((num == reqList.Count) || ((num != reqList.Count) && !this.CheckOneSystem(reqList[num - 1].InvType, reqList[num].InvType))))
                    {
                        invoice = this.TaxCardInstance.NInvGetUnlockInvoice(tarInv.InvType);
                        Convert.ToByte(invoice.get_Kind());
                        locked = new InvVolumeApp {
                            InvType  = Convert.ToByte(invoice.get_Kind()),
                            TypeCode = invoice.get_TypeCode(),
                            HeadCode = Convert.ToUInt32(invoice.get_Number()),
                            Number   = Convert.ToUInt16(invoice.get_Count())
                        };
                        if (HttpsSender.SendMsg("0020", this.RequestDownloadInput(null, locked, Convert.ToBase64String(invoice.Buffer), false), ref xml) != 0)
                        {
                            MessageManager.ShowMsgBox(xml);
                            this.webCommunicationError = true;
                            break;
                        }
                        XmlDocument document2 = new XmlDocument();
                        document2.LoadXml(xml);
                        if (this.logFlag)
                        {
                            document2.Save(this.logPath + @"\RequestDownloadOutputSingle.xml");
                        }
                        this.RequestDownloadOutput(document2);
                        if (this.zpErrTriger && this.hjErrTriger)
                        {
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void RunCommond()
        {
            string driverVersion = this.TaxCardInstance.get_StateInfo().DriverVersion;
            string str2          = driverVersion.Substring(7, 2) + driverVersion.Substring(10, 6);
            bool   flag          = false;

            if (this.TaxCardInstance.get_SoftVersion().Equals("FWKP_V2.0_Svr_Client"))
            {
                if (this.TaxCardInstance.get_Machine() != 0)
                {
                    if (str2.CompareTo("A0150730") < 0)
                    {
                        MessageManager.ShowMsgBox("INP-441244");
                        return;
                    }
                }
                else if (str2.CompareTo("A0150729") < 0)
                {
                    MessageManager.ShowMsgBox("INP-441244");
                    return;
                }
            }
            else if (this.TaxCardInstance.get_Machine() == 0)
            {
                if (str2.CompareTo("L0110501") < 0)
                {
                    MessageManager.ShowMsgBox("INP-441244");
                    return;
                }
            }
            else if (str2.CompareTo("L1150730") < 0)
            {
                MessageManager.ShowMsgBox("INP-441244");
                return;
            }
            if ((this.TaxCardInstance.get_QYLX().ISPTFP || this.TaxCardInstance.get_QYLX().ISZYFP) && (1 == this.TaxCardInstance.get_StateInfo().IsLockReached))
            {
                flag = true;
            }
            if ((this.TaxCardInstance.get_QYLX().ISHY || this.TaxCardInstance.get_QYLX().ISJDC) || (this.TaxCardInstance.get_QYLX().ISPTFPDZ || this.TaxCardInstance.get_QYLX().ISPTFPJSP))
            {
                for (int i = 0; i < this.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; i++)
                {
                    if (ShareMethods.IsZCInv(this.TaxCardInstance.get_StateInfo().InvTypeInfo[i].InvType) && (1 == this.TaxCardInstance.get_StateInfo().InvTypeInfo[i].IsLockTime))
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                MessageManager.ShowMsgBox("INP-441245");
            }
            else
            {
                List <InvVolumeApp> reqList = new List <InvVolumeApp>();
                if (this.TaxCardInstance.get_Machine() == 0)
                {
                    ListDown     down   = new ListDown();
                    DialogResult result = down.ShowDialog();
                    if (DialogResult.OK == result)
                    {
                        reqList = down.reqInvList;
                    }
                    else
                    {
                        if (DialogResult.No != result)
                        {
                            return;
                        }
                        SingleVolumn volumn = new SingleVolumn();
                        if (volumn.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        reqList = volumn.singleInvVolumn;
                        if (this.CheckHasElectricVolume(reqList))
                        {
                            this.hasElectricVolume = true;
                            this.electricApplyNum  = volumn.electricApplyNum;
                        }
                    }
                }
                else
                {
                    SingleVolumn volumn2 = new SingleVolumn();
                    if (volumn2.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    reqList = volumn2.singleInvVolumn;
                    if (this.CheckHasElectricVolume(reqList))
                    {
                        this.hasElectricVolume = true;
                        this.electricApplyNum  = volumn2.electricApplyNum;
                    }
                }
                if (this.hasElectricVolume)
                {
                    if (this.ClearAllocateBuffer())
                    {
                        while (((!this.buffFull && !this.hjErrTriger) && (!this.webCommunicationError && !this.webPartialError)) && (this.curElectricDownloadNum < this.electricApplyNum))
                        {
                            if (this.curElectricDownloadNum != 0)
                            {
                                reqList = DownloadCommon.GetElectricDownloadVolumes(0x33, this.electricApplyNum - this.curElectricDownloadNum, 0xffff);
                            }
                            this.ExecuteDownloadList(reqList);
                        }
                    }
                }
                else
                {
                    this.ExecuteDownloadList(reqList);
                }
                if (this.successList.Count > 0)
                {
                    InvInfoWebgetMsg msg = new InvInfoWebgetMsg();
                    msg.InsertInvVolume(this.successList);
                    msg.ShowDialog();
                }
                else
                {
                    MessageManager.ShowMsgBox("INP-441247");
                }
            }
        }