2011-10-12 66 views
-3

有沒有人知道如何創建一個C#應用程序,它可以打開連接到計算機的抽屜並同時打印收據?C#代碼打開/關閉抽屜並同時打印收據?

抽屜名稱:PCD-354電子收款機

現金收據打印機:愛普生TM-T88V

+0

我們怎麼可能給你的代碼中未知硬件? – Stijn

+3

有些東西告訴我你最好是閱讀你的硬件/軟件的API參考,而不是希望一些隨機的開發人員只是偶然知道API。 – Jamiec

回答

6
using System; 
using System.Collections.Generic; 
using System.Text; 
using Microsoft.PointOfService; 

namespace POS 
{ 
public class CashDrawerClass 
{ 
    CashDrawer myCashDrawer; 
    PosExplorer explorer; 

public CashDrawerClass() 
{ 
explorer = new PosExplorer(this); 
DeviceInfo ObjDevicesInfo = explorer.GetDevice("CashDrawer"); 
myCashDrawer = explorer.CreateInstance(ObjDevicesInfo); 
} 

public void OpenCashDrawer() 
    { 
    myCashDrawer.Open(); 
    myCashDrawer.Claim(1000); 
    myCashDrawer.DeviceEnabled = true; 
    myCashDrawer.OpenDrawer(); 
    myCashDrawer.DeviceEnabled = false; 
    myCashDrawer.Release(); 
    myCashDrawer.Close(); 
    } 
} 
} 

嘗試。也許它會幫助你對事情的概況

+0

謝謝,但我也必須有一個打印收據的代碼,你有什麼想法嗎? –

+0

它不適合我,我應該更改explorer.GetDevice(「CashDrawer」)的東西? –

+0

@AllanChua;你有沒有找到解決你的問題?我有同樣的問題。我的錢箱已連接到收據打印機 – Tariq