Przeglądaj źródła

铸造参数获取

zhanghe 4 miesięcy temu
rodzic
commit
7cb2b1c596

+ 15 - 0
src/main/java/com/jeesite/modules/mes/dao/MesSmeltingDao.java

@@ -0,0 +1,15 @@
+package com.jeesite.modules.mes.dao;
+
+import com.jeesite.common.dao.CrudDao;
+import com.jeesite.common.mybatis.annotation.MyBatisDao;
+import com.jeesite.modules.mes.entity.MesSmelting;
+
+/**
+ * 熔炼数据监控DAO接口
+ * @author system
+ * @version 2026-06-08
+ */
+@MyBatisDao
+public interface MesSmeltingDao extends CrudDao<MesSmelting> {
+	
+}

+ 86 - 0
src/main/java/com/jeesite/modules/mes/entity/MesSmelting.java

@@ -0,0 +1,86 @@
+package com.jeesite.modules.mes.entity;
+
+import javax.validation.constraints.Size;
+
+import com.jeesite.common.entity.DataEntity;
+import com.jeesite.common.mybatis.annotation.Column;
+import com.jeesite.common.mybatis.annotation.Table;
+import com.jeesite.common.mybatis.mapper.query.QueryType;
+import com.jeesite.common.utils.excel.annotation.ExcelField;
+import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
+import com.jeesite.common.utils.excel.annotation.ExcelFields;
+
+/**
+ * 熔炼数据监控Entity
+ * @author system
+ * @version 2026-06-08
+ */
+@Table(name="mes_smelting", alias="a", label="熔炼数据监控信息", columns={
+		@Column(name="id", attrName="id", label="id", isPK=true),
+		@Column(name="molten_aluminum_temperature", attrName="moltenAluminumTemperature", label="铝液温度"),
+		@Column(name="atmosphere_temperature", attrName="atmosphereTemperature", label="气氛温度"),
+		@Column(name="exhaust_gas_temperature", attrName="exhaustGasTemperature", label="排气温度"),
+		@Column(name="melting_temperature", attrName="meltingTemperature", label="熔化温度"),
+		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false, isUpdateForce=true),
+	}, orderBy="a.id DESC"
+)
+public class MesSmelting extends DataEntity<MesSmelting> {
+	
+	private static final long serialVersionUID = 1L;
+	private String moltenAluminumTemperature;		// 铝液温度
+	private String atmosphereTemperature;		// 气氛温度
+	private String exhaustGasTemperature;		// 排气温度
+	private String meltingTemperature;		// 熔化温度
+
+	@ExcelFields({
+		@ExcelField(title="铝液温度", attrName="moltenAluminumTemperature", align=Align.CENTER, sort=20),
+		@ExcelField(title="气氛温度", attrName="atmosphereTemperature", align=Align.CENTER, sort=30),
+		@ExcelField(title="排气温度", attrName="exhaustGasTemperature", align=Align.CENTER, sort=40),
+		@ExcelField(title="熔化温度", attrName="meltingTemperature", align=Align.CENTER, sort=50),
+		@ExcelField(title="创建时间", attrName="createDate", align=Align.CENTER, sort=60),
+	})
+	public MesSmelting() {
+		this(null);
+	}
+	
+	public MesSmelting(String id){
+		super(id);
+	}
+	
+	@Size(min=0, max=255, message="铝液温度长度不能超过 255 个字符")
+	public String getMoltenAluminumTemperature() {
+		return moltenAluminumTemperature;
+	}
+
+	public void setMoltenAluminumTemperature(String moltenAluminumTemperature) {
+		this.moltenAluminumTemperature = moltenAluminumTemperature;
+	}
+	
+	@Size(min=0, max=255, message="气氛温度长度不能超过 255 个字符")
+	public String getAtmosphereTemperature() {
+		return atmosphereTemperature;
+	}
+
+	public void setAtmosphereTemperature(String atmosphereTemperature) {
+		this.atmosphereTemperature = atmosphereTemperature;
+	}
+	
+	@Size(min=0, max=255, message="排气温度长度不能超过 255 个字符")
+	public String getExhaustGasTemperature() {
+		return exhaustGasTemperature;
+	}
+
+	public void setExhaustGasTemperature(String exhaustGasTemperature) {
+		this.exhaustGasTemperature = exhaustGasTemperature;
+	}
+	
+	@Size(min=0, max=255, message="熔化温度长度不能超过 255 个字符")
+	public String getMeltingTemperature() {
+		return meltingTemperature;
+	}
+
+	public void setMeltingTemperature(String meltingTemperature) {
+		this.meltingTemperature = meltingTemperature;
+	}
+	
+}

+ 137 - 0
src/main/java/com/jeesite/modules/mes/service/MesSmeltingService.java

@@ -0,0 +1,137 @@
+package com.jeesite.modules.mes.service;
+
+import java.util.List;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeesite.common.entity.Page;
+import com.jeesite.common.service.CrudService;
+import com.jeesite.modules.mes.entity.MesSmelting;
+import com.jeesite.modules.mes.dao.MesSmeltingDao;
+import com.jeesite.common.service.ServiceException;
+import com.jeesite.common.config.Global;
+import com.jeesite.common.validator.ValidatorUtils;
+import com.jeesite.common.utils.excel.ExcelImport;
+import org.springframework.web.multipart.MultipartFile;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+
+/**
+ * 熔炼数据监控Service
+ * @author system
+ * @version 2026-06-08
+ */
+@Service
+public class MesSmeltingService extends CrudService<MesSmeltingDao, MesSmelting> {
+	
+	/**
+	 * 获取单条数据
+	 * @param mesSmelting
+	 * @return
+	 */
+	@Override
+	public MesSmelting get(MesSmelting mesSmelting) {
+		return super.get(mesSmelting);
+	}
+	
+	/**
+	 * 查询分页数据
+	 * @param mesSmelting 查询条件
+	 * @param mesSmelting.page 分页对象
+	 * @return
+	 */
+	@Override
+	public Page<MesSmelting> findPage(MesSmelting mesSmelting) {
+		return super.findPage(mesSmelting);
+	}
+	
+	/**
+	 * 查询列表数据
+	 * @param mesSmelting
+	 * @return
+	 */
+	@Override
+	public List<MesSmelting> findList(MesSmelting mesSmelting) {
+		return super.findList(mesSmelting);
+	}
+	
+	/**
+	 * 保存数据(插入或更新)
+	 * @param mesSmelting
+	 */
+	@Override
+	@Transactional
+	public void save(MesSmelting mesSmelting) {
+		super.save(mesSmelting);
+	}
+
+	/**
+	 * 导入数据
+	 * @param file 导入的数据文件
+	 */
+	@Transactional
+	public String importData(MultipartFile file) {
+		if (file == null){
+			throw new ServiceException(text("请选择导入的数据文件!"));
+		}
+		int successNum = 0; int failureNum = 0;
+		StringBuilder successMsg = new StringBuilder();
+		StringBuilder failureMsg = new StringBuilder();
+		try(ExcelImport ei = new ExcelImport(file, 2, 0)){
+			List<MesSmelting> list = ei.getDataList(MesSmelting.class);
+			for (MesSmelting mesSmelting : list) {
+				try{
+					ValidatorUtils.validateWithException(mesSmelting);
+					this.save(mesSmelting);
+					successNum++;
+					successMsg.append("<br/>" + successNum + "、编号 " + mesSmelting.getId() + " 导入成功");
+				} catch (Exception e) {
+					failureNum++;
+					String msg = "<br/>" + failureNum + "、编号 " + mesSmelting.getId() + " 导入失败:";
+					if (e instanceof ConstraintViolationException){
+						ConstraintViolationException cve = (ConstraintViolationException)e;
+						for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
+							msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
+						}
+					}else{
+						msg += e.getMessage();
+					}
+					failureMsg.append(msg);
+					logger.error(msg, e);
+				}
+			}
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			failureMsg.append(e.getMessage());
+			return failureMsg.toString();
+		}
+		if (failureNum > 0) {
+			failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+			throw new ServiceException(failureMsg.toString());
+		}else{
+			successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+		}
+		return successMsg.toString();
+	}
+	
+	/**
+	 * 更新状态
+	 * @param mesSmelting
+	 */
+	@Override
+	@Transactional
+	public void updateStatus(MesSmelting mesSmelting) {
+		super.updateStatus(mesSmelting);
+	}
+	
+	/**
+	 * 删除数据
+	 * @param mesSmelting
+	 */
+	@Override
+	@Transactional
+	public void delete(MesSmelting mesSmelting) {
+		super.delete(mesSmelting);
+	}
+	
+}

+ 144 - 0
src/main/java/com/jeesite/modules/mes/web/MesSmeltingController.java

@@ -0,0 +1,144 @@
+package com.jeesite.modules.mes.web;
+
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.jeesite.common.config.Global;
+import com.jeesite.common.collect.ListUtils;
+import com.jeesite.common.entity.Page;
+import com.jeesite.common.lang.DateUtils;
+import com.jeesite.common.utils.excel.ExcelExport;
+import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
+import org.springframework.web.multipart.MultipartFile;
+import com.jeesite.common.web.BaseController;
+import com.jeesite.modules.mes.entity.MesSmelting;
+import com.jeesite.modules.mes.service.MesSmeltingService;
+
+/**
+ * 熔炼数据监控Controller
+ * @author system
+ * @version 2026-06-08
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/mes/mesSmelting")
+public class MesSmeltingController extends BaseController {
+
+	@Autowired
+	private MesSmeltingService mesSmeltingService;
+	
+	/**
+	 * 获取数据
+	 */
+	@ModelAttribute
+	public MesSmelting get(String id, boolean isNewRecord) {
+		return mesSmeltingService.get(id, isNewRecord);
+	}
+	
+	/**
+	 * 查询列表
+	 */
+	@RequiresPermissions("mes:mesSmelting:view")
+	@RequestMapping(value = {"list", ""})
+	public String list(MesSmelting mesSmelting, Model model) {
+		model.addAttribute("mesSmelting", mesSmelting);
+		return "modules/mes/mesSmeltingList";
+	}
+	
+	/**
+	 * 查询列表数据
+	 */
+	@RequiresPermissions("mes:mesSmelting:view")
+	@RequestMapping(value = "listData")
+	@ResponseBody
+	public Page<MesSmelting> listData(MesSmelting mesSmelting, HttpServletRequest request, HttpServletResponse response) {
+		mesSmelting.setPage(new Page<>(request, response));
+		Page<MesSmelting> page = mesSmeltingService.findPage(mesSmelting);
+		return page;
+	}
+
+	/**
+	 * 查看编辑表单
+	 */
+	@RequiresPermissions("mes:mesSmelting:view")
+	@RequestMapping(value = "form")
+	public String form(MesSmelting mesSmelting, Model model) {
+		model.addAttribute("mesSmelting", mesSmelting);
+		return "modules/mes/mesSmeltingForm";
+	}
+
+	/**
+	 * 保存数据
+	 */
+	@RequiresPermissions("mes:mesSmelting:edit")
+	@PostMapping(value = "save")
+	@ResponseBody
+	public String save(@Validated MesSmelting mesSmelting) {
+		mesSmeltingService.save(mesSmelting);
+		return renderResult(Global.TRUE, text("保存熔炼数据监控成功!"));
+	}
+
+	/**
+	 * 导出数据
+	 */
+	@RequiresPermissions("mes:mesSmelting:view")
+	@RequestMapping(value = "exportData")
+	public void exportData(MesSmelting mesSmelting, HttpServletResponse response) {
+		List<MesSmelting> list = mesSmeltingService.findList(mesSmelting);
+		String fileName = "熔炼数据监控" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
+		try(ExcelExport ee = new ExcelExport("熔炼数据监控", MesSmelting.class)){
+			ee.setDataList(list).write(response, fileName);
+		}
+	}
+
+	/**
+	 * 下载模板
+	 */
+	@RequiresPermissions("mes:mesSmelting:view")
+	@RequestMapping(value = "importTemplate")
+	public void importTemplate(HttpServletResponse response) {
+		MesSmelting mesSmelting = new MesSmelting();
+		List<MesSmelting> list = ListUtils.newArrayList(mesSmelting);
+		String fileName = "熔炼数据监控模板.xlsx";
+		try(ExcelExport ee = new ExcelExport("熔炼数据监控", MesSmelting.class, Type.IMPORT)){
+			ee.setDataList(list).write(response, fileName);
+		}
+	}
+
+	/**
+	 * 导入数据
+	 */
+	@ResponseBody
+	@RequiresPermissions("mes:mesSmelting:edit")
+	@PostMapping(value = "importData")
+	public String importData(MultipartFile file) {
+		try {
+			String message = mesSmeltingService.importData(file);
+			return renderResult(Global.TRUE, "posfull:"+message);
+		} catch (Exception ex) {
+			return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
+		}
+	}
+	
+	/**
+	 * 删除数据
+	 */
+	@RequiresPermissions("mes:mesSmelting:edit")
+	@RequestMapping(value = "delete")
+	@ResponseBody
+	public String delete(MesSmelting mesSmelting) {
+		mesSmeltingService.delete(mesSmelting);
+		return renderResult(Global.TRUE, text("删除熔炼数据监控成功!"));
+	}
+	
+}

+ 125 - 0
src/main/java/com/jeesite/modules/scheduling/SmeltingScheduling.java

@@ -0,0 +1,125 @@
+package com.jeesite.modules.scheduling;
+
+import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
+import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
+import com.jeesite.common.config.Global;
+import com.jeesite.common.lang.StringUtils;
+import com.jeesite.modules.mes.entity.MesSmelting;
+import com.jeesite.modules.mes.service.MesSmeltingService;
+import com.jeesite.modules.mes.service.MesDeviceAlarmService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+/**
+ * 熔炼数据监控采集定时任务
+ * 通过 S7 协议读取 PLC 中的铝液温度、气氛温度、排气温度、熔化温度,定时写入 mes_smelting 表。
+ *
+ * 可在 application.yml 或 sys_config 中配置:
+ *   mes.smelting.enabled   是否启用采集(默认 true)
+ *   mes.smelting.plc.ip    PLC IP 地址(默认 192.168.1.7)
+ *
+ * @author system
+ * @version 2026-06-08
+ */
+@Configuration
+@EnableScheduling
+public class SmeltingScheduling {
+
+    private static final Logger logger = LoggerFactory.getLogger(SmeltingScheduling.class);
+
+    /** 默认 PLC IP */
+    private static final String DEFAULT_PLC_IP = "192.168.1.7";
+
+    /** 该 PLC 对应的设备编号(用于联动设备报警状态) */
+    private static final String DEVICE_SN = "RL_OP030_01";
+
+    /** 设备报警状态:0=待处理,1=已处理 */
+    private static final String STATE_PENDING = "0";
+    private static final String STATE_HANDLED = "1";
+
+    /** 采集点位地址 */
+    private static final String ADDR_MOLTEN_ALUMINUM = "DB1.450.0";  // 铝液温度
+    private static final String ADDR_ATMOSPHERE      = "DB1.452.0";  // 气氛温度
+    private static final String ADDR_EXHAUST_GAS     = "DB1.454.0";  // 排气温度
+    private static final String ADDR_MELTING         = "DB1.456.0";  // 熔化温度
+
+    @Autowired
+    private MesSmeltingService mesSmeltingService;
+
+    @Autowired
+    private MesDeviceAlarmService mesDeviceAlarmService;
+
+    /**
+     * 每 30 秒采集一次
+     */
+    @Scheduled(fixedRate = 60000)
+    public void collect() {
+        // 采集开关:未配置则默认启用
+        String enabled = Global.getConfig("mes.smelting.enabled");
+        if (StringUtils.isNotBlank(enabled) && !"true".equalsIgnoreCase(enabled.trim())) {
+            return;
+        }
+
+        String ip = Global.getConfig("mes.smelting.plc.ip");
+        if (StringUtils.isBlank(ip)) {
+            ip = DEFAULT_PLC_IP;
+        }
+
+        S7PLC s7PLC = null;
+        try {
+            s7PLC = new S7PLC(EPlcType.SINUMERIK_828D, ip);
+            // 建立连接 / 检查状态
+            s7PLC.readStatus();
+
+            Short moltenAluminum = s7PLC.readInt16(ADDR_MOLTEN_ALUMINUM);
+            Short atmosphere = s7PLC.readInt16(ADDR_ATMOSPHERE);
+            Short exhaustGas = s7PLC.readInt16(ADDR_EXHAUST_GAS);
+            Short melting = s7PLC.readInt16(ADDR_MELTING);
+
+            MesSmelting mesSmelting = new MesSmelting();
+            mesSmelting.setMoltenAluminumTemperature(toStr(moltenAluminum));
+            mesSmelting.setAtmosphereTemperature(toStr(atmosphere));
+            mesSmelting.setExhaustGasTemperature(toStr(exhaustGas));
+            mesSmelting.setMeltingTemperature(toStr(melting));
+
+            mesSmeltingService.save(mesSmelting);
+
+            // 连接成功:设备状态置为已处理
+            updateDeviceState(STATE_HANDLED);
+
+            logger.info("熔炼数据采集成功[{}] 铝液温度:{} 气氛温度:{} 排气温度:{} 熔化温度:{}",
+                    ip, moltenAluminum, atmosphere, exhaustGas, melting);
+        } catch (Exception e) {
+            // 连接/读取失败:设备状态置为待处理
+            updateDeviceState(STATE_PENDING);
+            logger.error("熔炼数据采集失败[{}]:{}", ip, e.getMessage());
+        } finally {
+            if (s7PLC != null) {
+                try {
+                    s7PLC.close();
+                } catch (Exception e) {
+                    logger.warn("关闭 S7PLC 连接异常:{}", e.getMessage());
+                }
+            }
+        }
+    }
+
+    /**
+     * 更新设备 RL_OP030_01 的报警状态,异常不向上抛出,避免影响采集主流程
+     */
+    private void updateDeviceState(String state) {
+        try {
+            mesDeviceAlarmService.updateStateByDeviceSn(DEVICE_SN, state);
+        } catch (Exception e) {
+            logger.warn("更新设备[{}]状态为[{}]失败:{}", DEVICE_SN, state, e.getMessage());
+        }
+    }
+
+    private String toStr(Short val) {
+        return val == null ? null : String.valueOf(val);
+    }
+}

+ 15 - 0
src/main/resources/mappings/modules/mes/MesSmeltingDao.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeesite.modules.mes.dao.MesSmeltingDao">
+	
+	<!-- 查询数据
+	<select id="findList" resultType="MesSmelting">
+		SELECT ${sqlMap.column.toSql()}
+		FROM ${sqlMap.table.toSql()}
+		<where>
+			${sqlMap.where.toSql()}
+		</where>
+		ORDER BY ${sqlMap.order.toSql()}
+	</select> -->
+	
+</mapper>

+ 82 - 0
src/main/resources/views/modules/mes/mesSmeltingForm.html

@@ -0,0 +1,82 @@
+<% layout('/layouts/default.html', {title: '熔炼数据监控管理', libs: ['validate']}){ %>
+<div class="main-content">
+	<div class="box box-main">
+		<div class="box-header with-border">
+			<div class="box-title">
+				<i class="fa icon-note"></i> ${text(mesSmelting.isNewRecord ? '新增熔炼数据监控' : '编辑熔炼数据监控')}
+			</div>
+			<div class="box-tools pull-right">
+				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
+			</div>
+		</div>
+		<#form:form id="inputForm" model="${mesSmelting}" action="${ctx}/mes/mesSmelting/save" method="post" class="form-horizontal">
+			<div class="box-body">
+				<div class="form-unit">${text('基本信息')}</div>
+				<#form:hidden path="id"/>
+				<div class="row">
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4" title="">
+								<span class="required hide">*</span> ${text('铝液温度')}:<i class="fa icon-question hide"></i></label>
+							<div class="col-sm-8">
+								<#form:input path="moltenAluminumTemperature" maxlength="255" class="form-control"/>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4" title="">
+								<span class="required hide">*</span> ${text('气氛温度')}:<i class="fa icon-question hide"></i></label>
+							<div class="col-sm-8">
+								<#form:input path="atmosphereTemperature" maxlength="255" class="form-control"/>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4" title="">
+								<span class="required hide">*</span> ${text('排气温度')}:<i class="fa icon-question hide"></i></label>
+							<div class="col-sm-8">
+								<#form:input path="exhaustGasTemperature" maxlength="255" class="form-control"/>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4" title="">
+								<span class="required hide">*</span> ${text('熔化温度')}:<i class="fa icon-question hide"></i></label>
+							<div class="col-sm-8">
+								<#form:input path="meltingTemperature" maxlength="255" class="form-control"/>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+			<div class="box-footer">
+				<div class="row">
+					<div class="col-sm-offset-2 col-sm-10">
+						<% if (hasPermi('mes:mesSmelting:edit')){ %>
+							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
+						<% } %>
+						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
+					</div>
+				</div>
+			</div>
+		</#form:form>
+	</div>
+</div>
+<% } %>
+<script>
+$("#inputForm").validate({
+	submitHandler: function(form){
+		js.ajaxSubmitForm($(form), function(data){
+			js.showMessage(data.message);
+			if(data.result == Global.TRUE){
+				js.closeCurrentTabPage(function(contentWindow){
+					contentWindow.page();
+				});
+			}
+		}, "json");
+    }
+});
+</script>

+ 134 - 0
src/main/resources/views/modules/mes/mesSmeltingList.html

@@ -0,0 +1,134 @@
+<% layout('/layouts/default.html', {title: '熔炼数据监控管理', libs: ['dataGrid']}){ %>
+<div class="main-content">
+	<div class="box box-main">
+		<div class="box-header">
+			<div class="box-title">
+				<i class="fa icon-notebook"></i> ${text('熔炼数据监控管理')}
+			</div>
+			<div class="box-tools pull-right">
+				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
+				<a href="#" class="btn btn-default" id="btnExport"><i class="glyphicon glyphicon-export"></i> 导出</a>
+				<% if(hasPermi('mes:mesSmelting:edit')){ %>
+						<a href="#" class="btn btn-default" id="btnImport"><i class="glyphicon glyphicon-import"></i> 导入</a>
+					<a href="${ctx}/mes/mesSmelting/form" class="btn btn-default btnTool" title="${text('新增熔炼数据监控')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
+				<% } %>
+				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
+			</div>
+		</div>
+		<div class="box-body">
+			<#form:form id="searchForm" model="${mesSmelting}" action="${ctx}/mes/mesSmelting/listData" method="post" class="form-inline hide"
+					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
+				<div class="form-group">
+					<label class="control-label">${text('铝液温度')}:</label>
+					<div class="control-inline">
+						<#form:input path="moltenAluminumTemperature" maxlength="255" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('气氛温度')}:</label>
+					<div class="control-inline">
+						<#form:input path="atmosphereTemperature" maxlength="255" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('排气温度')}:</label>
+					<div class="control-inline">
+						<#form:input path="exhaustGasTemperature" maxlength="255" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('熔化温度')}:</label>
+					<div class="control-inline">
+						<#form:input path="meltingTemperature" maxlength="255" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
+					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
+				</div>
+			</#form:form>
+			<table id="dataGrid"></table>
+			<div id="dataGridPage"></div>
+		</div>
+	</div>
+</div>
+<% } %>
+<script>
+// 初始化DataGrid对象
+$('#dataGrid').dataGrid({
+	searchForm: $("#searchForm"),
+	columnModel: [
+		{header:'${text("铝液温度")}', name:'moltenAluminumTemperature', index:'a.molten_aluminum_temperature', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
+			return '<a href="${ctx}/mes/mesSmelting/form?id='+row.id+'" class="btnList" data-title="${text("编辑熔炼数据监控")}">'+(val||row.id)+'</a>';
+		}},
+		{header:'${text("气氛温度")}', name:'atmosphereTemperature', index:'a.atmosphere_temperature', width:150, align:"left"},
+		{header:'${text("排气温度")}', name:'exhaustGasTemperature', index:'a.exhaust_gas_temperature', width:150, align:"left"},
+		{header:'${text("熔化温度")}', name:'meltingTemperature', index:'a.melting_temperature', width:150, align:"left"},
+		{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
+			var actions = [];
+			//<% if(hasPermi('mes:mesSmelting:edit')){ %>
+				actions.push('<a href="${ctx}/mes/mesSmelting/form?id='+row.id+'" class="btnList" title="${text("编辑熔炼数据监控")}"><i class="fa fa-pencil"></i></a>&nbsp;');
+				actions.push('<a href="${ctx}/mes/mesSmelting/delete?id='+row.id+'" class="btnList" title="${text("删除熔炼数据监控")}" data-confirm="${text("确认要删除该熔炼数据监控吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
+			//<% } %>
+			return actions.join('');
+		}}
+	],
+	// 加载成功后执行事件
+	ajaxSuccess: function(data){
+		
+	}
+});
+</script><script>
+$('#btnExport').click(function(){
+	js.ajaxSubmitForm($('#searchForm'), {
+		url:'${ctx}/mes/mesSmelting/exportData',
+		downloadFile:true
+	});
+});
+$('#btnImport').click(function(){
+	js.layer.open({
+		type: 1,
+		area: ['400px'],
+		title: '${text("导入熔炼数据监控")}',
+		resize: false,
+		scrollbar: true,
+		content: js.template('importTpl'),
+		btn: ['<i class="fa fa-check"></i> ${text("导入")}',
+			'<i class="fa fa-remove"></i> ${text("关闭")}'],
+		btn1: function(index, layero){
+			var form = {
+				inputForm: layero.find('#inputForm'),
+				file: layero.find('#file').val()
+			};
+		    if (form.file == '' || (!js.endWith(form.file, '.xls') && !js.endWith(form.file, '.xlsx'))){
+		    	js.showMessage("${text('文件不正确,请选择后缀为“xls”或“xlsx”的文件。')}", null, 'warning');
+		        return false;
+		    }
+			js.ajaxSubmitForm(form.inputForm, function(data){
+				js.showMessage(data.message);
+				if(data.result == Global.TRUE){
+					js.layer.closeAll();
+				}
+				page();
+			}, "json");
+			return true;
+		}
+	});
+});
+</script>
+<script id="importTpl" type="text/template">//<!--
+<form id="inputForm" action="${ctx}/mes/mesSmelting/importData" method="post" enctype="multipart/form-data"
+	class="form-horizontal mt20 mb10" style="overflow:auto;max-height:200px;">
+	<div class="row">
+		<div class="col-xs-12 col-xs-offset-1">
+			<input type="file" id="file" name="file" class="form-file"/>
+			<div class="mt10 pt5" style="color:red">
+				${text('提示:仅允许导入“xls”或“xlsx”格式文件!')}
+			</div>
+			<div class="mt10 pt5">
+				<a href="${ctx}/mes/mesSmelting/importTemplate" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> ${text('下载模板')}</a>
+			</div>
+		</div>
+	</div>
+</form>
+//--></script>