Commit 6f0ad6d5 by yubin

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-inventory/src/main/java/com/ruoyi/inventory/controller/InventoryController.java
parents c0db3aae bd8d2429
......@@ -42,3 +42,24 @@ export function delInbound(id) {
method: 'delete'
})
}
// 首页入库次数统计api
export function inboundCount(){
return request({
url: '/inventory/inbound/inboundCount',
method: 'get'
})
}
// 按数量统计本月入库物料Top前10
export function countQuantity(){
return request({
url: '/inventory/inbound/countQuantity',
method: 'get'
})
}
// 按金额统计本月入库物料Top前10
export function countMoney(){
return request({
url: '/inventory/inbound/countMoney',
method: 'get'
})
}
......@@ -51,9 +51,10 @@ export function delInbound_items(id) {
}
// 统计入库单明细
export function inbound_details(){
export function inbound_details(query){
return request({
url: '/inventory/inbound_items/details',
method: 'get'
method: 'get',
params: query
})
}
......@@ -95,4 +95,12 @@ export function listInventoryDetail(query) {
method: 'get',
params: query
})
}
\ No newline at end of file
}
// 统计库存物料超出预警值
export function exceedWarnValue() {
return request({
url: '/inventory/inventory/exceed',
method: 'get'
})
}
......@@ -39,7 +39,7 @@ export function updateMaterials(data) {
export function delMaterials(id) {
return request({
url: '/inventory/materials/' + id,
method: 'delete'
method: 'put'
})
}
......
......@@ -39,7 +39,7 @@ export function updateMaterials_category(data) {
export function delMaterials_category(id) {
return request({
url: '/inventory/materials_category/' + id,
method: 'delete'
method: 'put'
})
}
......@@ -49,4 +49,4 @@ export function categoryTreeSelect() {
url: '/inventory/materials_category/categoryTree',
method: 'get'
})
}
\ No newline at end of file
}
......@@ -151,7 +151,47 @@
<template slot-scope="scope">
<!-- 可编辑模式 -->
<template v-if="scope.row.editable && column.editable !== false">
<template v-if="column.type === 'select'">
<!-- 仓库选择 -->
<template v-if="column.prop === 'warehousesName'">
<el-input
v-model="scope.row.warehousesName"
size="small"
readonly
placeholder="请选择仓库"
@focus="$emit('open-warehouse-selector', scope.row)"
:suffix-icon="''"
>
<template v-if="scope.row.warehousesName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearWarehouse(scope.row)"
></i>
</template>
</el-input>
</template>
<!-- 库位选择 -->
<template v-else-if="column.prop === 'locationName'">
<el-input
v-model="scope.row.locationName"
size="small"
readonly
placeholder="请选择库位"
@focus="$emit('open-location-selector', scope.row)"
:suffix-icon="''"
:disabled="!scope.row.warehouseId"
>
<template v-if="scope.row.locationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearLocation(scope.row)"
></i>
</template>
</el-input>
</template>
<!-- 其他选择框 -->
<template v-else-if="column.type === 'select'">
<el-select
v-model="scope.row[column.prop]"
size="small"
......@@ -166,6 +206,7 @@
/>
</el-select>
</template>
<!-- 数字输入框 -->
<template v-else-if="column.type === 'number'">
<el-input-number
v-model="scope.row[column.prop]"
......@@ -177,6 +218,7 @@
@change="handleNumberChange(scope.row, column.prop)"
/>
</template>
<!-- 普通输入框 -->
<template v-else>
<el-input
v-model="scope.row[column.prop]"
......@@ -201,8 +243,15 @@
<template v-else-if="column.type === 'number'">
{{ formatNumber(scope.row[column.prop]) }}
</template>
<!-- 仓库/库位兜底显示 -->
<template v-else-if="column.prop === 'warehousesName'">
{{ scope.row.warehousesName || scope.row.warehouseId || '-' }}
</template>
<template v-else-if="column.prop === 'locationName'">
{{ scope.row.locationName || scope.row.locationCode || scope.row.locationId || '-' }}
</template>
<template v-else>
{{ scope.row[column.prop] }}
{{ scope.row[column.prop] || '-' }}
</template>
</template>
</template>
......@@ -292,13 +341,20 @@ export default {
default: () => [
{ prop: 'materialId', label: '货物ID', width: '150', editable: false },
{ prop: 'materialName', label: '货物名称', width: '150', editable: false },
{ prop: 'warehouseId', label: '仓库ID', width: '150', editable: true,
type: 'select',
options: [{ label: '仓库A', value: 'WH001' }, { label: '仓库B', value: 'WH002' }, { label: '仓库C', value: 'WH003' }]
{
prop: 'warehousesName',
label: '仓库',
width: '150',
editable: true,
idProp: 'warehouseId'
},
{ prop: 'locationId', label: '库位ID', width: '150', editable: true,
type: 'select',
options: [{ label: '库位A1', value: 'LOC001' }, { label: '库位A2', value: 'LOC002' }, { label: '库位B1', value: 'LOC003' }]
{
prop: 'locationName',
label: '库位',
width: '150',
editable: true,
idProp: 'locationId',
codeProp: 'locationCode'
},
{ prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true },
{ prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true },
......@@ -320,8 +376,6 @@ export default {
},
data() {
return {
showSearch: true,
loading: false,
selectedRows: [],
......@@ -392,7 +446,7 @@ export default {
immediate: true,
handler(newVal) {
// 核心:过滤 null/空值,只在有效时执行逻辑
if (!newVal) return
if (!newVal) return
this.loadRelatedData(newVal)
this.displayData.forEach(item => {
if (!item.inboundOrderId) item.inboundOrderId = newVal
......@@ -414,11 +468,11 @@ export default {
// 根据字典类型和值,获取对应的listClass(标签样式)
getDictListClass(dictType, value) {
const dictList = this.dict.type[dictType] || []
if (!value) return 'info'
if (!value) return ''
const dictItem = dictList.find(item => item.value === value+"")
// 兼容raw和直接属性两种写法
return dictItem?.raw?.listClass || 'info'
return dictItem?.raw?.listClass
},
// 根据字典类型和值,获取对应的显示标签
......@@ -443,8 +497,9 @@ export default {
this.loading = true
this.queryParams.inboundOrderId = inboundOrderId
listInbound_itemsAndMname(this.queryParams).then(response => {
console.log(response.rows)
this.displayData = response.rows.map(item => ({
...item,
materialName: item.materialName,
editable: false,
......@@ -456,7 +511,7 @@ export default {
}).catch(() => {
this.loading = false
}).finally(() => {
})
},
......@@ -547,7 +602,9 @@ export default {
unitPrice: 0,
remark: null,
editable: true,
inboundOrderId: null,
tempId: Date.now() + Math.random()
}
this.displayData.push(newItem)
const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize)
......@@ -654,6 +711,23 @@ export default {
this.$emit('cell-blur', { row, prop, value: row[prop] })
},
// 清除仓库选择
clearWarehouse(row) {
this.$set(row, 'warehouseId', null);
this.$set(row, 'warehousesName', null);
// 同时清除库位选择
this.clearLocation(row);
this.$emit('cell-change', { row, prop: 'warehouseId', value: null });
},
// 清除库位选择
clearLocation(row) {
this.$set(row, 'locationId', null);
this.$set(row, 'locationCode', null);
this.$set(row, 'locationName', null);
this.$emit('cell-change', { row, prop: 'locationId', value: null });
},
// 选择变化
handleSelectionChange(selection) {
this.selectedRows = selection
......@@ -745,4 +819,4 @@ export default {
:deep(.el-select .el-tag) {
margin: 0;
}
</style>
\ No newline at end of file
</style>
......@@ -85,26 +85,26 @@
@search="handleQuery"
@reset="resetQuery"
>
<el-form-item label="物料编码" prop="materialCode">
<!-- <el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
</el-form-item> -->
<el-form-item label="SAP物料号" prop="sapNo">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
v-model="queryParams.sapNo"
placeholder="请输入SAP物料号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="SAP物料号" prop="sapNo">
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.sapNo"
placeholder="请输入SAP物料号"
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -150,7 +150,15 @@
{{ scope.row.displayCategory || categoryMap[scope.row.categoryCode] || scope.row.categoryCode }}
</template>
</el-table-column>
<el-table-column label="危险类别ID" align="center" prop="hazardId" width="150"/>
<el-table-column label="危险类别" align="center" prop="hazardId" width="150">
<template slot-scope="scope">
<el-tag
:type="getDictListClass('danger_type',scope.row.hazardId)"
size="small">
{{ getDictLabel('danger_type',scope.row.hazardId) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="计量单位" align="center" prop="materialUnit" />
<el-table-column label="单位重量" align="center" prop="unitWeight" />
......@@ -177,7 +185,15 @@
<el-tag :type="scope.row.isActive === 1 ? 'success' : 'info'" size="mini">{{ scope.row.isActive === 1 ? '是' : '否' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="风险等级" align="center" prop="riskLevel" />
<el-table-column label="风险等级" align="center" prop="riskLevel" >
<template slot-scope="scope">
<el-tag
:type="getDictListClass('risk_level',scope.row.riskLevel)"
size="small">
{{ getDictLabel('risk_level',scope.row.riskLevel) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
......@@ -255,7 +271,15 @@
<el-input v-model="form.maxStockLevel" placeholder="请输入最高库存" />
</el-form-item>
<el-form-item label="风险等级" prop="riskLevel">
<el-input v-model="form.riskLevel" placeholder="请输入风险等级" />
<el-select v-model="form.riskLevel" placeholder="请选择风险等级" clearable>
<el-option
v-for="dict in dict.type.risk_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否序列号管理" prop="isSerialManaged">
<el-radio-group v-model="form.isSerialManaged">
......@@ -285,8 +309,16 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="危险类别ID" prop="hazardId">
<el-input v-model="form.hazardId" placeholder="请输入危险类别ID" />
<el-form-item label="危险类别" prop="hazardId">
<el-select v-model="form.hazardId" placeholder="请选择危险类别" clearable>
<el-option
v-for="dict in dict.type.danger_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="计量单位" prop="materialUnit">
<el-input v-model="form.materialUnit" placeholder="请输入计量单位" />
......@@ -312,7 +344,7 @@
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
......@@ -346,6 +378,7 @@ import request from '@/utils/request'
export default {
name: "Materials",
dicts: ['danger_type','risk_level'],
components: {
TreeComponent,
Splitpanes,
......@@ -455,6 +488,20 @@ export default {
this.getList()
},
methods: {
getDictLabel(dictType, value) {
// 1. 空值/字典不存在时返回默认值
if (!value || !this.dict?.type?.[dictType]) return '-';
// 2. 从字典数组中匹配 value 对应的 label
const dictItem = this.dict.type[dictType].find(item => item.value === value);
return dictItem?.label || '-';
},
getDictListClass(dictType, value){
// 1. 空值/字典不存在时返回默认值
if (!value || !this.dict?.type?.[dictType]) return '-';
// 2. 从字典数组中匹配 value 对应的 label
const dictItem = this.dict.type[dictType].find(item => item.value === value);
return dictItem?.raw?.listClass || '';
},
async getCategoryList() {
try {
const response = await listMaterials_category({
......@@ -552,7 +599,7 @@ export default {
handleTreeClick(data) {
console.log('点击树节点:', data)
this.currentNodeId = data.sid
// 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data.categoryCode
this.queryParams.categoryNameInput = null // 清空名称输入
......@@ -762,7 +809,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm(row.id ? '是否确认删除编号为"' + row.materialCode + '"的数据项?' : '是否确认删除选中数量为"' + ids.length + '"的数据项?' ).then(() => {
this.$modal.confirm(row.id ? '是否确认删除物料号为"' + row.sapNo + '"的数据项?' : '是否确认删除选中数量为"' + ids.length + '"的数据项?' ).then(() => {
return delMaterials(ids)
}).then(() => {
this.getList()
......
......@@ -49,70 +49,70 @@
<div class="table-container">
<el-table v-loading="loading" :data="stocktakesList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<!-- <el-table-column label="盘点单号 隐藏,根据id同步生成值" align="center" prop="stocktakeId" />-->
<!-- <el-table-column label="盘点类型1-全面盘点 2-循环盘点 3-指定物料盘点 暂无用,默认1" align="center" prop="stocktakeType" />-->
<!-- <el-table-column label="仓库ID 暂无用" align="center" prop="warehouseId" />-->
<el-table-column label="计划日期" align="center" prop="plannedDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.plannedDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column prop="stocktakeStatus" label="盘点状态" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.stocktake_status" :value="scope.row.stocktakeStatus"/>
</template>
</el-table-column>
<!-- <el-table-column label="盘点物料范围 暂时无用" align="center" prop="materialRange" />-->
<!-- <el-table-column label="盘点库位范围 暂时无用" align="center" prop="locationRange" />-->
<!-- <el-table-column label="总差异金额 暂时无用" align="center" prop="totalVarianceAmount" />-->
<el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="应用数据1使用0删除 删除用" align="center" prop="isUsed" />-->
<!-- <el-table-column label="排序" align="center" prop="sortNo" />-->
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="排序号" align="center" prop="updateUserCode" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleViewInfo(scope.row)"
v-hasPermi="['inventory:stocktakes:query']"
>查看</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCheck(scope.row)"
v-if="scope.row.stocktakeStatus === '1'"
v-hasPermi="['inventory:stocktakes:check']"
>盘点</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-if="scope.row.stocktakeStatus === '1'"
@click="handleDelete(scope.row)"
v-hasPermi="['inventory:stocktakes:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-circle-check"
@click="handleConfirm(scope.row)"
v-if="scope.row.stocktakeStatus === '2'"
v-hasPermi="['inventory:stocktakes:confirm']"
>盘点确认</el-button>
</template>
</el-table-column>
</el-table>
<el-table v-loading="loading" height="100%" :data="stocktakesList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<!-- <el-table-column label="盘点单号 隐藏,根据id同步生成值" align="center" prop="stocktakeId" />-->
<!-- <el-table-column label="盘点类型1-全面盘点 2-循环盘点 3-指定物料盘点 暂无用,默认1" align="center" prop="stocktakeType" />-->
<!-- <el-table-column label="仓库ID 暂无用" align="center" prop="warehouseId" />-->
<el-table-column label="计划日期" align="center" prop="plannedDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.plannedDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column prop="stocktakeStatus" label="盘点状态" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.stocktake_status" :value="scope.row.stocktakeStatus"/>
</template>
</el-table-column>
<!-- <el-table-column label="盘点物料范围 暂时无用" align="center" prop="materialRange" />-->
<!-- <el-table-column label="盘点库位范围 暂时无用" align="center" prop="locationRange" />-->
<!-- <el-table-column label="总差异金额 暂时无用" align="center" prop="totalVarianceAmount" />-->
<el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="应用数据1使用0删除 删除用" align="center" prop="isUsed" />-->
<!-- <el-table-column label="排序" align="center" prop="sortNo" />-->
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="排序号" align="center" prop="updateUserCode" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleViewInfo(scope.row)"
v-hasPermi="['inventory:stocktakes:query']"
>查看</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCheck(scope.row)"
v-if="scope.row.stocktakeStatus === '1'"
v-hasPermi="['inventory:stocktakes:check']"
>盘点</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-if="scope.row.stocktakeStatus === '1'"
@click="handleDelete(scope.row)"
v-hasPermi="['inventory:stocktakes:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-circle-check"
@click="handleConfirm(scope.row)"
v-if="scope.row.stocktakeStatus === '2'"
v-hasPermi="['inventory:stocktakes:confirm']"
>盘点确认</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total>0"
......
......@@ -62,10 +62,10 @@
</page-wrapper-search>
<div class="table-container">
<el-table v-loading="loading" :data="stocktakesList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" height="300px" :data="stocktakesList" @selection-change="handleSelectionChange">
<el-table-column label="计划日期" align="center" prop="plannedDates" width="180" />
<el-table-column label="物料" prop="materialId" fixed>
<el-table-column label="物料" align="center" prop="materialId" fixed>
<template slot-scope="scope">
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') }}
</template>
......@@ -142,12 +142,12 @@
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') || '无' }}
</template>
</el-table-column>
<el-table-column label="SAP物料号" prop="sapNo" />
<el-table-column label="仓库" prop="warehousesName" />
<el-table-column label="库位" prop="locationName" />
<el-table-column label="危险类别" prop="hazardName" />
<el-table-column label="差异数量" prop="varianceQuantity" />
<el-table-column label="差异金额" prop="varianceAmount">
<el-table-column label="SAP物料号" align="center" prop="sapNo" />
<el-table-column label="仓库" align="center" prop="warehousesName" />
<el-table-column label="库位" align="center" prop="locationName" />
<el-table-column label="危险类别" align="center" prop="hazardName" />
<el-table-column label="差异数量" align="center" prop="varianceQuantity" />
<el-table-column label="差异金额" align="center" prop="varianceAmount">
<template slot-scope="scope">
{{ formatAmount(scope.row.varianceAmount) }}
</template>
......
......@@ -71,25 +71,25 @@
<!-- 表格 -->
<div class="table-container">
<el-table :data="filteredItemsList"
<el-table height="300px" :data="filteredItemsList"
:row-class-name="setRowIndex"
@selection-change="handleSelectionChange"
border
size="small">
<el-table-column label="子表ID" align="center" width="150px" prop="id" v-if="false" />
<el-table-column label="物料" prop="materialId" width="150px" fixed>
<el-table-column label="物料" align="center" prop="materialId" width="150px" fixed>
<template slot-scope="scope">
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') }}
</div>
</template>
</el-table-column>
<el-table-column label="批次编号" prop="batchCode" width="150px" >
<el-table-column label="批次编号" align="center" prop="batchCode" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.batchCode" placeholder="请输入批次编号" disabled />
</template>
</el-table-column>
<el-table-column label="仓库" prop="warehouseName" width="150px" >
<el-table-column label="仓库" align="center" prop="warehouseName" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.warehouseName" placeholder="请输入仓库" disabled />
<!-- <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">-->
......@@ -97,7 +97,7 @@
<!-- </div>-->
</template>
</el-table-column>
<el-table-column label="库位" prop="locationName" width="150px" >
<el-table-column label="库位" align="center" prop="locationName" width="150px" >
<template slot-scope="scope">
<!-- <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">-->
<!-- {{ scope.row.location_name || scope.row.locationId || '未知库位' }}-->
......@@ -105,12 +105,12 @@
<el-input v-model="scope.row.locationName" placeholder="请输入库位" disabled />
</template>
</el-table-column>
<el-table-column label="系统数量" prop="systemQuantity" width="150px" >
<el-table-column label="系统数量" align="center" prop="systemQuantity" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.systemQuantity" placeholder="请输入系统数量" disabled />
</template>
</el-table-column>
<el-table-column label="实际数量" prop="actualQuantity" width="150px" >
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.actualQuantity"
placeholder="请输入实际数量"
......@@ -120,31 +120,31 @@
/>
</template>
</el-table-column>
<el-table-column label="差异数量" prop="varianceQuantity" width="150px" >
<el-table-column label="差异数量" align="center" prop="varianceQuantity" width="150px" >
<template slot-scope="scope">
<el-input type="number" v-model="scope.row.varianceQuantity" placeholder="请输入差异数量" disabled />
</template>
</el-table-column>
<el-table-column label="单价" prop="unitPrice" width="150px" >
<el-table-column label="单价" align="center" prop="unitPrice" width="150px" >
<template slot-scope="scope">
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">
{{ formatAmount(scope.row.unitPrice) }}
</div>
</template>
</el-table-column>
<el-table-column label="差异金额" prop="varianceAmount" width="150px" >
<el-table-column label="差异金额" align="center" prop="varianceAmount" width="150px" >
<template slot-scope="scope">
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">
{{ formatAmount(scope.row.varianceAmount) }}
</div>
</template>
</el-table-column>
<el-table-column label="是否已调整" prop="adjusted" v-if="isConfirm" width="150px" >
<el-table-column label="是否已调整" align="center" prop="adjusted" v-if="isConfirm" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.adjusted" placeholder="请输入是否已调整0否1是" disabled />
</template>
</el-table-column>
<el-table-column label="调整原因" prop="adjustmentReason" width="150px" >
<el-table-column label="调整原因" align="center" prop="adjustmentReason" width="150px" >
<template slot-scope="scope">
<el-input
v-model="scope.row.adjustmentReason"
......@@ -156,12 +156,12 @@
/>
</template>
</el-table-column>
<el-table-column label="调整人" prop="adjustedBy" v-if="isConfirm" width="150px" >
<el-table-column label="调整人" align="center" prop="adjustedBy" v-if="isConfirm" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.adjustedBy" placeholder="请输入调整人" disabled />
</template>
</el-table-column>
<el-table-column label="调整时间" prop="adjustedAt"v-if="isConfirm" width="150px" >
<el-table-column label="调整时间" align="center" prop="adjustedAt"v-if="isConfirm" width="150px" >
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.adjustedAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择调整时间" disabled />
</template>
......
......@@ -141,7 +141,8 @@ public class InboundOrderItemsController extends BaseController
public TableDataInfo itemDetails(InboundDetailsVO inboundDetailsVO) throws Exception
{
startPage();
List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo();
System.out.println(inboundDetailsVO);
List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo(inboundDetailsVO);
return getDataTable(list);
}
}
......@@ -7,6 +7,7 @@ import com.ruoyi.common.utils.uuid.UUID;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.domain.vo.InboundTemplateVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -136,4 +137,36 @@ public class InboundOrdersController extends BaseController
String message = inboundOrdersService.importInboundOrders(inboundOrders, updateSupport, operName);
return success(message);
}
/**
* 首页入库次数统计api
*
*/
@GetMapping("/inboundCount")
public AjaxResult inboundCount(){
int count = inboundOrdersService.countInboundOrders();
return AjaxResult.success(count);
}
/**
* 按数量统计本月入库物料Top前10
* @return 结果
*/
@GetMapping("/countQuantity")
public TableDataInfo countQuantity(){
startPage();
List<InboundMaterialTotalVO> list = inboundOrdersService.countInboundMaterialQuantity();
return getDataTable(list);
}
/**
* 按金额统计本月入库物料Top前10
* @return 结果
*/
@GetMapping("/countMoney")
public TableDataInfo countMoney(){
startPage();
List<InboundMaterialTotalVO> list = inboundOrdersService.countInboundMaterialMoney();
return getDataTable(list);
}
}
......@@ -115,7 +115,18 @@ public class MaterialsCategoryController extends BaseController
}
/**
* 删除物料分类
* 修改物料分类有效状态
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE)
@PutMapping("/{ids}")
public AjaxResult updateIsUsed(@PathVariable String[] ids)
{
return toAjax(materialsCategoryService.updateCategoryIsUsedByIds(ids));
}
/**
* 删除物料分类(暂无用)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE)
......
......@@ -101,14 +101,15 @@ public class MaterialsController extends BaseController
}
/**
* 删除物料
* 删除物料 (修改物料有效性)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
@PutMapping("/{ids}")
public AjaxResult updateIsUsed(@PathVariable String[] ids)
{
return toAjax(materialsService.deleteMaterialsByIds(ids));
return toAjax(materialsService.updateMaterialsIsUsed(ids));
}
/**
......@@ -155,4 +156,15 @@ public class MaterialsController extends BaseController
}
}
/**
* 删除物料 (暂时无用)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(materialsService.deleteMaterialsByIds(ids));
}
}
......@@ -19,17 +19,15 @@ public class Materials extends BaseEntity
private String id;
/** 物料编码 检索条件 */
@Excel(name = "物料编码")
private String materialCode;
/** SAP物料号 检索条件 */
@Excel(name = "SAP物料号")
private String sapNo;
/** 物料名称 检索条件 */
@Excel(name = "物料名称")
private String materialName;
/** SAP物料号 检索条件 */
@Excel(name = "SAP物料号")
private String sapNo;
/** TS Code 检索条件 */
@Excel(name = "TS Code")
private String tsCode;
......
......@@ -4,18 +4,11 @@ import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.excel.EasyExcel;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
......@@ -26,6 +19,7 @@ import com.ruoyi.inventory.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.service.IInventoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 库存Controller
......@@ -79,7 +73,7 @@ public class InventoryController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:list')")
@PostMapping("/listByMaterialId")
public TableDataInfo listByMaterialId(@RequestBody OutboundOrderItems inventory)
public TableDataInfo listByMaterialId(@RequestBody Inventory inventory)
{
startPage();
List<Inventory> list = inventoryService.listByMatreialId(inventory);
......@@ -173,4 +167,15 @@ public class InventoryController extends BaseController
{
return toAjax(inventoryService.insertInventoryList(inventoryList));
}
/**
* 统计库存物料超出预警值
*/
@GetMapping("/exceed")
public TableDataInfo exceedWarnValue()
{
startPage();
List<InventoryExceedWarnVO> list = inventoryService.selectInventoryExceedWarnList();
return getDataTable(list);
}
}
......@@ -45,6 +45,8 @@ public class InboundOrders extends BaseEntity
@Excel(name = "货主ID")
private String ownerId;
private String ownerName;
/** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel(name = "入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus;
......@@ -283,6 +285,14 @@ public class InboundOrders extends BaseEntity
this.inboundOrderItemsList = inboundOrderItemsList;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -308,6 +318,7 @@ public class InboundOrders extends BaseEntity
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("inboundOrderItemsList", getInboundOrderItemsList())
.append("ownerName", getOwnerName())
.toString();
}
}
......@@ -38,10 +38,14 @@ public class InboundItemsAndMaterialName extends BaseEntity
@Excel(name = "仓库ID")
private String warehouseId;
private String warehousesName;
/** 库位ID 检索条件 */
@Excel(name = "库位ID")
private String locationId;
private String locationName;
/** 计划数量 */
@Excel(name = "计划数量")
private Long plannedQuantity;
......@@ -330,6 +334,22 @@ public class InboundItemsAndMaterialName extends BaseEntity
this.inboundOrderId = inboundOrderId;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -359,6 +379,8 @@ public class InboundItemsAndMaterialName extends BaseEntity
.append("updateUserCode", getUpdateUserCode())
.append("materialName", getMaterialName())
.append("inboundOrderId", getInboundOrderId())
.append("warehousesName", getWarehousesName())
.append("locationName", getLocationName())
.toString();
}
}
......@@ -6,6 +6,7 @@ import java.util.Date;
public class InboundDetailsVO {
private static final long serialVersionUID = 1L;
@Excel(name = "物料sapNo")
private String materialId;
......@@ -18,12 +19,17 @@ public class InboundDetailsVO {
@Excel(name = "批次ID")
private String batchId;
@Excel(name = "仓库ID")
// @Excel(name = "仓库ID")
private String warehouseId;
@Excel(name = "库位ID")
@Excel(name = "仓库名")
private String warehousesName;
// @Excel(name = "库位ID")
private String locationId;
private String locationName;
@Excel(name = "入库数量")
private Long actualQuantity;
......@@ -149,15 +155,33 @@ public class InboundDetailsVO {
this.inboundDate = inboundDate;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@Override
public String toString() {
return "InboundDetailsVO{" +
"sapNo='" + materialId + '\'' +
"materialId='" + materialId + '\'' +
", materialName='" + materialName + '\'' +
", orderId='" + orderId + '\'' +
", batchId='" + batchId + '\'' +
", warehouseId='" + warehouseId + '\'' +
", warehousesName='" + warehousesName + '\'' +
", locationId='" + locationId + '\'' +
", locationName='" + locationName + '\'' +
", actualQuantity=" + actualQuantity +
", actualPackages=" + actualPackages +
", labelColor='" + labelColor + '\'' +
......
......@@ -72,5 +72,5 @@ public interface InboundOrderItemsMapper
* 统计入库单明细
* @return 结果
*/
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo();
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO);
}
......@@ -3,6 +3,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.InboundOrders;
import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
/**
* 入库单主Mapper接口
......@@ -91,4 +92,25 @@ public interface InboundOrdersMapper
* @return 结果
*/
public int deleteInboundOrderItemsByOrderId(String id);
/**
* 统计本月入库次数
* @param monthParam yy-MM
* @return 结果
*/
public int countInboundOrders(String monthParam);
/**
* 按数量统计本月入库物料Top前10
* @param monthParam yy-MM
* @return 结果
*/
public List<InboundMaterialTotalVO> countInboundMaterialQuantity(String monthParam);
/**
* 按金额统计本月入库物料Top前10
* @param monthParam yy-MM
* @return 结果
*/
public List<InboundMaterialTotalVO> countInboundMaterialMoney(String monthParam);
}
......@@ -6,6 +6,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
/**
* 库存Mapper接口
......@@ -25,7 +26,7 @@ public interface InventoryMapper
/**
* 查询库存
*
* @param id 库存主键
* @param inventory 实体
* @return 库存
*/
public Inventory selectInventory(Inventory inventory);
......@@ -97,4 +98,11 @@ public interface InventoryMapper
* @return 库存明细集合
*/
public List<Inventory> selectInventoryDetailList(Inventory inventory);
/**
* 统计物料库存超出预警库存数量
*
* @return 超出预警值物料信息集合
*/
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList();
}
......@@ -50,6 +50,14 @@ public interface MaterialsCategoryMapper
public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/**
* 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 删除物料分类
*
* @param id 物料分类主键
......
......@@ -57,28 +57,14 @@ public interface MaterialsMapper
public int updateMaterials(Materials materials);
/**
* 删除物料
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
* 批量修改物料的使用状态
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int updateMaterialsIsUsedByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
*
......@@ -96,4 +82,19 @@ public interface MaterialsMapper
@MapKey("sap_no")
public List<Map<String, Object>> getMapList();
/**
* 删除物料(暂无用)
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料(暂无用)
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
}
......@@ -74,5 +74,5 @@ public interface IInboundOrderItemsService
* 统计入库单明细
* @return 结果
*/
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo();
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO);
}
......@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.InboundOrders;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.domain.vo.InboundTemplateVO;
/**
......@@ -69,4 +70,24 @@ public interface IInboundOrdersService
* @return 结果
*/
public String importInboundOrders(List<InboundTemplateVO> inboundOrders, Boolean isUpdateSupport, String operName);
/**
* 统计本月入库数量
*
* @return 结果
*/
public int countInboundOrders();
/**
* 按数量统计本月入库物料Top前10
* @return 结果
*/
public List<InboundMaterialTotalVO> countInboundMaterialQuantity();
/**
* 按金额统计本月入库物料Top前10
* @return 结果
*/
public List<InboundMaterialTotalVO> countInboundMaterialMoney();
}
......@@ -8,6 +8,7 @@ import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
/**
* 库存Service接口
......@@ -107,4 +108,11 @@ public interface IInventoryService
*/
public List<Inventory> selectInventoryDetailList(Inventory inventory);
/**
* 统计库存物料超出预警值
*
* @return 超出预警物料信息集合
*/
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList();
}
......@@ -70,7 +70,15 @@ public interface IMaterialsCategoryService
public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/**
* 批量删除物料分类
* 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 批量删除物料分类(暂无用)
*
* @param ids 需要删除的物料分类主键集合
* @return 结果
......@@ -78,7 +86,7 @@ public interface IMaterialsCategoryService
public int deleteMaterialsCategoryByIds(String[] ids);
/**
* 删除物料分类信息
* 删除物料分类信息(暂无用)
*
* @param id 物料分类主键
* @return 结果
......
......@@ -46,7 +46,7 @@ public interface IMaterialsService
public int updateMaterials(Materials materials);
/**
* 批量删除物料
* 批量删除物料 (暂时无用)
*
* @param ids 需要删除的物料主键集合
* @return 结果
......@@ -54,6 +54,14 @@ public interface IMaterialsService
public int deleteMaterialsByIds(String[] ids);
/**
* 修改物料有效状态
*
* @param ids 需要删除的物料主键集合
* @return 结果
*/
public int updateMaterialsIsUsed(String[] ids);
/**
* 删除物料信息
*
* @param id 物料主键
......
......@@ -176,7 +176,7 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
}
@Override
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo() {
return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo();
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO) {
return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo(inboundDetailsVO);
}
}
package com.ruoyi.inventory.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import org.springframework.util.CollectionUtils;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
......@@ -133,6 +137,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
inboundOrderItems.setId(UUID.randomUUID().toString());
inboundOrderItems.setOrderId(orderId);
inboundOrderItems.setCreateTime(DateUtils.getNowDate());
inboundOrderItems.setInboundOrderId(inboundOrders.getId());
list.add(inboundOrderItems);
}
if (list.size() > 0)
......@@ -292,4 +297,32 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
return finalSuccessMsg;
}
}
/**
* 统计本月入库数量
*
* @return 结果
*/
@Override
public int countInboundOrders() {
String monthParam = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
return inboundOrdersMapper.countInboundOrders(monthParam);
}
/**
* 按数量统计本月入库物料Top前10
* @return 结果
*/
@Override
public List<InboundMaterialTotalVO> countInboundMaterialQuantity() {
String monthParam = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
return inboundOrdersMapper.countInboundMaterialQuantity(monthParam);
}
/**
* 按金额统计本月入库物料Top前10
* @return 结果
*/
@Override
public List<InboundMaterialTotalVO> countInboundMaterialMoney() {
String monthParam = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
return inboundOrdersMapper.countInboundMaterialMoney(monthParam);
}
}
......@@ -9,6 +9,7 @@ import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
import com.ruoyi.inventory.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
......@@ -262,4 +263,9 @@ public class InventoryServiceImpl implements IInventoryService
{
return inventoryMapper.selectInventoryDetailList(inventory);
}
@Override
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList() {
return inventoryMapper.selectInventoryExceedWarnList();
}
}
......@@ -168,7 +168,18 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
}
/**
* 批量删除物料分类
* 修改物料分类有效状态
*
* @param ids 物料分类
* @return 结果
*/
@Override
public int updateCategoryIsUsedByIds(String[] ids) {
return materialsCategoryMapper.updateCategoryIsUsedByIds(ids);
}
/**
* 批量删除物料分类(暂无用)
*
* @param ids 需要删除的物料分类主键
* @return 结果
......@@ -180,7 +191,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
}
/**
* 删除物料分类信息
* 删除物料分类信息(暂无用)
*
* @param id 物料分类主键
* @return 结果
......
......@@ -77,35 +77,23 @@ public class MaterialsServiceImpl implements IMaterialsService
}
/**
* 批量修改物料的使用状态
* 修改物料的使用状态
*
* @param ids 需要删除的物料主键
* @return 结果
*/
@Override
public int deleteMaterialsByIds(String[] ids)
{
public int updateMaterialsIsUsed(String[] ids) {
return materialsMapper.updateMaterialsIsUsedByIds(ids);
}
/**
* 删除物料信息
* 导入物料
*
* @param id 物料主键
* @param materialsList 物料列表
* @return 结果
*/
@Override
public int deleteMaterialsById(String id)
{
return materialsMapper.deleteMaterialsById(id);
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
@Override
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(materialsList) || materialsList.size() == 0)
......@@ -176,4 +164,33 @@ public class MaterialsServiceImpl implements IMaterialsService
public List<Map<String, Object>> getMapList(){
return materialsMapper.getMapList();
}
/**
* 删除物料信息(暂时无用)
*
* @param id 物料主键
* @return 结果
*/
@Override
public int deleteMaterialsById(String id)
{
return materialsMapper.deleteMaterialsById(id);
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
/**
* 批量删除(暂时无用)
*
* @param ids 需要删除的物料主键
* @return 结果
*/
@Override
public int deleteMaterialsByIds(String[] ids)
{
return materialsMapper.deleteMaterialsByIds(ids);
}
}
......@@ -81,7 +81,9 @@
ii.material_id,
ii.batch_id,
ii.warehouse_id,
w.warehouses_name,
ii.location_id,
sl.location_name,
ii.planned_quantity,
ii.actual_quantity,
ii.planned_packages,
......@@ -104,6 +106,8 @@
m.material_name
FROM inbound_order_items ii
LEFT JOIN materials m ON ii.material_id = m.sap_no
left join warehouses w on ii.warehouse_id = w.id
left join storage_locations sl on ii.location_id = sl.id
<where>
<!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or -->
<if test="inboundOrderId != null and inboundOrderId != ''">
......@@ -279,7 +283,9 @@
<result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
......@@ -309,8 +315,9 @@
<result column="order_id" property="orderId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR" />
<result column="warehouses_name" property="warehousesName" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR"/>
<result column="location_name" property="locationName" jdbcType="VARCHAR" />
<!-- 数值型字段 -->
<result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" />
<result column="actual_packages" property="actualPackages" jdbcType="BIGINT" />
......@@ -329,14 +336,16 @@
<result column="inbound_date" property="inboundDate"/>
</resultMap>
<select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap">
<select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap" parameterType="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
SELECT
ioi.material_id,
ms.material_name,
ioi.order_id,
ioi.batch_id,
ioi.warehouse_id,
w.warehouses_name,
ioi.location_id,
sl.location_name,
SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages,
ioi.label_color,
......@@ -347,7 +356,32 @@
FROM inbound_orders io
INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id
INNER JOIN materials ms ON ms.sap_no = ioi.material_id
WHERE io.order_status = 2
inner join warehouses w on ioi.warehouse_id = w.id
inner join storage_locations sl on ioi.location_id = sl.id
<where>
io.order_status = 2
<if test="materialId != null and materialId != ''">
AND ioi.material_id = #{materialId}
</if>
<if test="materialName != null and materialName != ''">
AND ms.material_name LIKE CONCAT('%', #{materialName}, '%')
</if>
<if test="orderId != null and orderId != ''">
AND ioi.order_id = #{orderId}
</if>
<if test="batchId != null and batchId != ''">
AND ioi.batch_id = #{batchId}
</if>
<if test="warehouseId != null and warehouseId != ''">
AND ioi.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
AND ioi.location_id = #{locationId}
</if>
<if test="labelColor != null and labelColor != ''">
AND ioi.label_color = #{labelColor}
</if>
</where>
GROUP BY
ioi.material_id,
ioi.batch_id,
......
......@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" />
<result property="inboundDate" column="inbound_date" />
<result property="orderType" column="order_type" />
......@@ -32,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="inboundOrderItemsList" ofType="InboundOrderItems" column="id" select="selectInboundOrderItemsList" />
</resultMap>
<resultMap type="InboundOrderItems" id="InboundOrderItemsResult">
<resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
......@@ -60,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectInboundOrdersVo">
select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_orders
select io.id, io.order_id, io.system_no, io.order_type_id, io.batch_id, io.warehouse_id, io.owner_id, o.owner_name,
io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
io.remark, io.op_user_name, io.is_used, io.sort_no, io.create_time, io.create_user_code, io.update_time, io.update_user_code
from inbound_orders io left join owners o on io.owner_id = o.id
</sql>
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/>
<where>
<where>
<if test="id != null and Id != ''"> and id = #{Id}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
......@@ -88,17 +95,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult">
select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from inbound_orders
where id = #{id}
select io.id, io.order_id, io.system_no, io.order_type_id, io.batch_id, io.warehouse_id, io.owner_id, o.owner_name,
io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
io.remark, io.op_user_name, io.is_used, io.sort_no, io.create_time, io.create_user_code, io.update_time, io.update_user_code
from inbound_orders as io
left join owners as o on io.owner_id = o.id
where io.id = #{id}
</select>
<select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult">
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code, inbound_order_id
from inbound_order_items
where inbound_order_id = #{inboundOrderId}
select ioi.id, ioi.order_id, ioi.material_id, m.material_name, ioi.batch_id, ioi.warehouse_id, w.warehouses_name,
ioi.location_id, sl.location_name, ioi.planned_quantity, ioi.actual_quantity, ioi.planned_packages,
ioi.actual_packages, ioi.divisor, ioi.label_color, ioi.voucher_number, ioi.unit_price, ioi.item_status,
ioi.received_at, ioi.received_by, ioi.remark, ioi.is_used, ioi.sort_no, ioi.create_time, ioi.create_user_code,
ioi.update_time, ioi.update_user_code, ioi.inbound_order_id
from inbound_order_items as ioi
left join warehouses as w on ioi.warehouse_id = w.id
left join storage_locations as sl on ioi.location_id = sl.id
left join materials as m on ioi.material_id = m.sap_no
where ioi.inbound_order_id = #{id}
</select>
<select id="selectInboundOrdersByOrderId" resultType="InboundOrders">
select id, order_id
from inbound_orders
......@@ -210,4 +228,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.id}, #{item.orderId}, #{item.materialId}, #{item.batchId}, #{item.warehouseId}, #{item.locationId}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.plannedPackages}, #{item.actualPackages}, #{item.divisor}, #{item.labelColor}, #{item.voucherNumber}, #{item.unitPrice}, #{item.itemStatus}, #{item.receivedAt}, #{item.receivedBy}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode}, #{item.inboundOrderId})
</foreach>
</insert>
<!-- 统计入库次数-->
<select id="countInboundOrders" resultType="int" parameterType="String">
select count(id)
from inbound_orders
where DATE_FORMAT(inbound_date, '%Y-%m') = #{monthParam};
</select>
<!-- 统计入库物料数量Top10-->
<resultMap id="InboundMaterialTotalResultMap" type="com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO">
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="total_quantity" property="totalQuantity" jdbcType="BIGINT"/>
<result column="total_money" property="totalMoney" jdbcType="DECIMAL"/>
</resultMap>
<select id="countInboundMaterialQuantity" resultMap="InboundMaterialTotalResultMap" parameterType="String">
select ioi.material_name,sum(ioi.actual_quantity) as total_quantity
from inbound_order as io
inner join inbound_order_items as ioi on io.id = ioi.inbound_order_id
inner join materials as m on ioi.material_id = m.id
where io.order_status = 2
group by m.id
order by total_quantity desc
limit 10
</select>
<select id="countInboundMaterialMoney" resultMap="InboundMaterialTotalResultMap" parameterType="String">
select ioi.material_name,sum(ioi.actual_quantity * ioi.unit_price) as total_money
from inbound_order as io
inner join inbound_order_items as ioi on io.id = ioi.inbound_order_id
inner join materials as m on ioi.material_id = m.id
where io.order_status = 2
group by m.id
order by total_money desc
limit 10
</select>
</mapper>
\ No newline at end of file
......@@ -317,4 +317,24 @@ and inventory_status = '1'
#{id}
</foreach>
</delete>
<!-- 库存物料超出预警值统计-->
<resultMap id="InventoryExceedWarnResultMap" type="com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO">
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="category_name" property="categoryName" jdbcType="VARCHAR"/>
<result column="sap_no" property="sapNo" jdbcType="VARCHAR"/>
<result column="quantity" property="quantity" jdbcType="BIGINT"/>
<result column="min_stock_level" property="minStockLevel" jdbcType="BIGINT"/>
<result column="max_stock_level" property="maxStockLevel" jdbcType="BIGINT"/>
</resultMap>
<select id="selectInventoryExceedWarnList" resultMap="InventoryExceedWarnResultMap">
select m.material_name,mc.category_name,m.sap_no,
COALESCE(i.quantity, 0) AS quantity,
COALESCE(m.min_stock_level, 0) AS min_stock_level,
COALESCE(m.max_stock_level, 9999) AS max_stock_level
from materials as m
inner join inventory as i on i.material_id = m.id
inner join materials_category as mc on m.category_code = mc.id
where COALESCE(i.quantity, 0) &gt; COALESCE(m.max_stock_level, 999999)
or COALESCE(i.quantity, 0) &lt; COALESCE(m.min_stock_level, 0)
</select>
</mapper>
\ No newline at end of file
......@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryList" parameterType="MaterialsCategory" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/>
<where>
is_used != 0
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="categoryCode != null and categoryCode != ''"> and category_code like concat('%', #{categoryCode}, '%')</if>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
......@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null "> and create_time like concat('%', #{createTime}, '%')</if>
<if test="updateTime != null "> and update_time like concat('%', #{updateTime}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<!-- <if test="isUsed != null "> and is_used = #{isUsed}</if>-->
</where>
order by sort_no asc
</select>
......@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryById" parameterType="String" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/>
where id = #{id}
and is_used != 0
order by sort_no asc
</select>
<insert id="insertMaterialsCategory" parameterType="MaterialsCategory">
......@@ -84,6 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateCategoryIsUsedByIds" parameterType="String">
update materials_category
set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteMaterialsCategoryById" parameterType="String">
delete from materials_category where id = #{id}
</delete>
......
......@@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join storage_locations sl on st_it.location_id = sl.location_code and sl.is_used = 1
left join sys_dict_data dict on ma.hazard_id = dict.dict_sort and dict.status =0 and dict.dict_type ='danger_type'
where
st.is_used = 1
st.is_used = 1 and IFNULL(st_it.variance_quantity, 0) != 0
<if test="materialId != null "> and st_it.material_id = #{materialId}</if>
<if test="plannedDateArray != null and plannedDateArray.length > 0">
and date_format(st.planned_date,'%Y%m%d') in
......
......@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join storage_locations sl on st_it.location_id = sl.location_code and sl.is_used = 1
left join sys_dict_data dict on ma.hazard_id = dict.dict_sort and dict.status =0 and dict.dict_type ='danger_type'
where
st.is_used = 1
st.is_used = 1 and IFNULL(st_it.variance_quantity, 0) != 0
<if test="materialId != null "> and st_it.material_id = #{materialId}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(st.planned_date,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论