private void ClearBuffer(byte fplx) { byte[] buffer = null; if ((fplx == 0) || (2 == fplx)) { buffer = new byte[1]; } else if (((11 == fplx) || (12 == fplx)) || (0x33 == fplx)) { buffer = new byte[] { 11 }; } foreach (byte num in buffer) { UnlockInvoice invoice = this.TaxCardInstance.NInvGetUnlockInvoice(num); if (this.TaxCardInstance.get_RetCode() != 0) { MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode()); break; } if (!DownloadCommon.CheckEmpty(invoice.Buffer)) { 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()) }; bool withOperation = true; string str = string.Empty; string xml = string.Empty; if (((confirmVolumn.InvType == 0) || (2 == confirmVolumn.InvType)) || (12 == confirmVolumn.InvType)) { str = "0040"; withOperation = true; } else if (0x33 == confirmVolumn.InvType) { str = "0020"; withOperation = false; } if (HttpsSender.SendMsg(str, this.RequestDownloadInput(null, confirmVolumn, Convert.ToBase64String(invoice.Buffer), withOperation), ref xml) != 0) { MessageManager.ShowMsgBox(xml); break; } XmlDocument downInvXml = new XmlDocument(); downInvXml.LoadXml(xml); if (this.logFlag) { downInvXml.Save(this.logPath + @"\AllocateRequestDownloadOutput.xml"); } this.RequestDownloadOutput(downInvXml); } } }
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); } } }
private bool ClearAllocateBuffer() { UnlockInvoice invoice = this.TaxCardInstance.NInvGetUnlockInvoice(11); if (this.TaxCardInstance.get_RetCode() != 0) { MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode()); return(false); } if (!DownloadCommon.CheckEmpty(invoice.Buffer)) { 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()) }; if (0x33 == confirmVolumn.InvType) { return(true); } string xml = string.Empty; if (HttpsSender.SendMsg("0040", this.RequestDownloadInput(null, confirmVolumn, Convert.ToBase64String(invoice.Buffer), true), ref xml) != 0) { MessageManager.ShowMsgBox(xml); return(false); } XmlDocument downInvXml = new XmlDocument(); downInvXml.LoadXml(xml); if (this.logFlag) { downInvXml.Save(this.logPath + @"\AllocateRequestDownloadOutput.xml"); } this.RequestDownloadOutput(downInvXml); } return(true); }
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(); }
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); }
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; } }
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; } } } } }
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; } } } } }
public static XmlDocument CreateAllocateInput(UnlockInvoice volumeInfo) { try { 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("INPUT"); element.AppendChild(element2); XmlElement element3 = document.CreateElement("NSRSBH"); element3.InnerText = TaxCardInstance.get_TaxCode(); element2.AppendChild(element3); XmlElement element4 = document.CreateElement("KPJH"); element4.InnerText = TaxCardInstance.get_Machine().ToString(); element2.AppendChild(element4); XmlElement element5 = document.CreateElement("SBBH"); element5.InnerText = TaxCardInstance.GetInvControlNum(); element2.AppendChild(element5); XmlElement element6 = document.CreateElement("DCBB"); element6.InnerText = TaxCardInstance.get_StateInfo().DriverVersion; element2.AppendChild(element6); XmlElement element7 = document.CreateElement("HASH"); element7.InnerText = DownloadCommon.GetDecimalStr(TaxCardInstance.Get9BitHashTaxCode()); element2.AppendChild(element7); XmlElement element8 = document.CreateElement("YSSH"); element8.InnerText = TaxCardInstance.get_CompressCode(); element2.AppendChild(element8); XmlElement element9 = document.CreateElement("CZLX"); element9.InnerText = "Z1"; element2.AppendChild(element9); XmlElement element10 = document.CreateElement("FPJSFP"); element2.AppendChild(element10); XmlElement element11 = document.CreateElement("FKPJH"); element11.InnerText = volumeInfo.get_Machine().ToString(); element10.AppendChild(element11); XmlElement element12 = document.CreateElement("FPZL"); element12.InnerText = volumeInfo.get_Kind().ToString(); element10.AppendChild(element12); XmlElement element13 = document.CreateElement("LBDM"); element13.InnerText = volumeInfo.get_TypeCode(); element10.AppendChild(element13); XmlElement element14 = document.CreateElement("QSHM"); element14.InnerText = volumeInfo.get_Number().PadLeft(8, '0'); element10.AppendChild(element14); XmlElement element15 = document.CreateElement("FPFS"); element15.InnerText = volumeInfo.get_Count().ToString(); element10.AppendChild(element15); XmlElement element16 = document.CreateElement("FLAG"); element16.InnerText = Convert.ToBase64String(volumeInfo.Buffer); element10.AppendChild(element16); document.PreserveWhitespace = true; return(document); } catch (BaseException exception) { loger.Error(exception.Message); ExceptionHandler.HandleError(exception); return(null); } catch (Exception exception2) { loger.Error(exception2.Message); ExceptionHandler.HandleError(exception2); return(null); } }
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 }); }