瀏覽代碼

绝缘耐压,ccd

sunxianglong 2 月之前
父節點
當前提交
20e2194306

+ 15 - 0
src/main/java/com/jeesite/modules/mes/dao/MesProductJynyDao.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.MesProductJyny;
+
+/**
+ * 绝缘耐压数据表DAO接口
+ * @author sxl
+ * @version 2026-08-13
+ */
+@MyBatisDao
+public interface MesProductJynyDao extends CrudDao<MesProductJyny> {
+	
+}

+ 90 - 0
src/main/java/com/jeesite/modules/mes/entity/MesProductJyny.java

@@ -0,0 +1,90 @@
+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;
+
+/**
+ * 绝缘耐压数据表Entity
+ * @author sxl
+ * @version 2026-08-13
+ */
+@Table(name="mes_product_jyny", alias="a", label="绝缘耐压数据表信息", columns={
+		@Column(name="id", attrName="id", label="id", isPK=true),
+		@Column(name="sn", attrName="sn", label="工件码"),
+		@Column(name="dz_data", attrName="dzData", label="绝缘电阻"),
+		@Column(name="ld_data", attrName="ldData", label="漏电电流"),
+		@Column(name="create_by", attrName="createBy", label="创建人", isUpdate=false, isQuery=false),
+		@Column(name="result", attrName="result", label="工位结果"),
+		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false, isUpdateForce=true),
+		@Column(name="update_by", attrName="updateBy", label="更新人", isQuery=false),
+		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false, isUpdateForce=true),
+		@Column(name="oprno", attrName="oprno", label="工位号"),
+	}, orderBy="a.update_date DESC"
+)
+public class MesProductJyny extends DataEntity<MesProductJyny> {
+	
+	private static final long serialVersionUID = 1L;
+	private String sn;		// 工件码
+	private String dzData;		// 绝缘电阻
+	private String ldData;		// 漏电电流
+	private String result;		// 工位结果
+	private String oprno;		// 工位号
+
+	public MesProductJyny() {
+		this(null);
+	}
+	
+	public MesProductJyny(String id){
+		super(id);
+	}
+	
+	@Size(min=0, max=64, message="工件码长度不能超过 64 个字符")
+	public String getSn() {
+		return sn;
+	}
+
+	public void setSn(String sn) {
+		this.sn = sn;
+	}
+	
+	@Size(min=0, max=255, message="绝缘电阻长度不能超过 255 个字符")
+	public String getDzData() {
+		return dzData;
+	}
+
+	public void setDzData(String dzData) {
+		this.dzData = dzData;
+	}
+	
+	@Size(min=0, max=255, message="漏电电流长度不能超过 255 个字符")
+	public String getLdData() {
+		return ldData;
+	}
+
+	public void setLdData(String ldData) {
+		this.ldData = ldData;
+	}
+	
+	@Size(min=0, max=64, message="工位结果长度不能超过 64 个字符")
+	public String getResult() {
+		return result;
+	}
+
+	public void setResult(String result) {
+		this.result = result;
+	}
+	
+	@Size(min=0, max=64, message="工位号长度不能超过 64 个字符")
+	public String getOprno() {
+		return oprno;
+	}
+
+	public void setOprno(String oprno) {
+		this.oprno = oprno;
+	}
+	
+}

+ 2 - 2
src/main/java/com/jeesite/modules/mes/service/MesProductCcdService.java

@@ -183,7 +183,7 @@ public class MesProductCcdService extends CrudService<MesProductCcdDao, MesProdu
 			return CommonUitl.getXml("NG;参数错误4;");
 		}
 
-		String sn = parts[2];	//序号
+		String sn = parts[2];	//序号(条码)
 		String oprno = parts[3]; // OP290B
 		String lineSn = "XT";	//产线编号
 		String title = parts[4];//设备名称
@@ -206,7 +206,7 @@ public class MesProductCcdService extends CrudService<MesProductCcdDao, MesProdu
 			mesProductCcd.setSn(sn);
 			mesProductCcd.setOprno(oprno);
 			mesProductCcd.setLineSn(lineSn);
-			mesProductCcd.setCate("C005电池盒");
+			mesProductCcd.setCate("ADO6箱体");
 			mesProductCcd.setTitle(title);
 			//测试编号--序号
 			mesProductCcd.setTestNum(dtl.split("@")[0]);

+ 81 - 0
src/main/java/com/jeesite/modules/mes/service/MesProductJynyService.java

@@ -0,0 +1,81 @@
+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.MesProductJyny;
+import com.jeesite.modules.mes.dao.MesProductJynyDao;
+
+/**
+ * 绝缘耐压数据表Service
+ * @author sxl
+ * @version 2026-08-13
+ */
+@Service
+public class MesProductJynyService extends CrudService<MesProductJynyDao, MesProductJyny> {
+	
+	/**
+	 * 获取单条数据
+	 * @param mesProductJyny
+	 * @return
+	 */
+	@Override
+	public MesProductJyny get(MesProductJyny mesProductJyny) {
+		return super.get(mesProductJyny);
+	}
+	
+	/**
+	 * 查询分页数据
+	 * @param mesProductJyny 查询条件
+	 * @param mesProductJyny.page 分页对象
+	 * @return
+	 */
+	@Override
+	public Page<MesProductJyny> findPage(MesProductJyny mesProductJyny) {
+		return super.findPage(mesProductJyny);
+	}
+	
+	/**
+	 * 查询列表数据
+	 * @param mesProductJyny
+	 * @return
+	 */
+	@Override
+	public List<MesProductJyny> findList(MesProductJyny mesProductJyny) {
+		return super.findList(mesProductJyny);
+	}
+	
+	/**
+	 * 保存数据(插入或更新)
+	 * @param mesProductJyny
+	 */
+	@Override
+	@Transactional
+	public void save(MesProductJyny mesProductJyny) {
+		super.save(mesProductJyny);
+	}
+	
+	/**
+	 * 更新状态
+	 * @param mesProductJyny
+	 */
+	@Override
+	@Transactional
+	public void updateStatus(MesProductJyny mesProductJyny) {
+		super.updateStatus(mesProductJyny);
+	}
+	
+	/**
+	 * 删除数据
+	 * @param mesProductJyny
+	 */
+	@Override
+	@Transactional
+	public void delete(MesProductJyny mesProductJyny) {
+		super.delete(mesProductJyny);
+	}
+	
+}

+ 148 - 0
src/main/java/com/jeesite/modules/mes/web/MesProductJynyController.java

@@ -0,0 +1,148 @@
+package com.jeesite.modules.mes.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.jeesite.common.lang.ObjectUtils;
+import com.jeesite.common.lang.StringUtils;
+import com.jeesite.modules.mes.entity.MesProductRecord;
+import com.jeesite.modules.mes.service.MesProductRecordService;
+import com.jeesite.modules.sys.entity.User;
+import com.jeesite.modules.sys.utils.UserUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.ui.Model;
+import org.springframework.validation.annotation.Validated;
+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.entity.Page;
+import com.jeesite.common.web.BaseController;
+import com.jeesite.modules.mes.entity.MesProductJyny;
+import com.jeesite.modules.mes.service.MesProductJynyService;
+
+/**
+ * 绝缘耐压数据表Controller
+ * @author sxl
+ * @version 2026-08-13
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/mes/mesProductJyny")
+public class MesProductJynyController extends BaseController {
+
+	@Autowired
+	private MesProductJynyService mesProductJynyService;
+	@Autowired
+	private MesProductRecordService mesProductRecordService;
+
+
+	/**
+	 * 查询列表
+	 */
+	@RequiresPermissions("mes:mesProductJyny:view")
+	@RequestMapping(value = {"list", ""})
+	public String list(MesProductJyny mesProductJyny, Model model) {
+		model.addAttribute("mesProductJyny", mesProductJyny);
+		return "modules/mes/mesProductJynyList";
+	}
+
+	/**
+	 * 查询列表数据
+	 */
+	@RequiresPermissions("mes:mesProductJyny:view")
+	@RequestMapping(value = "listData")
+	@ResponseBody
+	public Page<MesProductJyny> listData(MesProductJyny mesProductJyny, HttpServletRequest request, HttpServletResponse response) {
+		mesProductJyny.setPage(new Page<>(request, response));
+		Page<MesProductJyny> page = mesProductJynyService.findPage(mesProductJyny);
+		return page;
+	}
+
+	/**
+	 * 查看编辑表单
+	 */
+	@RequiresPermissions("mes:mesProductJyny:view")
+	@RequestMapping(value = "form")
+	public String form(MesProductJyny mesProductJyny, Model model) {
+		model.addAttribute("mesProductJyny", mesProductJyny);
+		return "modules/mes/mesProductJynyForm";
+	}
+
+	/**
+	 * 保存数据
+	 */
+	@RequiresPermissions("mes:mesProductJyny:edit")
+	@PostMapping(value = "save")
+	@ResponseBody
+	public String save(@Validated MesProductJyny mesProductJyny) {
+		mesProductJynyService.save(mesProductJyny);
+		return renderResult(Global.TRUE, text("保存绝缘耐压数据表成功!"));
+	}
+
+	/**
+	 * 删除数据
+	 */
+	@RequiresPermissions("mes:mesProductJyny:edit")
+	@RequestMapping(value = "delete")
+	@ResponseBody
+	public String delete(MesProductJyny mesProductJyny) {
+		mesProductJynyService.delete(mesProductJyny);
+		return renderResult(Global.TRUE, text("删除绝缘耐压数据表成功!"));
+	}
+
+	/**
+	 * 接收绝缘耐压数据:先更新工件对应工位结果,再保存数据
+	 */
+	@PostMapping(value = "upload")
+	@ResponseBody
+	@Transactional
+	public String upload(MesProductJyny mesProductJyny) {
+		if (mesProductJyny == null || StringUtils.isBlank(mesProductJyny.getSn())) {
+			return renderResult(Global.FALSE, text("工件码不能为空!"));
+		}
+		if (StringUtils.isBlank(mesProductJyny.getOprno())) {
+			return renderResult(Global.FALSE, text("工位号不能为空!"));
+		}
+		if (StringUtils.isBlank(mesProductJyny.getResult())) {
+			return renderResult(Global.FALSE, text("工位结果不能为空!"));
+		}
+		String result = mesProductJyny.getResult().trim();
+		if (!"OK".equals(result) && !"NG".equals(result)) {
+			return renderResult(Global.FALSE, text("工位结果错误!"));
+		}
+
+		String sn = mesProductJyny.getSn().trim();
+		MesProductRecord record = mesProductRecordService.findBySnCate(sn);
+		if (ObjectUtils.isEmpty(record) || StringUtils.isBlank(record.getLineSn())) {
+			return renderResult(Global.FALSE, text("未找到该工件的生产记录!"));
+		}
+
+		String oprno = mesProductJyny.getOprno().trim();
+		if (oprno.length() == 5) {
+			oprno = oprno + "A";
+		}
+		String userCode = "";
+		User user = UserUtils.getUser();
+		if (user != null && StringUtils.isNotBlank(user.getUserCode())) {
+			userCode = user.getUserCode();
+		}
+
+		try {
+			// 1. 先更新工位结果
+			mesProductRecordService.updateRecord(sn, oprno, "100000", "", result, userCode, record.getLineSn());
+			// 2. 再保存绝缘耐压数据
+			mesProductJynyService.save(mesProductJyny);
+		} catch (Exception e) {
+			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+			logger.error("绝缘耐压数据上传失败", e);
+			return renderResult(Global.FALSE, text(StringUtils.isNotBlank(e.getMessage()) ? e.getMessage() : "操作失败!"));
+		}
+		return renderResult(Global.TRUE, text("操作成功!"));
+	}
+
+}

+ 1 - 1
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -3910,7 +3910,7 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 		// 01;工号;序号(条码);工序名称(工位号);资源名称;设备编码;工治具编码;
 		String commandString = req.getParameter("commandString");
 		logger.info("commandString:"+commandString);
-		mesLogService.apisave2("OP440","XT",commandString,req);
+		mesLogService.apisave2("OP370","XT",commandString,req);
 
 		if (commandString == null || commandString.isEmpty()) {
 			return CommonUitl.getXml("NG;参数错误;");

+ 15 - 0
src/main/resources/mappings/modules/mes/MesProductJynyDao.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.MesProductJynyDao">
+	
+	<!-- 查询数据
+	<select id="findList" resultType="MesProductJyny">
+		SELECT ${sqlMap.column.toSql()}
+		FROM ${sqlMap.table.toSql()}
+		<where>
+			${sqlMap.where.toSql()}
+		</where>
+		ORDER BY ${sqlMap.order.toSql()}
+	</select> -->
+	
+</mapper>

+ 91 - 0
src/main/resources/views/modules/mes/mesProductJynyForm.html

@@ -0,0 +1,91 @@
+<% 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(mesProductJyny.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="${mesProductJyny}" action="${ctx}/mes/mesProductJyny/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="sn" maxlength="64" 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="dzData" 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="ldData" 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="result" maxlength="64" 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="oprno" maxlength="64" 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:mesProductJyny: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>

+ 87 - 0
src/main/resources/views/modules/mes/mesProductJynyList.html

@@ -0,0 +1,87 @@
+<% 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>
+				<% if(hasPermi('mes:mesProductJyny:edit')){ %>
+					<a href="${ctx}/mes/mesProductJyny/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="${mesProductJyny}" action="${ctx}/mes/mesProductJyny/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="sn" maxlength="64" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('绝缘电阻')}:</label>
+					<div class="control-inline">
+						<#form:input path="dzData" 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="ldData" 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="result" maxlength="64" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('工位号')}:</label>
+					<div class="control-inline">
+						<#form:input path="oprno" maxlength="64" 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:'sn', index:'a.sn', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
+			return '<a href="${ctx}/mes/mesProductJyny/form?id='+row.id+'" class="btnList" data-title="${text("编辑绝缘耐压数据表")}">'+(val||row.id)+'</a>';
+		}},
+		{header:'${text("绝缘电阻")}', name:'dzData', index:'a.dz_data', width:150, align:"left"},
+		{header:'${text("漏电电流")}', name:'ldData', index:'a.ld_data', width:150, align:"left"},
+		{header:'${text("工位结果")}', name:'result', index:'a.result', width:150, align:"left"},
+		{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
+		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:150, align:"left"},
+		{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
+			var actions = [];
+			//<% if(hasPermi('mes:mesProductJyny:edit')){ %>
+				actions.push('<a href="${ctx}/mes/mesProductJyny/form?id='+row.id+'" class="btnList" title="${text("编辑绝缘耐压数据表")}"><i class="fa fa-pencil"></i></a>&nbsp;');
+				actions.push('<a href="${ctx}/mes/mesProductJyny/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>