ソースを参照

cnc刀具数据

liuwei 2 ヶ月 前
親
コミット
bf0d26a2c3

+ 15 - 0
src/main/java/com/jeesite/modules/mes/dao/MesProductCncToolGeoDao.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.MesProductCncToolGeo;
+
+/**
+ * CNC刀长半径采集DAO接口
+ * @author system
+ * @version 2026-08-11
+ */
+@MyBatisDao
+public interface MesProductCncToolGeoDao extends CrudDao<MesProductCncToolGeo> {
+
+}

+ 104 - 0
src/main/java/com/jeesite/modules/mes/entity/MesProductCncToolGeo.java

@@ -0,0 +1,104 @@
+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;
+
+import java.util.Date;
+
+/**
+ * CNC刀长半径采集Entity
+ * @author system
+ * @version 2026-08-11
+ */
+@Table(name="mes_product_cnc_tool_geo", alias="a", label="CNC刀长半径采集信息", columns={
+		@Column(name="id", attrName="id", label="id", isPK=true),
+		@Column(name="device_code", attrName="deviceCode", label="设备号", queryType=QueryType.LIKE),
+		@Column(name="tool_length", attrName="toolLength", label="刀长串", isQuery=false),
+		@Column(name="tool_radius", attrName="toolRadius", label="半径串", isQuery=false),
+		@Column(name="create_by", attrName="createBy", label="操作人", isUpdate=false, isQuery=false),
+		@Column(name="create_date", attrName="createDate", label="上传时间", isUpdate=false, isUpdateForce=true),
+	}, orderBy="a.create_date DESC"
+)
+public class MesProductCncToolGeo extends DataEntity<MesProductCncToolGeo> {
+
+	private static final long serialVersionUID = 1L;
+	private String deviceCode;
+	private String toolLength;
+	private String toolRadius;
+	/** 刀号(非表字段:列表展示 / 查询条件) */
+	private Integer toolNo;
+
+	@ExcelFields({
+		@ExcelField(title="设备号", attrName="deviceCode", align=Align.CENTER, sort=10),
+		@ExcelField(title="刀号", attrName="toolNo", align=Align.CENTER, sort=15),
+		@ExcelField(title="刀长", attrName="toolLength", align=Align.CENTER, sort=20),
+		@ExcelField(title="半径", attrName="toolRadius", align=Align.CENTER, sort=30),
+		@ExcelField(title="操作人", attrName="createBy", align=Align.CENTER, sort=40),
+		@ExcelField(title="上传时间", attrName="createDate", align=Align.CENTER, sort=50, dataFormat="yyyy-MM-dd HH:mm:ss"),
+	})
+	public MesProductCncToolGeo() {
+		this(null);
+	}
+
+	public MesProductCncToolGeo(String id) {
+		super(id);
+	}
+
+	@Size(min=0, max=64, message="设备号长度不能超过 64 个字符")
+	public String getDeviceCode() {
+		return deviceCode;
+	}
+
+	public void setDeviceCode(String deviceCode) {
+		this.deviceCode = deviceCode;
+	}
+
+	@Size(min=0, max=2000, message="刀长串长度不能超过 2000 个字符")
+	public String getToolLength() {
+		return toolLength;
+	}
+
+	public void setToolLength(String toolLength) {
+		this.toolLength = toolLength;
+	}
+
+	@Size(min=0, max=2000, message="半径串长度不能超过 2000 个字符")
+	public String getToolRadius() {
+		return toolRadius;
+	}
+
+	public void setToolRadius(String toolRadius) {
+		this.toolRadius = toolRadius;
+	}
+
+	public Integer getToolNo() {
+		return toolNo;
+	}
+
+	public void setToolNo(Integer toolNo) {
+		this.toolNo = toolNo;
+	}
+
+	public Date getCreateDate_gte() {
+		return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
+	}
+
+	public void setCreateDate_gte(Date createDate) {
+		sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
+	}
+
+	public Date getCreateDate_lte() {
+		return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
+	}
+
+	public void setCreateDate_lte(Date createDate) {
+		sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
+	}
+}

+ 46 - 0
src/main/java/com/jeesite/modules/mes/service/MesProductCncToolGeoService.java

@@ -0,0 +1,46 @@
+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.MesProductCncToolGeo;
+import com.jeesite.modules.mes.dao.MesProductCncToolGeoDao;
+
+/**
+ * CNC刀长半径采集Service
+ * @author system
+ * @version 2026-08-11
+ */
+@Service
+public class MesProductCncToolGeoService extends CrudService<MesProductCncToolGeoDao, MesProductCncToolGeo> {
+
+	@Override
+	public MesProductCncToolGeo get(MesProductCncToolGeo mesProductCncToolGeo) {
+		return super.get(mesProductCncToolGeo);
+	}
+
+	@Override
+	public Page<MesProductCncToolGeo> findPage(MesProductCncToolGeo mesProductCncToolGeo) {
+		return super.findPage(mesProductCncToolGeo);
+	}
+
+	@Override
+	public List<MesProductCncToolGeo> findList(MesProductCncToolGeo mesProductCncToolGeo) {
+		return super.findList(mesProductCncToolGeo);
+	}
+
+	@Override
+	@Transactional
+	public void save(MesProductCncToolGeo mesProductCncToolGeo) {
+		super.save(mesProductCncToolGeo);
+	}
+
+	@Override
+	@Transactional
+	public void delete(MesProductCncToolGeo mesProductCncToolGeo) {
+		super.delete(mesProductCncToolGeo);
+	}
+}

+ 155 - 0
src/main/java/com/jeesite/modules/mes/web/MesProductCncToolGeoController.java

@@ -0,0 +1,155 @@
+package com.jeesite.modules.mes.web;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+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.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.alibaba.druid.util.StringUtils;
+import com.jeesite.common.config.Global;
+import com.jeesite.common.entity.Page;
+import com.jeesite.common.web.BaseController;
+import com.jeesite.modules.mes.entity.MesProductCncToolGeo;
+import com.jeesite.modules.mes.service.MesProductCncToolGeoService;
+
+/**
+ * CNC刀长半径采集Controller
+ * 库中一次提交存一条(# 拼串);列表一行对应一次提交,默认展示 1 号刀刀长/半径
+ * @author system
+ * @version 2026-08-11
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/mes/mesProductCncToolGeo")
+public class MesProductCncToolGeoController extends BaseController {
+
+	@Autowired
+	private MesProductCncToolGeoService mesProductCncToolGeoService;
+
+	@ModelAttribute
+	public MesProductCncToolGeo get(String id, boolean isNewRecord) {
+		return mesProductCncToolGeoService.get(id, isNewRecord);
+	}
+
+	@RequiresPermissions("mes:mesProductCncToolGeo:view")
+	@RequestMapping(value = {"list", ""})
+	public String list(MesProductCncToolGeo mesProductCncToolGeo, Model model) {
+		model.addAttribute("mesProductCncToolGeo", mesProductCncToolGeo);
+		return "modules/mes/mesProductCncToolGeoList";
+	}
+
+	/**
+	 * 列表数据:一次提交一行;刀长/半径取指定刀号(默认 1 号)的段值
+	 */
+	@RequiresPermissions("mes:mesProductCncToolGeo:view")
+	@RequestMapping(value = "listData")
+	@ResponseBody
+	public Page<MesProductCncToolGeo> listData(MesProductCncToolGeo mesProductCncToolGeo,
+			HttpServletRequest request, HttpServletResponse response) {
+		Integer displayToolNo = mesProductCncToolGeo.getToolNo();
+		if (displayToolNo == null || displayToolNo <= 0) {
+			displayToolNo = 1;
+		}
+		mesProductCncToolGeo.setToolNo(null);
+		mesProductCncToolGeo.setPage(new Page<>(request, response));
+		Page<MesProductCncToolGeo> page = mesProductCncToolGeoService.findPage(mesProductCncToolGeo);
+		if (page.getList() != null) {
+			for (MesProductCncToolGeo row : page.getList()) {
+				fillToolSegment(row, displayToolNo);
+			}
+		}
+		return page;
+	}
+
+	@RequiresPermissions("mes:mesProductCncToolGeo:view")
+	@RequestMapping(value = "detail")
+	public String detail(MesProductCncToolGeo mesProductCncToolGeo, Model model) {
+		model.addAttribute("mesProductCncToolGeo", mesProductCncToolGeo);
+		model.addAttribute("toolRows", parseToolGeo(mesProductCncToolGeo.getToolLength(),
+				mesProductCncToolGeo.getToolRadius()));
+		return "modules/mes/mesProductCncToolGeoDetail";
+	}
+
+	/**
+	 * 供工机客户端上传(匿名)
+	 */
+	@PostMapping(value = "saveToolGeo")
+	@ResponseBody
+	public String saveToolGeo(HttpServletRequest request) {
+		String deviceCode = request.getParameter("deviceCode");
+		String ucode = request.getParameter("ucode");
+		String toolLength = request.getParameter("toolLength");
+		String toolRadius = request.getParameter("toolRadius");
+		if (StringUtils.isEmpty(deviceCode) || toolLength == null || toolRadius == null) {
+			return renderResult(Global.FALSE, text("参数错误!"));
+		}
+		String[] lens = toolLength.split("#", -1);
+		String[] rads = toolRadius.split("#", -1);
+		if (lens.length == 0 || lens.length != rads.length) {
+			return renderResult(Global.FALSE, text("刀长/半径段数不一致!"));
+		}
+		boolean allEmpty = true;
+		for (int i = 0; i < lens.length; i++) {
+			if ((lens[i] != null && !lens[i].trim().isEmpty())
+					|| (rads[i] != null && !rads[i].trim().isEmpty())) {
+				allEmpty = false;
+				break;
+			}
+		}
+		if (allEmpty) {
+			return renderResult(Global.FALSE, text("刀长半径数据为空!"));
+		}
+
+		MesProductCncToolGeo entity = new MesProductCncToolGeo();
+		entity.setDeviceCode(deviceCode.trim());
+		entity.setToolLength(toolLength);
+		entity.setToolRadius(toolRadius);
+		entity.setCreateBy(StringUtils.isEmpty(ucode) ? "system" : ucode);
+		mesProductCncToolGeoService.save(entity);
+		return renderResult(Global.TRUE, text("操作成功!"));
+	}
+
+	/**
+	 * 列表展示:用指定刀号的段值覆盖 toolLength/toolRadius,并写入 toolNo
+	 */
+	private void fillToolSegment(MesProductCncToolGeo row, int toolNo) {
+		String lengthRaw = row.getToolLength();
+		String radiusRaw = row.getToolRadius();
+		String[] lens = lengthRaw == null ? new String[0] : lengthRaw.split("#", -1);
+		String[] rads = radiusRaw == null ? new String[0] : radiusRaw.split("#", -1);
+		int idx = toolNo - 1;
+		row.setToolNo(toolNo);
+		row.setToolLength(idx >= 0 && idx < lens.length ? nullToEmpty(lens[idx]) : "");
+		row.setToolRadius(idx >= 0 && idx < rads.length ? nullToEmpty(rads[idx]) : "");
+	}
+
+	/** 详情页:全部刀号段(含空) */
+	private List<Map<String, String>> parseToolGeo(String toolLength, String toolRadius) {
+		List<Map<String, String>> rows = new ArrayList<>();
+		String[] lens = toolLength == null ? new String[0] : toolLength.split("#", -1);
+		String[] rads = toolRadius == null ? new String[0] : toolRadius.split("#", -1);
+		int n = Math.max(lens.length, rads.length);
+		for (int i = 0; i < n; i++) {
+			Map<String, String> row = new HashMap<>();
+			row.put("toolNo", String.valueOf(i + 1));
+			row.put("length", i < lens.length ? nullToEmpty(lens[i]) : "");
+			row.put("radius", i < rads.length ? nullToEmpty(rads[i]) : "");
+			rows.add(row);
+		}
+		return rows;
+	}
+
+	private String nullToEmpty(String s) {
+		return s == null ? "" : s.trim();
+	}
+}

+ 4 - 2
src/main/resources/config/application.yml

@@ -53,8 +53,8 @@ jdbc:
   # Mysql 数据库配置
   type: mysql
   driver: com.mysql.cj.jdbc.Driver
-  url: jdbc:mysql://127.0.0.1:3306/mes_cloud_ljr?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
-#  url: jdbc:mysql://10.0.20.10:3306/mes_cloud_ljr?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
+#  url: jdbc:mysql://127.0.0.1:3306/mes_cloud_ljr?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
+  url: jdbc:mysql://10.0.20.10:3306/mes_cloud_ljr?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 #  url: jdbc:mysql://192.168.22.99:3306/mes_cloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 #  username: mes_cloud
 #  password: YD57bSRabiyWBwkZ
@@ -706,6 +706,7 @@ shiro:
     ${adminPath}/mes/mesProductCncLife/saveLife = anon
     ${adminPath}/mes/mesProductCnc/saveBroken = anon
     ${adminPath}/mes/mesProductCncParam/batchsave = anon
+    ${adminPath}/mes/mesProductCncToolGeo/saveToolGeo = anon
     ${adminPath}/mes/mesProductRecord/pcdevice = anon
     ${adminPath}/mes/mesProductRecord/checkProduct = anon
     ${adminPath}/mes/mesProductRecord/editProduct = anon
@@ -750,6 +751,7 @@ shiro:
     ${adminPath}/mes/mesProductCnc/save= anon
     ${adminPath}/mes/mesProductCncLife/saveLife= anon
     ${adminPath}/mes/mesProductCncParam/batchsave= anon
+    ${adminPath}/mes/mesProductCncToolGeo/saveToolGeo= anon
     
     
   

+ 4 - 0
src/main/resources/mappings/modules/mes/MesProductCncToolGeoDao.xml

@@ -0,0 +1,4 @@
+<?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.MesProductCncToolGeoDao">
+</mapper>

+ 60 - 0
src/main/resources/views/modules/mes/mesProductCncToolGeoDetail.html

@@ -0,0 +1,60 @@
+<% layout('/layouts/default.html', {title: 'CNC刀长半径详情', libs: []}){ %>
+<style>
+	.table.table-bordered th.mpc-header { width: 140px; background: #f9f9f9; }
+	.tool-table th { background: #f5f5f5; text-align: center; }
+	.tool-table td { text-align: center; }
+</style>
+<div class="main-content">
+	<div class="box box-main">
+		<div class="box-header with-border">
+			<div class="box-title">
+				<i class="fa icon-eye"></i> ${text('CNC刀长半径详情')}
+			</div>
+		</div>
+		<div class="box-body">
+			<div class="form-unit">${text('基本信息')}</div>
+			<table class="table table-bordered">
+				<tr>
+					<th class="mpc-header">${text('设备号')}</th>
+					<td>${mesProductCncToolGeo.deviceCode}</td>
+					<th class="mpc-header">${text('操作人')}</th>
+					<td>${mesProductCncToolGeo.createBy}</td>
+				</tr>
+				<tr>
+					<th class="mpc-header">${text('上传时间')}</th>
+					<td colspan="3">${@DateUtils.formatDateTime(mesProductCncToolGeo.createDate)}</td>
+				</tr>
+			</table>
+
+			<div class="form-unit">${text('按刀号解析(第N段=N号刀,#分隔)')}</div>
+			<% if(toolRows == null || toolRows.~size == 0){ %>
+				<div class="alert alert-info" style="margin:0;">暂无刀具数据</div>
+			<% } else { %>
+				<table class="table table-bordered tool-table">
+					<thead>
+						<tr>
+							<th style="width:100px;">${text('刀号')}</th>
+							<th>${text('刀长 $TC_DP3')}</th>
+							<th>${text('半径 $TC_DP6')}</th>
+						</tr>
+					</thead>
+					<tbody>
+						<% for(var row in toolRows){ %>
+						<tr>
+							<td>${row.toolNo}</td>
+							<td>${row.length != '' ? row.length : '-'}</td>
+							<td>${row.radius != '' ? row.radius : '-'}</td>
+						</tr>
+						<% } %>
+					</tbody>
+				</table>
+			<% } %>
+		</div>
+		<div class="box-footer">
+			<button type="button" class="btn btn-sm btn-default" onclick="js.closeCurrentTabPage()">
+				<i class="fa fa-reply-all"></i> ${text('关 闭')}
+			</button>
+		</div>
+	</div>
+</div>
+<% } %>

+ 65 - 0
src/main/resources/views/modules/mes/mesProductCncToolGeoList.html

@@ -0,0 +1,65 @@
+<% layout('/layouts/default.html', {title: 'CNC刀长半径管理', 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('CNC刀长半径管理')}
+			</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="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
+			</div>
+		</div>
+		<div class="box-body">
+			<#form:form id="searchForm" model="${mesProductCncToolGeo}" action="${ctx}/mes/mesProductCncToolGeo/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="deviceCode" 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="toolNo" maxlength="10" class="form-control width-90" placeholder="默认1"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('上传时间')}:</label>
+					<div class="control-inline">
+						<#form:input path="createDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
+							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="createDate_lte.click()"/>
+						&nbsp;-&nbsp;
+						<#form:input path="createDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
+							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
+					</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({
+	searchForm: $("#searchForm"),
+	columnModel: [
+		{header:'${text("设备号")}', name:'deviceCode', index:'a.device_code', width:100, align:"center", frozen:true},
+		{header:'${text("刀号")}', name:'toolNo', index:'toolNo', width:80, align:"center"},
+		{header:'${text("刀长")}', name:'toolLength', index:'toolLength', width:120, align:"center"},
+		{header:'${text("半径")}', name:'toolRadius', index:'toolRadius', width:120, align:"center"},
+		{header:'${text("操作人")}', name:'createBy', index:'a.create_by', width:100, align:"center"},
+		{header:'${text("上传时间")}', name:'createDate', index:'a.create_date', width:160, align:"center"},
+		{header:'${text("操作")}', name:'actions', width:80, align:"center", formatter: function(val, obj, row){
+			return '<a href="${ctx}/mes/mesProductCncToolGeo/detail?id='+row.id+'" class="btnList" title="${text("全部刀号详情")}"><i class="fa fa-fw fa-eye"></i></a>';
+		}}
+	],
+	ajaxSuccess: function(data){}
+});
+</script>

+ 14 - 0
src/main/resources/views/modules/mes/mesScrapList.html

@@ -30,6 +30,20 @@
 					</div>
 				</div>
 				<div class="form-group">
+					<label class="control-label">${text('起始时间')}:</label>
+					<div class="control-inline">
+						<#form:input path="updateDate_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
+							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" data-done="updateDate_lte.click()"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('结束时间')}:</label>
+					<div class="control-inline">
+						<#form:input path="updateDate_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
+							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
+					</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>