From cc9d69e980b73aae333ab72d370aff82594afbf4 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期五, 23 五月 2025 11:03:28 +0800
Subject: [PATCH] 调整细节

---
 igds-dzhwk-web/src/main/resources/static/dzhwk/gas/PrintBuilder.js |  209 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 209 insertions(+), 0 deletions(-)

diff --git a/igds-dzhwk-web/src/main/resources/static/dzhwk/gas/PrintBuilder.js b/igds-dzhwk-web/src/main/resources/static/dzhwk/gas/PrintBuilder.js
new file mode 100644
index 0000000..2a37eff
--- /dev/null
+++ b/igds-dzhwk-web/src/main/resources/static/dzhwk/gas/PrintBuilder.js
@@ -0,0 +1,209 @@
+/**
+ * 鏍规嵁姘斾綋淇℃伅鐢熸垚鎵撳嵃妯$増
+ * 
+ * @param depotData
+ *            浠撳簱鍩烘湰淇℃伅
+ * @param grainData
+ *            绮儏鏁版嵁淇℃伅
+ */
+builderModel = function(curData,dept) {
+	var depotData = curData.depotData;
+	var listPoint = curData.listPoint;
+
+	var model = "<!DOCTYPE html><html lang=\"zh-cn\">\n"
+			+ "<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"><title>姘斾綋鎶ヨ〃妯$増</title>"
+			+ "    <style>\n"
+			+ "        table,table tr th,table tr td{border:1px solid #0d1021}table{width:100%;line-height:23px;text-align:center;font-size:14px}.table-2{border-top:0px solid #0d1021 !important}.table-2 tr{border-top:0px solid #0d1021 !important}.table-2 td{border-top:0px solid #0d1021 !important}.table-row-tr{border-left:0px !important;border-right:0px !important;border-top:0px !important}.table-row-fz{border:0px !important}.link-top{width:100%;border-top:solid #0d1021 1px}</style>\n"
+			+ "</head><body>";
+
+	model += "<div style=\"text-align: center\">\n"
+			+ "<span style=\"font-size: 26px; font-weight: bold;\">\n";
+	if(dept){
+		model += dept.name;
+	}else{
+		model += "--XXX--绮簱"
+	}
+	model += "</span><div class=\"link-top\"></div><div class=\"link-top\"></div>\n";
+	model += "<span style=\"font-size: 18px; \">";
+	model += depotData.name;
+	model += "&nbsp;&nbsp;&nbsp;&nbsp;姘斾綋鎶ヨ〃</span>\n";
+	model += "</div><div style=\"margin-top: 5px;\"><span style=\"float: left;\">";
+	model += "&nbsp;&nbsp;鏂瑰悜锛氫笢</span><span style=\"float: right;\">妫�娴嬫椂闂达細";
+	model += curData.receiveDate;
+	model += "</span></div>";
+
+	// 鍔ㄦ�侀厤缃�
+	model += "<table cellspacing=\"0\" cellpadding=\"0\">";
+	model += "<tr><td>閲囬泦浣�</td><td>CO2</td><td>O2</td><td>PH3</td><td>N2</td><td>閲囬泦浣�</td><td>CO2</td><td>O2</td><td>PH3</td><td>N2</td></tr>";
+
+	var num = Math.ceil(listPoint.length / 2);
+	var index = 1;
+	var point;
+	for (var i = 0; i < num; i++) {
+		point = listPoint[index - 1];
+		model += "<tr>";
+
+		model += "<td class=\"table-row-fz\">閲囬泦浣� " + point.passCode + "</td>";
+		model += "<td class=\"table-row-fz\">"
+				+ attrPoint(point, curData, "CO2") + "</td>";
+		model += "<td class=\"table-row-fz\">"
+				+ attrPoint(point, curData, "O2") + "</td>";
+		model += "<td class=\"table-row-fz\">"
+				+ attrPoint(point, curData, "PH3") + "</td>";
+		model += "<td class=\"table-row-fz\">"
+				+ attrPoint(point, curData, "N2") + "</td>";
+
+		index++;
+
+		if (index > listPoint.length) {
+			model += "<td class=\"table-row-fz\"></td>";
+			model += "<td class=\"table-row-fz\"></td>";
+			model += "<td class=\"table-row-fz\"></td>";
+			model += "<td class=\"table-row-fz\"></td>";
+			model += "<td class=\"table-row-fz\"></td>";
+		} else {
+			point = listPoint[index - 1];
+			model += "<td class=\"table-row-fz\">閲囬泦浣� " + point.passCode + "</td>";
+			model += "<td class=\"table-row-fz\">"
+					+ attrPoint(point, curData, "CO2") + "</td>";
+			model += "<td class=\"table-row-fz\">"
+					+ attrPoint(point, curData, "O2") + "</td>";
+			model += "<td class=\"table-row-fz\">"
+					+ attrPoint(point, curData, "PH3") + "</td>";
+			model += "<td class=\"table-row-fz\">"
+					+ attrPoint(point, curData, "N2") + "</td>";
+
+			index++;
+		}
+		model += "</tr>";
+	}
+	model += "</table>";
+	// <!--涓嬮潰琛ㄦ牸寮�濮�-->
+	model += "<table cellspacing=\"0\" cellpadding=\"0\" class=\"table-2\">";
+	model += "<tr><td width=\"20%\">妫�娴嬪垎鏋愶細</td>";
+	model += "<td colspan=4>" + (curData.remark == null ? "/" : curData.remark) + "</td></tr>";
+	model += "<tr><td width=\"20%\"></td><td width=\"20%\">鏈�楂�</td><td width=\"20%\">鏈�浣�</td><td width=\"20%\">骞冲潎</td><td width=\"20%\">澶囨敞</td></tr>";
+
+	// 姘斾綋鏁翠綋淇℃伅
+	model += "<tr> <td>CO2锛圥PM锛�</td><td>" + curData.perCo2Max + "</td>";
+	model += "<td>" + curData.perCo2Min + "</td>";
+	model += "<td>" + curData.perCo2 + "</td>";
+	model += "<td></td></tr>";
+
+	model += "<tr> <td>O2锛�%锛�</td><td>" + curData.perO2Max + "</td>";
+	model += "<td>" + curData.perO2Min + "</td>";
+	model += "<td>" + curData.perO2 + "</td>";
+	model += "<td></td></tr>";
+
+	model += "<tr> <td>PH3锛圥PM锛�</td><td>" + curData.perPh3Max + "</td>";
+	model += "<td>" + curData.perPh3Min + "</td>";
+	model += "<td>" + curData.perPh3 + "</td>";
+	model += "<td></td></tr>";
+
+	model += "<tr> <td>N2锛�%锛�</td><td>" + curData.perN2Max + "</td>";
+	model += "<td>" + curData.perN2Min + "</td>";
+	model += "<td>" + curData.perN2 + "</td>";
+	model += "<td></td></tr>";
+
+	// 浠撳簱淇℃伅
+	model += "<tr><td>浠撴埧绫诲瀷</td><td>" + depotData.depotTypeName + "</td>";
+	model += "<td>鍏ヤ粨鏃ユ湡</td><td>" + (depotData.storeDate == null ? "/" : depotData.storeDate) + "</td><td ></td></tr>";
+
+	model += "<tr><td>绮鍝佺</td><td>" + depotData.foodVarietyName + "</td>";
+	model += "<td>瀹為檯鍌ㄩ噺锛堝惃锛�</td><td>" + (depotData.storageReal == null ? "/" : (Number(depotData.storageReal)/1000).toFixed(2))
+			+ "</td><td ></td></tr>";
+
+	model += "<tr><td>鍏ヤ粨姘村垎锛�%锛�</td><td>" + (depotData.perWet == null ? "/" : depotData.perWet) + "</td>";
+	model += "<td>褰撳墠姘村垎锛�%锛�</td><td>" + (depotData.perWet == null ? "/" : depotData.perWet) + "</td><td ></td></tr>";
+
+	model += "<tr><td>鍑虹硻鐜囷紙%锛�</td><td>" + (depotData.rough == null ? "/" : depotData.rough) + "</td>";
+	model += "<td>绮浜у湴</td><td>" + (depotData.foodLocation == null ? "/" : depotData.foodLocation)
+			+ "</td><td ></td></tr>";
+
+	model += "<tr><td>瀹归噸锛坘g/m3锛�</td><td>" + (depotData.bulkWeight == null ? "/" : depotData.bulkWeight) + "</td>";
+	model += "<td>闈㈢瓔鎸佹按鐜囷紙%锛�</td><td>" + (depotData.waterGluten == null ? "/" : depotData.waterGluten) + "</td><td></td></tr>";
+
+	model += "<tr><td>鏉傝川锛�%锛�</td><td>" + (depotData.perImpurity == null ? "/" : depotData.perImpurity) + "</td>";
+	model += "<td>涓嶅畬鍠勭矑锛�%锛�</td><td>" + (depotData.broken == null ? "/" : depotData.broken) + "</td><td ></td></tr>";
+
+	model += "<tr><td>妫�娴嬩汉</td><td>" + curData.checkUser + "</td>";
+	model += "<td>淇濈鍛�</td><td>" + (depotData.storeKeeperName == null ? "/" : depotData.storeKeeperName)
+			+ "</td><td ></td></tr>";
+
+	model += "</table>";
+
+	// 娣诲姞灏鹃儴淇℃伅
+	model += "<div style=\"margin-top: 5px;\">";
+	model += "<span style=\"float: left;\">娉細#琛ㄧず鏈�浣�&nbsp;&nbsp;*琛ㄧず鏈�楂�</span>";
+	model += "<span style=\"float: right;\">鍒惰〃鏃堕棿锛�" + curData.sysDate
+			+ "</span></div>";
+	model += "</div></body></html>";
+
+	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妯$増鎵撳嵃涓篈4
+ * 
+ * @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();
+};
\ No newline at end of file

--
Gitblit v1.9.3