/** * 根据气体信息生成打印模版 * * @param depotData * 仓库基本信息 * @param grainData * 粮情数据信息 */ builderModel = function(curData,dept) { var depotData = curData.depotData; var listPoint = curData.listPoint; var model = "\n" + "气体报表模版" + " \n" + ""; model += "
\n" + "\n"; if(dept){ model += dept.name; }else{ model += "--XXX--粮库" } model += "\n"; model += ""; model += depotData.name; model += "    气体报表\n"; model += "
"; model += "  方向:东检测时间:"; model += curData.receiveDate; model += "
"; // 动态配置 model += ""; model += ""; var num = Math.ceil(listPoint.length / 2); var index = 1; var point; for (var i = 0; i < num; i++) { point = listPoint[index - 1]; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; index++; if (index > listPoint.length) { model += ""; model += ""; model += ""; model += ""; model += ""; } else { point = listPoint[index - 1]; model += ""; model += ""; model += ""; model += ""; model += ""; index++; } model += ""; } model += "
采集位CO2O2PH3N2采集位CO2O2PH3N2
采集位 " + point.passCode + "" + attrPoint(point, curData, "CO2") + "" + attrPoint(point, curData, "O2") + "" + attrPoint(point, curData, "PH3") + "" + attrPoint(point, curData, "N2") + "采集位 " + point.passCode + "" + attrPoint(point, curData, "CO2") + "" + attrPoint(point, curData, "O2") + "" + attrPoint(point, curData, "PH3") + "" + attrPoint(point, curData, "N2") + "
"; // model += ""; model += ""; model += ""; model += ""; // 气体整体信息 model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; // 仓库信息 model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += ""; model += "
检测分析:" + (curData.remark == null ? "/" : curData.remark) + "
最高最低平均备注
CO2(PPM)" + curData.perCo2Max + "" + curData.perCo2Min + "" + curData.perCo2 + "
O2(%)" + curData.perO2Max + "" + curData.perO2Min + "" + curData.perO2 + "
PH3(PPM)" + curData.perPh3Max + "" + curData.perPh3Min + "" + curData.perPh3 + "
N2(%)" + curData.perN2Max + "" + curData.perN2Min + "" + curData.perN2 + "
仓房类型" + depotData.depotTypeName + "入仓日期" + (depotData.storeDate == null ? "/" : depotData.storeDate) + "
粮食品种" + depotData.foodVarietyName + "实际储量(吨)" + (depotData.storageReal == null ? "/" : (Number(depotData.storageReal)/1000).toFixed(2)) + "
入仓水分(%)" + (depotData.perWet == null ? "/" : depotData.perWet) + "当前水分(%)" + (depotData.perWet == null ? "/" : depotData.perWet) + "
出糙率(%)" + (depotData.rough == null ? "/" : depotData.rough) + "粮食产地" + (depotData.foodLocation == null ? "/" : depotData.foodLocation) + "
容重(kg/m3)" + (depotData.bulkWeight == null ? "/" : depotData.bulkWeight) + "面筋持水率(%)" + (depotData.waterGluten == null ? "/" : depotData.waterGluten) + "
杂质(%)" + (depotData.perImpurity == null ? "/" : depotData.perImpurity) + "不完善粒(%)" + (depotData.broken == null ? "/" : depotData.broken) + "
检测人" + curData.checkUser + "保管员" + (depotData.storeKeeperName == null ? "/" : depotData.storeKeeperName) + "
"; // 添加尾部信息 model += "
"; model += "注:#表示最低  *表示最高"; model += "制表时间:" + curData.sysDate + "
"; model += ""; return model; }; // 根据采集点赋值,注意数据库生成的坐标是从0开始的 attrPoint = function(point, curData, type) { if (type == "CO2") { if (-100.0 == point.perCo2) { return "备用"; } if (curData.perCo2Max == point.perCo2) { return point.perCo2 + "*"; } if (curData.perCo2Min == point.perCo2) { return point.perCo2 + "#"; } } if (type == "O2") { if (-100.0 == point.perO2) { return "备用"; } if (curData.perO2Max == point.perO2) { return point.perO2 + "*"; } if (curData.perO2Min == point.perO2) { return point.perO2 + "#"; } } if (type == "PH3") { if (-100.0 == point.perPh3) { return "备用"; } if (curData.perPh3Max == point.perPh3) { return point.perPh3 + "*"; } if (curData.perPh3Min == point.perPh3) { return point.perPh3 + "#"; } } if (type == "N2") { if (-100.0 == point.perN2) { return "备用"; } if (curData.perN2Max == point.perN2) { return point.perN2 + "*"; } if (curData.perN2Min == point.perN2) { return point.perN2 + "#"; } } return ""; }; /** * 根据HTML模版打印为A4 * * @param strHtml */ previewA4 = function(strHtml) { var LODOP = getLodop(); LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4"); LODOP.PRINT_INIT("气体报表"); LODOP.ADD_PRINT_HTM(30, 40, "180mm", "100%", strHtml); LODOP.PREVIEW(); };