Browse Source

创建人员

hfy 3 months ago
parent
commit
afd52a4b24

+ 2 - 0
src/main/java/com/jeesite/modules/mes/dao/MesProductArcWeldingDao.java

@@ -14,4 +14,6 @@ public interface MesProductArcWeldingDao extends CrudDao<MesProductArcWelding> {
 
 	MesProductArcWelding findLatestById(MesProductArcWelding mesProductArcWelding);
 
+	String findProductRecordUpdateBy(MesProductArcWelding mesProductArcWelding);
+
 }

+ 1 - 0
src/main/java/com/jeesite/modules/mes/entity/MesProductArcWelding.java

@@ -55,6 +55,7 @@ public class MesProductArcWelding extends DataEntity<MesProductArcWelding> {
 		@ExcelField(title="工位名称", attrName="oprnoTitle", align=Align.CENTER, sort=35),
 		@ExcelField(title="工件码", attrName="sn", align=Align.CENTER, sort=40),
 		@ExcelField(title="参数内容", attrName="content", align=Align.CENTER, sort=50),
+		@ExcelField(title="创建人员", attrName="createBy", align=Align.CENTER, sort=55),
 		@ExcelField(title="创建时间", attrName="createDate", align=Align.CENTER, sort=60),
 	})
 	public MesProductArcWelding() {

+ 4 - 0
src/main/java/com/jeesite/modules/mes/service/MesProductArcWeldingService.java

@@ -29,6 +29,10 @@ public class MesProductArcWeldingService extends CrudService<MesProductArcWeldin
 		mesProductArcWelding.setId(id);
 		return dao.findLatestById(mesProductArcWelding);
 	}
+
+	public String findProductRecordUpdateBy(MesProductArcWelding mesProductArcWelding) {
+		return dao.findProductRecordUpdateBy(mesProductArcWelding);
+	}
 	
 	/**
 	 * 获取单条数据

+ 23 - 0
src/main/java/com/jeesite/modules/mes/web/MesProductArcWeldingController.java

@@ -124,9 +124,31 @@ public class MesProductArcWeldingController extends BaseController {
 		mesProductArcWelding.setPage(new Page<>(request, response));
 		Page<MesProductArcWelding> page = mesProductArcWeldingService.findPage(mesProductArcWelding);
 		fillOprnoTitle(page.getList());
+		fillCreateByFromProductRecord(page.getList());
 		return page;
 	}
 
+	private void fillCreateByFromProductRecord(List<MesProductArcWelding> list) {
+		if (ListUtils.isEmpty(list)) {
+			return;
+		}
+		Map<String, String> updateByMap = new HashMap<>();
+		for (MesProductArcWelding record : list) {
+			if (StringUtils.isBlank(record.getSn()) || StringUtils.isBlank(record.getOprno())
+					|| StringUtils.isBlank(record.getLineSn())) {
+				continue;
+			}
+			String key = record.getSn() + "|" + record.getOprno() + "|" + record.getLineSn();
+			if (!updateByMap.containsKey(key)) {
+				updateByMap.put(key, mesProductArcWeldingService.findProductRecordUpdateBy(record));
+			}
+			String updateBy = updateByMap.get(key);
+			if (StringUtils.isNotBlank(updateBy)) {
+				record.setCreateBy(updateBy);
+			}
+		}
+	}
+
 	private void fillOprnoTitle(List<MesProductArcWelding> list) {
 		if (ListUtils.isEmpty(list)) {
 			return;
@@ -194,6 +216,7 @@ public class MesProductArcWeldingController extends BaseController {
 	public void exportData(MesProductArcWelding mesProductArcWelding, HttpServletResponse response) {
 		List<MesProductArcWelding> list = mesProductArcWeldingService.findList(mesProductArcWelding);
 		fillOprnoTitle(list);
+		fillCreateByFromProductRecord(list);
 		String exportTitle = "arc".equals(mesProductArcWelding.getWeldingCategory()) ? "弧焊参数" : "点焊参数";
 		String fileName = exportTitle + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
 		try(ExcelExport ee = new ExcelExport(exportTitle, MesProductArcWelding.class)){

+ 30 - 0
src/main/resources/mappings/modules/mes/MesProductArcWeldingDao.xml

@@ -27,5 +27,35 @@
 		</where>
 		ORDER BY ${sqlMap.order.toSql()}
 	</select> -->
+	<select id="findList" resultType="MesProductArcWelding">
+		SELECT
+			${sqlMap.column.toSql()},
+			(
+				SELECT r.update_by
+				FROM mes_product_record r
+				WHERE r.sn = a.sn
+				  AND r.oprno = a.oprno
+				  AND (r.line_sn = a.line_sn OR r.cate_sn = a.line_sn)
+				ORDER BY CASE WHEN r.update_by IS NOT NULL AND r.update_by != '' AND r.update_by != 'system' THEN 0 ELSE 1 END,
+					r.update_date DESC, r.create_date DESC
+				LIMIT 1
+			) AS "createBy"
+		FROM ${sqlMap.table.toSql()}
+		<where>
+			${sqlMap.where.toSql()}
+		</where>
+		ORDER BY ${sqlMap.order.toSql()}
+	</select>
+
+	<select id="findProductRecordUpdateBy" resultType="String">
+		SELECT r.update_by
+		FROM mes_product_record r
+		WHERE r.sn = #{sn}
+		  AND r.oprno = #{oprno}
+		  AND (r.line_sn = #{lineSn} OR r.cate_sn = #{lineSn})
+		ORDER BY CASE WHEN r.update_by IS NOT NULL AND r.update_by != '' AND r.update_by != 'system' THEN 0 ELSE 1 END,
+			r.update_date DESC, r.create_date DESC
+		LIMIT 1
+	</select>
 	
 </mapper>

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

@@ -68,6 +68,7 @@ $('#dataGrid').dataGrid({
 		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:100, align:"center"},
 		{header:'${text("工位名称")}', name:'oprnoTitle', index:'b.title', width:180, align:"center", sortable:false},
 		{header:'${text("工件码")}', name:'sn', index:'a.sn', width:200, align:"center"},
+		{header:'${text("创建人员")}', name:'createBy', width:120, align:"center", sortable:false},
 		{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:160, align:"center"},
 		{header:'${text("操作")}', name:'actions', width:100, align:"center", formatter: function(val, obj, row, act){
 			var actions = [];

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

@@ -74,7 +74,7 @@ $('#dataGrid').dataGrid({
 		{header:'${text("产线编号")}', name:'lineSn', index:'a.line_sn', width:100, align:"center"},
 		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:100, align:"center"},
 		{header:'${text("名称")}', name:'title', index:'a.title', width:150, align:"center"},
-		{header:'${text("测试人员")}', name:'workNum', index:'a.work_num', width:150, align:"center"},
+		{header:'${text("创建人员")}', name:'workNum', index:'a.work_num', width:150, align:"center"},
 		{header:'${text("时间")}', name:'testTime', index:'a.test_time', width:150, align:"center"},
 		{header:'${text("测试压")}', name:'testPressure', index:'a.test_pressure', width:150, align:"center"},
 		{header:'${text("测试压单位")}', name:'testPressureUnit', index:'a.test_pressure_unit', width:150, align:"center"},

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

@@ -74,7 +74,7 @@ $('#dataGrid').dataGrid({
 		{header:'${text("产线编号")}', name:'lineSn', index:'a.line_sn', width:100, align:"center"},
 		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:100, align:"center"},
 		{header:'${text("名称")}', name:'title', index:'a.title', width:150, align:"center"},
-		{header:'${text("测试人员")}', name:'workNum', index:'a.work_num', width:150, align:"center"},
+		{header:'${text("创建人员")}', name:'workNum', index:'a.work_num', width:150, align:"center"},
 		{header:'${text("时间")}', name:'testTime', index:'a.test_time', width:150, align:"center"},
 		{header:'${text("测试压")}', name:'testPressure', index:'a.test_pressure', width:150, align:"center"},
 		{header:'${text("测试压单位")}', name:'testPressureUnit', index:'a.test_pressure_unit', width:150, align:"center"},

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

@@ -68,6 +68,7 @@ $('#dataGrid').dataGrid({
 		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:100, align:"center"},
 		{header:'${text("工位名称")}', name:'oprnoTitle', index:'b.title', width:180, align:"center", sortable:false},
 		{header:'${text("工件码")}', name:'sn', index:'a.sn', width:200, align:"center"},
+		{header:'${text("创建人员")}', name:'createBy', width:120, align:"center", sortable:false},
 		{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:160, align:"center"},
 		{header:'${text("操作")}', name:'actions', width:100, align:"center", formatter: function(val, obj, row, act){
 			var actions = [];