This commit is contained in:
张怡蓉
2025-10-24 16:25:48 +08:00
parent fceae65162
commit 2e760e7a3e
13 changed files with 282 additions and 165 deletions

View File

@@ -87,6 +87,15 @@ public class KpiController extends BaseController {
return success(kpiService.getSpaceAnalysis(warehouseId)); return success(kpiService.getSpaceAnalysis(warehouseId));
} }
/**
* 新增:根据仓库和巷道统计各状态货位数量
*/
@GetMapping("/spaceStatusCounts")
public AjaxResult getSpaceStatusCounts(String warehouseId,
String roadwayId) {
return success(kpiService.getSpaceStatusCounts(warehouseId, roadwayId));
}
/** /**
* 获取货位巷道数据 * 获取货位巷道数据
* *
@@ -97,6 +106,7 @@ public class KpiController extends BaseController {
public AjaxResult getRoadways(@RequestParam("warehouseId") String warehouseId){ public AjaxResult getRoadways(@RequestParam("warehouseId") String warehouseId){
return success(kpiService.getRoadways(warehouseId)); return success(kpiService.getRoadways(warehouseId));
} }
/** /**
* 获取货位排数据 * 获取货位排数据
* *

View File

@@ -40,11 +40,12 @@ public interface KpiService {
Map<String, Object> getPlatoons(String warehouseId, String roadwayId); Map<String, Object> getPlatoons(String warehouseId, String roadwayId);
Map<String,Object> getChartData(String warehouseId, String roadwayId, String thePlatoon); Map<String,Object> getChartData(String warehouseId, String roadwayId, String thePlatoon);
Map<String,Object> getChartMag(String warehouseId, String theColumn, String theFloor, String thePlatoon); Map<String,Object> getChartMag(String warehouseId, String theColumn, String theFloor, String thePlatoon);
AjaxResult getInAnalysisByData(String warehouseId, String startTime, String endTime,String inOut); AjaxResult getInAnalysisByData(String warehouseId, String startTime, String endTime,String inOut);
// 新增:根据仓库和巷道统计各状态货位数量
Map<String, Object> getSpaceStatusCounts(String warehouseId, String roadwayId);
} }

View File

@@ -278,7 +278,7 @@ public class KpiServiceImpl implements KpiService
// 为每个巷道添加数量,如果没有数据则为0 // 为每个巷道添加数量,如果没有数据则为0
for (String roadwayId : roadwayIds) { for (String roadwayId : roadwayIds) {
statusData.put(MessageUtils.message("kpi.spacePlan.roadway") + roadwayId, entry.getValue().getOrDefault(roadwayId, 0)); statusData.put("巷道" + roadwayId, entry.getValue().getOrDefault(roadwayId, 0));
} }
result.add(statusData); result.add(statusData);
@@ -289,6 +289,34 @@ public class KpiServiceImpl implements KpiService
return response; return response;
} }
// 新增:根据仓库和巷道统计各状态货位数量(用于前端饼图)
@Override
public Map<String, Object> getSpaceStatusCounts(String warehouseId, String roadwayId) {
BasCargoSpace query = new BasCargoSpace();
query.setWarehouseId(warehouseId);
query.setRoadwayId(roadwayId);
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(query);
Map<String, Integer> counts = new HashMap<>();
counts.put("1", 0); // 空闲
counts.put("2", 0); // 占用
counts.put("3", 0); // 入库分配
counts.put("4", 0); // 出库分配
counts.put("5", 0); // 入库待检
counts.put("6", 0); // 出库待检
for (BasCargoSpace space : list) {
String status = space.getStatus();
if (status != null && counts.containsKey(status)) {
counts.put(status, counts.get(status) + 1);
}
}
Map<String, Object> res = new HashMap<>();
res.put("data", counts);
return res;
}
@Override @Override
public Map<String, Object> getRoadways(String warehouseId){ public Map<String, Object> getRoadways(String warehouseId){
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
@@ -311,7 +339,7 @@ public class KpiServiceImpl implements KpiService
for (String roadwayId : roadwaySet) { for (String roadwayId : roadwaySet) {
Map<String, String> roadway = new HashMap<>(); Map<String, String> roadway = new HashMap<>();
roadway.put("value", roadwayId); roadway.put("value", roadwayId);
roadway.put("label", MessageUtils.message("kpi.spacePlan.roadway") + roadwayId); roadway.put("name", roadwayId+"巷道");
roadways.add(roadway); roadways.add(roadway);
} }

View File

@@ -89,6 +89,16 @@ public class OutStockoutFinish extends BaseEntity
private String remark; private String remark;
private String supplierName;
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getRemark() { public String getRemark() {
return remark; return remark;
} }

View File

@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="finishDate" column="finish_date" /> <result property="finishDate" column="finish_date" />
<result property="warehouseName" column="warehouse_name" /> <result property="warehouseName" column="warehouse_name" />
<result property="customerName" column="customer_name" /> <result property="customerName" column="customer_name" />
<result property="supplierName" column="supplier_name" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
@@ -141,10 +142,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectOutStockoutFinishListByOutStockout" parameterType="OutStockout" resultMap="OutStockoutFinishResult"> <select id="selectOutStockoutFinishListByOutStockout" parameterType="OutStockout" resultMap="OutStockoutFinishResult">
select distinct o.stockout_guid, o.stockout_id, o.out_type, o.create_date, o.department_no, o.customer_no, o.create_man_id, o.status, o.stockout_source, select distinct o.stockout_guid, o.stockout_id, o.out_type, o.create_date, o.department_no, o.customer_no, o.create_man_id, o.status, o.stockout_source,
o.warehouse_id, o.class_now_id, o.exit_id, o.car_number, o.FID, o.erp_stockout_id,o.start_date,o.finish_date,bw.warehouse_name,bc.customer_name,o.remark from out_stockout_finish o o.class_now_id, o.exit_id, o.car_number, o.FID, o.erp_stockout_id,o.start_date,o.finish_date,o.remark from out_stockout_finish o
left join bas_warehouse bw on bw.warehouse_id = o.warehouse_id
left join bas_customer bc on bc.customer_no = o.customer_no
left join out_stockout_detail_finish d on d.stockout_id = o.stockout_id left join out_stockout_detail_finish d on d.stockout_id = o.stockout_id
left join bas_warehouse bw on bw.warehouse_id = d.warehouse_id
left join bas_customer bc on bc.customer_no = d.out_id
left join bas_supplier bs on bs.supplier_no = d.supplier_id
left join bas_product bp on bp.product_id = d.product_id left join bas_product bp on bp.product_id = d.product_id
<where> <where>
<if test="stockoutGuid != null and stockoutGuid != ''"> and o.stockout_guid = #{stockoutGuid}</if> <if test="stockoutGuid != null and stockoutGuid != ''"> and o.stockout_guid = #{stockoutGuid}</if>
@@ -155,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createManId != null and createManId != ''"> and o.create_man_id = #{createManId}</if> <if test="createManId != null and createManId != ''"> and o.create_man_id = #{createManId}</if>
<if test="status != null and status != ''"> and o.status = #{status}</if> <if test="status != null and status != ''"> and o.status = #{status}</if>
<if test="stockoutSource != null and stockoutSource != ''"> and o.stockout_source = #{stockoutSource}</if> <if test="stockoutSource != null and stockoutSource != ''"> and o.stockout_source = #{stockoutSource}</if>
<if test="warehouseId != null and warehouseId != ''"> and o.warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''"> and d.warehouse_id = #{warehouseId}</if>
<if test="classNowId != null and classNowId != ''"> and o.class_now_id = #{classNowId}</if> <if test="classNowId != null and classNowId != ''"> and o.class_now_id = #{classNowId}</if>
<if test="exitId != null and exitId != ''"> and o.exit_id = #{exitId}</if> <if test="exitId != null and exitId != ''"> and o.exit_id = #{exitId}</if>
<if test="carNumber != null and carNumber != ''"> and o.car_number = #{carNumber}</if> <if test="carNumber != null and carNumber != ''"> and o.car_number = #{carNumber}</if>
@@ -166,6 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productId != null and productId != ''"> and d.product_id = #{productId}</if> <if test="productId != null and productId != ''"> and d.product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and bp.product_name like concat('%', #{productName}, '%')</if> <if test="productName != null and productName != ''"> and bp.product_name like concat('%', #{productName}, '%')</if>
<if test="customerName != null and customerName != ''"> and bc.customer_name like concat('%', #{customerName}, '%')</if> <if test="customerName != null and customerName != ''"> and bc.customer_name like concat('%', #{customerName}, '%')</if>
<if test="supplierName != null and supplierName != ''"> and bs.supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="remark != null and remark != ''"> and o.remark like concat('%', #{remark}, '%')</if> <if test="remark != null and remark != ''"> and o.remark like concat('%', #{remark}, '%')</if>
</where> </where>
order by o.create_date desc order by o.create_date desc

View File

@@ -7,3 +7,12 @@ export function getSpaceAnalysisList(query) {
params: query params: query
}) })
} }
// 新增:统计选定仓库+巷道的各状态货位数量
export function getSpaceStatusCounts(query) {
return request({
url: '/kpi/spaceStatusCounts',
method: 'get',
params: query
})
}

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询库存信息列表 // 查询库存信息列表
export function listManagement(query) { export function listManagement(query) {
return request({ return request({
url: '/stock/management/list', url: '/out/handAllotStock/list',
method: 'get', method: 'get',
params: query params: query
}) })

View File

@@ -124,10 +124,10 @@
</el-table-column> </el-table-column>
<el-table-column label="任务号" align="left" prop="taskNo" /> <!-- 任务号 --> <el-table-column label="任务号" align="left" prop="taskNo" /> <!-- 任务号 -->
<!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> &lt;!&ndash; 客户ID &ndash;&gt;--> <!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> &lt;!&ndash; 客户ID &ndash;&gt;-->
<!-- <el-table-column label="托盘码" align="left" prop="trayCode" /> &lt;!&ndash; 托盘码 &ndash;&gt;--> <el-table-column label="托盘码" align="left" prop="trayCode" /> <!-- 托盘码 -->
<!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> &lt;!&ndash; 巷道ID &ndash;&gt;--> <!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> &lt;!&ndash; 巷道ID &ndash;&gt;-->
<el-table-column label="货位" align="left" prop="cargoSpaceName" /> <!-- 货位ID --> <el-table-column label="货位" align="left" prop="cargoSpaceName" /> <!-- 货位ID -->
<el-table-column label="订单号" align="left" prop="lineId" /> <!-- 结束时间 --> <!-- <el-table-column label="订单号" align="left" prop="lineId" /> &lt;!&ndash; 结束时间 &ndash;&gt;-->
<!-- <el-table-column label="优先级" align="left" prop="priority" /> &lt;!&ndash; 优先级 &ndash;&gt;--> <!-- <el-table-column label="优先级" align="left" prop="priority" /> &lt;!&ndash; 优先级 &ndash;&gt;-->
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase"> &lt;!&ndash; 执行阶段 &ndash;&gt;--> <!-- <el-table-column label="执行阶段" align="left" prop="executionPhase"> &lt;!&ndash; 执行阶段 &ndash;&gt;-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
@@ -135,7 +135,7 @@
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column label="仓库" align="left" prop="warehouseName" />
<el-table-column label="出口" align="left" prop="exitId"/> <!-- 出口ID --> <el-table-column label="出口" align="left" prop="exitId"/> <!-- 出口ID -->
<el-table-column label="创建时间" align="left" prop="createTime" width="180"/> <!-- 创建时间 --> <el-table-column label="创建时间" align="left" prop="createTime" width="180"/> <!-- 创建时间 -->
<el-table-column label="开始时间" align="left" prop="startTime" width="180"/> <!-- 开始时间 --> <el-table-column label="开始时间" align="left" prop="startTime" width="180"/> <!-- 开始时间 -->
@@ -160,18 +160,38 @@
<el-table-column label="物料编码" align="left" prop="productId" /> <el-table-column label="物料编码" align="left" prop="productId" />
<el-table-column label="物料名称" align="left" prop="productName" /> <el-table-column label="物料名称" align="left" prop="productName" />
<el-table-column label="出库数量" align="right" prop="outQuantity" /> <!-- 出库数量 --> <el-table-column label="出库数量" align="right" prop="outQuantity" /> <!-- 出库数量 -->
<el-table-column label="批次号" align="left" prop="lotNo" /> <el-table-column label="批号" align="left" prop="lotNo" />
<el-table-column label="机型" align="left" prop="unit"/><!--机型--> <el-table-column label="单价" align="left" prop="printDate" />
<el-table-column label="分销" align="left" prop="spare9"/><!--分销--> <el-table-column label="供应商" align="left" prop="supplierName" />
<el-table-column label="规格" align="left" prop="spec"/><!--规格--> <el-table-column label="来源" align="left" prop="spare1" ><!--来源-->
<el-table-column label="型号" align="left" prop="spare1"/><!--型号--> <template slot-scope="scope">
<el-table-column label="净重" align="left" prop="spare2"/><!--净重--> <dict-tag :options="dict.type.origin_type" :value="scope.row.spare1"/>
<el-table-column label="颜色" align="left" prop="spare3"/><!--颜色--> </template>
<el-table-column label="序列号" align="left" prop="spare4"/><!--序列号--> </el-table-column>
<el-table-column label="电压" align="left" prop="spare5"/><!--电压--> <el-table-column label="状态" align="left" prop="spare2" ><!--用途-->
<el-table-column label="功率" align="left" prop="spare6"/><!--功率--> <template slot-scope="scope">
<el-table-column label="相位" align="left" prop="spare7"/><!--相位--> <dict-tag :options="dict.type.turnover_type" :value="scope.row.spare2"/>
<el-table-column label="毛重" align="left" prop="spare8"/><!--毛重--> </template>
</el-table-column>
<el-table-column label="套账" align="left" prop="spare3" ><!--用途-->
<template slot-scope="scope">
<dict-tag :options="dict.type.account_type" :value="scope.row.spare3"/>
</template>
</el-table-column>
<el-table-column label="用途" align="left" prop="spare4" ><!--用途-->
<template slot-scope="scope">
<dict-tag :options="dict.type.purpose_type" :value="scope.row.spare4"/>
</template>
</el-table-column>
<el-table-column label="台次" align="left" prop="spare5" />
<el-table-column label="合同号" align="left" prop="spare6" />
<el-table-column label="件次" align="left" prop="spare7" />
<el-table-column label="质量等级" align="left" prop="spare8" ><!--用途-->
<template slot-scope="scope">
<dict-tag :options="dict.type.quality_type" :value="scope.row.spare8"/>
</template>
</el-table-column>
<el-table-column label="管理号" align="left" prop="spare9" />
</el-table> </el-table>
<pagination <pagination
@@ -191,7 +211,7 @@ import {listWarehouse} from "@/api/bas/warehouse";
export default { export default {
name: "MydoJob", name: "MydoJob",
dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status','out_job_type'], dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status','out_job_type','product_type','origin_type','account_type','turnover_type','purpose_type','quality_type'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层

View File

@@ -1,16 +1,16 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form :model="queryParams" ref="queryForm" :inline="true">
<!-- <el-form-item label="仓库" prop="warehouseId"> &lt;!&ndash; 仓库 &ndash;&gt;--> <el-form-item label="仓库" prop="warehouseId"> <!-- 仓库 -->
<!-- <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable> &lt;!&ndash; 请选择仓库 &ndash;&gt;--> <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable> <!-- 请选择仓库 -->
<!-- <el-option--> <el-option
<!-- v-for="item in warehouseOptions"--> v-for="item in warehouseOptions"
<!-- :key="item.warehouseId"--> :key="item.warehouseId"
<!-- :label="item.warehouseName"--> :label="item.warehouseName"
<!-- :value="item.warehouseId"--> :value="item.warehouseId"
<!-- />--> />
<!-- </el-select>--> </el-select>
<!-- </el-form-item>--> </el-form-item>
<el-form-item label="时间范围" prop="dateRange"> <!-- 时间范围 --> <el-form-item label="时间范围" prop="dateRange"> <!-- 时间范围 -->
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
@@ -46,7 +46,7 @@ export default {
return { return {
// 查询参数 // 查询参数
queryParams: { queryParams: {
warehouseId: undefined, warehouseId: null,
startTime: '', startTime: '',
endTime: '', endTime: '',
inOut:'1' inOut:'1'

View File

@@ -1,16 +1,16 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form :model="queryParams" ref="queryForm" :inline="true">
<!-- <el-form-item label="仓库" prop="warehouseId"> &lt;!&ndash; 仓库 &ndash;&gt;--> <el-form-item label="仓库" prop="warehouseId"> <!-- 仓库 -->
<!-- <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable> &lt;!&ndash; 请选择仓库 &ndash;&gt;--> <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable> <!-- 请选择仓库 -->
<!-- <el-option--> <el-option
<!-- v-for="item in warehouseOptions"--> v-for="item in warehouseOptions"
<!-- :key="item.warehouseId"--> :key="item.warehouseId"
<!-- :label="item.warehouseName"--> :label="item.warehouseName"
<!-- :value="item.warehouseId"--> :value="item.warehouseId"
<!-- />--> />
<!-- </el-select>--> </el-select>
<!-- </el-form-item>--> </el-form-item>
<el-form-item label="时间范围" prop="dateRange"> <!-- 时间范围 --> <el-form-item label="时间范围" prop="dateRange"> <!-- 时间范围 -->
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
@@ -46,7 +46,7 @@ export default {
return { return {
// 查询参数 // 查询参数
queryParams: { queryParams: {
warehouseId: undefined, warehouseId: null,
startTime: '', startTime: '',
endTime: '', endTime: '',
inOut:'2' inOut:'2'

View File

@@ -1,26 +1,37 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">--> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<!-- &lt;!&ndash; 仓库 &ndash;&gt;--> <!-- 仓库 -->
<!-- <el-form-item label="仓库" prop="warehouseId">--> <el-form-item label="仓库" prop="warehouseId">
<!-- <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable>--> <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable @change="onWarehouseChange">
<!-- <el-option--> <el-option
<!-- v-for="dict in warehouseOptions"--> v-for="dict in warehouseOptions"
<!-- :key="dict.warehouseId"--> :key="dict.warehouseId"
<!-- :label="dict.warehouseName"--> :label="dict.warehouseName"
<!-- :value="dict.warehouseId"--> :value="dict.warehouseId"
<!-- />--> />
<!-- </el-select>--> </el-select>
<!-- </el-form-item>--> </el-form-item>
<!-- <el-form-item>--> <!-- 巷道 -->
<!-- &lt;!&ndash; 【搜索】按钮 &ndash;&gt;--> <el-form-item label="巷道" prop="roadwayId">
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>--> <el-select v-model="queryParams.roadwayId" placeholder="请选择巷道" clearable @change="handleQuery">
<!-- &lt;!&ndash; 【重置】按钮 &ndash;&gt;--> <el-option
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>--> v-for="item in roadwayOptions"
<!-- </el-form-item>--> :key="item.value"
<!-- </el-form>--> :label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<!-- 【搜索】按钮 -->
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<!-- 【重置】按钮 -->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 柱状图容器 --> <!-- 饼状图容器 -->
<div class="chart-container" style="height: 700px"> <div class="chart-container" style="height: 700px">
<div ref="spaceChart" style="width: 100%; height: 100%"></div> <div ref="spaceChart" style="width: 100%; height: 100%"></div>
</div> </div>
@@ -29,8 +40,9 @@
<script> <script>
import * as echarts from '@/plugins/echarts.min.js' import * as echarts from '@/plugins/echarts.min.js'
import { getSpaceAnalysisList } from "@/api/kpi/spaceAnalysis" import { getSpaceStatusCounts } from "@/api/kpi/spaceAnalysis"
import {listWarehouse} from "@/api/bas/warehouse"; import { listWarehouse } from "@/api/bas/warehouse";
import { getRoadways } from "@/api/kpi/spacePlan";
export default { export default {
name: "spaceAnalysis", name: "spaceAnalysis",
data() { data() {
@@ -41,14 +53,17 @@ export default {
showSearch: true, showSearch: true,
// 仓库选项 // 仓库选项
warehouseOptions: [], warehouseOptions: [],
// 巷道选项
roadwayOptions: [],
// 查询参数 // 查询参数
queryParams: { queryParams: {
warehouseId: null // 默认选择仓库1 warehouseId: null,
roadwayId: null
}, },
// 图表实例 // 图表实例
chart: null, chart: null,
// 图表数据(模拟数据) // 图表数据(状态计数)
chartData:[], chartData: {},
queryWarehouseParam:{ queryWarehouseParam:{
pageNum: 1, pageNum: 1,
pageSize: 99, pageSize: 99,
@@ -76,33 +91,61 @@ export default {
methods: { methods: {
/** 查询仓库列表 */ /** 查询仓库列表 */
getWarehouseList() { getWarehouseList() {
listWarehouse(this.queryWarehouseParam).then(response => { listWarehouse(this.queryWarehouseParam).then(response => {
this.warehouseOptions = response.rows; this.warehouseOptions = response.rows;
// 默认选择第一个仓库并加载巷道
// if (!this.queryParams.warehouseId && this.warehouseOptions.length) {
// this.queryParams.warehouseId = this.warehouseOptions[0].warehouseId;
// }
this.getRoadwayList();
});
}
,
/** 仓库切换 */
onWarehouseChange() {
this.queryParams.roadwayId = null;
this.getRoadwayList();
}
,
/** 查询巷道列表 */
getRoadwayList() {
if (!this.queryParams.warehouseId) return;
getRoadways({ warehouseId: this.queryParams.warehouseId }).then(res => {
this.roadwayOptions = (res.data && res.data.data) || [];
// 默认选择第一个巷道
// if (!this.queryParams.roadwayId && this.roadwayOptions.length) {
// this.queryParams.roadwayId = this.roadwayOptions[0].value;
// }
this.handleQuery();
}); });
// this.warehouseOptions = [{warehouseId: "01", warehouseName: "仓库1"}, {warehouseId: "02", warehouseName: "仓库2"}];
} }
, ,
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
getSpaceAnalysisList(this.queryParams).then(response => { // if (!this.queryParams.warehouseId || !this.queryParams.roadwayId) return;
getSpaceStatusCounts(this.queryParams).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.chartData = response.data; this.chartData = response.data.data || {};
this.updateChart(); this.updateChart();
} else { } else {
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}).catch(error => { }).catch(error => {
// 提示:获取数据失败
console.error('获取数据失败:', error); console.error('获取数据失败:', error);
this.$message.error('获取数据失败'); this.$message.error('获取数据失败');
}); });
}, }
,
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.warehouseId = "01"; // 重置时仍选择仓库1 // 保持默认仓库,重新加载巷道并刷新
this.handleQuery(); if (this.warehouseOptions.length) {
this.queryParams.warehouseId = this.warehouseOptions[0].warehouseId;
}
this.queryParams.roadwayId = null;
this.getRoadwayList();
} }
, ,
/** 初始化图表 */ /** 初始化图表 */
@@ -118,57 +161,29 @@ export default {
'2': '占用', '2': '占用',
'3': '入库分配', '3': '入库分配',
'4': '出库分配', '4': '出库分配',
'5': '入库待检', '5': '入库需盘点',
'6': '出库待检' '6': '出库需盘点'
}; };
return statusMap[statusCode] || statusCode; return statusMap[statusCode] || statusCode;
}, }
/** 更新图表数据 */ ,
/** 更新图表数据为饼图 */
updateChart() { updateChart() {
console.log('chartData:', this.chartData); const counts = this.chartData || {};
if (!this.chartData || !this.chartData.data || this.chartData.data.length === 0) { const statusCodes = ['1','2','3','4','5','6'];
// 提示:无效的图表数据 const pieData = statusCodes.map(code => ({
console.warn('无效的图表数据'); name: this.getStatusText(code),
return; value: counts[code] || 0
}
// 获取数据中所有的巷道字段
const firstItem = this.chartData.data[0];
// 巷道
const roadwayFields = Object.keys(firstItem).filter(key => key.startsWith('巷道'));
// 准备系列配置
const series = roadwayFields.map(roadway => ({
name: roadway,
type: 'bar',
data: this.chartData.data.map(item => item[roadway]),
barWidth: '30%',
itemStyle: {
// 巷道1-4
color: roadway === '巷道1' ? '#1890ff' :
roadway === '巷道2' ? '#52c41a' :
roadway === '巷道3' ? '#1890ff' :
roadway === '巷道4' ? '#52c41a' : '#1890ff'
},
label: {
show: true,
position: 'top'
}
})); }));
// 提示:生成的系列配置
console.log('系列配置:', series);
const option = { const option = {
title: { title: {
// 货位状态分析
text: '货位状态分析', text: '货位状态分析',
left: 'center' left: 'center'
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'item',
axisPointer: { formatter: '{b}: {c} ({d}%)'
type: 'shadow'
}
}, },
legend: { legend: {
top: "5%", top: "5%",
@@ -177,22 +192,21 @@ export default {
color: "#292c2c" color: "#292c2c"
}, },
}, },
xAxis: { series: [{
type: 'category', name: '货位状态',
data: this.chartData.data.map(item => this.getStatusText(item.status)), type: 'pie',
axisLabel: { radius: '60%',
interval: 0, center: ['50%', '60%'],
rotate: 0 data: pieData,
label: {
show: true,
formatter: '{b}: {c}'
} }
}, }]
yAxis: {
type: 'value',
// 数量
name: '数量'
},
series: series
}; };
this.chart.setOption(option); if (this.chart) {
this.chart.setOption(option);
}
}, },
} }
} }

View File

@@ -3,16 +3,16 @@
<div class="search-box"> <div class="search-box">
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form :model="queryParams" ref="queryForm" :inline="true">
<!-- 仓库 --> <!-- 仓库 -->
<!-- <el-form-item label="仓库" prop="warehouseId">--> <el-form-item label="仓库" prop="warehouseId">
<!-- <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" @change="handleWarehouseChange">--> <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" @change="handleWarehouseChange">
<!-- <el-option--> <el-option
<!-- v-for="dict in warehouseOptions"--> v-for="dict in warehouseOptions"
<!-- :key="dict.warehouseId"--> :key="dict.warehouseId"
<!-- :label="dict.warehouseName"--> :label="dict.warehouseName"
<!-- :value="dict.warehouseId"--> :value="dict.warehouseId"
<!-- />--> />
<!-- </el-select>--> </el-select>
<!-- </el-form-item>--> </el-form-item>
<!-- 巷道 --> <!-- 巷道 -->
<el-form-item label="巷道"> <el-form-item label="巷道">
<el-select v-model="queryParams.roadwayId" style="width: 150px" @change="handleRoadwayChange"> <el-select v-model="queryParams.roadwayId" style="width: 150px" @change="handleRoadwayChange">

View File

@@ -59,25 +59,47 @@
<el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange" max-height="650"> <el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange" max-height="650">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="库存编码" align="center" prop="stockId" width="160"/> <el-table-column label="库存编码" align="center" prop="stockId" />
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" width="160"/> <el-table-column label="货位名称" align="center" prop="cargoSpaceName" />
<el-table-column label="批次号" align="center" prop="lotNo" /> <el-table-column label="批次号" align="center" prop="lotNo" />
<el-table-column label="订单号" align="center" prop="orderId" width="160"/> <el-table-column label="物料编码" align="center" prop="productId" />
<el-table-column label="品号" align="center" prop="productId" /> <el-table-column label="物料名称" align="center" prop="productName" />
<el-table-column label="品名" align="center" prop="productName" /> <el-table-column label="规格型号" align="center" prop="netWeight" />
<el-table-column label="数量" align="center" prop="quantity" width="80" /> <el-table-column label="图号" align="center" prop="grossWeight" />
<el-table-column label="规格" align="center" prop="spare1" /> <el-table-column label="库存数量" align="center" prop="quantity" width="80" />
<el-table-column label="单位" align="center" prop="spare3" /> <el-table-column label="来源" align="center" prop="spare1" >
<el-table-column label="型号" align="center" prop="spare4" /> <template slot-scope="scope">
<el-table-column label="颜色" align="center" prop="spare5" /> <dict-tag :options="dict.type.origin_type" :value="scope.row.spare1"/>
<el-table-column label="序列号" align="center" prop="spare6" /> </template>
<el-table-column label="电压" align="center" prop="voltage" />
<el-table-column label="功率" align="center" prop="power" /> </el-table-column>
<el-table-column label="相位" align="center" prop="phase" /> <el-table-column label="套账" align="center" prop="spare3" >
<el-table-column label="净重" align="center" prop="netWeight" /> <template slot-scope="scope">
<el-table-column label="毛重" align="center" prop="grossWeight" /> <dict-tag :options="dict.type.account_type" :value="scope.row.spare3"/>
<el-table-column label="分销" align="center" prop="distribution" /> </template>
<el-table-column label="机型" align="center" prop="model" /> </el-table-column>
<el-table-column label="用途" align="center" prop="spare4" >
<template slot-scope="scope">
<dict-tag :options="dict.type.purpose_type" :value="scope.row.model"/>
</template>
</el-table-column>
<el-table-column label="台次" align="center" prop="spare5" />
<el-table-column label="入库单价" align="center" prop="spare6" />
<el-table-column label="状态" align="center" prop="voltage" >
<template slot-scope="scope">
<dict-tag :options="dict.type.turnover_type" :value="scope.row.voltage"/>
</template>
</el-table-column>
<el-table-column label="件次" align="center" prop="power" />
<!-- <el-table-column label="供应商" align="center" prop="phase" />-->
<el-table-column label="供应商" align="center" prop="inClassId" />
<el-table-column label="管理号" align="center" prop="distribution" />
<el-table-column label="产品质量" align="center" prop="spare8" >
<template slot-scope="scope">
<dict-tag :options="dict.type.quality_type" :value="scope.row.spare8"/>
</template>
</el-table-column>
<el-table-column label="合同号" align="center" prop="orderId" />
</el-table> </el-table>
@@ -148,7 +170,7 @@ import {listWarehouse} from "@/api/bas/warehouse"
import {pointOut} from "@/api/job/OutmydoJob" import {pointOut} from "@/api/job/OutmydoJob"
export default { export default {
name: "Management", name: "Management",
dicts: ['product_status', 'stock_status','cargo_space_status','cargo_space_lock_status'], dicts: ['product_status', 'stock_status','cargo_space_status','cargo_space_lock_status', 'product_type', 'quality_type', 'turnover_type', 'sys_yes_no','account_type','origin_type','purpose_type','warehouse'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
@@ -223,8 +245,8 @@ export default {
}, },
// 出口选项 // 出口选项
exitOptions: [ exitOptions: [
{ exitId: '1', exitName: '一楼'}, { exitId: '1', exitName: '1'},
{ exitId: '2', exitName: '二楼'}, { exitId: '2', exitName: '2'},
], ],