Search in sources :

Example 11 with DataSet

use of cn.cerc.jdb.core.DataSet in project summer-mis by cn-cerc.

the class RemoteServiceTest method test.

@Test
@Ignore
public void test() {
    RemoteService app = new RemoteService();
    // app.setHost("r1.knowall.cn");
    app.setService("SvrUserLogin.check");
    DataSet datain = app.getDataIn();
    Record head = datain.getHead();
    head.setField("Account_", "admin");
    head.setField("Password_", "123456");
    head.setField("MachineID_", "webclient");
    boolean result = app.exec();
    assertTrue(app.getMessage(), result);
}
Also used : RemoteService(cn.cerc.jbean.client.RemoteService) DataSet(cn.cerc.jdb.core.DataSet) Record(cn.cerc.jdb.core.Record) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 12 with DataSet

use of cn.cerc.jdb.core.DataSet in project summer-bean by cn-cerc.

the class BatchFormTemplate method output.

@Override
public void output(WritableSheet sheet) throws RowsExceededException, WriteException {
    int newRow = 0;
    for (DataSet dataSet : items) {
        this.setDataSet(dataSet);
        this.setFooter((template, sheet1) -> {
            Record footer = new Record();
            for (Record item : dataSet) {
                footer.setField("合计数量", footer.getDouble("合计数量") + item.getDouble("Num_"));
                footer.setField("合计金额", footer.getDouble("合计金额") + item.getDouble("OriAmount_"));
            }
            int row = template.getRow();
            for (String field : footer.getItems().keySet()) {
                row++;
                Object val = footer.getItems().get(field);
                sheet1.addCell(new Label(0, row, field));
                sheet1.addCell(new Label(1, row, Double.toString(utils.roundTo((Double) val, -2))));
            }
        });
        // 输出原来的表格
        super.output(sheet);
        newRow += this.getHeads().size() + dataSet.size() + 6;
        this.setRow(newRow);
    }
}
Also used : DataSet(cn.cerc.jdb.core.DataSet) Label(jxl.write.Label) Record(cn.cerc.jdb.core.Record)

Example 13 with DataSet

use of cn.cerc.jdb.core.DataSet in project summer-bean by cn-cerc.

the class ExportExcel method export.

public void export(String message) throws WriteException, IOException {
    this.setTemplateId("ExportMessage");
    DataSet ds = new DataSet();
    ds.append();
    ds.setField("message_", message);
    this.getTemplate().setDataSet(ds);
    exportDataSet();
}
Also used : DataSet(cn.cerc.jdb.core.DataSet)

Example 14 with DataSet

use of cn.cerc.jdb.core.DataSet in project summer-bean by cn-cerc.

the class Barcode128Template method output.

@Override
public void output(Document document, PdfWriter writer) throws DocumentException, IOException {
    PdfContentByte cb = writer.getDirectContent();
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 设置中文字体和字体样式
    Font f8 = new Font(bfChinese, fontSize, Font.NORMAL);
    DataSet dataSet = this.getDataSet();
    dataSet.first();
    while (dataSet.fetch()) {
        // 条码信息
        Barcode128 code128 = new Barcode128();
        code128.setBarHeight(barHeight);
        String code = dataSet.getString("Code_");
        code128.setCode(code);
        // 反算条码宽度
        int length = code.length();
        float x = 125 / ((length + 2) * 11 + 2f);
        code128.setX(x);
        document.add(code128.createImageWithBarcode(cb, null, null));
        // 描述信息
        Paragraph paragraph = new Paragraph(dataSet.getString("Name_"), f8);
        paragraph.setAlignment(Element.ALIGN_CENTER);
        document.add(paragraph);
    }
}
Also used : Barcode128(com.itextpdf.text.pdf.Barcode128) DataSet(cn.cerc.jdb.core.DataSet) BaseFont(com.itextpdf.text.pdf.BaseFont) PdfContentByte(com.itextpdf.text.pdf.PdfContentByte) Font(com.itextpdf.text.Font) BaseFont(com.itextpdf.text.pdf.BaseFont) Paragraph(com.itextpdf.text.Paragraph)

Example 15 with DataSet

use of cn.cerc.jdb.core.DataSet in project summer-bean by cn-cerc.

the class BarcodeTemplate method output.

@Override
public void output(Document document, PdfWriter writer) throws DocumentException, IOException {
    PdfContentByte cb = writer.getDirectContent();
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 设置中文字体和字体样式
    Font f8 = new Font(bfChinese, fontSize, Font.NORMAL);
    DataSet dataSet = this.getDataSet();
    dataSet.first();
    while (dataSet.fetch()) {
        // 商品名称
        if (dataSet.getCurrent().hasValue("Name_"))
            document.add(new Paragraph(dataSet.getString("Name_"), f8));
        // 商品条码
        BarcodeEAN codeEAN = new BarcodeEAN();
        codeEAN.setBarHeight(barHeight);
        codeEAN.setCode(dataSet.getString("Code_"));
        document.add(codeEAN.createImageWithBarcode(cb, null, null));
        codeEAN.setGuardBars(false);
    }
}
Also used : BarcodeEAN(com.itextpdf.text.pdf.BarcodeEAN) DataSet(cn.cerc.jdb.core.DataSet) BaseFont(com.itextpdf.text.pdf.BaseFont) PdfContentByte(com.itextpdf.text.pdf.PdfContentByte) Font(com.itextpdf.text.Font) BaseFont(com.itextpdf.text.pdf.BaseFont) Paragraph(com.itextpdf.text.Paragraph)

Aggregations

DataSet (cn.cerc.jdb.core.DataSet)26 Record (cn.cerc.jdb.core.Record)4 LocalService (cn.cerc.jbean.client.LocalService)3 IField (cn.cerc.jpage.core.IField)3 Test (org.junit.Test)3 BuildQuery (cn.cerc.jdb.mysql.BuildQuery)2 IColumn (cn.cerc.jpage.core.IColumn)2 AbstractField (cn.cerc.jpage.fields.AbstractField)2 RowCell (cn.cerc.jpage.grid.RowCell)2 Font (com.itextpdf.text.Font)2 Paragraph (com.itextpdf.text.Paragraph)2 BaseFont (com.itextpdf.text.pdf.BaseFont)2 PdfContentByte (com.itextpdf.text.pdf.PdfContentByte)2 IOException (java.io.IOException)2 Label (jxl.write.Label)2 WritableSheet (jxl.write.WritableSheet)2 WritableWorkbook (jxl.write.WritableWorkbook)2 FileItem (org.apache.commons.fileupload.FileItem)2 Ignore (org.junit.Ignore)2 RemoteService (cn.cerc.jbean.client.RemoteService)1