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);
}
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);
}
}
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();
}
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);
}
}
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);
}
}
Aggregations