Jelajahi Sumber

电焊详情

hfy 3 bulan lalu
induk
melakukan
4487cb808d

File diff ditekan karena terlalu besar
+ 58 - 0
db/mysql/mes_product_arc_welding.sql


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

@@ -11,5 +11,7 @@ import com.jeesite.modules.mes.entity.MesProductArcWelding;
  */
 @MyBatisDao
 public interface MesProductArcWeldingDao extends CrudDao<MesProductArcWelding> {
-	
-}
+
+	MesProductArcWelding findLatestById(MesProductArcWelding mesProductArcWelding);
+
+}

+ 7 - 1
src/main/java/com/jeesite/modules/mes/service/MesProductArcWeldingService.java

@@ -23,6 +23,12 @@ import javax.validation.ConstraintViolationException;
  */
 @Service
 public class MesProductArcWeldingService extends CrudService<MesProductArcWeldingDao, MesProductArcWelding> {
+
+	public MesProductArcWelding findLatestById(String id) {
+		MesProductArcWelding mesProductArcWelding = new MesProductArcWelding();
+		mesProductArcWelding.setId(id);
+		return dao.findLatestById(mesProductArcWelding);
+	}
 	
 	/**
 	 * 获取单条数据
@@ -134,4 +140,4 @@ public class MesProductArcWeldingService extends CrudService<MesProductArcWeldin
 		super.delete(mesProductArcWelding);
 	}
 	
-}
+}

+ 9 - 2
src/main/java/com/jeesite/modules/mes/web/MesProductArcWeldingController.java

@@ -52,7 +52,14 @@ public class MesProductArcWeldingController extends BaseController {
 		mesProductArcWelding.setId(id);
 		mesProductArcWelding.setCreateDate(createDate);
 		mesProductArcWelding.setIsNewRecord(isNewRecord);
-		return mesProductArcWeldingService.getAndValid(mesProductArcWelding);
+		MesProductArcWelding entity = mesProductArcWeldingService.getAndValid(mesProductArcWelding);
+		if (StringUtils.isNotBlank(id) && StringUtils.isBlank(entity.getContent())) {
+			MesProductArcWelding latest = mesProductArcWeldingService.findLatestById(id);
+			if (latest != null && StringUtils.isNotBlank(latest.getContent())) {
+				return latest;
+			}
+		}
+		return entity;
 	}
 	
 	/**
@@ -198,4 +205,4 @@ public class MesProductArcWeldingController extends BaseController {
 	}
 
 	
-}
+}

+ 17 - 1
src/main/resources/mappings/modules/mes/MesProductArcWeldingDao.xml

@@ -1,6 +1,22 @@
 <?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.MesProductArcWeldingDao">
+
+	<select id="findLatestById" resultType="com.jeesite.modules.mes.entity.MesProductArcWelding">
+		SELECT
+			id,
+			sn,
+			oprno,
+			line_sn AS lineSn,
+			content,
+			create_date AS createDate
+		FROM
+			mes_product_arc_welding
+		WHERE
+			id = #{id}
+		ORDER BY create_date DESC
+		LIMIT 1
+	</select>
 	
 	<!-- 查询数据
 	<select id="findList" resultType="MesProductArcWelding">
@@ -12,4 +28,4 @@
 		ORDER BY ${sqlMap.order.toSql()}
 	</select> -->
 	
-</mapper>
+</mapper>

+ 5 - 55
src/main/resources/views/modules/mes/mesProductArcWeldingInfo.html

@@ -21,9 +21,6 @@
             <div ref="iChart" style="width: 100%;height:500px;"></div>
             <br>
             <br>
-            <div v-if="showThirdChart" ref="speedChart" style="width: 100%;height:500px;"></div>
-            <br>
-            <br>
             <div class="col-sm-12">
                 <table class="table table-bordered" style="table-layout: fixed;white-space: normal;">
                     <thead>
@@ -31,7 +28,6 @@
                             <template v-for="n in welderCount">
                                 <th>{{ firstMetricName }}{{n}}</th>
                                 <th>{{ secondMetricName }}{{n}}</th>
-                                <th v-if="showThirdChart">{{ thirdMetricName }}{{n}}</th>
                                 <th v-if="!isNewJson">错误码{{n}}</th>
                                 <th v-if="!isNewJson">JOB号{{n}}</th>
                             </template>
@@ -43,7 +39,6 @@
                             <template v-for="n in welderCount">
                                 <td>{{ item['V' + n] }}</td>
                                 <td>{{ item['I' + n] }}</td>
-                                <td v-if="showThirdChart">{{ item['speed' + n] }}</td>
                                 <td v-if="!isNewJson">{{ item['code' + n] }}</td>
                                 <td v-if="!isNewJson">{{ item['JOB' + n] }}</td>
                             </template>
@@ -184,12 +179,10 @@
             const obj = {};
             obj.V1 = parseFloat(sample.robot1Voltage || 0) || 0;
             obj.I1 = parseFloat(sample.robot1Current || 0) || 0;
-            obj.speed1 = parseFloat(sample.robot1Pressure || sample.robot1WeldTime || 0) || 0;
-            obj.code1 = 0;
-            obj.JOB1 = '';
             obj.V2 = parseFloat(sample.robot2Voltage || 0) || 0;
             obj.I2 = parseFloat(sample.robot2Current || 0) || 0;
-            obj.speed2 = parseFloat(sample.robot2Pressure || sample.robot2WeldTime || 0) || 0;
+            obj.code1 = 0;
+            obj.JOB1 = '';
             obj.code2 = 0;
             obj.JOB2 = '';
             obj.createDate = sample.time || '';
@@ -227,8 +220,7 @@
             content: ${toJson(mesProductArcWelding.content!'')},
             welderCount: 2,
             vChart: null,
-            iChart: null,
-            speedChart: null
+            iChart: null
         },
         computed: {
             myData() {
@@ -249,16 +241,10 @@
                 return '焊接过程参数';
             },
             firstMetricName() {
-                return this.weldingType === 'spot' ? '电流' : '电压';
+                return '电压';
             },
             secondMetricName() {
-                return this.weldingType === 'spot' ? '压力' : '电流';
-            },
-            thirdMetricName() {
-                return this.weldingType === 'spot' ? '焊接时间' : '送丝速度';
-            },
-            showThirdChart() {
-                return this.weldingType === 'spot';
+                return '电流';
             },
             timeArr() {
                 if (!this.myData || this.myData.length === 0) return [];
@@ -328,35 +314,6 @@
                     yAxis: { name: this.secondMetricName, type: 'value' },
                     series: series
                 };
-            },
-            speedOption() {
-                const series = [];
-                const legendData = [];
-                for (let i = 1; i <= this.welderCount; i++) {
-                    legendData.push(this.thirdMetricName + i);
-                    const arr = [];
-                    for (let j = 0; j < this.myData.length; j++) {
-                        arr.push(this.myData[j]['speed' + i]);
-                    }
-                    series.push({
-                        name: this.thirdMetricName + i,
-                        type: 'line',
-                        data: arr,
-                        smooth: true,
-                        showSymbol: true,
-                        symbolSize: 8
-                    });
-                }
-                return {
-                    title: { text: this.thirdMetricName + '变化折线图' },
-                    tooltip: { trigger: 'axis' },
-                    legend: { data: legendData },
-                    grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
-                    toolbox: { feature: { saveAsImage: {} } },
-                    xAxis: { type: 'category', name: '时间', boundaryGap: false, data: this.timeArr },
-                    yAxis: { name: this.thirdMetricName, type: 'value' },
-                    series: series
-                };
             }
         },
         watch: {
@@ -366,7 +323,6 @@
                         this.welderCount = getWelderCount(this.content);
                         this.vChart.setOption(this.vOption, true);
                         this.iChart.setOption(this.iOption, true);
-                        if (this.speedChart) { this.speedChart.setOption(this.speedOption, true); }
                     }
                 },
                 deep: true
@@ -380,14 +336,8 @@
             this.$nextTick(() => {
                 this.vChart = echarts.init(this.$refs.vChart)
                 this.iChart = echarts.init(this.$refs.iChart)
-                if (this.$refs.speedChart) {
-                    this.speedChart = echarts.init(this.$refs.speedChart)
-                }
                 this.vChart.setOption(this.vOption);
                 this.iChart.setOption(this.iOption);
-                if (this.speedChart) {
-                    this.speedChart.setOption(this.speedOption);
-                }
             });
         }
     })