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