hfy 1 месяц назад
Родитель
Сommit
5f67c9cd10

+ 13 - 3
src/main/java/com/jeesite/modules/mes/entity/MesProductGp12.java

@@ -1,7 +1,5 @@
 package com.jeesite.modules.mes.entity;
 
-import javax.validation.constraints.Size;
-
 import com.jeesite.common.collect.ListUtils;
 import com.jeesite.common.entity.DataEntity;
 import com.jeesite.common.mybatis.annotation.Column;
@@ -11,6 +9,7 @@ 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 javax.validation.constraints.Size;
 import java.util.Date;
 import java.util.List;
 
@@ -25,6 +24,7 @@ import java.util.List;
 		@Column(name="oprno", attrName="oprno", label="工位号"),
 		@Column(name="line_sn", attrName="lineSn", label="产线编号"),
 		@Column(name="remark", attrName="remark", label="备注"),
+		@Column(name="result", attrName="result", label="结果"),
 		@Column(name="create_by", attrName="createBy", label="创建人"),
 		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdateForce=true),
 		@Column(name="update_by", attrName="updateBy", label="update_by", isQuery=false),
@@ -37,6 +37,7 @@ public class MesProductGp12 extends DataEntity<MesProductGp12> {
 	private String sn;		// 工件码
 	private String oprno;		// 工位号
 	private String lineSn;		// 产线编号
+	private String result;		// 结果
 	private String remark;		// 备注
 	private List img = ListUtils.newArrayList();//图片
 	@ExcelFields({
@@ -44,6 +45,7 @@ public class MesProductGp12 extends DataEntity<MesProductGp12> {
 		@ExcelField(title="工件码", attrName="sn", align=Align.CENTER, sort=20),
 		@ExcelField(title="工位号", attrName="oprno", align=Align.CENTER, sort=30),
 		@ExcelField(title="产线编号", attrName="lineSn", align=Align.CENTER, sort=40),
+		@ExcelField(title="结果", attrName="result", align=Align.CENTER, sort=40),
 		@ExcelField(title="备注", attrName="remark", align=Align.CENTER, sort=50),
 		@ExcelField(title="创建人", attrName="createBy", align=Align.CENTER, sort=60),
 		@ExcelField(title="创建时间", attrName="createDate", align=Align.CENTER, sort=70, dataFormat="yyyy-MM-dd hh:mm"),
@@ -63,6 +65,14 @@ public class MesProductGp12 extends DataEntity<MesProductGp12> {
 		return sn;
 	}
 
+	public String getResult() {
+		return result;
+	}
+
+	public void setResult(String result) {
+		this.result = result;
+	}
+
 	public void setSn(String sn) {
 		this.sn = sn;
 	}
@@ -76,7 +86,7 @@ public class MesProductGp12 extends DataEntity<MesProductGp12> {
 		this.oprno = oprno;
 	}
 	
-	@Size(min=0, max=2, message="产线编号长度不能超过 2 个字符")
+	@Size(min=0, max=10, message="产线编号长度不能超过 103 个字符")
 	public String getLineSn() {
 		return lineSn;
 	}

+ 13 - 0
src/main/java/com/jeesite/modules/mes/web/MesBatchSnController.java

@@ -12,8 +12,10 @@ import com.jeesite.common.collect.ListUtils;
 import com.jeesite.common.collect.MapUtils;
 import com.jeesite.common.mybatis.mapper.query.QueryType;
 import com.jeesite.modules.mes.entity.MesProduct;
+import com.jeesite.modules.mes.entity.MesProductGp12;
 import com.jeesite.modules.mes.resp.CommonResp;
 import com.jeesite.modules.mes.service.MesProductService;
+import com.jeesite.modules.mes.service.MesProductGp12Service;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -50,6 +52,8 @@ public class MesBatchSnController extends BaseController {
 	private MesBatchSnService mesBatchSnService;
 	@Autowired
 	private MesProductService mesProductService;
+	@Autowired
+	private MesProductGp12Service mesProductGp12Service;
 	/**
 	 * 获取数据
 	 */
@@ -233,6 +237,15 @@ public class MesBatchSnController extends BaseController {
 		if (StringUtils.isNotBlank(mesProduct1.getBatchSn())) {
 			return renderResult(Global.FALSE, text("该工件已绑定批次码"));
 		}
+		MesProductGp12 mesProductGp12 = new MesProductGp12();
+		mesProductGp12.setSn(sn);
+		MesProductGp12 latestGp12 = mesProductGp12Service.findInfo(mesProductGp12);
+		if (ObjectUtils.isEmpty(latestGp12)) {
+			return renderResult(Global.FALSE, text("请先进行GP12检查"));
+		}
+		if (!"OK".equalsIgnoreCase(StringUtils.trim(latestGp12.getResult()))) {
+			return renderResult(Global.FALSE, text("GP12检查不合格,无法绑定"));
+		}
 		User curUser = UserUtils.getUser();
 		mesProduct1.setBatchSn(msInfo.getBatchSn());
 		mesProduct1.setBindDate(new Date());

+ 35 - 23
src/main/java/com/jeesite/modules/mes/web/MesProductGp12Controller.java

@@ -1,16 +1,19 @@
 package com.jeesite.modules.mes.web;
 
-import java.util.List;
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.jeesite.common.collect.ListUtils;
 import com.jeesite.common.collect.MapUtils;
-import com.jeesite.common.mybatis.mapper.query.QueryType;
+import com.jeesite.common.config.Global;
+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 com.jeesite.common.web.BaseController;
 import com.jeesite.modules.file.entity.FileUpload;
 import com.jeesite.modules.file.service.FileUploadService;
 import com.jeesite.modules.file.utils.FileUploadUtils;
+import com.jeesite.modules.mes.entity.MesProductGp12;
 import com.jeesite.modules.mes.resp.CommonResp;
+import com.jeesite.modules.mes.service.MesProductGp12Service;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,17 +24,12 @@ 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.MesProductGp12;
-import com.jeesite.modules.mes.service.MesProductGp12Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 工件拍照记录Controller
@@ -182,19 +180,34 @@ public class MesProductGp12Controller extends BaseController {
 		if (StringUtils.isBlank(lineSn))
 			return renderResult(Global.FALSE, "缺少必要参数");
 
-		// 根据工件码查询是否已存在该数据
+		String result = mesProductGp12.getResult();
+		if (StringUtils.isBlank(result))
+			return renderResult(Global.FALSE, "缺少必要参数");
+
+	/*	// 根据工件码查询是否已存在该数据
 		mesProductGp12.getSqlMap().getWhere().and("a.sn", QueryType.EQ, sn);
 		List<MesProductGp12> list = mesProductGp12Service.findList(mesProductGp12);
-		if (list.size() > 0){return renderResult(Global.FALSE, "该记录已存在");}
-
-
-
+		if (list.size() == 1){
+			MesProductGp12 entry = list.get(0);
+			entry.setSn(mesProductGp12.getSn());
+			entry.setLineSn(mesProductGp12.getLineSn());
+			entry.setOprno(mesProductGp12.getOprno());
+			entry.setRemark(mesProductGp12.getRemark());
+			entry.setResult(result);
+			mesProductGp12Service.save(entry);
+			FileUploadUtils.saveFileUpload(entry, entry.getId(), "mesProductGp12_image");
+			return renderResult(Global.TRUE, "操作成功");
+		}
+		if (list.size() > 1){
+			return renderResult(Global.FALSE, "该记录存在多条");
+		}*/
 		// 向数据库添加数据
 		MesProductGp12 entry = new MesProductGp12();
 		entry.setSn(mesProductGp12.getSn());
 		entry.setLineSn(mesProductGp12.getLineSn());
 		entry.setOprno(mesProductGp12.getOprno());
 		entry.setRemark(mesProductGp12.getRemark());
+		entry.setResult(result);
 		mesProductGp12Service.save(entry);
 
 		FileUploadUtils.saveFileUpload(entry, entry.getId(), "mesProductGp12_image");
@@ -285,7 +298,6 @@ public class MesProductGp12Controller extends BaseController {
 		return resp;
 	}
 
-
 	/**
 	 * 删除数据
 	 */
@@ -297,4 +309,4 @@ public class MesProductGp12Controller extends BaseController {
 		return renderResult(Global.TRUE, text("删除工件拍照记录成功!"));
 	}
 	
-}
+}

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

@@ -5043,7 +5043,6 @@ public class MesProductRecordController extends BaseController {
 			return resp;
 		}
 	}
-
 	//pda查询工件质量
 	@PostMapping(value = "pdaQueryQuality")
 	@ResponseBody
@@ -5127,6 +5126,42 @@ public class MesProductRecordController extends BaseController {
 			return resp;
 		}
 	}
+	//pda根据工件码查询信息
+	@PostMapping(value = "pdaQueryBySn")
+	@ResponseBody
+	public CommonResp pdaQueryBySn(HttpServletRequest request) {
+
+		CommonResp resp = new CommonResp<>();
+
+		try {
+			String sn = request.getParameter("sn");
+			// 当为空时返回失败
+			if(StringUtils.isEmpty(sn)){
+				resp.setResult(Global.FALSE);
+				resp.setMessage("工件码为空");
+				return resp;
+			}
+			MesProduct mesProduct = mesProductService.findBySn(sn);
+			if (mesProduct == null) {
+				resp.setResult(Global.FALSE);
+				resp.setMessage("工件码不存在");
+				return resp;
+			}
+			Map<String, Object> data = MapUtils.newHashMap();
+			data.put("sn", sn);
+			data.put("cate", mesProduct.getCate().substring(0, mesProduct.getCate().length() - 2));
+			data.put("oprno", "GP12");
+
+			resp.setData(data);
+			resp.setResult(Global.TRUE);
+			resp.setMessage("查询成功");
+		} catch (Exception e) {
+			resp.setResult(Global.FALSE);
+			logger.error("根据工件码查询信息失败", e);
+			resp.setMessage("查询失败:" + e.getMessage());
+		}
+		return resp;
+	}
 
 
 	// 识别图片接口

+ 3 - 1
src/main/resources/config/application.yml

@@ -182,7 +182,7 @@ jdbc:
 #  username: mes_cloud
 #  password: s2ENj7KaEySTC7dW
   username: root
-  password: root
+  password: 123456
   testSql: SELECT 1
 
   #  # Oracle 数据库配置(若使用 12c,请修改 /modules/core/pom.xml 文件,打开 12c 依赖,去掉 11g 依赖)
@@ -854,6 +854,8 @@ shiro:
     ${adminPath}/mes/mesProductRecord/pcbind = anon
     ${adminPath}/mes/mesProductRecord/pcunbind = anon
     ${adminPath}/mes/mesProductRecord/pdaQueryIsSn = anon
+    ${adminPath}/mes/mesProductRecord/pdaQueryBySn = anon
+    ${adminPath}/mes/mesProductGp12/submit = anon
     ${adminPath}/mes/mesProductRecord/pdaQueryQuality = anon
     ${adminPath}/mes/mesProductRecord/pdaQueryLineSn = anon
     ${adminPath}/mes/mesProductRecord/pdaQueryOprno = anon

+ 10 - 4
src/main/resources/views/modules/mes/mesProductGp12Form.html

@@ -1,4 +1,4 @@
-<% layout('/layouts/default.html', {title: '工件拍照记录详情', libs: ['validate','dataGrid','fileupload']}){ %>
+<% layout('/layouts/default.html', {title: 'GP12拍照记录详情', libs: ['validate','dataGrid','fileupload']}){ %>
 
 <style>
 	table{
@@ -30,14 +30,21 @@
 					<td>${mesProductGp12.sn}</td>
 				</tr>
 				<tr>
-					<th class="mpc-header">工位号</th>
+					<th class="mpc-header">工位名称</th>
+					<td>GP12</td>
+<!--
 					<td>${mesProductGp12.oprno}</td>
+-->
 				</tr>
 				<tr>
 					<th class="mpc-header">产线编号</th>
 					<td>${mesProductGp12.lineSn}</td>
 				</tr>
 				<tr>
+					<th class="mpc-header">结果</th>
+					<td>${mesProductGp12.result}</td>
+				</tr>
+				<tr>
 					<th class="mpc-header">创建人</th>
 					<td>${mesProductGp12.createBy}</td>
 				</tr>
@@ -52,7 +59,6 @@
 						uploadType="image" class="" readonly="true" preview="true"/>
 					</td>
 				</tr>
-
 			</table>
 		</div>
 		<div class="box-footer">
@@ -82,4 +88,4 @@
 			}, "json");
 		}
 	});
-</script>
+</script>

+ 7 - 6
src/main/resources/views/modules/mes/mesProductGp12List.html

@@ -1,9 +1,9 @@
-<% layout('/layouts/default.html', {title: '工件拍照记录管理', libs: ['dataGrid']}){ %>
+<% layout('/layouts/default.html', {title: 'GP12下线列表', 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('工件拍照记录管理')}
+				<i class="fa icon-notebook"></i> ${text('GP12下线列表')}
 			</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>
@@ -25,7 +25,7 @@
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="control-label">${text('工位号')}:</label>
+					<label class="control-label">${text('工位名称')}:</label>
 					<div class="control-inline">
 						<#form:input path="oprno" maxlength="20" class="form-control width-120"/>
 					</div>
@@ -33,7 +33,7 @@
 				<div class="form-group">
 					<label class="control-label">${text('产线编号')}:</label>
 					<div class="control-inline">
-						<#form:input path="lineSn" maxlength="2" class="form-control width-120"/>
+						<#form:input path="lineSn" maxlength="5" class="form-control width-120"/>
 					</div>
 				</div>
 <!--				<div class="form-group">-->
@@ -75,8 +75,9 @@ $('#dataGrid').dataGrid({
 	searchForm: $("#searchForm"),
 	columnModel: [
 		{header:'${text("工件码")}', name:'sn', index:'a.sn', width:300, align:"center", frozen:true},
-		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:150, align:"center"},
+		{header:'${text("工位名称")}', name:'oprno', index:'a.oprno', width:150, align:"center",formatter:function (row){return "GP12"}},
 		{header:'${text("产线编号")}', name:'lineSn', index:'a.line_sn', width:150, align:"center"},
+		{header:'${text("结果")}', name:'result', index:'a.result', width:100, align:"center"},
 		{header:'${text("备注")}', name:'remark', index:'a.remark', width:150, align:"center"},
 		{header:'${text("创建人")}', name:'createBy', index:'a.create_by', width:150, align:"center"},
 		{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
@@ -149,4 +150,4 @@ $('#btnImport').click(function(){
 		</div>
 	</div>
 </form>
-//--></script>
+//--></script>