From ac45194a5ff830a0f355a76a202e1d4f1d15a35b Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 26 九月 2024 13:07:15 +0800
Subject: [PATCH] #
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/TaskDetlLogService.java | 5 +
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/InformationTop.java | 14 +++
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/TaskDetlLogServiceImpl.java | 11 ++
zy-asrs-wms/src/main/resources/mapper/asrs/TaskDetlLogMapper.xml | 16 ++++
zy-asrs-admin/src/views/HomeView.vue | 126 ++++++++++++++++++++++++++++++-
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java | 45 +++++++++++
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/TaskDetlLogMapper.java | 5 +
7 files changed, 217 insertions(+), 5 deletions(-)
diff --git a/zy-asrs-admin/src/views/HomeView.vue b/zy-asrs-admin/src/views/HomeView.vue
index 42278e5..db2e818 100644
--- a/zy-asrs-admin/src/views/HomeView.vue
+++ b/zy-asrs-admin/src/views/HomeView.vue
@@ -1,5 +1,5 @@
<script setup>
-import { getCurrentInstance, ref, onMounted } from 'vue';
+import { getCurrentInstance, ref, onMounted, reactive } from 'vue';
import { get, post } from '@/utils/request.js'
import * as echarts from "echarts";
const context = getCurrentInstance()?.appContext.config.globalProperties;
@@ -107,8 +107,6 @@
]
}
- console.log(lineOptions);
-
chartLine.setOption(lineOptions);
}
@@ -129,10 +127,46 @@
})
}
+const information = reactive({
+ inCount: 0,
+ outCount: 0,
+ totalCount: 0,
+ matCount: 0,
+});
+function getInformation() {
+ post('/api/charts/information', {}).then(resp => {
+ let result = resp.data;
+ if (result.code == 200) {
+ let data = result.data;
+ information.inCount = data.inCount;
+ information.outCount = data.outCount;
+ information.totalCount = data.totalCount;
+ information.matCount = data.matCount;
+ }
+ })
+}
+
+const informationTop = reactive({
+ topIn: [],
+ topOut: [],
+});
+function getInformationTop() {
+ post('/api/charts/information/top', {}).then(resp => {
+ let result = resp.data;
+ if (result.code == 200) {
+ let data = result.data;
+ informationTop.topIn = data.topIn;
+ informationTop.topOut = data.topOut;
+ }
+ })
+}
+
onMounted(() => {
initChart()
getPieOptions()
getLineOptions()
+ getInformation()
+ getInformationTop()
})
</script>
@@ -145,8 +179,90 @@
<template>
<div style="display: flex;">
- <div ref="chartPieContainer" style="width: 49%;height: 400px;"></div>
- <div ref="chartLineContainer" style="width: 49%;height: 400px;"></div>
+ <div style="width: 24%;margin-right: 20px;">
+ <a-card>
+ <a-statistic title="浠婃棩鍏ュ嚭搴�" :value="information.totalCount" :value-style="{ color: '#3f8600' }"
+ style="margin-right: 50px">
+ <template #prefix>
+ <!-- <arrow-up-outlined /> -->
+ </template>
+ </a-statistic>
+ </a-card>
+ </div>
+ <div style="width: 24%;margin-right: 20px;">
+ <a-card>
+ <a-statistic title="浠婃棩鍏ュ簱" :value="information.inCount" :value-style="{ color: '#3f8600' }"
+ style="margin-right: 50px">
+ <template #prefix>
+ <!-- <arrow-up-outlined /> -->
+ </template>
+ </a-statistic>
+ </a-card>
+ </div>
+ <div style="width: 24%;margin-right: 20px;">
+ <a-card>
+ <a-statistic title="浠婃棩鍑哄簱" :value="information.outCount" :value-style="{ color: '#3f8600' }"
+ style="margin-right: 50px">
+ <template #prefix>
+ <!-- <arrow-up-outlined /> -->
+ </template>
+ </a-statistic>
+ </a-card>
+ </div>
+ <div style="width: 24%;margin-right: 20px;">
+ <a-card>
+ <a-statistic title="鍟嗗搧鎬绘暟" :value="information.matCount" :value-style="{ color: '#3f8600' }"
+ style="margin-right: 50px">
+ <template #prefix>
+ <!-- <arrow-up-outlined /> -->
+ </template>
+ </a-statistic>
+ </a-card>
+ </div>
+ </div>
+ <div style="display: flex;margin-top: 20px;">
+ <div style="width: 49%;margin-right: 20px;">
+ <a-card title="浠婃棩鍏ュ簱Top10">
+ <div v-if="informationTop.topIn.length == 0">
+ <a-empty />
+ </div>
+ <div v-else v-for="(item, index) in informationTop.topIn" :key="index"
+ style="display: flex;justify-content: space-between;margin-top: 10px;">
+ <div>{{ item.matnr }} - {{ item.maktx }}</div>
+ <div>
+ <a-tag v-if="index == 0" color="#87d068">{{ item.count }}</a-tag>
+ <a-tag v-else color="#2db7f5">{{ item.count }}</a-tag>
+ </div>
+ </div>
+ </a-card>
+ </div>
+ <div style="width: 49%;margin-right: 20px;">
+ <a-card title="浠婃棩鍑哄簱Top10">
+ <div v-if="informationTop.topOut.length == 0">
+ <a-empty />
+ </div>
+ <div v-else v-for="(item, index) in informationTop.topOut" :key="index"
+ style="display: flex;justify-content: space-between;margin-top: 10px;">
+ <div>{{ item.matnr }} - {{ item.maktx }}</div>
+ <div>
+ <a-tag v-if="index == 0" color="#87d068">{{ item.count }}</a-tag>
+ <a-tag v-else color="#2db7f5">{{ item.count }}</a-tag>
+ </div>
+ </div>
+ </a-card>
+ </div>
+ </div>
+ <div style="display: flex;margin-top: 20px;">
+ <div style="width: 49%;margin-right: 20px;">
+ <a-card>
+ <div ref="chartPieContainer" style="width: 100%;height: 400px;"></div>
+ </a-card>
+ </div>
+ <div style="width: 49%;">
+ <a-card>
+ <div ref="chartLineContainer" style="width: 90%;height: 400px;"></div>
+ </a-card>
+ </div>
<!-- <EChartView ref="chartChild2" /> -->
</div>
</template>
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java
index 9e1a1dd..6aee8d7 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java
@@ -8,7 +8,12 @@
import com.zy.asrs.wms.asrs.entity.echart.EChartLineBean;
import com.zy.asrs.wms.asrs.entity.echart.EChartPieBean;
import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
+import com.zy.asrs.wms.asrs.entity.statistics.InformationTop;
+import com.zy.asrs.wms.asrs.entity.statistics.ViewInOut;
+import com.zy.asrs.wms.asrs.mapper.statistics.ViewInOutMapper;
import com.zy.asrs.wms.asrs.service.LocService;
+import com.zy.asrs.wms.asrs.service.MatService;
+import com.zy.asrs.wms.asrs.service.TaskDetlLogService;
import com.zy.asrs.wms.asrs.service.TaskLogService;
import com.zy.asrs.wms.system.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +32,12 @@
private LocService locService;
@Autowired
private TaskLogService taskLogService;
+ @Autowired
+ private TaskDetlLogService taskDetlLogService;
+ @Autowired
+ private ViewInOutMapper viewInOutMapper;
+ @Autowired
+ private MatService matService;
@PostMapping("/charts/loc/use")
public R locUse(){
@@ -111,4 +122,38 @@
return R.ok().add(map);
}
+ @PostMapping("/charts/information")
+ public R information() {
+ HashMap<String, Object> data = new HashMap<>();
+ long matCount = matService.count();
+ Long inQty = 0L;
+ Long outQty = 0L;
+ Long totalQty = 0L;
+
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+ ViewInOut viewInOut = viewInOutMapper.selectOne(new LambdaQueryWrapper<ViewInOut>().eq(ViewInOut::getYmd, format.format(new Date())).orderByDesc(ViewInOut::getYmd).last("limit 0,1"));
+ if(viewInOut != null) {
+ inQty = viewInOut.getInQty();
+ outQty = viewInOut.getOutQty();
+ totalQty = viewInOut.getTotalQty();
+ }
+
+ data.put("inCount", inQty);
+ data.put("outCount", outQty);
+ data.put("totalCount", totalQty);
+ data.put("matCount", matCount);
+ return R.ok().add(data);
+ }
+
+ @PostMapping("/charts/information/top")
+ public R informationTop() {
+ List<InformationTop> topIn = taskDetlLogService.getInformationTopIn(10);
+ List<InformationTop> topOut = taskDetlLogService.getInformationTopOut(10);
+
+ HashMap<String, Object> data = new HashMap<>();
+ data.put("topIn", topIn);
+ data.put("topOut", topOut);
+ return R.ok().add(data);
+ }
+
}
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/InformationTop.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/InformationTop.java
new file mode 100644
index 0000000..3eaf304
--- /dev/null
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/InformationTop.java
@@ -0,0 +1,14 @@
+package com.zy.asrs.wms.asrs.entity.statistics;
+
+import lombok.Data;
+
+@Data
+public class InformationTop {
+
+ private String matnr;
+
+ private String maktx;
+
+ private Double count;
+
+}
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/TaskDetlLogMapper.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/TaskDetlLogMapper.java
index 85c078d..62214b2 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/TaskDetlLogMapper.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/TaskDetlLogMapper.java
@@ -2,6 +2,7 @@
import com.zy.asrs.wms.asrs.entity.TaskDetlLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zy.asrs.wms.asrs.entity.statistics.InformationTop;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@@ -13,4 +14,8 @@
List<Long> getTaskIdsByDetlId(Long detlId);
+ List<InformationTop> getInformationTopIn(Integer top);
+
+ List<InformationTop> getInformationTopOut(Integer top);
+
}
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/TaskDetlLogService.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/TaskDetlLogService.java
index 70c64bb..704a80a 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/TaskDetlLogService.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/TaskDetlLogService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.asrs.wms.asrs.entity.TaskDetlLog;
+import com.zy.asrs.wms.asrs.entity.statistics.InformationTop;
import java.util.List;
@@ -13,4 +14,8 @@
List<TaskDetlLog> parseDetl(List<TaskDetlLog> list);
+ List<InformationTop> getInformationTopIn(Integer top);
+
+ List<InformationTop> getInformationTopOut(Integer top);
+
}
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/TaskDetlLogServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/TaskDetlLogServiceImpl.java
index 2e6c3c6..b50b0e1 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/TaskDetlLogServiceImpl.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/TaskDetlLogServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.wms.asrs.entity.*;
+import com.zy.asrs.wms.asrs.entity.statistics.InformationTop;
import com.zy.asrs.wms.asrs.mapper.TaskDetlLogMapper;
import com.zy.asrs.wms.asrs.service.TaskDetlFieldLogService;
import com.zy.asrs.wms.asrs.service.TaskDetlLogService;
@@ -41,4 +42,14 @@
}
return list;
}
+
+ @Override
+ public List<InformationTop> getInformationTopIn(Integer top) {
+ return this.baseMapper.getInformationTopIn(top);
+ }
+
+ @Override
+ public List<InformationTop> getInformationTopOut(Integer top) {
+ return this.baseMapper.getInformationTopOut(top);
+ }
}
diff --git a/zy-asrs-wms/src/main/resources/mapper/asrs/TaskDetlLogMapper.xml b/zy-asrs-wms/src/main/resources/mapper/asrs/TaskDetlLogMapper.xml
index 9d6d652..55aa6f8 100644
--- a/zy-asrs-wms/src/main/resources/mapper/asrs/TaskDetlLogMapper.xml
+++ b/zy-asrs-wms/src/main/resources/mapper/asrs/TaskDetlLogMapper.xml
@@ -7,4 +7,20 @@
where detl_id = #{detlId}
</select>
+ <select id="getInformationTopIn" resultType="com.zy.asrs.wms.asrs.entity.statistics.InformationTop">
+ select matnr,maktx,sum(anfme) count from view_today_task_detl_log
+ where task_sts = 100
+ group by matnr,anfme,maktx
+ order by count desc
+ limit 0,#{top}
+ </select>
+
+ <select id="getInformationTopOut" resultType="com.zy.asrs.wms.asrs.entity.statistics.InformationTop">
+ select matnr,maktx,sum(anfme) count from view_today_task_detl_log
+ where task_sts = 200
+ group by matnr,anfme,maktx
+ order by count desc
+ limit 0,#{top}
+ </select>
+
</mapper>
--
Gitblit v1.9.1