Esempio n. 1
0
        protected override object[] doService(object[] param)
        {
            string startDate = param[0].ToString();
            string endDate   = param[1].ToString();
            string xml       = string.Empty;
            int    num       = HttpsSender.SendMsg("0040", AllocateCommon.RequestListInput(startDate, endDate), ref xml);

            if (num != 0)
            {
                XmlDocument    document = new XmlDocument();
                XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "GBK", null);
                document.PreserveWhitespace = false;
                document.AppendChild(newChild);
                XmlElement element = document.CreateElement("FPXT");
                document.AppendChild(element);
                XmlElement element2 = document.CreateElement("OUTPUT");
                element.AppendChild(element2);
                XmlElement element3 = document.CreateElement("CODE");
                element3.InnerText = num.ToString();
                element2.AppendChild(element3);
                XmlElement element4 = document.CreateElement("MESS");
                element4.InnerText = xml;
                element2.AppendChild(element4);
                document.PreserveWhitespace = true;
                return(new object[] { document.InnerXml });
            }
            XmlDocument document2 = new XmlDocument();

            document2.LoadXml(xml);
            return(new object[] { document2.InnerXml });
        }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (this.date_ksrq.Value > this.date_jsrq.Value)
     {
         MessageManager.ShowMsgBox("INP-441203");
     }
     else if (this.CheckValid())
     {
         base.Close();
         XmlDocument document = AllocateCommon.CreateAllocateQueryInput(this.queryParams);
         if (this.logFlag)
         {
             document.Save(this.logPath + "AllocateQueryInput.xml");
         }
         string xml = string.Empty;
         if (HttpsSender.SendMsg("0040", document.InnerXml, ref xml) != 0)
         {
             MessageManager.ShowMsgBox(xml);
         }
         else
         {
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(xml);
             if (this.logFlag)
             {
                 doc.Save(this.logPath + @"\AllocateQueryOutput.xml");
             }
             string msg = string.Empty;
             if (!AllocateCommon.ParseAllocateQueryOutput(doc, out msg, out this.outList))
             {
                 MessageManager.ShowMsgBox(msg);
             }
             else if (this.outList.Count == 0)
             {
                 MessageManager.ShowMsgBox("INP-441207", new string[] { "查询", "分配" });
             }
             else
             {
                 new AllocateQueryList(this.outList).ShowDialog();
             }
         }
     }
 }
        public void Run()
        {
            bool          flag         = true;
            UnlockInvoice unlockVolume = this.TaxCardInstance.NInvSearchUnlockFromMain();

            if (this.TaxCardInstance.get_RetCode() == 0)
            {
                flag = DownloadCommon.CheckEmpty(unlockVolume.Buffer);
            }
            else
            {
                flag = true;
            }
            if (!flag && (DialogResult.Yes == MessageManager.ShowMsgBox("INP-4412B1")))
            {
                List <InvVolumeApp> invList = new List <InvVolumeApp>();
                bool         isDeviceError  = false;
                string       str            = string.Empty;
                InvVolumeApp item           = new InvVolumeApp();
                if (AllocateCommon.AllocateOneVolume(unlockVolume, out isDeviceError, out str))
                {
                    item.InvType  = Convert.ToByte(unlockVolume.get_Kind());
                    item.TypeCode = unlockVolume.get_TypeCode();
                    item.HeadCode = Convert.ToUInt32(unlockVolume.get_Number());
                    item.Number   = Convert.ToUInt16(unlockVolume.get_Count());
                    invList.Add(item);
                    InvInfoWebAllocMsg msg = new InvInfoWebAllocMsg();
                    msg.InsertInvVolume(invList);
                    msg.ShowDialog();
                }
                else if (isDeviceError)
                {
                    MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode());
                }
                else
                {
                    MessageManager.ShowMsgBox(str);
                }
            }
        }
        protected override object[] doService(object[] param)
        {
            List <string> queryParams = new List <string>();

            foreach (object obj2 in param)
            {
                queryParams.Add(obj2.ToString());
            }
            XmlDocument document = AllocateCommon.CreateAllocateQueryInput(queryParams);
            int         num      = 0;
            string      xml      = string.Empty;

            num = HttpsSender.SendMsg("0040", document.InnerXml, ref xml);
            if (num != 0)
            {
                XmlDocument    document2 = new XmlDocument();
                XmlDeclaration newChild  = document2.CreateXmlDeclaration("1.0", "GBK", null);
                document2.PreserveWhitespace = false;
                document2.AppendChild(newChild);
                XmlElement element = document2.CreateElement("FPXT");
                document2.AppendChild(element);
                XmlElement element2 = document2.CreateElement("OUTPUT");
                element.AppendChild(element2);
                XmlElement element3 = document2.CreateElement("CODE");
                element3.InnerText = num.ToString();
                element2.AppendChild(element3);
                XmlElement element4 = document2.CreateElement("MESS");
                element4.InnerText = xml;
                element2.AppendChild(element4);
                document2.PreserveWhitespace = true;
                return(new object[] { document2.InnerXml });
            }
            XmlDocument document3 = new XmlDocument();

            document3.LoadXml(xml);
            return(new object[] { document3.InnerXml });
        }
Esempio n. 5
0
        private void btnAllocate_Click(object sender, EventArgs e)
        {
            List <InvVolumeApp> list;
            bool          flag2;
            string        str;
            InvVolumeApp  app2;
            string        str2;
            long          num;
            long          num2;
            InvoiceType   typeCode;
            int           num3;
            UnlockInvoice invoice2;

            if (this.IsRightData())
            {
                list = new List <InvVolumeApp>();
                bool flag = true;
                flag2 = false;
                str   = string.Empty;
                UnlockInvoice unlockVolume = base.TaxCardInstance.NInvSearchUnlockFromMain();
                if (base.TaxCardInstance.get_RetCode() != 0)
                {
                    MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
                    return;
                }
                if (!DownloadCommon.CheckEmpty(unlockVolume.Buffer))
                {
                    InvVolumeApp item = new InvVolumeApp();
                    flag = AllocateCommon.AllocateOneVolume(unlockVolume, out flag2, out str);
                    if (flag)
                    {
                        item.InvType  = Convert.ToByte(unlockVolume.get_Kind());
                        item.TypeCode = unlockVolume.get_TypeCode();
                        item.HeadCode = Convert.ToUInt32(unlockVolume.get_Number());
                        item.Number   = Convert.ToUInt16(unlockVolume.get_Count());
                        list.Add(item);
                    }
                    else if (flag2)
                    {
                        MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
                    }
                    else
                    {
                        MessageManager.ShowMsgBox(str);
                    }
                }
                if (!flag)
                {
                    goto Label_0598;
                }
                app2     = new InvVolumeApp();
                str2     = this.SelectedItems[1].ToString();
                num      = Convert.ToInt64(this.lblStartNumAlloc.Text);
                num2     = Convert.ToInt64(this.tbxAmountAlloc.Text);
                typeCode = (InvoiceType)ShareMethods.GetTypeCode(this.SelectedItems[0].ToString());
                num3     = Convert.ToInt32(this.tbxMachineAlloc.Text);
                if ((2 == typeCode) || (typeCode == null))
                {
                    if (base.TaxCardInstance.get_StateInfo().IsLockReached != 0)
                    {
                        MessageManager.ShowMsgBox("TCD_85_19");
                        return;
                    }
                    if (base.TaxCardInstance.get_StateInfo().IsRepReached != 0)
                    {
                        MessageManager.ShowMsgBox("TCD_85_19");
                        return;
                    }
                    goto Label_04E5;
                }
                if (11 != typeCode)
                {
                    if (12 != typeCode)
                    {
                        if (0x33 == typeCode)
                        {
                            ushort isLockTime = 2;
                            for (int j = 0; j < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; j++)
                            {
                                if (0x33 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].InvType)
                                {
                                    isLockTime = base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].IsLockTime;
                                    ushort isRepTime  = base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].IsRepTime;
                                    ushort jSPRepInfo = base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].JSPRepInfo;
                                    break;
                                }
                            }
                            if (1 == isLockTime)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                            if (1 == isLockTime)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                        }
                        else if (0x29 == typeCode)
                        {
                            ushort num10 = 2;
                            for (int k = 0; k < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; k++)
                            {
                                if (0x33 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].InvType)
                                {
                                    num10 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].IsLockTime;
                                    ushort num17 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].IsRepTime;
                                    ushort num18 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].JSPRepInfo;
                                    break;
                                }
                            }
                            if (1 == num10)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                            if (1 == num10)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                        }
                    }
                    else
                    {
                        ushort num6 = 2;
                        for (int m = 0; m < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; m++)
                        {
                            if (12 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].InvType)
                            {
                                num6 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].IsLockTime;
                                ushort num13 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].IsRepTime;
                                ushort num14 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].JSPRepInfo;
                                break;
                            }
                        }
                        if (1 == num6)
                        {
                            MessageManager.ShowMsgBox("TCD_85_19");
                            return;
                        }
                        if (1 == num6)
                        {
                            MessageManager.ShowMsgBox("TCD_85_19");
                            return;
                        }
                    }
                    goto Label_04E5;
                }
                ushort num4 = 2;
                for (int i = 0; i < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; i++)
                {
                    if (11 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].InvType)
                    {
                        num4 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].IsLockTime;
                        ushort num1  = base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].IsRepTime;
                        ushort num12 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].JSPRepInfo;
                        break;
                    }
                }
                if (1 == num4)
                {
                    MessageManager.ShowMsgBox("TCD_85_19");
                    return;
                }
                if (1 != num4)
                {
                    goto Label_04E5;
                }
                MessageManager.ShowMsgBox("TCD_85_19");
            }
            return;

Label_04E5:
            invoice2 = base.TaxCardInstance.NInvAllotToSubMachine(str2, num, num2, typeCode, num3);
            if (base.TaxCardInstance.get_RetCode() != 0)
            {
                MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
                return;
            }
            if (AllocateCommon.AllocateOneVolume(invoice2, out flag2, out str))
            {
                app2.InvType  = Convert.ToByte(invoice2.get_Kind());
                app2.TypeCode = invoice2.get_TypeCode();
                app2.HeadCode = Convert.ToUInt32(invoice2.get_Number());
                app2.Number   = Convert.ToUInt16(invoice2.get_Count());
                list.Add(app2);
            }
            else if (flag2)
            {
                MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
            }
            else
            {
                MessageManager.ShowMsgBox(str);
            }
Label_0598:
            if (list.Count > 0)
            {
                InvInfoWebAllocMsg msg = new InvInfoWebAllocMsg();
                msg.InsertInvVolume(list);
                msg.ShowDialog();
            }
            base.DialogResult = DialogResult.OK;
            base.Close();
        }
        protected override object[] doService(object[] param)
        {
            TaxCard             card  = TaxCardFactory.CreateTaxCard();
            List <InvVolumeApp> list  = new List <InvVolumeApp>();
            List <int>          list2 = new List <int>();
            bool        flag          = false;
            bool        flag2         = true;
            bool        isDeviceError = false;
            string      msg           = string.Empty;
            InvoiceType typeCode      = (InvoiceType)ShareMethods.GetTypeCode(param[1].ToString());

            if (((0x33 == typeCode) || (11 == typeCode)) || (0x29 == typeCode))
            {
                flag = true;
                msg  = "待分配发票类型有误";
            }
            if (!flag)
            {
                UnlockInvoice unlockVolume = card.NInvSearchUnlockFromMain();
                if (card.get_RetCode() != 0)
                {
                    flag2         = false;
                    isDeviceError = true;
                    msg           = card.get_ErrCode();
                }
                else
                {
                    bool   flag4 = DownloadCommon.CheckEmpty(unlockVolume.Buffer);
                    string str2  = "";
                    if (!flag4)
                    {
                        str2 = unlockVolume.get_Number().PadLeft(8, '0');
                        InvVolumeApp item = new InvVolumeApp();
                        flag2 = AllocateCommon.AllocateOneVolume(unlockVolume, out isDeviceError, out msg);
                        if (flag2)
                        {
                            item.InvType  = Convert.ToByte(unlockVolume.get_Kind());
                            item.TypeCode = unlockVolume.get_TypeCode();
                            item.HeadCode = Convert.ToUInt32(unlockVolume.get_Number());
                            item.Number   = Convert.ToUInt16(unlockVolume.get_Count());
                            list.Add(item);
                            list2.Add(unlockVolume.get_Machine());
                        }
                    }
                    bool flag5 = false;
                    if (Convert.ToInt32(param[3].ToString()).ToString("00000000") == str2)
                    {
                        flag5 = true;
                    }
                    if (flag2 && !flag5)
                    {
                        InvVolumeApp  app2     = new InvVolumeApp();
                        string        str3     = param[2].ToString();
                        long          num      = Convert.ToInt64(param[3].ToString());
                        long          num2     = Convert.ToInt64(param[4].ToString());
                        InvoiceType   type2    = (InvoiceType)ShareMethods.GetTypeCode(param[1].ToString());
                        int           num3     = Convert.ToInt32(param[0].ToString());
                        UnlockInvoice invoice2 = card.NInvAllotToSubMachine(str3, num, num2, type2, num3);
                        if (card.get_RetCode() != 0)
                        {
                            flag2         = false;
                            isDeviceError = true;
                            msg           = card.get_ErrCode();
                        }
                        else
                        {
                            flag2 = AllocateCommon.AllocateOneVolume(invoice2, out isDeviceError, out msg);
                            if (flag2)
                            {
                                app2.InvType  = Convert.ToByte(invoice2.get_Kind());
                                app2.TypeCode = invoice2.get_TypeCode();
                                app2.HeadCode = Convert.ToUInt32(invoice2.get_Number());
                                app2.Number   = Convert.ToUInt16(invoice2.get_Count());
                                list.Add(app2);
                                list2.Add(invoice2.get_Machine());
                            }
                        }
                    }
                }
            }
            XmlDocument    document = new XmlDocument();
            XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "GBK", null);

            document.PreserveWhitespace = false;
            document.AppendChild(newChild);
            XmlElement element = document.CreateElement("FPXT");

            document.AppendChild(element);
            XmlElement element2 = document.CreateElement("OUTPUT");

            element.AppendChild(element2);
            XmlElement element3 = document.CreateElement("CODE");
            XmlElement element4 = document.CreateElement("MESS");

            if (flag)
            {
                element3.InnerText = "0002";
                element4.InnerText = msg;
            }
            else if (flag2)
            {
                element3.InnerText = "0000";
                element4.InnerText = string.Empty;
            }
            else if (isDeviceError)
            {
                element3.InnerText = msg;
                element4.InnerText = MessageManager.GetMessageInfo(msg);
            }
            else
            {
                element3.InnerText = "0001";
                element4.InnerText = msg;
            }
            element2.AppendChild(element3);
            element2.AppendChild(element4);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    XmlElement element5 = document.CreateElement("FPJFP");
                    element2.AppendChild(element5);
                    XmlElement element6 = document.CreateElement("FKPJH");
                    element6.InnerText = list2[i].ToString();
                    element5.AppendChild(element6);
                    XmlElement element7 = document.CreateElement("FPZL");
                    element7.InnerText = list[i].InvType.ToString();
                    element5.AppendChild(element7);
                    XmlElement element8 = document.CreateElement("LBDM");
                    element8.InnerText = list[i].TypeCode;
                    element5.AppendChild(element8);
                    XmlElement element9 = document.CreateElement("QSHM");
                    element9.InnerText = list[i].HeadCode.ToString();
                    element5.AppendChild(element9);
                    XmlElement element10 = document.CreateElement("FPFS");
                    element10.InnerText = list[i].Number.ToString();
                    element5.AppendChild(element10);
                }
            }
            document.PreserveWhitespace = true;
            return(new object[] { document.InnerXml });
        }
 private void btnQuery_Click(object sender, EventArgs e)
 {
     this.reqInvList.Clear();
     if ((this.chkQS.Checked && this.chkJZ.Checked) && (this.data_ksrq.Value > this.data_jsrq.Value))
     {
         MessageManager.ShowMsgBox("INP-441203");
     }
     else
     {
         string startDate = string.Empty;
         string endDate   = string.Empty;
         if (this.chkQS.Checked)
         {
             startDate = this.data_ksrq.Value.ToString("yyyyMMdd");
         }
         else
         {
             startDate = string.Empty;
         }
         if (this.chkJZ.Checked)
         {
             endDate = this.data_jsrq.Value.ToString("yyyyMMdd");
         }
         else
         {
             endDate = string.Empty;
         }
         string xml = string.Empty;
         if (HttpsSender.SendMsg("0040", AllocateCommon.RequestListInput(startDate, endDate), ref xml) != 0)
         {
             MessageManager.ShowMsgBox(xml);
         }
         else
         {
             XmlDocument invList = new XmlDocument();
             invList.LoadXml(xml);
             if (this.logFlag)
             {
                 invList.Save(this.logPath + @"\AllocateRequestListOutput.xml");
             }
             List <InvVolumeApp> listModel = this.RequestListOutput(invList);
             listModel.Sort(delegate(InvVolumeApp left, InvVolumeApp right) {
                 if (left.InvType > right.InvType)
                 {
                     return(1);
                 }
                 if (left.InvType == right.InvType)
                 {
                     if (Convert.ToInt64(left.TypeCode) > Convert.ToInt64(right.TypeCode))
                     {
                         return(1);
                     }
                     if (Convert.ToInt64(left.TypeCode) != Convert.ToInt64(right.TypeCode))
                     {
                         return(-1);
                     }
                     if (left.HeadCode > right.HeadCode)
                     {
                         return(1);
                     }
                     if (left.HeadCode == right.HeadCode)
                     {
                         return(0);
                     }
                 }
                 return(-1);
             });
             this.InsertData(listModel);
         }
     }
 }