From e39d9bfeee0b62a60dc08e2dc93e0a05f3d6b503 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期四, 15 八月 2024 14:41:20 +0800
Subject: [PATCH] add report
---
pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml | 37 +++++++++
pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportSv.java | 103 +++++++++++++++++++++++++
pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportCtrl.java | 50 ++++++++++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java | 3
pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml | 8 +-
5 files changed, 197 insertions(+), 4 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java
index c997bc0..872c532 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java
@@ -3,6 +3,7 @@
import com.dy.pmsGlobal.pojoSta.StaDeviceProductionLog;
import org.apache.ibatis.annotations.Mapper;
+import java.util.Date;
import java.util.List;
/**
@@ -24,6 +25,8 @@
List<StaDeviceProductionLog> selectByDeviceNo(String deviceNo);
+ List<StaDeviceProductionLog> selectProductLog(String deviceNo, Date startTime, Date endTime);
+
int updateByPrimaryKeySelective(StaDeviceProductionLog record);
int updateByPrimaryKey(StaDeviceProductionLog record);
diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
index 0bd9d4d..4bcae20 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
@@ -198,10 +198,10 @@
<if test="lineName != null and lineName != '' ">
and ll.name like concat('%', #{lineName}, '%')
</if>
- <if test="startTime != null and startTime !=''">
+ <if test="startTime != null">
and l.start_time <![CDATA[ > ]]> #{startTime}
</if>
- <if test="endTime != null and endTime !=''">
+ <if test="endTime != null">
and l.start_time <![CDATA[ < ]]> #{endTime}
</if>
<if test="userId != null and userId !=''">
@@ -265,10 +265,10 @@
<if test="lineName != null and lineName != '' ">
and ll.name like concat('%', #{lineName}, '%')
</if>
- <if test="startTime != null and startTime !=''">
+ <if test="startTime != null">
and l.start_time <![CDATA[ > ]]> #{startTime,jdbcType=TIMESTAMP}
</if>
- <if test="endTime != null and endTime !=''">
+ <if test="endTime != null">
and l.start_time <![CDATA[ < ]]> #{endTime,jdbcType=TIMESTAMP}
</if>
<if test="userId != null and userId !=''">
diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml
index 17450de..0ef9802 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml
@@ -62,6 +62,43 @@
ORDER BY t.id DESC
</select>
+ <select id="selectProductLog" resultMap="joinResultMap">
+ select
+ t.* ,p.`name` plan_name,s.`name` station_name,u.`name` update_user_name
+ FROM
+ (
+ select <include refid="Base_Column_List" /> from sta_device_production_log_past
+ <where>
+ <if test="deviceNo != null and deviceNo !=''">
+ and device_no = #{deviceNo,jdbcType=VARCHAR}
+ </if>
+ <if test="startTime != null">
+ and out_time <![CDATA[ > ]]> #{startTime,jdbcType=TIMESTAMP}
+ </if>
+ <if test="endTime != null">
+ and out_time <![CDATA[ < ]]> #{endTime,jdbcType=TIMESTAMP}
+ </if>
+ </where>
+ union
+ select <include refid="Base_Column_List" /> from sta_device_production_log
+ <where>
+ <if test="deviceNo != null and deviceNo !=''">
+ and device_no = #{deviceNo,jdbcType=VARCHAR}
+ </if>
+ <if test="startTime != null">
+ and out_time <![CDATA[ > ]]> #{startTime,jdbcType=TIMESTAMP}
+ </if>
+ <if test="endTime != null">
+ and out_time <![CDATA[ < ]]> #{endTime,jdbcType=TIMESTAMP}
+ </if>
+ </where>
+ ) t
+ left join pr_assembly_plan p on t.plan_id=p.id
+ left join plt_station s on s.id = t.station_id
+ left JOIN ba_user u on u.id=t.updated_by
+ ORDER BY t.id DESC
+ </select>
+
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sta_device_production_log
where id = #{id,jdbcType=BIGINT}
diff --git a/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportCtrl.java b/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportCtrl.java
new file mode 100644
index 0000000..21a3cbf
--- /dev/null
+++ b/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportCtrl.java
@@ -0,0 +1,50 @@
+package com.dy.pmsOther.screen;
+
+import com.dy.common.aop.SsoPowerAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.aop.Log;
+import com.dy.pmsGlobal.pojoPr.PrProductionProcess;
+import com.dy.pmsGlobal.pojoSta.StaDeviceProductionLog;
+import jakarta.validation.Valid;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 澶у睆鐪嬫澘
+ */
+@Slf4j
+@RestController
+@RequestMapping(path="screen")
+public class ScreenReportCtrl {
+ private ScreenReportSv sv;
+ @Autowired
+ public void setSv(ScreenReportSv screenSv){
+ this.sv = screenSv;
+ }
+
+ @GetMapping(path = "getDeviceInfo")
+ public BaseResponse<Map<String, Object>> getDeviceInfo(String deviceNo) {
+ log.info("DeviceReportCtl.getDeviceInfo():{}",deviceNo);
+ Map<String, Object> result = sv.getDeviceInfo(deviceNo);
+ return BaseResponseUtils.buildSuccess(null);
+ }
+ /**
+ * 鏍规嵁鏃堕棿鍖洪棿鏌ヨ 鎵�鏈夎繃绔欒褰�
+ * @return
+ */
+ @GetMapping(path="queryDeviceLog")
+ @Log("鏌ヨ鐢熶骇璁板綍")
+ public BaseResponse<List<Map<String,String>>> queryDeviceLog(String startTime, String endTime){
+ List<StaDeviceProductionLog> log = sv.queryDeviceLog(startTime,endTime);
+ return BaseResponseUtils.buildSuccess(log);
+ }
+}
+
+
+
diff --git a/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportSv.java b/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportSv.java
new file mode 100644
index 0000000..871085b
--- /dev/null
+++ b/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportSv.java
@@ -0,0 +1,103 @@
+package com.dy.pmsOther.screen;
+
+
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.dy.pmsGlobal.daoSta.*;
+import com.dy.pmsGlobal.pojoSta.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAccessor;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class ScreenReportSv {
+ private StaDeviceLastMapper deviceLastDao;
+ private StaDeviceLifeMapper deviceLifeDao;
+ private StaWipSnExMapper wipSnExDao;
+ private StaDeviceProductionLogMapper deviceProductionLogDao;
+ private StaRepairInfoMapper repairInfoDao;
+ @Autowired
+ public void setDeviceLastDao(StaDeviceLastMapper deviceLastDao) {
+ this.deviceLastDao = deviceLastDao;
+ }
+
+ @Autowired
+ public void setDeviceLifeDao(StaDeviceLifeMapper deviceLifeDao) {
+ this.deviceLifeDao = deviceLifeDao;
+ }
+
+ @Autowired
+ public void setWipSnExDao(StaWipSnExMapper wipSnExDao) {
+ this.wipSnExDao = wipSnExDao;
+ }
+
+ @Autowired
+ public void setDeviceProductionLogDao(StaDeviceProductionLogMapper deviceProductionLogDao) {
+ this.deviceProductionLogDao = deviceProductionLogDao;
+ }
+
+ @Autowired
+ public void setRepairInfoDao(StaRepairInfoMapper repairInfoDao) {
+ this.repairInfoDao = repairInfoDao;
+ }
+
+ public Map<String, Object> getDeviceInfo(String deviceNo) {
+ if (StringUtils.isBlank(deviceNo)) {
+ return null;
+ }
+ // 鏌ヨ璁惧淇℃伅
+ StaDeviceLast deviceLast = deviceLastDao.selectByDeviceNo(deviceNo);
+ if (deviceLast == null) {
+ return null;
+ }
+ Map<String, Object> deviceInfo =new HashMap<>();
+ deviceInfo.put("deviceInfo", deviceLast);
+ //鏌ヨ璁惧鏃ュ織
+ List<StaDeviceProductionLog> log = deviceProductionLogDao.selectByDeviceNo(deviceNo);
+ deviceInfo.put("deviceLog", log);
+ // 鏌ヨ璁惧鐢熷懡鍛ㄦ湡
+ List<StaDeviceLife> deviceLife = deviceLifeDao.selectByDeviceNo(deviceNo);
+ deviceInfo.put("deviceLife", deviceLife);
+ // 鏌ヨ璁惧缁翠慨淇℃伅
+ List<StaRepairInfo> repairInfo = repairInfoDao.selectByDeviceNo(deviceNo);
+ deviceInfo.put("deviceRepair", repairInfo);
+ // 鏌ヨ璁惧闄勪欢淇℃伅
+ List<StaWipSnEx> wipSnEx = wipSnExDao.selectByDeviceNo(deviceNo);
+ deviceInfo.put("deviceAttach", wipSnEx);
+ return deviceInfo;
+ }
+
+ public List<StaDeviceProductionLog> queryDeviceLog(String startTime, String endTime) {
+ Date startDt = parseToDate(startTime,0);
+ Date endDt = parseToDate(endTime,1);
+ //鏌ヨ璁惧鏃ュ織
+ List<StaDeviceProductionLog> log = deviceProductionLogDao.selectProductLog("",startDt,endDt);
+ return log;
+ }
+
+ private Date parseToDate(String strDt,long offDays) {
+ LocalDateTime dt = LocalDateTime.of(LocalDate.now().plusDays(offDays), LocalTime.of(0,0,0)); // 浠婂ぉ24鐐�
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ DateTimeFormatter dtf1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ if (strDt.matches("\\d{4}(-\\d{2}){2} \\d{2}(:\\d{2}){2}")) {//2024-08-15 00:00:00
+ dt = LocalDateTime.parse(strDt,dtf);
+ }else if (strDt.matches("\\d{4}(-\\d{2}){2}")){
+ dt = LocalDateTime.of(LocalDate.parse(strDt,dtf1), LocalTime.of(0,0,0));
+ }
+ Date date = Date.from(dt.atZone(ZoneId.systemDefault()).toInstant());
+ return date;
+ }
+
+
+}
--
Gitblit v1.8.0