public void SelectVolumnList(out List <InvVolumeApp> invList, out List <string> typeList) { List <InvVolumeApp> list = new List <InvVolumeApp>(); List <string> list2 = new List <string>(); DataTable table = this.baseDao.querySQLDataTable("aisino.Fwkp.Fplygl.JPInfo.SelectList", null); if ((table != null) && (table.Rows.Count > 0)) { for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; InvVolumeApp item = new InvVolumeApp { TypeCode = row["LBDM"].ToString(), BuyNumber = Convert.ToInt32(row["LGZS"]), HeadCode = Convert.ToUInt32(row["QSHM"]), Number = Convert.ToUInt16(row["SYZS"]), BuyDate = Convert.ToDateTime(row["LGRQ"]) }; string str = row["JPGG"].ToString(); list.Add(item); list2.Add(str); } } invList = list; typeList = list2; }
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 static string GetFPLBMC(InvVolumeApp invVolume, Dictionary <string, object> dictFPLBBM) { try { string invType = string.Empty; invType = GetInvType(invVolume.InvType); string typeCode = invVolume.TypeCode; string key = string.Empty; string str4 = string.Empty; if (!string.IsNullOrEmpty(typeCode)) { typeCode = typeCode.Trim(); if (2 <= typeCode.Length) { if (10 == typeCode.Length) { key = typeCode.Substring(0, 2) + "00"; } else if (12 == typeCode.Length) { key = typeCode.Substring(1, 2) + "00"; } } else { typeCode = string.Empty; key = string.Empty; } } else { typeCode = string.Empty; key = string.Empty; } if ((dictFPLBBM != null) && (dictFPLBBM.Count > 0)) { str4 = dictFPLBBM.ContainsKey(key) ? dictFPLBBM[key].ToString().Trim() : string.Empty; str4 = str4.Trim() + invType; } return(str4); } catch (BaseException exception) { loger.Error(exception.Message); ExceptionHandler.HandleError(exception); return(string.Empty); } catch (Exception exception2) { loger.Error(exception2.Message); ExceptionHandler.HandleError(exception2); return(string.Empty); } }
public bool DeleteSingleVolumn(InvVolumeApp invVolumn) { this.dict.Clear(); this.dict.Add("LBDM", invVolumn.TypeCode); this.dict.Add("JQSH", ShareMethods.GetVolumnStartNum(invVolumn)); this.dict.Add("JZZH", ShareMethods.GetVolumnEndNum(invVolumn)); if (this.baseDao.updateSQL("aisino.Fwkp.Fplygl.JPInfo.DeleteSingle", this.dict) != 1) { return(false); } return(true); }
private bool FPTuiHui() { try { if (base._bError) { return(false); } DataGridViewRow currentRow = base.customStyleDataGrid1.CurrentRow; if ((currentRow == null) || (base.customStyleDataGrid1.RowCount <= 0)) { return(false); } base.SelectedItems.Clear(); base.SelectedItems.Add(currentRow.Cells["JH"].Value.ToString().Trim()); if (base.SelectedItems.Count <= 0) { MessageManager.ShowMsgBox("INP-441202"); return(false); } if (DialogResult.Yes == MessageManager.ShowMsgBox("INP-441213")) { InvInfoReturnMsg msg = new InvInfoReturnMsg(); msg.InsertInvVolume(currentRow); InvVolumeApp returnVolume = new InvVolumeApp { InvType = ShareMethods.GetTypeCode(currentRow.Cells["FPZL"].Value.ToString()), TypeCode = currentRow.Cells["LBDM"].Value.ToString(), HeadCode = Convert.ToUInt32(currentRow.Cells["QSHM"].Value.ToString()), Number = Convert.ToUInt16(currentRow.Cells["SYZS"].Value.ToString()) }; if (DialogResult.Yes == msg.ShowDialog()) { this.TuiHuiAction(returnVolume); } } } catch (BaseException exception) { base._bError = true; this.loger.Error(exception.Message); ExceptionHandler.HandleError(exception); return(false); } catch (Exception exception2) { base._bError = true; this.loger.Error(exception2.Message); ExceptionHandler.HandleError(exception2); return(false); } return(true); }
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); } }
private bool UpdateVolumnFormats() { Dictionary <InvVolumeApp, string> volumnFormat = new Dictionary <InvVolumeApp, string>(); foreach (DataGridViewRow row in (IEnumerable)this.csdgVolumns.Rows) { InvVolumeApp key = new InvVolumeApp { TypeCode = row.Cells["LBDM"].Value.ToString(), HeadCode = Convert.ToUInt32(row.Cells["JQSH"].Value), Number = Convert.ToUInt16(row.Cells["LGZS"].Value), BuyNumber = Convert.ToUInt16(row.Cells["LGZS"].Value) }; volumnFormat.Add(key, row.Cells["JPGG"].Value.ToString()); } return(this.jpxxDal.UpdateVolumnList(volumnFormat)); }
public string GetSpecificFormat(InvVolumeApp invVolume) { this.dict.Clear(); this.dict.Add("LBDM", invVolume.TypeCode); this.dict.Add("JQSH", ShareMethods.GetVolumnStartNum(invVolume)); this.dict.Add("JZZH", ShareMethods.GetVolumnEndNum(invVolume)); DataTable table = this.baseDao.querySQLDataTable("aisino.Fwkp.Fplygl.JPInfo.GetSpecificFormat", this.dict); string str = string.Empty; if ((table != null) && (table.Rows.Count > 0)) { DataRow row = table.Rows[0]; str = row["JPGG"].ToString(); } return(str); }
public bool InsertSingleVolumn(InvVolumeApp invVolumn, string formatCode) { this.dict.Clear(); this.dict.Add("LBDM", invVolumn.TypeCode); this.dict.Add("JQSH", ShareMethods.GetVolumnStartNum(invVolumn)); this.dict.Add("JZZH", ShareMethods.GetVolumnEndNum(invVolumn)); this.dict.Add("LGZS", invVolumn.BuyNumber); this.dict.Add("QSHM", invVolumn.HeadCode); this.dict.Add("SYZS", invVolumn.Number); this.dict.Add("KPXE", 0); this.dict.Add("LGRQ", invVolumn.BuyDate); this.dict.Add("JPGG", formatCode); if (this.baseDao.updateSQL("aisino.Fwkp.Fplygl.JPInfo.InsertSingle", this.dict) != 1) { return(false); } return(true); }
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 OutDownList() { this.reqInvList.Clear(); foreach (DataGridViewRow row in (IEnumerable)this.csdgList.Rows) { if ((bool)row.Cells["xz"].Value) { InvVolumeApp item = new InvVolumeApp { InvType = this.Str2InvType(row.Cells["fpzl"].Value.ToString()), TypeCode = row.Cells["fpdm"].Value.ToString(), HeadCode = Convert.ToUInt32(row.Cells["qshm"].Value.ToString()), Number = Convert.ToUInt16(row.Cells["fpzs"].Value.ToString()) }; this.reqInvList.Add(item); } } if (this.reqInvList.Count <= 0) { MessageManager.ShowMsgBox("INP-441243"); return(false); } return(true); }
public Dictionary <InvVolumeApp, string> SelectVolumnList() { Dictionary <InvVolumeApp, string> dictionary = new Dictionary <InvVolumeApp, string>(); DataTable table = this.baseDao.querySQLDataTable("aisino.Fwkp.Fplygl.JPInfo.SelectList", null); if ((table != null) && (table.Rows.Count > 0)) { for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; InvVolumeApp key = new InvVolumeApp { TypeCode = row["LBDM"].ToString(), BuyNumber = Convert.ToInt32(row["LGZS"]), HeadCode = Convert.ToUInt32(row["QSHM"]), Number = Convert.ToUInt16(row["SYZS"]), BuyDate = Convert.ToDateTime(row["LGRQ"]) }; string str = row["JPGG"].ToString(); dictionary.Add(key, str); } } return(dictionary); }
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); }
public static List <InvVolumeApp> GetElectricDownloadVolumes(byte type, int amount, int volumeMaxAmount = 0xffff) { List <InvVolumeApp> list = new List <InvVolumeApp>(); int num = amount % volumeMaxAmount; int num2 = amount / volumeMaxAmount; for (int i = 0; i < num2; i++) { InvVolumeApp item = new InvVolumeApp { InvType = type, Number = Convert.ToUInt16(volumeMaxAmount) }; list.Add(item); } if (num != 0) { InvVolumeApp app2 = new InvVolumeApp { InvType = type, Number = Convert.ToUInt16(num) }; list.Add(app2); } return(list); }
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); }
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 }); }
public static bool CheckRepeat(InvVolumeApp locked, InvVolumeApp tarInv) { return(((locked.TypeCode == tarInv.TypeCode) && (locked.HeadCode == tarInv.HeadCode)) && (locked.Number == tarInv.Number)); }
private void btn_download_Click(object sender, EventArgs e) { int num = 0x33; if (this.fplx.SelectedValue.ToString() != num.ToString()) { if (this.fpdm.Text.Equals(string.Empty)) { MessageManager.ShowMsgBox("INP-441231"); return; } if (this.qshm.Text.Equals(string.Empty)) { MessageManager.ShowMsgBox("INP-441232"); return; } } if (this.fpzs.Text.Equals(string.Empty)) { MessageManager.ShowMsgBox("INP-441233"); } else { int num2 = 0x33; if (this.fplx.SelectedValue.ToString() == num2.ToString()) { if (Convert.ToInt32(this.fpzs.Text) <= 0) { MessageManager.ShowMsgBox("INP-441234"); return; } if (Convert.ToInt32(this.fpzs.Text) > Convert.ToInt32(this.qshm.Text)) { MessageManager.ShowMsgBox("INP-441235"); return; } } else if ((0 >= Convert.ToInt32(this.fpzs.Text)) || (Convert.ToInt32(this.fpzs.Text) > 0xffff)) { MessageManager.ShowMsgBox("INP-441236"); return; } this.singleInvVolumn.Clear(); int num3 = 0x33; if (this.fplx.SelectedValue.ToString() == num3.ToString()) { this.singleInvVolumn = DownloadCommon.GetElectricDownloadVolumes(0x33, Convert.ToInt32(this.fpzs.Text), 0xffff); this.isElectricDownload = true; this.electricApplyNum = Convert.ToInt32(this.fpzs.Text); } else { InvVolumeApp item = new InvVolumeApp { InvType = Convert.ToByte(this.fplx.SelectedValue.ToString()), TypeCode = this.fpdm.Text, HeadCode = Convert.ToUInt32(this.qshm.Text.PadLeft(8, '0')), Number = Convert.ToUInt16(this.fpzs.Text) }; this.singleInvVolumn.Add(item); } base.DialogResult = DialogResult.OK; base.Close(); } }
private void TuiHuiAction(InvVolumeApp returnVolume) { try { if (!base._bError) { string deviceType = string.Empty; if (1 == base.TaxCardInstance.get_StateInfo().TBRegFlag) { ChooseReturnMedium medium = new ChooseReturnMedium(); if (DialogResult.OK != medium.ShowDialog()) { return; } deviceType = medium.GetDeviceType(); } else { deviceType = "1"; } bool flag = base.TaxCardInstance.InvReturn(Convert.ToInt32(base.SelectedItems[0]), deviceType); if (base.TaxCardInstance.get_RetCode() != 0) { MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode()); base._bError = true; base.Close(); } else if (flag) { if (0x29 == returnVolume.InvType) { this.jpxxDal.DeleteSingleVolumn(returnVolume); } if (base.TaxCardInstance.get_Machine() == 0) { MessageManager.ShowMsgBox("TCD_9109_"); } else { MessageManager.ShowMsgBox("TCD_9110_"); } this.QueryIndexChanged(null, null); } else if (!this.DeterErrorCard()) { } } } catch (BaseException exception) { base._bError = true; this.loger.Error(exception.Message); ExceptionHandler.HandleError(exception); } catch (Exception exception2) { base._bError = true; this.loger.Error(exception2.Message); ExceptionHandler.HandleError(exception2); } }
public static int GetVolumnEndNum(InvVolumeApp invVolumn) { return(((int)(invVolumn.HeadCode + invVolumn.Number)) - 1); }
private void btnAllot_Click(object sender, EventArgs e) { try { string deviceType; if (this.IsRightData()) { if (DialogResult.OK != MessageManager.ShowMsgBox("INP-441221")) { goto Label_02C4; } deviceType = string.Empty; ChooseAllocateMedium medium = new ChooseAllocateMedium(); if (DialogResult.OK == medium.ShowDialog()) { deviceType = medium.GetDeviceType(); goto Label_0040; } } return; Label_0040: if (base.TaxCardInstance.InvAllot(ShareMethods.StringToInt(this.SelectedItems[0].ToString()), this.lblFpqshm.Text.Trim(), ShareMethods.StringToInt(this.tbxCount.Text.Trim()), deviceType)) { new AllocateSuccess(this.SelectedItems[4].ToString(), this.tbxCount.Text.Trim()).ShowDialog(); string str2 = this.SelectedItems[2].ToString(); uint num = (Convert.ToUInt32(this.SelectedItems[4]) + Convert.ToUInt32(this.SelectedItems[5])) - Convert.ToUInt32(this.SelectedItems[7]); uint num2 = (Convert.ToUInt32(this.SelectedItems[4]) + Convert.ToUInt32(this.SelectedItems[5])) - 1; InvVolumeApp invVolume = new InvVolumeApp { TypeCode = str2, HeadCode = num, Number = Convert.ToUInt16(this.SelectedItems[5]), BuyNumber = Convert.ToInt32(this.SelectedItems[7]) }; string specificFormat = this.jpxxDal.GetSpecificFormat(invVolume); Convert.ToUInt32(this.SelectedItems[4]); uint num3 = (Convert.ToUInt32(this.SelectedItems[4]) + Convert.ToUInt32(this.tbxCount.Text)) - 1; if (num3 < num2) { InvVolumeApp invVolumn = new InvVolumeApp { BuyDate = Convert.ToDateTime(this.SelectedItems[6]), BuyNumber = (int)(num2 - num3), HeadCode = num3 + 1, InvType = ShareMethods.GetTypeCode(this.SelectedItems[1].ToString()), Number = (ushort)(num2 - num3), TypeCode = this.SelectedItems[2].ToString() }; this.jpxxDal.InsertSingleVolumn(invVolumn, specificFormat); } this.jpxxDal.DeleteSingleVolumn(invVolume); } else { if (base.TaxCardInstance.get_RetCode() != 0) { base.TaxCardInstance.get_RetCode(); MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode()); } return; } } catch (BaseException exception) { this.loger.Error(exception.Message); ExceptionHandler.HandleError(exception); } catch (Exception exception2) { this.loger.Error(exception2.Message); ExceptionHandler.HandleError(exception2); } Label_02C4: base.DialogResult = DialogResult.OK; }
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 string RequestDownloadInput(InvVolumeApp downVolumn, InvVolumeApp confirmVolumn, string confirmCrypt, bool withOperation = true) { 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 = this.TaxCardInstance.get_TaxCode(); element2.AppendChild(element3); XmlElement element4 = document.CreateElement("HASH"); element4.InnerText = DownloadCommon.GetDecimalStr(this.TaxCardInstance.Get9BitHashTaxCode()); element2.AppendChild(element4); XmlElement element5 = document.CreateElement("YSSH"); element5.InnerText = this.TaxCardInstance.get_CompressCode(); element2.AppendChild(element5); XmlElement element6 = document.CreateElement("DQBH"); element6.InnerText = this.TaxCardInstance.get_RegionCode(); element2.AppendChild(element6); XmlElement element7 = document.CreateElement("KPJH"); element7.InnerText = this.TaxCardInstance.get_Machine().ToString(); element2.AppendChild(element7); XmlElement element8 = document.CreateElement("SBBH"); element8.InnerText = this.TaxCardInstance.GetInvControlNum(); element2.AppendChild(element8); XmlElement element9 = document.CreateElement("DCBB"); element9.InnerText = this.TaxCardInstance.get_StateInfo().DriverVersion; element2.AppendChild(element9); if (withOperation) { XmlElement element10 = document.CreateElement("CZLX"); element10.InnerText = "F2"; element2.AppendChild(element10); } if (confirmVolumn != null) { XmlElement element11 = document.CreateElement("FPJS"); element2.AppendChild(element11); XmlElement element12 = document.CreateElement("FPZL"); element12.InnerText = confirmVolumn.InvType.ToString(); element11.AppendChild(element12); XmlElement element13 = document.CreateElement("LBDM"); element13.InnerText = confirmVolumn.TypeCode; element11.AppendChild(element13); XmlElement element14 = document.CreateElement("QSHM"); element14.InnerText = confirmVolumn.HeadCode.ToString(); element11.AppendChild(element14); XmlElement element15 = document.CreateElement("FPFS"); element15.InnerText = confirmVolumn.Number.ToString(); element11.AppendChild(element15); XmlElement element16 = document.CreateElement("FLAG"); element16.InnerText = confirmCrypt; element11.AppendChild(element16); } if (downVolumn != null) { XmlElement element17 = document.CreateElement("FPXZ"); element2.AppendChild(element17); XmlElement element18 = document.CreateElement("FPZL"); element18.InnerText = downVolumn.InvType.ToString(); element17.AppendChild(element18); XmlElement element19 = document.CreateElement("LBDM"); if (0x33 == downVolumn.InvType) { element19.InnerText = string.Empty; } else { element19.InnerText = downVolumn.TypeCode; } element17.AppendChild(element19); XmlElement element20 = document.CreateElement("QSHM"); if (0x33 == downVolumn.InvType) { element20.InnerText = string.Empty; } else { element20.InnerText = downVolumn.HeadCode.ToString(); } element17.AppendChild(element20); XmlElement element21 = document.CreateElement("FPFS"); element21.InnerText = downVolumn.Number.ToString(); element17.AppendChild(element21); byte[] inArray = this.TaxCardInstance.NInvGetAuthorization(); XmlElement element22 = document.CreateElement("GPSQ"); element22.InnerText = Convert.ToBase64String(inArray); element17.AppendChild(element22); } document.PreserveWhitespace = true; if (this.logFlag) { document.Save(this.logPath + @"\RequestDownloadInput.xml"); } return(document.InnerXml); }
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 int GetVolumnStartNum(InvVolumeApp invVolumn) { return(((int)(invVolumn.HeadCode + invVolumn.Number)) - invVolumn.BuyNumber); }