/// <summary> /// Get infomation asset issue by name /// </summary> /// <param name="parameters"> /// Parameter Index /// [0] : Asset issue name /// </param> /// <returns></returns> public static bool AssetIssueListByName(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] <asset issue name>\n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters == null || parameters.Length != 1) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { string name = parameters[0]; RpcApiResult result = RpcApi.AssetIssueListByName(name, out AssetIssueList contracts); if (result.Result) { Console.WriteLine(PrintUtil.PrintAssetIssueList(contracts)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
/// <summary> /// Get information node list /// </summary> /// <param name="parameters"> /// Parameter Index /// </param> /// <returns></returns> public static bool ListNode(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] \n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters != null) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { RpcApiResult result = RpcApi.ListNode(out NodeList nodes); if (result.Result) { Console.WriteLine(PrintUtil.PrintNodeList(nodes)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
public override void CreateNewData(BizDataEventArgs e) { base.CreateNewData(e); ComboFieldEditor comboEidtor = this.View.GetControl <ComboFieldEditor>("F_HS_SelectPrinter"); List <EnumItem> comboOptions = new List <EnumItem>(); List <string> printers = PrintUtil.GetPrinterList(); comboOptions.Add(new EnumItem() { EnumId = "", Value = "", Caption = new LocaleValue("") }); // 空选项 for (int i = 0; i < printers.Count; i++) { string ProjectName = printers[i]; comboOptions.Add( new EnumItem() { EnumId = "" + i + 1, Value = ProjectName, Caption = new LocaleValue(ProjectName) }); } comboEidtor.SetComboItems(comboOptions); }
// Update is called once per frame void Update() { float speedMagnitude = controller.Vel.magnitude; // bob logic float desiredScale = controller.MidAir ? 0 : Mathf.Min(speedMagnitude / controller.speed, 1); _speedJumpLerp = PrintUtil.Damp(_speedJumpLerp, desiredScale, transitionLambda, Time.deltaTime); float desiredSprintScale = controller.MidAir ? 0 : Mathf.Clamp(speedMagnitude / controller.speed - 1, 0, 1); _sprintLerp = PrintUtil.Damp(_sprintLerp, desiredSprintScale, transitionLambda, Time.deltaTime); // update distance moved _distanceMoved += speedMagnitude * Time.deltaTime; // walking animation float bounce = (Mathf.Abs(Mathf.Sin(_distanceMoved * bobSpeed / controller.speed)) * bobHeight - _halfBobHeight) * _speedJumpLerp; float shift = (Mathf.Cos(_distanceMoved * bobSpeed / controller.speed) * shiftWidth - _halfShiftWidth) * _sprintLerp; _rotXShift = PrintUtil.Damp(_rotXShift, -controller.DRotY * sway / Time.deltaTime, swayLambda, Time.deltaTime); _rotYShift = PrintUtil.Damp(_rotYShift, controller.DRotX * sway / Time.deltaTime, swayLambda, Time.deltaTime); // vert velocity shift float desiredVerticalShift = controller.MidAir ? Mathf.Clamp(controller.Vel.y * verticalVelocityInfluence, -verticalInfluenceClamp, verticalInfluenceClamp) : 0; _verticalVelocityShift = PrintUtil.Damp(_verticalVelocityShift, desiredVerticalShift, transitionLambda, Time.deltaTime); transform.localPosition = new Vector3(shift + _rotXShift, bounce + _rotYShift, 0); transform.position += new Vector3(0, _verticalVelocityShift, 0); }
public override void ButtonClick(ButtonClickEventArgs e) { base.ButtonClick(e); if (e.Key.EqualsIgnoreCase("F_HS_Confirm")) { try { string printerName = GetSelectedPrinterName(); if (numbers != null && numbers.Count > 0) { foreach (var num in numbers) { if (num != null) { PrintUtil.Print("C:\\Fedex\\" + num + ".pdf", printerName); } } } this.View.Close(); } catch (Exception ex) { this.View.ShowErrMessage(ex.Message + Environment.NewLine + ex.StackTrace, "", MessageBoxType.Error); } } else if (e.Key.EqualsIgnoreCase("F_HS_Cancel")) { this.View.Close(); } }
/// <summary> /// Get Blocks /// </summary> /// <param name="parameters"> /// Parameter Index /// [0] : Start block number /// [1] : Block limit count /// </param> /// <returns></returns> public static bool GetBlockByLimitNext(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] <start number> <end number>\n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters == null || parameters.Length != 2) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { long start = long.Parse(parameters[0]); long end = long.Parse(parameters[1]); RpcApiResult result = RpcApi.GetBlockByLimitNext(start, end, out BlockListExtention blocks); if (result.Result) { Console.WriteLine(PrintUtil.PrintBlockListExtention(blocks)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
/// <summary> /// Get block by id /// </summary> /// <param name="parameters"> /// Parameter Index /// [0] : Block Id /// </param> /// <returns></returns> public static bool GetBlockById(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] <block id>\n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters == null || parameters.Length != 1) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { RpcApiResult result = RpcApi.GetBlockById(parameters[0], out BlockExtention block); if (result.Result) { Console.WriteLine(PrintUtil.PrintBlockExtention(block)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
public void ReadCsvFileTest() { //create a file that we will try to read using the component var printFile = new PrintUtil { ForceCreation = true, OutputColumns = new List <string>(), PrintFileName = TxtTestFileName, PrintList = "1234" }; printFile.OutputColumns.Add("#"); printFile.PrintFile(); //check if file exists Assert.IsTrue(File.Exists(printFile.PrintFileName)); //check if this file can be read Assert.IsTrue(ReadUtil.ReadCsvFile(printFile.PrintFileName).Count > 0); //check if the file was loaded with all records Assert.IsTrue(ReadUtil.ReadCsvFile(printFile.PrintFileName).Count == 4); //clean up now File.Delete(printFile.PrintFileName); Assert.IsFalse(File.Exists(printFile.PrintFileName)); }
private void BTN_PRINT_Click(object sender, EventArgs e) { DialogResult dRet = MetroMessageBox.Show(this, Constants.getMessage("REPRINT_CONFIRM"), "상세조회", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dRet != DialogResult.Yes) { return; } Transaction tran = new Transaction(); JObject sebdObj = new JObject(); sebdObj.Add("buy_serial_no", TXT_BUY_SERIAL_NO.Text.Replace("-", "")); sebdObj.Add("tml_id", Constants.TML_ID); try { JObject objRet = tran.sendServer_object(sebdObj.ToString(), tran.url_Slip_Info, 60, true, true); PrintUtil pu = new PrintUtil(); pu.PrintRefundSlip(objRet); } catch (Exception ex2) { MetroMessageBox.Show(this, Constants.getMessage("ERROR_PRINT"), "상세조회", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static Transaction SetPermissionId(ref Transaction transaction) { if (transaction.Signature.Count != 0 || transaction.RawData.Contract[0].PermissionId != 0) { return(transaction); } Console.WriteLine("Your transaction details are as follows, please confirm."); Console.WriteLine("transaction hex string is " + transaction.ToByteArray().ToHexString()); Console.WriteLine(PrintUtil.PrintTransaction(transaction)); Console.WriteLine("Please confirm and input your permission id," + " if input y or Y means default 0, other non-numeric characters will cancell transaction."); int permission_id = InputPermissionid(); if (permission_id < 0) { throw new OperationCanceledException("user cancelled."); } if (permission_id != 0) { transaction.RawData.Contract[0].PermissionId = permission_id; } return(transaction); }
public void PrintFileTest() { //create a file that we will try to read using the component var printFile = new PrintUtil { ForceCreation = true, OutputColumns = new List <string>(), PrintFileName = TxtTestFileName, PrintList = "#" }; printFile.OutputColumns.Add("#"); printFile.PrintFile(); //check if file exists Assert.IsTrue(File.Exists(printFile.PrintFileName)); //read the contents of the file using (var streamReader = new StreamReader(printFile.PrintFileName)) { var stream = streamReader.ReadLine(); Assert.AreEqual("#", stream, "File was not Printed successfully"); } //clean up now File.Delete(printFile.PrintFileName); Assert.IsFalse(File.Exists(printFile.PrintFileName)); }
/// <summary> /// Get approved transaction list /// </summary> /// <param name="parameters"></param> /// /// Parameter Index /// [0] : Transaction binary data /// <returns></returns> public static bool GetTransactionApprovedList(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] <transaction>\n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters == null || parameters.Length != 1) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { Transaction transaction = Transaction.Parser.ParseFrom(parameters[0].HexToBytes()); RpcApiResult result = RpcApi.GetTransactionApprovedList(transaction, out TransactionApprovedList transaction_list); if (result.Result) { Console.WriteLine(PrintUtil.PrintTransactionApprovedList(transaction_list)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
protected override void InBlock(string shcode, bool isNext = false) { var szTrCode = _resModel.Name; LOG.Debug($"trCountLimit : {_query.GetTRCountLimit(szTrCode)}, trCountRequest : {_query.GetTRCountRequest(szTrCode)}, trCountBaseSec : {_query.GetTRCountBaseSec(szTrCode)}, trCountPerSec : {_query.GetTRCountPerSec(szTrCode)}"); if (_query.GetTRCountLimit(szTrCode) != 0) { while (_query.GetTRCountLimit(szTrCode) <= _query.GetTRCountRequest(szTrCode)) { LOG.Debug($"sleep {szTrCode} {_query.GetTRCountLimit(szTrCode)}, {_query.GetTRCountRequest(szTrCode)}"); Thread.Sleep(10000); } } if (isNext == false) { fi = new FileInfo(Settings.Default.data_path + "\\xing\\" + szTrCode + "-" + shcode + ".csv"); if (fi.Directory != null && !fi.Directory.Exists) { System.IO.Directory.CreateDirectory(fi.DirectoryName); } fi.Delete(); var today = DateTime.Now; _inBlock = new _t4201InBlock() { shcode = shcode, gubun = "0", ncnt = 1, qrycnt = 500, tdgb = "0", sdate = today.AddDays(-5).ToString("yyyyMMdd"), edate = today.ToString("yyyyMMdd"), }; } var block = _resModel.Blocks[szTrCode + "InBlock"]; _query.SetFieldData(block.Name, "shcode", 0, _inBlock.shcode); _query.SetFieldData(block.Name, "gubun", 0, _inBlock.gubun); _query.SetFieldData(block.Name, "ncnt", 0, _inBlock.ncnt.ToString()); _query.SetFieldData(block.Name, "qrycnt", 0, _inBlock.qrycnt.ToString()); _query.SetFieldData(block.Name, "tdgb", 0, _inBlock.tdgb); _query.SetFieldData(block.Name, "sdate", 0, _inBlock.sdate); _query.SetFieldData(block.Name, "edate", 0, _inBlock.edate); _query.SetFieldData(block.Name, "cts_date", 0, _inBlock.cts_date); _query.SetFieldData(block.Name, "cts_time", 0, _inBlock.cts_time); _query.SetFieldData(block.Name, "cts_daygb", 0, _inBlock.cts_daygb); _query.Request(isNext); LOG.Info("s==============InBlock================="); LOG.Info("=========== GetTrCode"); LOG.Info(_query.GetTrCode()); LOG.Info("=========== GetTrDesc"); LOG.Info(_query.GetTrDesc()); LOG.Info("=========== InBlock Data"); LOG.Info(PrintUtil.PrintProperties(_inBlock)); LOG.Info("e==============InBlock================="); }
void tsmPrint_Click(object sender, EventArgs e) { if (_contract == null || _details == null) { MessageBox.Show("请查询出合同信息再打印。"); return; } _contract.moneydaxie = ctlmoney.Text; PrintUtil.PrintContract3(_contract, _details); }
/// <summary> /// 获取header节点数据 /// </summary> /// <param name="dEBusinessItem"></param> /// <returns></returns> private DataTable GetHeaderTable(DEBusinessItem dEBusinessItem) { if (dEBusinessItem == null) { return(null); } var dt = BuildHeaderDt(); DataRow row = dt.NewRow(); #region 普通节点,默认ERP列名和PLM列名一致 foreach (DataColumn col in dt.Columns) { var val = dEBusinessItem.GetAttrValue(dEBusinessItem.ClassName, col.ColumnName.ToUpper()); switch (col.ColumnName) { default: row[col] = val == null ? DBNull.Value : val; break; case "CreatePerson": row[col] = PrintUtil.GetUserName(dEBusinessItem.Creator); break; case "ModifyPerson": row[col] = PrintUtil.GetUserName(dEBusinessItem.LatestUpdator); break; case "ModifyDate": row[col] = dEBusinessItem.LatestUpdateTime; break; case "unitgroup_code": row[col] = val == null ? "01" : val; break; case "cPlanMethod": row[col] = val == null ? "L" : val; break; case "cSRPolicy": row[col] = val == null ? "PE" : val; break; case "iSupplyType": row[col] = val == null ? 0 : val; break; } } #endregion dt.Rows.Add(row); return(dt); }
void Update() { // rotation _cameraKickRot *= (Quaternion.SlerpUnclamped(Quaternion.identity, _cameraKickVel, Time.deltaTime)); _cameraKickVel = PrintUtil.Damp(_cameraKickVel, Quaternion.identity, kickVelLambda, Time.deltaTime); _cameraKickRot = PrintUtil.Damp(_cameraKickRot, Quaternion.identity, kickLambda, Time.deltaTime); // position _cameraBouncePos += _cameraBounceVel * Time.deltaTime; _cameraBounceVel = PrintUtil.Damp(_cameraBounceVel, Vector3.zero, bounceVelLambda, Time.deltaTime); _cameraBouncePos = PrintUtil.Damp(_cameraBouncePos, Vector3.zero, bounceLambda, Time.deltaTime); }
private void btnPrintNew_Click(object sender, RoutedEventArgs e) { var items = this.gcs.ToArray(); if (items == null || items.Length < 1) { MessageBox.Show("没有需要打印的数据"); return; } try { string printer = LocalConfigService.GetValue(SystemNames.CONFIG_PRINTER_A4, ""); if (string.IsNullOrWhiteSpace(printer)) { throw new Exception("请在系统配置里面,配置要使用的打印机"); } //数据数量过滤 int minCount = 1; int.TryParse(this.tbMinCount.Text.Trim(), out minCount); Dictionary <string, List <GoodsCount> > gcs = new Dictionary <string, List <GoodsCount> >(); foreach (var gc in items) { if (items.Where(obj => obj.Address == gc.Address).Select(o => o.Count).Sum() >= minCount) { if (gcs.ContainsKey(gc.Vendor) == false) { gcs[gc.Vendor] = new List <GoodsCount>(); } gcs[gc.Vendor].Add(gc); } } string message = string.Format("是否打印:\n打印机:{0}\n打印数量:{1}", printer, gcs.Select(obj => obj.Value.Count).Sum()); if (MessageBox.Show(message, "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return; } var pd = PrintUtil.GetPrinter(printer); GoodsCountPrintDocument2 goodsCountDoc = new GoodsCountPrintDocument2(); goodsCountDoc.PageSize = new Size(pd.PrintableAreaWidth, pd.PrintableAreaHeight); goodsCountDoc.SetGoodsCount(gcs, ServiceContainer.GetService <SystemConfigService>().Get(-1, "GOODS_NAME", ""), ServiceContainer.GetService <SystemConfigService>().Get(-1, "GOODS_PHONE", "")); pd.PrintDocument(goodsCountDoc, "拿货统计"); MessageBox.Show("打印完成"); } catch (Exception ex) { MessageBox.Show(ex.Message, "打印出错"); } }
public void Print(PrintOptions optName) { //initialize the Print Utility var printer = new PrintUtil { ForceCreation = true, PrintFileName = PrintFileName, OutputColumns = new List <string>() }; //switch Print View - use linq to order and sort the raw data into various file formats switch (optName) { case PrintOptions.Frequency: printer.OutputColumns.Add("LastName"); printer.OutputColumns.Add("Frequency"); printer.PrintList = Records.GroupBy( l => l.LastName, l => l.LastName, (key, g) => new { LastName = key, Frequency = g.Count() }).OrderByDescending(l => l.Frequency); break; case PrintOptions.AddressSort: printer.OutputColumns.Add("Address"); printer.PrintList = Records.OrderBy(a => a.StreetName); break; case PrintOptions.NameList: printer.OutputColumns.Add("FirstName"); printer.OutputColumns.Add("LastName"); printer.PrintList = Records.OrderByDescending(o => o.LastName).Select(p => new ContactInfo { FirstName = p.FirstName, LastName = p.LastName }).ToList(); break; case PrintOptions.Default: printer.OutputColumns.Add("FirstName"); printer.OutputColumns.Add("LastName"); printer.OutputColumns.Add("Address"); printer.OutputColumns.Add("PhoneNumber"); printer.PrintList = Records; break; default: throw new ArgumentOutOfRangeException(nameof(optName), optName, null); } //call Generic Print based on View if (printer.PrintFile()) { Process.Start("notepad.exe", printer.PrintFileName); } }
public static void Demo() { int[] array = new int[] { 4, 1, 3, 2, 16, 9, 10, 14, 8, 7, 4, 3, 19, 8, 33, 45 }; PrintUtil.PrintHeap(array); HeapSort(array); PrintUtil.PrintHeap(array); foreach (var item in array) { Console.Write(item); Console.Write(' '); } }
/// <summary> /// Get block information /// </summary> /// <param name="parameters"> /// Parameter Index /// [0] : Block number (optional) /// </param> /// <returns></returns> public static bool GetBlock(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] <block number>\n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters != null && parameters.Length > 1) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { RpcApiResult result = null; BlockExtention block = null; if (parameters == null) { Console.WriteLine("Get current block."); result = RpcApi.GetBlockByLatestNum(out block); } else { if (!long.TryParse(parameters[0], out long block_num)) { Console.WriteLine("Invalid block number"); return(true); } result = RpcApi.GetBlock(block_num, out block); } if (result.Result) { Console.WriteLine(PrintUtil.PrintBlockExtention(block)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
/// <summary> /// Get transaction information by id /// </summary> /// <param name="parameters"></param> /// /// Parameter Index /// [0] : Transaction id /// <returns></returns> public static bool GetTransactionsToThis(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] <transaction id>\n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters == null || parameters.Length != 3) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { byte[] address = Wallet.Base58ToAddress(parameters[0]); int offset = int.Parse(parameters[1]); int limit = int.Parse(parameters[2]); RpcApiResult result = RpcApi.GetTransactionsToThis(address, offset, limit, out TransactionListExtention transactions); if (result.Result) { if (transactions != null) { Console.WriteLine(PrintUtil.PrintTransactionExtentionList(new List <TransactionExtention>(transactions.Transaction))); } else { Console.WriteLine("No transaction from " + Wallet.AddressToBase58(address)); } } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
public static void Start() { ListNode l_1_head = new ListNode(2); ListNode l_1_1 = new ListNode(4); ListNode l_1_2 = new ListNode(3); l_1_head.next = l_1_1; l_1_1.next = l_1_2; ListNode l_2_head = new ListNode(5); ListNode l_2_1 = new ListNode(6); ListNode l_2_2 = new ListNode(4); l_2_head.next = l_2_1; l_2_1.next = l_2_2; ListNode ret = AddTwoNumbers(l_1_head, l_2_head); PrintUtil.PrintListNode(ret); }
void CameraMovement() { Vector2 deltaAim = m_Aim.ReadValue <Vector2>(); _dRotX = (invertMouseY ? 1 : -1) * deltaAim.y * sensitivity; _lookX += _dRotX; _lookX = Mathf.Clamp(_lookX, -90, 90); _dRotY = deltaAim.x * sensitivity; _lookY += _dRotY; cam.transform.localRotation = Quaternion.Euler(_lookX, _lookY, 0) * kickController.CameraKickRot; // move camera ahead a bit if grounded _cameraXZPos = !_midAir && cameraVelocityShift ? PrintUtil.Damp(_cameraXZPos, new Vector2(_vel.x, _vel.z) *cameraVelocityShiftScale, 10f, Time.deltaTime) : PrintUtil.Damp(_cameraXZPos, Vector2.zero, 10f, Time.deltaTime); cam.transform.localPosition = _initialCameraPos + new Vector3(_cameraXZPos.x, 0, _cameraXZPos.y); cam.transform.position += kickController.CameraBouncePos; }
static void Main(string[] args) { //print1("电子票.pdf"); try { Stopwatch watch = new Stopwatch(); watch.Start(); int i = 0; while (i < 1) { PrintUtil.PrintDefault("电子票.pdf"); i++; } watch.Stop(); Console.WriteLine(watch.Elapsed); Console.ReadKey(); } catch (Exception e) { Console.Write(e); } Console.ReadKey(); }
/// <summary> /// 打印PDF文件 /// </summary> /// <param name="printer_name"></param> /// <param name="file_path"></param> /// <param name="ax_acropdfunit"></param> /// <returns></returns> public static string print(string printer_name, string file_path, AxAcroPDF ax_acropdfunit) { try { if (!printer_name.isNull()) { string default_printer = PrintUtil.defaultPrinter(); if (default_printer != printer_name) { PrintUtil.setDefaultPrinter(printer_name); while (PrintUtil.defaultPrinter() != printer_name) { Thread.Sleep(50); } Thread.Sleep(1000); } } ax_acropdfunit.LoadFile(file_path); ax_acropdfunit.printAllFit(true); return(""); } catch (Exception ex) { return(ex.ToString()); } }
private void btnPrint_Click(object sender, RoutedEventArgs e) { var items = this.gcs.ToArray(); if (items == null || items.Length < 1) { MessageBox.Show("没有需要打印的数据"); return; } try { string printer = LocalConfigService.GetValue(SystemNames.CONFIG_PRINTER_A4, ""); if (string.IsNullOrWhiteSpace(printer)) { throw new Exception("请在系统配置里面,配置要使用的打印机"); } string message = string.Format("是否打印:\n打印机:{0}\n打印数量:{1}", printer, items.Select(obj => obj.Count).Sum()); if (MessageBox.Show(message, "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return; } var pd = PrintUtil.GetPrinter(printer); GoodsCountPrintDocument goodsCountDoc = new GoodsCountPrintDocument(); goodsCountDoc.PageSize = new Size(796.8, 1123.2); goodsCountDoc.SetGoodsCount(items); pd.PrintDocument(goodsCountDoc, "拿货统计"); SaveLastOrderInfo(); MessageBox.Show("打印完成"); } catch (Exception ex) { MessageBox.Show(ex.Message, "打印出错"); } }
/// <summary> /// Get information proposal list /// </summary> /// <param name="parameters"> /// Parameter Index /// [0] : Offset /// [1] : Limit /// </param> /// <returns></returns> public static bool ListProposalPaginated(string command, string[] parameters) { string[] usage = new string[] { string.Format("{0} [command option] \n", command) }; string[] command_option = new string[] { HelpCommandOption.Help }; if (parameters == null || parameters.Length != 2) { OutputHelpMessage(usage, null, command_option, null); return(true); } try { int offset = int.Parse(parameters[0]); int limit = int.Parse(parameters[1]); RpcApiResult result = RpcApi.ListProposalPaginated(offset, limit, out ProposalList proposals); if (result.Result) { Console.WriteLine(PrintUtil.PrintProposalsList(proposals)); } OutputResultMessage(command, result.Result, result.Code, result.Message); } catch (System.Exception e) { Console.WriteLine(e.Message + "\n\n" + e.StackTrace); } return(true); }
public static RpcApiResult SignatureTransaction(ref Transaction transaction) { if (transaction.RawData.Timestamp == 0) { transaction.RawData.Timestamp = Helper.CurrentTimeMillis(); } ProtocolUtil.SetExpirationTime(ref transaction); Console.WriteLine("Your transaction details are as follows, please confirm."); Console.WriteLine("transaction hex string is " + transaction.ToByteArray().ToHexString()); Console.WriteLine(PrintUtil.PrintTransaction(transaction)); Console.WriteLine( "Please confirm and input your permission id, if input y or Y means default 0, other non-numeric characters will cancell transaction."); ProtocolUtil.SetPermissionId(ref transaction); try { while (true) { Console.WriteLine("Please choose keystore for signature."); KeyStore key_store = SelectKeyStore(); string password = CommandLineUtil.ReadPasswordString("Please input password"); if (KeyStoreService.DecryptKeyStore(password, key_store, out byte[] privatekey))
private void BTN_SUBMIT_Click(object sender, EventArgs e) { try { Boolean bRet = false; //처리중에 이중 입력 방지 if (this.UseWaitCursor) { return; } setWaitCursor(true); Utils util = new Utils(); Transaction tran = new Transaction(); if (Constants.PRINTER_TYPE == null || string.Empty.Equals(Constants.PRINTER_TYPE.Trim())) { MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_NOTHING"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning); setWaitCursor(false); BTN_SUBMIT.Focus(); return; } //정합성 체크. 여권정보 없어도 출력 할 수 있게끔.. if (!validationCheck(false, true)) { setWaitCursor(false); BTN_SUBMIT.Focus(); return; } long nCalTax = Int64.Parse(TXT_SALES_AMT.Text.ToString().Replace(",", "")) / 11; long nViewTax = Int64.Parse(TXT_TAX_AMT.Text.ToString().Replace(",", "")); //예상새액이 계산 세액보다 5% 이상 차이가 있으면 오류 확인 팝업 호출 Boolean bDiff = (Math.Abs(nCalTax - nViewTax) * 100 / nCalTax) >= 5.0 ? true : false; DialogResult dRet; if (bDiff) { dRet = MetroMessageBox.Show(this, Constants.getMessage("TAX_CONFIRM") + "\n● 예상 세금액:" + string.Format(CultureInfo.CreateSpecificCulture("en-US"), "{0:n0}", nCalTax).Replace("$", "") + "\n● 입력 세금액:" + string.Format(CultureInfo.CreateSpecificCulture("en-US"), "{0:n0}", nViewTax).Replace("$", "") , "Issue", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dRet != DialogResult.Yes) { setWaitCursor(false); BTN_SUBMIT.Focus(); return; } } //전표발행여부 확인 //전표를 발행하시겠습니까? //아래에 관련 데이터 출력해야 함 //여권정보 //숙박일수 dRet = MetroMessageBox.Show(this, Constants.getMessage("ISSUE_CONFIRM") + "\n● 공급가격:" + TXT_SALES_AMT.Text + "\n● 세금:" + TXT_TAX_AMT.Text + "\n● 환급금:" + TXT_REFUND_AMT.Text, "Issue", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dRet != DialogResult.Yes) { setWaitCursor(false); BTN_SUBMIT.Focus(); return; } try { setWaitCursor(true); JObject jsonSlip = new JObject(); JObject jsonStdInfo = new JObject(); JObject jsonSutInfo = new JObject(); JArray arrjsonSlip = new JArray(); int nSerialNo = 0; //calAccAmt();//금액 재계산 calAccAmt(true, true);//금액 재계산 long nStdNight = Int64.Parse(COM_STD_NIGHT.Text.Replace(",", "")); long nSutNight = Int64.Parse(COM_SUT_NIGHT.Text.Replace(",", "")); long nStdSalesAmt = Int64.Parse(TXT_STD_SALES_AMT.Text.Replace(",", "")); long nSutSalesAmt = Int64.Parse(TXT_SUT_SALES_AMT.Text.Replace(",", "")); jsonSlip.Add("passport_no", TXT_PASSPORT_NO.Text); jsonSlip.Add("passport_name", TXT_PASSPORT_NAME.Text); jsonSlip.Add("passport_nat", TXT_PASSPORT_NAT.Text); jsonSlip.Add("passport_sex", COM_PASSPORT_SEX.Text); jsonSlip.Add("passport_birth", TXT_PASSPORT_BIRTH.Text.Replace("-", "").Replace("/", "")); jsonSlip.Add("passport_expire", TXT_PASSPORT_EXP.Text.Replace("-", "").Replace("/", "")); jsonSlip.Add("sales_amount", TXT_SALES_AMT.Text.Replace(",", "")); jsonSlip.Add("tax_amount", TXT_TAX_AMT.Text.Replace(",", "")); jsonSlip.Add("charge_amount", (Int64.Parse(TXT_TAX_AMT.Text.Replace(",", "")) - Int64.Parse(TXT_REFUND_AMT.Text.Replace(",", ""))).ToString()); jsonSlip.Add("refund_amount", TXT_REFUND_AMT.Text.Replace(",", "")); jsonSlip.Add("tml_id", Constants.TML_ID); jsonSlip.Add("sale_date", TXT_REFUND_DATE.Text.Replace("-", "").Replace("/", "")); jsonSlip.Add("sale_time", DateTime.Now.ToString("HHmmss")); jsonSlip.Add("payment_type", COM_PAYMENT.SelectedIndex != 0 ? "02" : "01");//2018.02.20 지불조건 추가 //jsonSlip.Add("export_expiry_date", TXT_PASSPORT_EXP.Text); //jsonSlip.Add("shop_name", TXT_PASSPORT_EXP.Text); //jsonSlip.Add("biz_permit_no", "104-00-00000"); //jsonSlip.Add("company_reg_no", "");//관광사업자등록번호 //jsonSlip.Add("shop_name", "글로벌호텔");//관광사업자등록번호 //jsonSlip.Add("ceo_name", "홍길동");//관광사업자등록번호 //jsonSlip.Add("shop_addr", "서울특별시 중구 퇴계로 131 2층");//관광사업자등록번호 jsonSlip.Add("remark", TXT_REMARK.Text); jsonSlip.Add("sign_img", TXT_SIGN_DATA.Text); if (TXT_SIGN_DATA.Text != null && !"".Equals(TXT_SIGN_DATA.Text.Trim())) { jsonSlip.Add("sign_img_type_code", "01"); } else { jsonSlip.Add("sign_img_type_code", ""); } //숙박일 수 있는 경우 if (COM_STD_NIGHT.SelectedIndex > 0) { nSerialNo++; jsonStdInfo.Add("serial_no", nSerialNo.ToString()); jsonStdInfo.Add("unit_price", (Int64.Parse(TXT_STD_SALES_AMT.Text.Replace(",", "")) / Int64.Parse(COM_STD_NIGHT.Text)).ToString()); jsonStdInfo.Add("qty", COM_STD_NIGHT.Text); jsonStdInfo.Add("goods_name", "일반객실(standard room)"); jsonStdInfo.Add("sales_amount", TXT_STD_SALES_AMT.Text.Replace(",", "")); jsonStdInfo.Add("tax_amount", TXT_STD_TAX_AMT.Text.Replace(",", "")); jsonStdInfo.Add("vat_amount", TXT_STD_TAX_AMT.Text.Replace(",", "")); jsonStdInfo.Add("sct_amount", "0"); jsonStdInfo.Add("et_amount", "0"); jsonStdInfo.Add("item_code", "40"); jsonStdInfo.Add("item_name", "Standard"); jsonStdInfo.Add("item_tax_code", "1"); arrjsonSlip.Add(jsonStdInfo); } if (COM_SUT_NIGHT.SelectedIndex > 0) { nSerialNo++; jsonSutInfo.Add("serial_no", nSerialNo.ToString()); jsonSutInfo.Add("unit_price", (Int64.Parse(TXT_SUT_SALES_AMT.Text.Replace(",", "")) / Int64.Parse(COM_SUT_NIGHT.Text)).ToString()); jsonSutInfo.Add("qty", COM_SUT_NIGHT.Text); jsonSutInfo.Add("goods_name", "스위트룸(suite room)"); jsonSutInfo.Add("sales_amount", TXT_SUT_SALES_AMT.Text.Replace(",", "")); jsonSutInfo.Add("tax_amount", TXT_SUT_TAX_AMT.Text.Replace(",", "")); jsonSutInfo.Add("vat_amount", TXT_SUT_TAX_AMT.Text.Replace(",", "")); jsonSutInfo.Add("sct_amount", "0"); jsonSutInfo.Add("et_amount", "0"); jsonSutInfo.Add("item_code", "41"); jsonSutInfo.Add("item_name", "Suite"); jsonSutInfo.Add("item_tax_code", "1"); arrjsonSlip.Add(jsonSutInfo); } jsonSlip.Add("buyList", arrjsonSlip); //송신 JObject objRet = tran.sendServer_object(jsonSlip.ToString(), tran.url_Slip_Submit, 60, true, true); if (objRet != null && "S".Equals(objRet["result"].ToString())) { jsonSlip.Add("biz_permit_no", objRet["biz_permit_no"]); jsonSlip.Add("buy_serial_no", objRet["buy_serial_no"]); jsonSlip.Add("company_reg_no", objRet["company_reg_no"]); jsonSlip.Add("shop_name", objRet["shop_name"]); jsonSlip.Add("ceo_name", objRet["ceo_name"]); jsonSlip.Add("shop_addr", objRet["shop_addr"]); jsonSlip.Add("shop_phone", objRet["shop_phone"]); try { PrintUtil pu = new PrintUtil(); pu.PrintRefundSlip(jsonSlip); bRet = true; MetroMessageBox.Show(this, Constants.getMessage("ISSUE_SUCCESS"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex2) { MetroMessageBox.Show(this, Constants.getMessage("ERROR_PRINT"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Information); } //bRet = true; } else { if (objRet != null && objRet["resp_msg"] != null) { MetroMessageBox.Show(this, objRet["resp_msg"].ToString(), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MetroMessageBox.Show(this, Constants.getMessage("ISSUE_ERROR"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { setWaitCursor(false); BTN_SUBMIT.Focus(); } //거래 성공 시 화면 초기화 if (bRet) { SCREEN_CLEAR(); } } catch (Exception e2) { Constants.LOGGER_MAIN.Info(e2.Message); } setWaitCursor(false); }
private void btnPrint_Click(object sender, RoutedEventArgs e) { if (this.OrderReturns.Count < 1) { MessageBox.Show("没有需要打印的数据"); return; } try { string printer = LocalConfigService.GetValue(SystemNames.CONFIG_PRINTER_A4, ""); if (string.IsNullOrWhiteSpace(printer)) { throw new Exception("请在系统配置里面,配置要使用的打印机"); } if (MessageBox.Show("是否使用打印机:" + printer + Environment.NewLine + "打印?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return; } var pd = PrintUtil.GetPrinter(printer); VendorService vs = ServiceContainer.GetService <VendorService>(); var goodsCountDoc = new OrderReturnOutPrintDocument(); List <GoodsCount> counts = new List <GoodsCount>(); foreach (var item in this.OrderReturns) { string[] infos = item.Source.GoodsInfo.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); if (infos.Length < 4) { MessageBox.Show("退货信息不正确,请检查:" + item.Source.Id); continue; } var vendor = vs.GetByAll(infos[0], "", "", "", 0, 0).First; if (vendor == null) { vendor = vs.GetByAll(infos[0] + infos[1], "", "", "", 0, 0).First; } if (vendor == null) { MessageBox.Show("退货信息厂家找不到,请检查:" + item.Source.Id); continue; } GoodsCount count = null; if (infos.Length >= 5) { count = counts.FirstOrDefault( obj => obj.Vendor == VendorService.FormatVendorName(infos[0]) && obj.Number == infos[1] && obj.Edtion == infos[2] && obj.Color == infos[3] && obj.Size == infos[4]); } else { count = counts.FirstOrDefault( obj => obj.Vendor == VendorService.FormatVendorName(infos[0]) && obj.Number == infos[1] && obj.Color == infos[2] && obj.Size == infos[3]); } if (count == null) { count = new GoodsCount { Vendor = infos[0].Trim(), Number = infos[1].Trim(), Money = (int)(item.Source.GoodsMoney / item.Source.Count), Count = 0, FirstPayTime = item.Source.ProcessTime, }; if (infos.Length >= 5) { count.Edtion = infos[2].Trim(); count.Color = infos[3].Trim(); count.Size = infos[4].Trim(); } else { count.Edtion = ""; count.Color = infos[2].Trim(); count.Size = infos[3].Trim(); } count.Address = vendor.MarketAddressShort; count.Vendor = VendorService.FormatVendorName(count.Vendor); counts.Add(count); } foreach (var c in counts.Where(obj => obj.Vendor == count.Vendor && obj.Number == count.Number && obj.Edtion == count.Edtion)) { //取消最大金额值 if (c.Money < count.Money) { c.Money = count.Money; } else { count.Money = c.Money; } } if (count.FirstPayTime >= item.Source.ProcessTime) { count.FirstPayTime = item.Source.ProcessTime; } count.Count += item.Source.Count; } IComparer <GoodsCount> comparer = new OrderGoodsCountSortByDoor(); counts.Sort(comparer); //拿货地址 counts.Sort(comparer); //货号 counts.Sort(comparer); //版本 counts.Sort(comparer); //颜色 counts.Sort(comparer); //尺码 goodsCountDoc.PageSize = new Size(793, 1122.24); goodsCountDoc.SetGoodsCount(counts.ToArray()); pd.PrintDocument(goodsCountDoc, "退货统计"); foreach (var item in this.OrderReturns) { this.OrderReturnService.Update(item.Source); } MessageBox.Show("打印完成"); } catch (Exception ex) { MessageBox.Show(ex.Message, "打印出错"); } }