TODO:
  1. 删除修改发送等文字用图标替代.
  2. 为什么类别没有显示出来。
-- Sam 16:55 08/10/2017

when system know user are setting the -w: 16, system will automatically set -f: to  29,33, 34. this means for some machine, 29,33,34 will also set the font to a super large one.
-- Sam 17:36 28/09/2017
 Epson printer command set, how to make font bigger?
  1. bydefalt: 27,33,0 (the smallest font)
  2.                  27,33,17(double height)
  3.                  27,33,34(double width)
  4.                  27,33,51(double height and width)
  5.                  27.33,68(back to smallest font, seems like all non-valid input will cause smallest font)
while for zijiang printer (may be also rongta thermal printer) we can  use 29,33,68 to print with super huge font. this command doesn't work for Ronta non-thermal printer.
        for  针孔打印机,we an use 28,33,110,to make the Chinese character also double width double height. (110 can also be 0xd6,0xd0,not tested yet)
for ronta 针孔打印机,目前最佳的宽度是-w:20, 而不是默认的24.
-- Sam 14:14 29/09/2017
昨天给chrome的快捷方式加了参数,好像是" --koisk -printing“,具体记不得了。最后好像是成功了,之前有犯两个错误,一个是--写成了一个-; 另一个错误是在window.print()之后立即调用了一个页面跳转方法,wondlow.location=../dashboard。导致没有效果。
我的想法:
  1. epson不知什么时候能到,到了也不知道pei能不能搞的定,搞的定也存在一个客户的成本问题和wee的利润问题。
  2. 考虑到客户的局域网内很可能会有一台可以利用的Window笔记本电脑。
  3. 所以我们可以利用这个windows电脑,安装一个chrome或者多个chrome程序(多个的话必须是chrome portable版本),每个桌面创建一个快捷方式,并都加上全屏静默打印的启动参数,主页都设置为该店的登录页面。
  4. 负责该电脑的人要负责打开电脑时,要负责点开每个chrome,并用printer1、printer2d等用户进行登录。(登录后应该自行打开到dashboard页面。)
  5. 这样,各个printer用户将定时想服务器请求属于自己的打印项目。
  6. 服务器方面,收到fetchItemToPrin请求t时,首先找到最早的状态为10的mainorder记录,然后找到对应的products,然后根据各产品的printer信息筛选出属于该printer的产品列表,返回一个printPreview页面用户展示这些产品。如果项目为空,则自动寻找下一条mainOrder,知道找到非空产品集或者找不到mainOrder为止。
  7. printPreview页面显示后,页面上的javascript将自动启动,检查页面上是否有pringArea元素,如果有,那么进行打印。并且更新order状态为20。
  8. 无论有没有可打印内容,最后都会等待20秒后返回../dashboard.请求看有没有打印任务。
----------------------------------------------------------------------------------------
  1. 问题:系统能否安装两个chrome,并同时通过两个不同的用户登录?(可以),用chromeportable版本!
  2. 两个chrome能否有不同的打印机设置,一个默认从A打印机打印,另一个默认选择B打印机?(可以只是这种方案不好远程维护)
  3. 有没有可能在javascript中设置打印机信息?(估计不可以,不过好在chrome貌似能够记住用户设置, 安装版已测,portable版本待测)长远之道还是用websocket。
-- Sam 11:31 01/06/2017
 打印机抵档的只有4k内存,用C语言对端口编程。高档一点的用c语言对端口进行tcp/ip编程,使支持网络通讯。
高档打印机可能会带系统,从而可以跑应用程序服务器,并提供共多功能。
目前大概只有Epson等大厂支持了websocket,国内小厂尚无人支持。
-- Sam 06:53 31/05/2017

This  is the code I wrote 10 years ago for a pos machine, it shows how to use the command to drive the pos printer.
  
private void printInvoice(String pDate){
        CommPortIdentifier tPortIdty;
        try{
            Enumeration tPorts = CommPortIdentifier.getPortIdentifiers();
            if(tPorts == null){
                JOptionPane.showMessageDialog(this, "no comm ports found!");
                return;
            }
            
            while (tPorts.hasMoreElements()){
                tPortIdty = (CommPortIdentifier) tPorts.nextElement();
                if(!tPortIdty.getName().equals("LPT1"))
                    continue;

                if (!tPortIdty.isCurrentlyOwned()){
                    ParallelPort tParallelPort = (ParallelPort) tPortIdty.open("ParallelBlackBox",2000);
                    DataOutputStream tOutStream = new DataOutputStream(tParallelPort.getOutputStream());
                    
                    tOutStream.write(27);                    //打印机初始化:
                    tOutStream.write(64);
                    
                    char[] tTime = pDate.toCharArray();        //输出日期时间 输出操作员工号
                    for(int i = 0; i < tTime.length; i++)
                        tOutStream.write(tTime[i]);
                    
                    tOutStream.write(13);                    //回车
                    tOutStream.write(10);                    //换行
                    tOutStream.write(10);                    //进纸一行
                    
                    tOutStream.write(28);                    //设置为中文模式:
                    tOutStream.write(38);
                    String tContent = ((String)CustOpts.custOps.getValue(PosDlgConst.PrintTitle)).concat("\n");
                    for(int i = 0, len = getUsedRowCount(); i < len; i++){                                //遍历有效行。
                        tContent = tContent.concat((String)tblContent.getValueAt(i, 1)).concat("\n");    //再取出品名
                        tContent = tContent.concat((String)tblContent.getValueAt(i, 3)).concat("   ");    //再取出单价
                        tContent = tContent.concat((String)tblContent.getValueAt(i, 2)).concat("   ");    //再取出数量
                        tContent = tContent.concat((String)tblContent.getValueAt(i, 4)).concat("\n");    //再取出小计
                    }
                    for(int i = 0; i < 4; i++)//换行
                        tContent = tContent.concat("\n");
                    
                    tContent = tContent.concat(PosDlgConst.SumTotal);
                    tContent = tContent.concat(tfdShoudReceive.getText());
                    tContent = tContent.concat(PosDlgConst.Unit).concat("   ");//总计
                    
                    tContent = tContent.concat(PosDlgConst.Receive);
                    tContent = tContent.concat(tfdActuallyReceive.getText());
                    tContent = tContent.concat(PosDlgConst.Unit).concat("\n");//收银
                    
                    tContent = tContent.concat(PosDlgConst.Change);
                    tContent = tContent.concat(tfdChange.getText());
                    tContent = tContent.concat(PosDlgConst.Unit);//找零
                    
                    
                    tContent = tContent.concat("\n\n      ").concat((String)CustOpts.custOps.getValue(PosDlgConst.Thankword));
                    tContent = tContent.concat("\n\n");
                    
                    Object tEncodType = CustOpts.custOps.getValue(PosDlgConst.EncodeStyle);
                    if(tEncodType == null)
                        tEncodType = "GBK";
                    if(!Charset.isSupported(tEncodType.toString()))
                        return;
                    BufferedWriter tWriter = new BufferedWriter(new OutputStreamWriter(tOutStream, tEncodType.toString()));
                    tWriter.write(tContent);
                    tWriter.close();

                    tOutStream.close();
                    tParallelPort.close();
                }
            }
        }catch(PortInUseException e){
            e.printStackTrace();
        }catch(IOException e){
            e.printStackTrace();
        }
    }
-- Sam 11:22 19/05/2017

Please click here to login and add comments! || automatically refresh content every seconds