add:实时库存分析
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.device_manage.ios.service.structIvt.dao.mapper;
|
package org.nl.wms.device_manage.ios.service.structIvt.dao.mapper;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
@@ -28,4 +29,7 @@ public interface EmBiStructivtMapper extends BaseMapper<EmBiStructivt> {
|
|||||||
List<Map> getSemiProductIvt(@Param("query") StructIvtEmQuery query);
|
List<Map> getSemiProductIvt(@Param("query") StructIvtEmQuery query);
|
||||||
|
|
||||||
List<Map> getStructIvt(@Param("query") StructIvtEmQuery query);
|
List<Map> getStructIvt(@Param("query") StructIvtEmQuery query);
|
||||||
|
|
||||||
|
List<JSONObject> getIvtPor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,4 +186,20 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
mater.material_spec,
|
||||||
|
MAX(unit.unit_name) AS unit_name,
|
||||||
|
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||||
|
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM em_bi_structivt) * 100,2) AS pro
|
||||||
|
FROM
|
||||||
|
em_bi_structivt ivt
|
||||||
|
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||||
|
|
||||||
|
GROUP BY ivt.material_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.stata_manage.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.wms.stata_manage.service.RealTimeIvtService;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "实时库存统计分析")
|
||||||
|
@RequestMapping("/api/realtimeivt")
|
||||||
|
@Slf4j
|
||||||
|
public class RealTimeIvtController {
|
||||||
|
|
||||||
|
private final RealTimeIvtService realTimeIvtService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@ApiOperation("库存查询")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(realTimeIvtService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/autoWeb")
|
||||||
|
@ApiOperation("饼图")
|
||||||
|
public ResponseEntity<Object> autoWeb(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(realTimeIvtService.autoWeb(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.stata_manage.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务接口
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
public interface RealTimeIvtService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 饼图数据获取
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONObject autoWeb( JSONObject whereJson );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据仓库查询不同仓库得来类型
|
||||||
|
* @param whereJson 、
|
||||||
|
* @return 、
|
||||||
|
*/
|
||||||
|
List<JSONObject> queryIvt(Map whereJson);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.nl.wms.stata_manage.service.dto;
|
||||||
|
public class StorUtil {
|
||||||
|
public static final String STOR_YL = "1528627964823080960";
|
||||||
|
public static final String STOR_CP = "1528627995269533696";
|
||||||
|
public static final String STOR_BCP = "15286279952695336962";
|
||||||
|
public static final String STOR_HR_BCP = "15286279952695336963";
|
||||||
|
public static final String STOR_BJ = "15286279952695336977";
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.stata_manage.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.common.utils.PageUtil;
|
||||||
|
import org.nl.wms.device_manage.ios.service.structIvt.dao.mapper.EmBiStructivtMapper;
|
||||||
|
import org.nl.wms.stata_manage.service.RealTimeIvtService;
|
||||||
|
import org.nl.wms.stata_manage.service.dto.StorUtil;
|
||||||
|
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.mapper.StIvtStructivtCpMapper;
|
||||||
|
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper.StIvtStructivtYlMapper;
|
||||||
|
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.mapper.StIvtStructivtBcpMapper;
|
||||||
|
import org.nl.wms.storage_manage.semimanagehr.service.structIvt.dao.mapper.StIvtStructivtHrBcpMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务实现
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class RealTimeIvtServiceImpl implements RealTimeIvtService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StIvtStructivtYlMapper stIvtStructivtYlMapper; // 原料
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StIvtStructivtBcpMapper stIvtStructivtBcpMapper; // 半成品
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StIvtStructivtCpMapper stIvtStructivtCpMapper; // 成品
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StIvtStructivtHrBcpMapper stIvtStructivtHrBcpMapper; // 海柔半成品
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmBiStructivtMapper emBiStructivtMapper; // 备件
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
|
List<JSONObject> allList = queryIvt(whereJson);
|
||||||
|
|
||||||
|
// 组织分页
|
||||||
|
Map<String, Object> json = PageUtil.toPage(
|
||||||
|
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), allList),
|
||||||
|
allList.size()
|
||||||
|
);
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject autoWeb(JSONObject whereJson) {
|
||||||
|
List<JSONObject> allList = queryIvt(whereJson);
|
||||||
|
|
||||||
|
// 处理数据
|
||||||
|
List<JSONObject> resultList = allList.stream()
|
||||||
|
.map(row -> {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("name", row.getString("material_code"));
|
||||||
|
jsonObject.put("value", row.getDoubleValue("pro"));
|
||||||
|
return jsonObject;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("ivtList", resultList);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JSONObject> queryIvt(Map whereJson) {
|
||||||
|
|
||||||
|
String stor_id = MapUtil.getStr(whereJson, "stor_id");
|
||||||
|
|
||||||
|
List<JSONObject> result = new ArrayList<>();
|
||||||
|
|
||||||
|
switch (stor_id) {
|
||||||
|
case StorUtil.STOR_YL :
|
||||||
|
result = stIvtStructivtYlMapper.getIvtPor();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StorUtil.STOR_BCP :
|
||||||
|
result = stIvtStructivtBcpMapper.getIvtPor();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StorUtil.STOR_CP :
|
||||||
|
result = stIvtStructivtCpMapper.getIvtPor();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StorUtil.STOR_HR_BCP :
|
||||||
|
result = stIvtStructivtHrBcpMapper.getIvtPor();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StorUtil.STOR_BJ :
|
||||||
|
result = emBiStructivtMapper.getIvtPor();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,4 +33,6 @@ public interface StIvtStructivtCpMapper extends BaseMapper<StIvtStructivtCp> {
|
|||||||
|
|
||||||
List<Map> getStructAll(@Param("chanList") List<String> list);
|
List<Map> getStructAll(@Param("chanList") List<String> list);
|
||||||
|
|
||||||
|
List<JSONObject> getIvtPor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,4 +236,20 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
mater.material_spec,
|
||||||
|
MAX(unit.unit_name) AS unit_name,
|
||||||
|
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||||
|
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_cp) * 100,2) AS pro
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt_cp ivt
|
||||||
|
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||||
|
|
||||||
|
GROUP BY ivt.material_id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper;
|
package org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||||
@@ -29,4 +30,6 @@ public interface StIvtStructivtYlMapper extends BaseMapper<StIvtStructivtYl> {
|
|||||||
List<Map> getSemiProductIvt(@Param("query") StructIvtYLQuery query);
|
List<Map> getSemiProductIvt(@Param("query") StructIvtYLQuery query);
|
||||||
|
|
||||||
List<Map> getStructIvt(@Param("query") StructIvtYLQuery query);
|
List<Map> getStructIvt(@Param("query") StructIvtYLQuery query);
|
||||||
|
|
||||||
|
List<JSONObject> getIvtPor();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,4 +192,20 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
mater.material_spec,
|
||||||
|
MAX(unit.unit_name) AS unit_name,
|
||||||
|
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||||
|
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_yl) * 100,2) AS pro
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt_yl ivt
|
||||||
|
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||||
|
|
||||||
|
GROUP BY ivt.material_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ public interface StIvtStructivtBcpMapper extends BaseMapper<StIvtStructivtBcp> {
|
|||||||
List<Map> getPdaBcpMaterialIvt(JSONObject jo);
|
List<Map> getPdaBcpMaterialIvt(JSONObject jo);
|
||||||
|
|
||||||
StIvtStructivtBcp queryIvtOutOne(JSONObject json);
|
StIvtStructivtBcp queryIvtOutOne(JSONObject json);
|
||||||
|
|
||||||
|
List<JSONObject> getIvtPor();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,4 +271,20 @@
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
mater.material_spec,
|
||||||
|
MAX(unit.unit_name) AS unit_name,
|
||||||
|
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||||
|
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_bcp) * 100,2) AS pro
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt_bcp ivt
|
||||||
|
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||||
|
|
||||||
|
GROUP BY ivt.material_id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -39,4 +39,7 @@ public interface StIvtStructivtHrBcpMapper extends BaseMapper<StIvtStructivtHrBc
|
|||||||
StIvtStructivtBcp queryIvtOutOne(JSONObject json);
|
StIvtStructivtBcp queryIvtOutOne(JSONObject json);
|
||||||
|
|
||||||
List<Map> getBcpMoveIvt(@Param("query") StructIvtYLQuery query);
|
List<Map> getBcpMoveIvt(@Param("query") StructIvtYLQuery query);
|
||||||
|
|
||||||
|
List<JSONObject> getIvtPor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,4 +282,20 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
mater.material_spec,
|
||||||
|
MAX(unit.unit_name) AS unit_name,
|
||||||
|
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||||
|
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_hr_bcp) * 100,2) AS pro
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt_hr_bcp ivt
|
||||||
|
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||||
|
|
||||||
|
GROUP BY ivt.material_id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
101
mes/qd/src/views/wms/stata_manage/realtimeivt/PieChart.vue
Normal file
101
mes/qd/src/views/wms/stata_manage/realtimeivt/PieChart.vue
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<div :class="className" :style="{height:height,width:width}" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import echarts from 'echarts'
|
||||||
|
require('echarts/theme/macarons') // echarts theme
|
||||||
|
import { debounce } from '@/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
className: {
|
||||||
|
type: String,
|
||||||
|
default: 'chart'
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '100%'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '300px'
|
||||||
|
},
|
||||||
|
chartData: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chart: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
chartData: {
|
||||||
|
deep: true,
|
||||||
|
handler() {
|
||||||
|
this.setOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.initChart()
|
||||||
|
this.__resizeHandler = debounce(() => {
|
||||||
|
if (this.chart) {
|
||||||
|
this.chart.resize()
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
window.addEventListener('resize', this.__resizeHandler)
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (!this.chart) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.removeEventListener('resize', this.__resizeHandler)
|
||||||
|
this.chart.dispose()
|
||||||
|
this.chart = null
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initChart() {
|
||||||
|
this.chart = echarts.init(this.$el, 'macarons')
|
||||||
|
this.setOptions()
|
||||||
|
},
|
||||||
|
setOptions() {
|
||||||
|
this.chart.setOption({
|
||||||
|
title: {
|
||||||
|
text: '统计',
|
||||||
|
subtext: '',
|
||||||
|
subtextStyle: {
|
||||||
|
'color': '#333'
|
||||||
|
},
|
||||||
|
left: 'center'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
orient: 'vertical',
|
||||||
|
left: 'left'
|
||||||
|
},
|
||||||
|
// color: ['#e0a803', '#27aa0f', '#d2d1d1'], // 修改图饼颜色
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '百分比',
|
||||||
|
type: 'pie',
|
||||||
|
radius: '70%',
|
||||||
|
data: this.chartData,
|
||||||
|
emphasis: {
|
||||||
|
itemStyle: {
|
||||||
|
shadowBlur: 10,
|
||||||
|
shadowOffsetX: 0,
|
||||||
|
shadowColor: 'rgba(0,0,0,0.5)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
160
mes/qd/src/views/wms/stata_manage/realtimeivt/index.vue
Normal file
160
mes/qd/src/views/wms/stata_manage/realtimeivt/index.vue
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="所属仓库">
|
||||||
|
<label slot="label">仓 库:</label>
|
||||||
|
<el-select
|
||||||
|
v-model="query.stor_id"
|
||||||
|
size="mini"
|
||||||
|
placeholder="所属仓库"
|
||||||
|
class="filter-item"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in storlist"
|
||||||
|
:key="item.stor_id"
|
||||||
|
:label="item.stor_name"
|
||||||
|
:value="item.stor_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- <el-form-item label="物料编码">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_code"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="物料编码、名称、规格"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>-->
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission" />
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :xs="24" :sm="24" :lg="24">
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
size="mini"
|
||||||
|
:data="crud.data"
|
||||||
|
highlight-current-row
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="material_code" label="物料编码" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="material_name" label="物料名称" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="material_spec" label="物料规格" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="canuse_qty" label="库存" :formatter="crud.formatNum3" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="unit_name" label="单位" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="pro" label="占比(%)" />
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<hr/>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :xs="24" :sm="24" :lg="24">
|
||||||
|
<div class="chart-wrapper">
|
||||||
|
<pie-chart :chart-data="ivtList" />
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||||
|
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||||
|
import Realtimeivt, { autoWeb } from '@/views/wms/stata_manage/realtimeivt/realtimeivt'
|
||||||
|
import PieChart from '@/views/wms/stata_manage/realtimeivt/PieChart'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RealTimeIvt',
|
||||||
|
components: { crudOperation, rrOperation, PieChart, udOperation, pagination, DateRangePicker },
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '实时库存分析',
|
||||||
|
optShow: { add: false, reset: true },
|
||||||
|
idField: 'stockrecord_id',
|
||||||
|
url: '/api/realtimeivt',
|
||||||
|
crudMethod: { ...Realtimeivt }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mixins: [presenter(), header(), crud()],
|
||||||
|
// 数据字典
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
query_flag: true,
|
||||||
|
permission: {},
|
||||||
|
storlist: [],
|
||||||
|
ivtList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function() {
|
||||||
|
const that = this
|
||||||
|
window.onresize = function temp() {
|
||||||
|
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||||
|
}
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// js提供的clearInterval方法用来清除定时器
|
||||||
|
console.log('定时器销毁')
|
||||||
|
clearInterval(this.timer)
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudStorattr.getStor({ 'stor_type': '' }).then(res => {
|
||||||
|
this.storlist = res.content
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
if (this.query_flag) {
|
||||||
|
this.crud.query.stor_id = '1528627995269533696'
|
||||||
|
this.query_flag = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init: function() {
|
||||||
|
this.initStageData()
|
||||||
|
},
|
||||||
|
initStageData() {
|
||||||
|
this.timer = setInterval(() => { // 定时刷新
|
||||||
|
console.log('定时器启动')
|
||||||
|
this.initStatus()
|
||||||
|
}, 4000)
|
||||||
|
},
|
||||||
|
initStatus() {
|
||||||
|
autoWeb(this.crud.query).then(res => {
|
||||||
|
this.ivtList = res.ivtList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
40
mes/qd/src/views/wms/stata_manage/realtimeivt/realtimeivt.js
Normal file
40
mes/qd/src/views/wms/stata_manage/realtimeivt/realtimeivt.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/realtimeivt',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/api/realtimeivt/delete',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/realtimeivt/update',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function autoWeb(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/realtimeivt/autoWeb',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
del,
|
||||||
|
autoWeb
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user