Quellcode durchsuchen

优化点检项照片、增加GP12检查项页面

jingbo vor 1 Monat
Ursprung
Commit
136854cff8

+ 48 - 0
db/mysql/add_mes_gp12_check_menu.sql

@@ -0,0 +1,48 @@
+-- GP12检查项:迁移到质量管理菜单下的独立菜单
+-- 原入口在「工件类型管理」列表的操作按钮,现改为质量管理下独立菜单管理
+
+-- PC 菜单:质量管理 / GP12检查项
+INSERT INTO `js_sys_menu` (
+  `menu_code`, `parent_code`, `parent_codes`, `tree_sort`, `tree_sorts`, `tree_leaf`, `tree_level`,
+  `tree_names`, `menu_name`, `menu_type`, `menu_href`, `menu_target`, `menu_icon`, `menu_color`,
+  `menu_title`, `permission`, `weight`, `is_show`, `sys_code`, `module_codes`, `component`, `params`,
+  `status`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`
+)
+SELECT
+  'mesProductGp12Check',
+  '1669218434433699840',
+  '0,1669218434433699840,',
+  150,
+  '0000009230,0000000150,',
+  '1',
+  1,
+  '质量管理/GP12检查项',
+  'GP12检查项',
+  '1',
+  '/mes/mesProductGp12Check/list',
+  '',
+  'icon-notebook',
+  '',
+  '',
+  'mes:mesProductGp12Check:view',
+  80,
+  '1',
+  'default',
+  'core',
+  NULL,
+  NULL,
+  '0',
+  'system',
+  NOW(),
+  'system',
+  NOW(),
+  ''
+FROM DUAL
+WHERE NOT EXISTS (
+  SELECT 1 FROM `js_sys_menu` WHERE `menu_code` = 'mesProductGp12Check'
+);
+
+-- 角色授权:corpAdmin
+INSERT INTO `js_sys_role_menu` (`role_code`, `menu_code`)
+SELECT 'corpAdmin', 'mesProductGp12Check' FROM DUAL
+WHERE NOT EXISTS (SELECT 1 FROM `js_sys_role_menu` WHERE `role_code`='corpAdmin' AND `menu_code`='mesProductGp12Check');

+ 12 - 0
src/main/java/com/jeesite/modules/mes/entity/MesToolReplaceRecord.java

@@ -12,6 +12,8 @@ import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
 import com.jeesite.common.utils.excel.annotation.ExcelFields;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 工具寿命更换记录Entity
@@ -49,6 +51,16 @@ public class MesToolReplaceRecord extends DataEntity<MesToolReplaceRecord> {
 	private String name;   //名称
 	private String name1;
 
+	private List<Map<String, Object>> img;   //照片列表,非持久化字段
+
+	public List<Map<String, Object>> getImg() {
+		return img;
+	}
+
+	public void setImg(List<Map<String, Object>> img) {
+		this.img = img;
+	}
+
 	public String getName1() {
 		return name1;
 	}

+ 30 - 10
src/main/java/com/jeesite/modules/mes/web/MesProductGp12CheckController.java

@@ -3,6 +3,9 @@ package com.jeesite.modules.mes.web;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -47,18 +50,19 @@ public class MesProductGp12CheckController extends BaseController {
 	/**
 	 * 查询列表
 	 */
-	@RequiresPermissions("mes:mesProductCate:view")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@RequestMapping(value = {"list", ""})
 	public String list(MesProductGp12Check mesProductGp12Check, Model model) {
 		model.addAttribute("mesProductGp12Check", mesProductGp12Check);
 		model.addAttribute("cateInfo", findCateInfo(mesProductGp12Check.getCateSn()));
+		model.addAttribute("cateList", findCateList());
 		return "modules/mes/mesProductGp12CheckList";
 	}
 
 	/**
 	 * 查询列表数据
 	 */
-	@RequiresPermissions("mes:mesProductCate:view")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@RequestMapping(value = "listData")
 	@ResponseBody
 	public Page<MesProductGp12Check> listData(MesProductGp12Check mesProductGp12Check,
@@ -76,21 +80,19 @@ public class MesProductGp12CheckController extends BaseController {
 	/**
 	 * 查看编辑表单
 	 */
-	@RequiresPermissions("mes:mesProductCate:view")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@RequestMapping(value = "form")
 	public String form(MesProductGp12Check mesProductGp12Check, Model model) {
 		model.addAttribute("mesProductGp12Check", mesProductGp12Check);
 		model.addAttribute("cateInfo", findCateInfo(mesProductGp12Check.getCateSn()));
-		MesProductCate query = new MesProductCate();
-		query.setStatus(MesProductCate.STATUS_NORMAL);
-		model.addAttribute("cateList", mesProductCateService.findList(query));
+		model.addAttribute("cateList", findCateList());
 		return "modules/mes/mesProductGp12CheckForm";
 	}
 
 	/**
 	 * 保存数据
 	 */
-	@RequiresPermissions("mes:mesProductCate:edit")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@PostMapping(value = "save")
 	@ResponseBody
 	public String save(@Validated MesProductGp12Check mesProductGp12Check) {
@@ -110,7 +112,7 @@ public class MesProductGp12CheckController extends BaseController {
 	/**
 	 * 停用数据
 	 */
-	@RequiresPermissions("mes:mesProductCate:edit")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@RequestMapping(value = "disable")
 	@ResponseBody
 	public String disable(MesProductGp12Check mesProductGp12Check) {
@@ -122,7 +124,7 @@ public class MesProductGp12CheckController extends BaseController {
 	/**
 	 * 启用数据
 	 */
-	@RequiresPermissions("mes:mesProductCate:edit")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@RequestMapping(value = "enable")
 	@ResponseBody
 	public String enable(MesProductGp12Check mesProductGp12Check) {
@@ -134,7 +136,7 @@ public class MesProductGp12CheckController extends BaseController {
 	/**
 	 * 删除数据
 	 */
-	@RequiresPermissions("mes:mesProductCate:edit")
+	@RequiresPermissions("mes:mesProductGp12Check:view")
 	@RequestMapping(value = "delete")
 	@ResponseBody
 	public String delete(MesProductGp12Check mesProductGp12Check) {
@@ -149,6 +151,24 @@ public class MesProductGp12CheckController extends BaseController {
 		return mesProductCateService.findBySn(cateSn);
 	}
 
+	private List<MesProductCate> findCateList() {
+		MesProductCate query = new MesProductCate();
+		query.setStatus(MesProductCate.STATUS_NORMAL);
+		List<MesProductCate> list = mesProductCateService.findList(query);
+		if (list == null) {
+			return new ArrayList<>();
+		}
+		// 仅展示 HEV 系列工件类型(新增 GP12 检查项时只能选择 HEV 产品)
+		List<MesProductCate> result = new ArrayList<>();
+		for (MesProductCate cate : list) {
+			if (cate != null && StringUtils.isNotBlank(cate.getSn())
+					&& cate.getSn().trim().toUpperCase().startsWith("HEV")) {
+				result.add(cate);
+			}
+		}
+		return result;
+	}
+
 	private void fillCateTitle(MesProductGp12Check item) {
 		if (item == null || StringUtils.isBlank(item.getCateSn())) {
 			return;

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

@@ -9,9 +9,11 @@ import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.jeesite.modules.file.utils.FileUploadUtils;
 import com.jeesite.modules.mes.entity.MesToolLife;
 import com.jeesite.modules.mes.resp.CommonResp;
 import com.jeesite.modules.mes.service.MesToolLifeService;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -46,6 +48,8 @@ public class MesToolReplaceRecordController extends BaseController {
     @Autowired
     private MesToolLifeService mesToolLifeService;
 
+    /** 工具寿命更换照片,标准类型 mesToolReplaceRecord_image */
+    private static final String IMAGE_BIZ_TYPE = "mesToolReplaceRecord_image";
 
     /**
      * 获取数据
@@ -276,11 +280,24 @@ public class MesToolReplaceRecordController extends BaseController {
     @RequiresPermissions("mes:mesToolReplaceRecord:api")
     @PostMapping("change")
     @ResponseBody
-    public String change(String id, String remark) {
+    public String change(String id, String remark, HttpServletRequest request) {
+        if (StringUtils.isBlank(id)) {
+            return renderResult(Global.FALSE, "缺少必要参数");
+        }
+        String imageIds = StringUtils.trim(request.getParameter(IMAGE_BIZ_TYPE));
+        if (StringUtils.isBlank(imageIds)) {
+            return renderResult(Global.FALSE, "请上传照片");
+        }
         MesToolReplaceRecord record = new MesToolReplaceRecord();
         record.setToolLifeId(id);
         record.setRemark(remark);
+        MesToolLife toolLife = mesToolLifeService.get(id);
+        if (toolLife != null) {
+            // 与网页 save 一致:把唯一标识写入更换记录,供后续检查匹配
+            record.setName1(toolLife.getName());
+        }
         mesToolReplaceRecordService.save(record);
+        FileUploadUtils.saveFileUpload(record, record.getId(), IMAGE_BIZ_TYPE);
         return renderResult(Global.TRUE, text("更改成功"));
     }
 

+ 0 - 1
src/main/resources/views/modules/mes/mesProductCateList.html

@@ -71,7 +71,6 @@ $('#dataGrid').dataGrid({
 			var actions = [];
 			//<% if(hasPermi('mes:mesProductCate:edit')){ %>
 				actions.push('<a href="${ctx}/mes/mesProductCate/form?id='+row.id+'" class="btnList" title="${text("编辑工件类型")}"><i class="fa fa-pencil"></i></a>&nbsp;');
-				actions.push('<a href="${ctx}/mes/mesProductGp12Check/list?cateSn='+encodeURIComponent(row.sn)+'" class="btn btn-info btn-xs btnList" title="GP12检查项">GP12检查项</a>&nbsp;');
 				actions.push('<a href="${ctx}/mes/mesProductCate/delete?id='+row.id+'" class="btnList" title="${text("删除工件类型")}" data-confirm="${text("确认要删除该工件类型吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
 			//<% } %>
 			return actions.join('');

+ 1 - 3
src/main/resources/views/modules/mes/mesProductGp12CheckForm.html

@@ -81,9 +81,7 @@
 			<div class="box-footer">
 				<div class="row">
 					<div class="col-sm-offset-2 col-sm-10">
-						<% if (hasPermi('mes:mesProductCate:edit')){ %>
-							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
-						<% } %>
+						<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>

+ 14 - 13
src/main/resources/views/modules/mes/mesProductGp12CheckList.html

@@ -12,16 +12,19 @@
 			</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:mesProductCate:edit')){ %>
-					<a href="${ctx}/mes/mesProductGp12Check/form?cateSn=${mesProductGp12Check.cateSn}" class="btn btn-default btnTool" title="${text('新增GP12检查项')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
-				<% } %>
+				<a href="${ctx}/mes/mesProductGp12Check/form?cateSn=${mesProductGp12Check.cateSn}" class="btn btn-default btnTool" title="${text('新增GP12检查项')}"><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="${mesProductGp12Check}" action="${ctx}/mes/mesProductGp12Check/listData" method="post" class="form-inline hide"
 					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
-				<#form:hidden path="cateSn"/>
+				<div class="form-group">
+					<label class="control-label">${text('工件类型')}:</label>
+					<div class="control-inline width-160">
+						<#form:select path="cateSn" items="${cateList}" itemLabel="title" itemValue="sn" blankOption="true" class="form-control"/>
+					</div>
+				</div>
 				<div class="form-group">
 					<label class="control-label">${text('名称')}:</label>
 					<div class="control-inline">
@@ -73,15 +76,13 @@ $('#dataGrid').dataGrid({
 		{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
 		{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
 			var actions = [];
-			//<% if(hasPermi('mes:mesProductCate:edit')){ %>
-				actions.push('<a href="${ctx}/mes/mesProductGp12Check/form?id='+row.id+'" class="btnList" title="${text("编辑GP12检查项")}"><i class="fa fa-pencil"></i></a>&nbsp;');
-				if (row.status == Global.STATUS_NORMAL){
-					actions.push('<a href="${ctx}/mes/mesProductGp12Check/disable?id='+row.id+'" class="btnList" title="${text("停用GP12检查项")}" data-confirm="${text("确认要停用该GP12检查项吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
-				} else if (row.status == Global.STATUS_DISABLE){
-					actions.push('<a href="${ctx}/mes/mesProductGp12Check/enable?id='+row.id+'" class="btnList" title="${text("启用GP12检查项")}" data-confirm="${text("确认要启用该GP12检查项吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
-				}
-				actions.push('<a href="${ctx}/mes/mesProductGp12Check/delete?id='+row.id+'" class="btnList" title="${text("删除GP12检查项")}" data-confirm="${text("确认要删除该GP12检查项吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
-			//<% } %>
+			actions.push('<a href="${ctx}/mes/mesProductGp12Check/form?id='+row.id+'" class="btnList" title="${text("编辑GP12检查项")}"><i class="fa fa-pencil"></i></a>&nbsp;');
+			if (row.status == Global.STATUS_NORMAL){
+				actions.push('<a href="${ctx}/mes/mesProductGp12Check/disable?id='+row.id+'" class="btnList" title="${text("停用GP12检查项")}" data-confirm="${text("确认要停用该GP12检查项吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
+			} else if (row.status == Global.STATUS_DISABLE){
+				actions.push('<a href="${ctx}/mes/mesProductGp12Check/enable?id='+row.id+'" class="btnList" title="${text("启用GP12检查项")}" data-confirm="${text("确认要启用该GP12检查项吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
+			}
+			actions.push('<a href="${ctx}/mes/mesProductGp12Check/delete?id='+row.id+'" class="btnList" title="${text("删除GP12检查项")}" data-confirm="${text("确认要删除该GP12检查项吗?")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
 			return actions.join('');
 		}}
 	],

+ 56 - 4
src/main/resources/views/modules/mes/mesToolReplaceRecordForm.html

@@ -1,9 +1,9 @@
-<% layout('/layouts/default.html', {title: '工具寿命更换记录管理', libs: ['validate']}){ %>
+<% layout('/layouts/default.html', {title: '工具寿命更换记录管理', libs: ['validate','fileupload']}){ %>
 <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(mesToolReplaceRecord.isNewRecord ? '新增工具寿命更换记录' : '编辑工具寿命更换记录')}
+				<i class="fa icon-note"></i> ${text(mesToolReplaceRecord.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>
@@ -11,6 +11,7 @@
 		</div>
 		<#form:form id="inputForm" model="${mesToolReplaceRecord}" action="${ctx}/mes/mesToolReplaceRecord/save" method="post" class="form-horizontal">
 			<div class="box-body">
+				<% if(mesToolReplaceRecord.isNewRecord){ %>
 				<div class="form-unit">${text('基本信息')}</div>
 				<#form:hidden path="id"/>
 				<div class="row">
@@ -43,13 +44,64 @@
 							</div>
 						</div>
 					</div>
-
 				</div>
+				<% } else { %>
+				<div class="form-unit">${text('基本信息')}</div>
+				<div class="row">
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4">${text('工具')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${mesToolReplaceRecord.title}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4">${text('唯一标识')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${mesToolReplaceRecord.name}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4">${text('更换人')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${mesToolReplaceRecord.createBy}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4">${text('更换时间')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${mesToolReplaceRecord.createDate,dateFormat='yyyy-MM-dd HH:mm'}</p>
+							</div>
+						</div>
+					</div>
+					<div class="col-xs-6">
+						<div class="form-group">
+							<label class="control-label col-sm-4">${text('备注')}:</label>
+							<div class="col-sm-8">
+								<p class="form-control-static">${mesToolReplaceRecord.remark}</p>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div class="form-unit">${text('照片')}</div>
+				<div class="row">
+					<div class="col-xs-12">
+						<#form:fileupload id="uploadImage" bizKey="${mesToolReplaceRecord.id}" bizType="mesToolReplaceRecord_image"
+							uploadType="image" class="" readonly="true" preview="true"/>
+					</div>
+				</div>
+				<% } %>
 			</div>
 			<div class="box-footer">
 				<div class="row">
 					<div class="col-sm-offset-2 col-sm-10">
-						<% if (hasPermi('mes:mesToolReplaceRecord:edit')){ %>
+						<% if(mesToolReplaceRecord.isNewRecord && hasPermi('mes:mesToolReplaceRecord: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>

+ 5 - 0
src/main/resources/views/modules/mes/mesToolReplaceRecordList.html

@@ -75,6 +75,11 @@ $('#dataGrid').dataGrid({
 		{header:'${text("更换人")}', name:'createBy', index:'a.create_by', width:150, align:"center", frozen:true},
 		{header:'${text("更换时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
 		{header:'${text("备注")}', name:'remark', index:'a.remark', width:150, align:"center"},
+		{header:'${text("操作")}', name:'actions', width:120, align:"center", formatter: function(val, obj, row, act){
+			var actions = [];
+			actions.push('<a href="${ctx}/mes/mesToolReplaceRecord/form?id='+row.id+'" class="btnList" title="${text("详情")}"><i class="fa fa-fw fa-eye"></i> ${text("详情")}</a>&nbsp;');
+			return actions.join('');
+		}},
 		// {header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
 		// 	var actions = [];
 		// 	//<% if(hasPermi('mes:mesToolReplaceRecord:edit')){ %>