Procházet zdrojové kódy

王子文 生产日报 查询

wangggziwen před 3 roky
rodič
revize
31fa99e4fe

+ 9 - 3
master/src/main/java/com/ruoyi/project/production/controller/TDailyProductionReportController.java

@@ -73,10 +73,16 @@ public class TDailyProductionReportController extends BaseController
      * 按日期获取每日生产报告详细信息
      */
     @PreAuthorize("@ss.hasPermi('production:report:query')")
-    @GetMapping(value = "/getInfoByReportDate/{reportDate}")
-    public AjaxResult getInfoByReportDate(@PathVariable("reportDate") Date reportDate)
+    @GetMapping(value = "/getInfoByReportDate")
+    public AjaxResult getInfoByReportDate(TDailyProductionReport tDailyProductionReport)
     {
-        return AjaxResult.success(tDailyProductionReportService.selectTDailyProductionReportByReportDate(reportDate));
+        if (tDailyProductionReport == null) {
+            TDailyProductionReport tDailyProductionReportToday = new TDailyProductionReport();
+            tDailyProductionReportToday.setReportDate(new Date());
+            return AjaxResult.success(tDailyProductionReportService.selectTDailyProductionReportByReportDate(tDailyProductionReportToday));
+        } else {
+            return AjaxResult.success(tDailyProductionReportService.selectTDailyProductionReportByReportDate(tDailyProductionReport));
+        }
     }
 
     /**

+ 3 - 0
master/src/main/java/com/ruoyi/project/production/domain/TDailyProductionReport.java

@@ -21,14 +21,17 @@ public class TDailyProductionReport extends BaseEntity
     private Long id;
 
     /** $column.columnComment */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Date fromDate;
 
     /** $column.columnComment */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Date toDate;
 
     /** $column.columnComment */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Date reportDate;
 

+ 3 - 3
master/src/main/java/com/ruoyi/project/production/mapper/TDailyProductionReportMapper.java

@@ -11,7 +11,7 @@ import com.ruoyi.project.production.domain.TDailyProductionReport;
  * @author ruoyi
  * @date 2022-08-23
  */
-public interface TDailyProductionReportMapper 
+public interface TDailyProductionReportMapper
 {
     /**
      * 查询每日生产报告
@@ -24,10 +24,10 @@ public interface TDailyProductionReportMapper
     /**
      * 查询每日生产报告
      *
-     * @param reportDate 每日生产报告ID
+     * @param tDailyProductionReport 每日生产报告
      * @return 每日生产报告
      */
-    public TDailyProductionReport selectTDailyProductionReportByReportDate(Date reportDate);
+    public TDailyProductionReport selectTDailyProductionReportByReportDate(TDailyProductionReport tDailyProductionReport);
 
     /**
      * 查询每日生产报告列表

+ 2 - 2
master/src/main/java/com/ruoyi/project/production/service/ITDailyProductionReportService.java

@@ -23,10 +23,10 @@ public interface ITDailyProductionReportService
     /**
      * 查询每日生产报告
      *
-     * @param reportDate 每日生产报告日期
+     * @param tDailyProductionReport 每日生产报告
      * @return 每日生产报告
      */
-    public TDailyProductionReport selectTDailyProductionReportByReportDate(Date reportDate);
+    public TDailyProductionReport selectTDailyProductionReportByReportDate(TDailyProductionReport tDailyProductionReport);
 
     /**
      * 查询每日生产报告列表

+ 3 - 3
master/src/main/java/com/ruoyi/project/production/service/impl/TDailyProductionReportServiceImpl.java

@@ -35,13 +35,13 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
     /**
      * 查询每日生产报告
      *
-     * @param reportDate 每日生产报告日期
+     * @param tDailyProductionReport 每日生产报告
      * @return 每日生产报告
      */
     @Override
-    public TDailyProductionReport selectTDailyProductionReportByReportDate(Date reportDate)
+    public TDailyProductionReport selectTDailyProductionReportByReportDate(TDailyProductionReport tDailyProductionReport)
     {
-        return tDailyProductionReportMapper.selectTDailyProductionReportByReportDate(reportDate);
+        return tDailyProductionReportMapper.selectTDailyProductionReportByReportDate(tDailyProductionReport);
     }
 
     /**

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
master/src/main/resources/mybatis/production/TDailyProductionReportMapper.xml


+ 5 - 4
ui/src/api/production/report.js

@@ -17,11 +17,12 @@ export function getReport(id) {
   })
 }
 
-// 按日期查询每日生产报告详细
-export function getReportByreportDate(reportDate) {
+// 查询每日生产报告详细
+export function getReportByReportDate(query) {
   return request({
-    url: '/production/report/getInfoByReportDate/' + reportDate,
-    method: 'get'
+    url: '/production/report/getInfoByReportDate',
+    method: 'get',
+    params: query
   })
 }
 

+ 37 - 8
ui/src/views/production/daily/index.vue

@@ -3,6 +3,7 @@
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="报告日期" prop="reportDate">
         <el-date-picker clearable size="small" style="width: 200px"
+                        @change="handleQuery"
                         v-model="queryParams.reportDate"
                         type="date"
                         value-format="yyyy-MM-dd"
@@ -10,7 +11,6 @@
         </el-date-picker>
       </el-form-item>
       <el-form-item>
-        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button
           type="info"
           icon="el-icon-upload2"
@@ -1090,7 +1090,7 @@
 </template>
 
 <script>
-import { listReport, getReport, delReport, addReport, updateReport, exportReport, importTemplate} from "@/api/production/report";
+import { getReportByReportDate, listReport, getReport, delReport, addReport, updateReport, exportReport, importTemplate} from "@/api/production/report";
 import { treeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
@@ -2214,7 +2214,9 @@ export default {
         pguAeuTotalLoss: null,
         pguAeuLossPercentage: null,
         pguAeuFeedLoadPercentage: null
-      }
+      },
+      // 日期保留
+      lastSelectedDate: null
     };
   },
   watch: {
@@ -2228,11 +2230,39 @@ export default {
       this.$nextTick(() => {
           this.clientHeight = document.body.clientHeight -250
       })
-    // this.getList();
-    this.getTreeselect();
-    this.loading = false;
+      this.setDateAsToday();
+      this.getReport();
+      this.getTreeselect();
+      this.loading = false;
   },
   methods: {
+    /** 设置日期 */
+    setDateAsToday() {
+      let today = new Date();
+      let todayString = today.getFullYear()
+        + "-" + (today.getMonth() + 1)
+        + "-" + today.getDate();
+      // this.queryParams.reportDate = todayString;
+      // this.lastSelectedDate = todayString;
+      this.queryParams.reportDate = "2022-8-8";
+      this.lastSelectedDate = "2022-8-8";
+    },
+    /** 查询生产报告 */
+    getReport() {
+      this.loading = true;
+      listReport(this.queryParams).then(response => {
+        if (response.rows.length != 0) {
+          this.lastSelectedDate = this.queryParams.reportDate;
+          this.reportData = response.rows[0];
+          this.loading = false;
+        } else {
+          let str = "未查询到" + this.queryParams.reportDate + "的日报,请修改搜索日期或手动导入数据。";
+          this.queryParams.reportDate = this.lastSelectedDate;
+          this.$message.error(str);
+          this.loading = false;
+        }
+      });
+    },
     /** 查询每日生产报告列表 */
     getList() {
       this.loading = true;
@@ -2795,8 +2825,7 @@ export default {
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.getReport();
     },
     /** 重置按钮操作 */
     resetQuery() {

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů