我在C#中使用了这段代码。该程序应该使用财务打印机打印。我运行程序时不会抛出错误,但它是
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FiscPrinter = FiscPrnSys.FiscPrnIface;
namespace IncortexLibrary
{
public class Class1
{
public List<String> salesITems = new List<String>();
public String user;
public String shop;
public double total;
public double subtotal;
public String tax;
public short data = (short) 8;
public short parity = (short)0;
public short stopbit = (short)1;
public void PrintBon()
{
FiscPrnSys.FiscPrnIface FiscPrinter = new FiscPrnSys.FiscPrnIface();
FiscPrinter.Connect("COM2", 9600, data, parity, stopbit);
FiscPrinter.TestPrinter((short)48, "1,0,1", "HELLO");
FiscPrinter.Sale("TEST ITEM 1", "A", 2, 2, 0);
FiscPrinter.Sale("TEST ITEM 1", "A", 2, 2, 0);
FiscPrinter.Sale("TEST STOCK ITEMS ZERO VAT", "B", 2, 2, 0);
FiscPrinter.Sale("Cooking Fat Always Ultra", "B", 2, 2, 0);
FiscPrinter.PrintFiscalText("TEST STOCK ITEMS VATABLE");
FiscPrinter.Sale("001000124", "A", 2, 2, 0);
FiscPrinter.PrintFiscalText("Kimbo 1 Kg");
FiscPrinter.Sale("598699484", "A", 5, 5, 0);
FiscPrinter.PrintFiscalText("Tily Cooking Fat");
FiscPrinter.Sale("484949404", "A", 2, 2, 0);
FiscPrinter.Sale("Always ULtra", "A", 10, 2, 0);
FiscPrinter.Disconnect();
}
public void setUser(String user)
{
this.user = user;
}
public void setShop(String shop)
{
this.shop = shop;
}
public void addSaleItem(String item)
{
salesITems.Add(item);
}
public void setDouble(double pTotal)
{
this.total = pTotal;
}
public void setSubTotal(double sTotal)
{
this.subtotal = sTotal;
}
public void setTax(String pTax)
{
this.tax = pTax;
}
}
}
和其他课程
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IncortexLibrary;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Class1 printer = new Class1();
printer.PrintBon();
}
}
}
可能是什么问题?我已经包含了所有必需的库。