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) { ...@@ -42,3 +42,24 @@ export function delInbound(id) {
method: 'delete' 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) { ...@@ -51,9 +51,10 @@ export function delInbound_items(id) {
} }
// 统计入库单明细 // 统计入库单明细
export function inbound_details(){ export function inbound_details(query){
return request({ return request({
url: '/inventory/inbound_items/details', url: '/inventory/inbound_items/details',
method: 'get' method: 'get',
params: query
}) })
} }
...@@ -95,4 +95,12 @@ export function listInventoryDetail(query) { ...@@ -95,4 +95,12 @@ export function listInventoryDetail(query) {
method: 'get', method: 'get',
params: query 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) { ...@@ -39,7 +39,7 @@ export function updateMaterials(data) {
export function delMaterials(id) { export function delMaterials(id) {
return request({ return request({
url: '/inventory/materials/' + id, url: '/inventory/materials/' + id,
method: 'delete' method: 'put'
}) })
} }
......
...@@ -39,7 +39,7 @@ export function updateMaterials_category(data) { ...@@ -39,7 +39,7 @@ export function updateMaterials_category(data) {
export function delMaterials_category(id) { export function delMaterials_category(id) {
return request({ return request({
url: '/inventory/materials_category/' + id, url: '/inventory/materials_category/' + id,
method: 'delete' method: 'put'
}) })
} }
...@@ -49,4 +49,4 @@ export function categoryTreeSelect() { ...@@ -49,4 +49,4 @@ export function categoryTreeSelect() {
url: '/inventory/materials_category/categoryTree', url: '/inventory/materials_category/categoryTree',
method: 'get' method: 'get'
}) })
} }
\ No newline at end of file
...@@ -23,18 +23,26 @@ ...@@ -23,18 +23,26 @@
@search="handleQuery" @search="handleQuery"
@reset="resetQuery" @reset="resetQuery"
> >
<el-form-item label="入库单号" prop="orderId"> <el-form-item label="物料SAPNO" prop="materialId">
<el-input <el-input
v-model="queryParams.orderId" v-model="queryParams.materialId"
placeholder="请输入入库单号" placeholder="请输入物料SAPNO"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="系统编号" prop="systemNo"> <el-form-item label="物料名称" prop="materialName">
<el-input <el-input
v-model="queryParams.systemNo" v-model="queryParams.materialName"
placeholder="请输入系统编号" placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="关联入库单单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入入库单单号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
...@@ -47,34 +55,49 @@ ...@@ -47,34 +55,49 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable>
<el-option
v-for="item in inBoundTypeOptions"
:key="item.orderTypeId"
:label="item.orderTypeName"
:value="item.orderTypeId"
/>
</el-select>
</el-form-item>
<el-form-item label="入库单状态" prop="orderStatus"> <el-form-item label="仓库" prop="warehouseId">
<el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable> <el-input
<el-option v-model="queryWarehouseName"
v-for="item in inBoundStatusOptions" placeholder="请选择仓库"
:key="item.orderStatus" readonly
:label="item.orderStatusName" @focus="openWarehouseSelector"
:value="item.orderStatus" :suffix-icon="''"
/> >
</el-select> <template v-if="queryWarehouseName" #suffix>
</el-form-item> <i
<el-form-item label="订单类型" prop="orderType"> class="el-icon-circle-close el-input__icon"
<el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable> style="cursor: pointer;"
@click.stop="clearQueryWarehouse"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="库位" prop="locationId">
<el-input
v-model="queryLocationName"
placeholder="请选择库位"
readonly
@focus="openLocationSelector"
:suffix-icon="''"
:disabled="!queryParams.warehouseId"
>
<template v-if="queryLocationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryLocation"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="标签颜色" prop="labelColor">
<el-select v-model="queryParams.labelColor" placeholder="请选择标签颜色" clearable>
<el-option <el-option
v-for="item in orderTypeOptions" v-for="dict in dict.type.label_color"
:key="item.orderType" :key="dict.value"
:label="item.orderTypeName" :label="dict.label"
:value="item.orderType" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -87,22 +110,32 @@ ...@@ -87,22 +110,32 @@
height="100%" height="100%"
:data="inboundList" :data="inboundList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:row-key="(row) => row.materialId + '_' + row.orderId"
> >
<el-table-column label="物料SAPNO" align="center" prop="materialId" width="200"/> <el-table-column label="物料SAPNO" align="center" prop="materialId" width="200"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="200"/> <el-table-column label="物料名称" align="center" prop="materialName" width="200"/>
<el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/> <el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/> <el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="仓库ID" align="center" prop="warehouseId" width="200"/> <el-table-column label="所在仓库" align="center" prop="warehousesName" width="200"/>
<el-table-column label="库位ID" align="center" prop="locationId" width="200"/> <el-table-column label="库位ID" align="center" prop="locationName" width="200"/>
<el-table-column label="入库数量" align="center" prop="actualQuantity" width="200"/> <el-table-column label="入库数量" align="center" prop="actualQuantity" width="200"/>
<el-table-column label="件数" align="center" prop="actualPackages" width="200"/> <el-table-column label="件数" align="center" prop="actualPackages" width="200"/>
<el-table-column label="单价" align="center" prop="unitPrice" width="200"/> <el-table-column label="单价" align="center" prop="unitPrice" width="200"/>
<el-table-column label="入库批次物料总价" align="center" prop="totalPrice" width="200"/> <el-table-column label="入库批次物料总价" align="center" prop="totalPrice" width="200"/>
<el-table-column label="标签颜色" align="center" prop="labelColor" width="200"/> <el-table-column label="标签颜色" align="center" prop="labelColor" width="200">
<template slot-scope="scope">
<el-tag
:type="getDictListClass('label_color', scope.row.labelColor)"
size="small"
>
{{ getDictLabel('label_color', scope.row.labelColor) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="200"/> <el-table-column label="备注" align="center" prop="remark" width="200"/>
<el-table-column label="入库时间" align="center" prop="inboundDate" width="200"> <el-table-column label="入库时间" align="center" prop="inboundDate" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.inboundDate) }}</span> <span>{{ parseTime(scope.row.inboundDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
...@@ -133,6 +166,17 @@ ...@@ -133,6 +166,17 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 仓库选择组件 -->
<WarehouseSelector
v-model="warehouseSelectorVisible"
@selected="handleWarehouseSelected"
/>
<!-- 库位选择组件 -->
<LocationSelector
v-model="locationSelectorVisible"
:warehousesId="queryParams.warehouseId"
@selected="handleLocationSelected"
/>
</div> </div>
<!-- 入库单详情弹窗 --> <!-- 入库单详情弹窗 -->
...@@ -198,29 +242,41 @@ import { batchAddInventory } from "@/api/inventory/inventory" ...@@ -198,29 +242,41 @@ import { batchAddInventory } from "@/api/inventory/inventory"
import InboundItems from "@/views/inventory/inbound_items/index.vue" import InboundItems from "@/views/inventory/inbound_items/index.vue"
import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件 import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件
import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件 import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件
import { listWarehouses } from "@/api/inventory/warehouses"
import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
import LocationSelector from "@/views/compononents/LocationSelector.vue"
export default { export default {
name: "Inbound", name: "InboundDetails",
dicts: ['label_color'],
filters: {
dictFilter(value, dictType) {
if (!value || !this.dict[dictType]) return '-';
return this.dict.type[dictType][value] || '-';
}
},
components: { components: {
InboundItems, InboundItems,
PageTitle, PageTitle,
PageWrapperSearch PageWrapperSearch,
WarehouseSelector,
LocationSelector
}, },
data() { data() {
return { return {
inBoundTypeOptions: [ labelColorOptions: [],
{ orderTypeId: '1', orderTypeName: '入库类型1' }, // 仓库列表
{ orderTypeId: '2', orderTypeName: '入库类型2' } warehouseOptions: [],
], // 库位列表
inBoundStatusOptions: [ locationOptions: [],
{ orderStatus: 1, orderStatusName: '草稿', type: 'info' }, loadingWarehouse: false,
{ orderStatus: 2, orderStatusName: '已完成', type: 'success' }, // 仓库选择相关
{ orderStatus: 3, orderStatusName: '已取消', type: 'danger' } warehouseSelectorVisible: false,
], queryWarehouseName: null,
orderTypeOptions: [ // 库位选择相关
{ orderType: '1', orderTypeName: '订单类型1' }, locationSelectorVisible: false,
{ orderType: '2', orderTypeName: '订单类型2' } queryLocationName: null,
], // 可编辑状态
isEditable: true, isEditable: true,
// 物料组件显示 // 物料组件显示
materialSelectOpen: false, materialSelectOpen: false,
...@@ -256,6 +312,7 @@ export default { ...@@ -256,6 +312,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
materialId: null,
orderId: null, orderId: null,
orderTypeId: null, orderTypeId: null,
systemNo: null, systemNo: null,
...@@ -290,31 +347,37 @@ export default { ...@@ -290,31 +347,37 @@ export default {
updateUserCode: null, updateUserCode: null,
// 明细列表 // 明细列表
inboundOrderItemsList: [] inboundOrderItemsList: []
},
// 表单校验
rules: {
orderId: [
{ required: true, message: "入库单号不能为空", trigger: "blur" }
],
orderTypeId: [
{ required: true, message: "入库类型不能为空", trigger: "blur" }
],
systemNo: [
{ required: true, message: "系统编号不能为空", trigger: "blur" }
],
batchId: [
{ required: true, message: "批次ID不能为空", trigger: "blur" }
]
} }
} }
}, },
mounted(){
// console.log("标签颜色字典数据:", this.dict.type.label_color);
},
created() { created() {
this.getList() this.getList()
// 初始化标签颜色下拉选项
}, },
methods: { 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 || '';
},
/** 查询入库列表 */ /** 查询入库列表 */
getList() { getList() {
this.loading = true this.loading = true
inbound_details(this.queryParams).then(response => { inbound_details(this.queryParams).then(response => {
this.inboundList = response.rows this.inboundList = response.rows
this.total = response.total this.total = response.total
...@@ -323,26 +386,6 @@ export default { ...@@ -323,26 +386,6 @@ export default {
this.loading = false this.loading = false
}) })
}, },
/** 获取状态样式类型 */
getStatusType(status) {
const item = this.inBoundStatusOptions.find(item => item.orderStatus === status)
return item ? item.type : 'info'
},
/** 获取状态类型名称 */
getStatusName(status) {
const item = this.inBoundStatusOptions.find(item => item.orderStatus === status)
return item ? item.orderStatusName : status
},
getInBoundTypeName(typeId) {
if (!typeId) return '未知类型'
const item = this.inBoundTypeOptions.find(item => item.orderTypeId === typeId)
return item ? item.orderTypeName : '未知类型'
},
getOrderTypeName(type) {
if (!type) return '未知类型'
const item = this.orderTypeOptions.find(item => item.orderType === type)
return item ? item.orderTypeName : '未知类型'
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
...@@ -389,7 +432,7 @@ export default { ...@@ -389,7 +432,7 @@ export default {
getInbound(id).then(response => { getInbound(id).then(response => {
this.form = response.data this.form = response.data
// 加载明细数据 // 加载明细数据
this.inboundOrderId = id this.inboundOrderId = id
this.$nextTick(() => { this.$nextTick(() => {
}) })
this.open = true this.open = true
...@@ -408,6 +451,51 @@ export default { ...@@ -408,6 +451,51 @@ export default {
this.detailOpen = true this.detailOpen = true
}) })
}, },
/** 打开仓库选择器 */
openWarehouseSelector() {
this.warehouseSelectorVisible = true
},
/** 仓库选择回调 */
handleWarehouseSelected(warehouse) {
if (!warehouse) return
this.queryParams.warehouseId = warehouse.warehouseId
this.queryWarehouseName = warehouse.warehousesName || warehouse.warehousesCode
// 仓库选择后,清空库位信息
this.queryLocationName = null
this.queryParams.locationId = null
this.handleQuery()
},
/** 清空仓库选择 */
clearQueryWarehouse() {
this.queryWarehouseName = null
this.queryParams.warehouseId = null
this.queryParams.warehousesCode = null
// 清空仓库时,同时清空库位
this.queryLocationName = null
this.queryParams.locationId = null
this.handleQuery()
},
/** 打开库位选择器 */
openLocationSelector() {
if (!this.queryParams.warehouseId) {
this.$message.warning("请先选择仓库")
return
}
this.locationSelectorVisible = true
},
/** 库位选择回调 */
handleLocationSelected(location) {
if (!location) return
this.queryParams.locationId = location.locationId || location.id
this.queryLocationName = location.locationName || location.locationCode
this.handleQuery()
},
/** 清空库位选择 */
clearQueryLocation() {
this.queryLocationName = null
this.queryParams.locationId = null
this.handleQuery()
},
// 打开物料选择弹窗 // 打开物料选择弹窗
showMaterials(status) { showMaterials(status) {
this.materialSelectOpen = status; this.materialSelectOpen = status;
...@@ -489,7 +577,6 @@ export default { ...@@ -489,7 +577,6 @@ export default {
// 捕获取消确认/接口失败的异常 // 捕获取消确认/接口失败的异常
if (error !== 'cancel') { if (error !== 'cancel') {
this.$message.error('确认入库失败:' + (error.msg || '网络异常')); this.$message.error('确认入库失败:' + (error.msg || '网络异常'));
console.log(error)
} }
} }
}, },
...@@ -715,4 +802,4 @@ export default { ...@@ -715,4 +802,4 @@ export default {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
</style> </style>
\ No newline at end of file
...@@ -88,31 +88,49 @@ ...@@ -88,31 +88,49 @@
<el-form-item label="入库类型" prop="orderTypeId"> <el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable> <el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable>
<el-option <el-option
v-for="item in inBoundTypeOptions" v-for="dict in dict.type.inbound_type"
:key="item.orderTypeId" :key="dict.value"
:label="item.orderTypeName" :label="dict.label"
:value="item.orderTypeId" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 新增:搜索页货主选择 -->
<el-form-item label="货主" prop="ownerId">
<el-input
v-model="queryOwnerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector('query')"
@click="openOwnerSelector('query')"
:suffix-icon="''"
>
<template v-if="queryOwnerName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryOwner"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="入库单状态" prop="orderStatus"> <el-form-item label="入库单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable> <el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable>
<el-option <el-option
v-for="item in inBoundStatusOptions" v-for="dict in dict.type.inbound_status"
:key="item.orderStatus" :key="dict.value"
:label="item.orderStatusName" :label="dict.label"
:value="item.orderStatus" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="订单类型" prop="orderType"> <el-form-item label="订单类型" prop="orderType">
<el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable> <el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable>
<el-option <el-option
v-for="item in orderTypeOptions" v-for="dict in dict.type.order_type"
:key="item.orderType" :key="dict.value"
:label="item.orderTypeName" :label="dict.label"
:value="item.orderType" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -129,18 +147,24 @@ ...@@ -129,18 +147,24 @@
<el-table-column type="selection" width="55" align="center" fixed /> <el-table-column type="selection" width="55" align="center" fixed />
<el-table-column label="入库单号" align="center" prop="orderId" width="200"/> <el-table-column label="入库单号" align="center" prop="orderId" width="200"/>
<el-table-column label="系统编号" align="center" prop="systemNo" width="200"/> <el-table-column label="系统编号" align="center" prop="systemNo" width="200"/>
<!-- 新增:表格显示货主名称 -->
<el-table-column label="货主" align="center" prop="ownerName" width="200"/>
<el-table-column label="入库类型" align="center" prop="orderTypeId" :show-overflow-tooltip="true" width="200"> <el-table-column label="入库类型" align="center" prop="orderTypeId" :show-overflow-tooltip="true" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" size="small"> <el-tag
{{ getInBoundTypeName(scope.row.orderTypeId) }} :type="getDictListClass('inbound_type',scope.row.orderTypeId)"
size="small">
{{ getDictLabel('inbound_type',scope.row.orderTypeId) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="订单类型" align="center" prop="orderType" :show-overflow-tooltip="true" width="200"> <el-table-column label="订单类型" align="center" prop="orderType" :show-overflow-tooltip="true" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" size="small"> <el-tag
{{ getOrderTypeName(scope.row.orderType) }} :type="getDictListClass('order_type',scope.row.orderTypeId)"
size="small">
{{ getDictLabel('order_type',scope.row.orderTypeId) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -148,8 +172,8 @@ ...@@ -148,8 +172,8 @@
<el-table-column label="入库单状态" align="center" prop="orderStatus" width="200"> <el-table-column label="入库单状态" align="center" prop="orderStatus" width="200">
<!-- 状态显示 --> <!-- 状态显示 -->
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.orderStatus)" size="small" width="200"> <el-tag :type="getDictListClass('inbound_status',scope.row.orderStatus+'')" size="small" width="200">
{{ getStatusName(scope.row.orderStatus) }} {{ getDictLabel('inbound_status',scope.row.orderStatus+"") }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -228,10 +252,10 @@ ...@@ -228,10 +252,10 @@
<el-form-item label="入库类型" prop="orderTypeId"> <el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="form.orderTypeId" placeholder="请选择入库类型" clearable> <el-select v-model="form.orderTypeId" placeholder="请选择入库类型" clearable>
<el-option <el-option
v-for="item in inBoundTypeOptions" v-for="dict in dict.type.inbound_type"
:key="item.orderTypeId" :key="dict.value"
:label="item.orderTypeName" :label="dict.label"
:value="item.orderTypeId" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -250,24 +274,39 @@ ...@@ -250,24 +274,39 @@
<el-form-item label="系统编号" prop="systemNo"> <el-form-item label="系统编号" prop="systemNo">
<el-input v-model="form.systemNo" placeholder="请输入系统编号" /> <el-input v-model="form.systemNo" placeholder="请输入系统编号" />
</el-form-item> </el-form-item>
<el-form-item label="货主ID" prop="ownerId"> <el-form-item label="货主" prop="ownerId">
<el-input v-model="form.ownerId" placeholder="请输入货主ID" /> <el-input
v-model="form.ownerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector('form')"
@click="openOwnerSelector('form')"
:suffix-icon="''"
>
<template v-if="form.ownerName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearFormOwner"
></i>
</template>
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="订单类型" prop="orderType"> <el-form-item label="订单类型" prop="orderType">
<el-select v-model="form.orderType" placeholder="请选择订单类型" clearable> <el-select v-model="form.orderType" placeholder="请选择订单类型" clearable>
<el-option <el-option
v-for="item in orderTypeOptions" v-for="dict in dict.type.order_type"
:key="item.orderType" :key="dict.value"
:label="item.orderTypeName" :label="dict.label"
:value="item.orderType" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-divider content-position="center">入库其他信息</el-divider> <!-- <el-divider content-position="center">入库其他信息</el-divider> -->
<el-row :gutter="24"> <!-- <el-row :gutter="24">
<el-col :span="12"> <el-col :span="12">
<div class="form-col"> <div class="form-col">
<el-form-item label="计划量" prop="totalPlannedQuantity"> <el-form-item label="计划量" prop="totalPlannedQuantity">
...@@ -290,7 +329,7 @@ ...@@ -290,7 +329,7 @@
<el-input v-model="form.opUserName" placeholder="请输入负责人" /> <el-input v-model="form.opUserName" placeholder="请输入负责人" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row> -->
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
...@@ -319,6 +358,8 @@ ...@@ -319,6 +358,8 @@
@batch-delete="handleBatchDelete" @batch-delete="handleBatchDelete"
@cell-change="handleCellChange" @cell-change="handleCellChange"
@show-materials="showMaterials" @show-materials="showMaterials"
@open-warehouse-selector="openWarehouseSelector"
@open-location-selector="openLocationSelector"
/> />
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -341,19 +382,19 @@ ...@@ -341,19 +382,19 @@
<el-descriptions-item label="入库单号">{{ detailForm.orderId || '-' }}</el-descriptions-item> <el-descriptions-item label="入库单号">{{ detailForm.orderId || '-' }}</el-descriptions-item>
<el-descriptions-item label="系统编号">{{ detailForm.systemNo || '-' }}</el-descriptions-item> <el-descriptions-item label="系统编号">{{ detailForm.systemNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item> <el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item>
<el-descriptions-item label="货主ID">{{ detailForm.ownerId || '-' }}</el-descriptions-item> <el-descriptions-item label="货主">{{ detailForm.ownerName || detailForm.ownerId || '-' }}</el-descriptions-item>
<el-descriptions-item label="入库类型"> <el-descriptions-item label="入库类型">
{{ getInBoundTypeName(detailForm.orderTypeId) }} {{ getDictLabel('inbound_type',detailForm.orderTypeId) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="订单类型"> <el-descriptions-item label="订单类型">
{{ getOrderTypeName(detailForm.orderType) }} {{ getDictLabel('order_type',detailForm.orderType) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="入库日期">{{ detailForm.inboundDate || '-' }}</el-descriptions-item> <el-descriptions-item label="入库日期">{{ detailForm.inboundDate || '-' }}</el-descriptions-item>
<el-descriptions-item label="负责人">{{ detailForm.opUserName || '-' }}</el-descriptions-item> <el-descriptions-item label="负责人">{{ detailForm.opUserName || '-' }}</el-descriptions-item>
<el-descriptions-item label="计划量">{{ detailForm.totalPlannedQuantity || '-' }}</el-descriptions-item> <el-descriptions-item label="计划量">{{ detailForm.totalPlannedQuantity || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际量">{{ detailForm.totalActualQuantity || '-' }}</el-descriptions-item> <el-descriptions-item label="实际量">{{ detailForm.totalActualQuantity || '-' }}</el-descriptions-item>
<el-descriptions-item label="总件数">{{ detailForm.totalPackages || '-' }}</el-descriptions-item> <!-- <el-descriptions-item label="总件数">{{ detailForm.totalPackages || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="仓库ID">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> <!-- <el-descriptions-item label="仓库ID">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="备注" :span="2"> <el-descriptions-item label="备注" :span="2">
<div class="remark-text">{{ detailForm.remark || '-' }}</div> <div class="remark-text">{{ detailForm.remark || '-' }}</div>
</el-descriptions-item> </el-descriptions-item>
...@@ -405,7 +446,22 @@ ...@@ -405,7 +446,22 @@
template-name="入库单导入模板" template-name="入库单导入模板"
@success="getList" @success="getList"
/> />
</div> <OwnerSelector
v-model="ownerSelectorVisible"
@selected="handleOwnerSelected"
/>
<!-- 仓库选择组件 -->
<WarehouseSelector
v-model="warehouseSelectorVisible"
@selected="handleWarehouseSelected"
/>
<!-- 库位选择组件 -->
<LocationSelector
v-model="locationSelectorVisible"
:warehousesId="currentEditRowWarehousesId"
@selected="handleLocationSelected"
/>
</div>
</template> </template>
<script> <script>
...@@ -417,31 +473,40 @@ import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组 ...@@ -417,31 +473,40 @@ import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组
import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件 import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件
import MaterialSelector from "@/views/inventory/materials/materialsSeletor.vue"; import MaterialSelector from "@/views/inventory/materials/materialsSeletor.vue";
import ImportExcel from "@/components/ImportExcel/index" import ImportExcel from "@/components/ImportExcel/index"
import OwnerSelector from "@/views/compononents/OwnerSelector.vue"
import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
import LocationSelector from "@/views/compononents/LocationSelector.vue"
export default { export default {
name: "Inbound", name: "Inbound",
dicts: ['inbound_type','order_type','inbound_status'],
components: { components: {
InboundItems, InboundItems,
PageTitle, PageTitle,
PageWrapperSearch, PageWrapperSearch,
MaterialSelector, MaterialSelector,
ImportExcel ImportExcel,
OwnerSelector,
WarehouseSelector,
LocationSelector
}, },
data() { data() {
return { return {
inBoundTypeOptions: [
{ orderTypeId: '1', orderTypeName: '入库类型1' },
{ orderTypeId: '2', orderTypeName: '入库类型2' }
],
inBoundStatusOptions: [ inBoundStatusOptions: [
{ orderStatus: 1, orderStatusName: '草稿', type: 'info' }, { orderStatus: 1, orderStatusName: '草稿', type: 'info' },
{ orderStatus: 2, orderStatusName: '已完成', type: 'success' }, { orderStatus: 2, orderStatusName: '已完成', type: 'success' },
{ orderStatus: 3, orderStatusName: '已取消', type: 'danger' } { orderStatus: 3, orderStatusName: '已取消', type: 'danger' }
], ],
orderTypeOptions: [ // 货主选择相关(对齐退库组件)
{ orderType: '1', orderTypeName: '订单类型1' }, queryOwnerName: null,
{ orderType: '2', orderTypeName: '订单类型2' } ownerSelectorVisible: false,
], ownerSelectTarget: 'form', // 标记当前货主选择的目标:query-搜索页,form-表单页
// 仓库和库位选择相关
warehouseSelectorVisible: false,
locationSelectorVisible: false,
currentEditRow: null,
currentEditRowWarehousesId: null,
// 可编辑状态
isEditable: true, isEditable: true,
// 物料组件显示 // 物料组件显示
materialSelectOpen: false, materialSelectOpen: false,
...@@ -482,22 +547,28 @@ export default { ...@@ -482,22 +547,28 @@ export default {
systemNo: null, systemNo: null,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
ownerId: null, ownerId: null, // 货主ID(搜索用)
ownerName: null, // 货主名称(搜索用)
ownerCode: null, // 货主编码(搜索用)
orderStatus: null, orderStatus: null,
orderType: null orderType: null
}, },
// 表单参数 // 表单参数(对齐退库组件的货主字段)
form: { form: {
id: null, id: null,
orderId: null, orderId: null,
orderTypeId: null, orderTypeId: null,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
ownerId: null, warehousesName: null,
ownerId: null, // 货主ID
ownerName: null, // 货主名称
ownerCode: null, // 货主编码
orderStatus: 1, orderStatus: 1,
referenceNo: null, referenceNo: null,
plannedArrivalDate: undefined, plannedArrivalDate: undefined,
actualArrivalDate: undefined, actualArrivalDate: undefined,
inboundDate: null, // 入库日期
totalPlannedQuantity: null, totalPlannedQuantity: null,
totalActualQuantity: null, totalActualQuantity: null,
totalPackages: null, totalPackages: null,
...@@ -525,10 +596,16 @@ export default { ...@@ -525,10 +596,16 @@ export default {
], ],
batchId: [ batchId: [
{ required: true, message: "批次ID不能为空", trigger: "blur" } { required: true, message: "批次ID不能为空", trigger: "blur" }
],
ownerId: [ // 新增货主必填校验
{ required: true, message: "货主不能为空", trigger: "change" }
] ]
} }
} }
}, },
mounted() {
console.log("dict:",this.dict)
},
created() { created() {
this.getList() this.getList()
}, },
...@@ -554,10 +631,19 @@ export default { ...@@ -554,10 +631,19 @@ export default {
const item = this.inBoundStatusOptions.find(item => item.orderStatus === status) const item = this.inBoundStatusOptions.find(item => item.orderStatus === status)
return item ? item.orderStatusName : status return item ? item.orderStatusName : status
}, },
getInBoundTypeName(typeId) { getDictLabel(dictType, value) {
if (!typeId) return '未知类型' // 1. 空值/字典不存在时返回默认值
const item = this.inBoundTypeOptions.find(item => item.orderTypeId === typeId) if (!value || !this.dict?.type?.[dictType]) return '-';
return item ? item.orderTypeName : '未知类型' // 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 || '';
}, },
getOrderTypeName(type) { getOrderTypeName(type) {
if (!type) return '未知类型' if (!type) return '未知类型'
...@@ -572,7 +658,8 @@ export default { ...@@ -572,7 +658,8 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = [] this.$refs.queryForm?.resetFields()
this.queryOwnerName = null
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
...@@ -582,10 +669,11 @@ export default { ...@@ -582,10 +669,11 @@ export default {
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
ownerId: null, ownerId: null,
ownerName: null,
ownerCode: null,
orderStatus: null, orderStatus: null,
orderType: null orderType: null
} }
// this.$refs.queryForm.resetFields()
this.handleQuery() this.handleQuery()
}, },
...@@ -605,19 +693,36 @@ export default { ...@@ -605,19 +693,36 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset();
const id = row.id const id = row.id;
getInbound(id).then(response => { getInbound(id).then(response => {
this.form = response.data this.form = response.data || {};
// 加载明细数据 // 货主回显
this.inboundOrderId = id this.form.ownerName = response.data.ownerName || response.data.ownerCode || response.data.ownerId;
// 仓库回显
this.form.warehousesName = response.data.warehousesName || response.data.warehouseId || '-';
// 明细行回显(核心:同步仓库/库位名称)
if (this.form.inboundOrderItemsList && this.form.inboundOrderItemsList.length) {
this.form.inboundOrderItemsList = this.form.inboundOrderItemsList.map(item => ({
...item,
// 仓库名称兜底
warehousesName: item.warehousesName || item.warehouseId || '-',
// 库位名称/编码兜底
locationName: item.locationName || item.locationCode || item.locationId || '-',
locationCode: item.locationCode || item.locationId || '-'
}));
}
this.inboundOrderId = id;
// 强制触发子组件的 value 监听(关键)
this.$nextTick(() => { this.$nextTick(() => {
}) this.$refs.inboundItemsRef?.handlePagination();
this.open = true this.$refs.inboundItemsRef?.calculateTotals();
this.title = "修改入库单" });
}).finally(() => { this.open = true;
this.inboundOrderId = null this.title = "修改入库单";
}) });
}, },
/** 查看详情 */ /** 查看详情 */
handleDetail(row) { handleDetail(row) {
...@@ -627,55 +732,144 @@ export default { ...@@ -627,55 +732,144 @@ export default {
getInbound(id).then(response => { getInbound(id).then(response => {
// 加载明细数据到详情 // 加载明细数据到详情
this.detailForm = response.data this.detailForm = response.data
// 适配货主回显
this.detailForm.ownerName = response.data.ownerName || response.data.ownerCode || response.data.ownerId
this.detailForm.inboundOrderId = id this.detailForm.inboundOrderId = id
this.detailOpen = true this.detailOpen = true
}).finally(() => {
this.detailForm.inboundOrderId = null
}) })
}, },
// 打开货主选择器(区分搜索/表单场景)
openOwnerSelector(target = 'form') {
this.ownerSelectTarget = target
this.ownerSelectorVisible = true
},
// 货主选择回调(对齐退库组件逻辑)
handleOwnerSelected(owner) {
if (!owner) return
// 搜索页选择货主
if (this.ownerSelectTarget === 'query') {
this.queryParams.ownerId = owner.ownerId
this.queryParams.ownerCode = owner.ownerCode
this.queryOwnerName = owner.ownerName || owner.ownerCode
this.handleQuery() // 选择后立即搜索
} else {
// 表单页选择货主
this.form.ownerId = owner.ownerId
this.form.ownerCode = owner.ownerCode
this.form.ownerName = owner.ownerName
}
this.ownerSelectorVisible = false
},
// 清空搜索页货主
clearQueryOwner() {
this.queryOwnerName = null
this.queryParams.ownerId = null
this.queryParams.ownerCode = null
this.queryParams.ownerName = null
this.handleQuery() // 清空后重新搜索
},
// 清空表单页货主
clearFormOwner() {
this.form.ownerId = null
this.form.ownerCode = null
this.form.ownerName = null
// 清除货主字段校验
this.$refs.form?.clearValidate('ownerId')
},
// 打开仓库选择器
openWarehouseSelector(row) {
this.currentEditRow = row
this.warehouseSelectorVisible = true
},
// 仓库选择回调
handleWarehouseSelected(warehouse) {
if (this.currentEditRow) {
// 1. 用 $set 赋值,确保响应式
this.$set(this.currentEditRow, 'warehouseId', warehouse.warehouseId);
this.$set(this.currentEditRow, 'warehousesName', warehouse.warehousesName);
// 2. 通知子组件刷新(关键:触发 displayData 的响应式更新)
this.$refs.inboundItemsRef?.syncDataToParent();
this.$refs.inboundItemsRef?.calculateTotals();
} else {
this.form.warehouseId = warehouse.warehouseId;
this.form.warehousesName = warehouse.warehousesName;
}
this.warehouseSelectorVisible = false;
},
// 打开库位选择器
openLocationSelector(row) {
this.currentEditRow = row
this.currentEditRowWarehousesId = row.warehouseId // 传递仓库ID给库位选择器
this.locationSelectorVisible = true
},
// 库位选择回调
handleLocationSelected(location) {
if (this.currentEditRow) {
// 1. 用 $set 赋值,确保响应式
this.$set(this.currentEditRow, 'locationId', location.locationId);
this.$set(this.currentEditRow, 'locationCode', location.locationCode);
this.$set(this.currentEditRow, 'locationName', location.locationName);
// 2. 通知子组件刷新
this.$refs.inboundItemsRef?.syncDataToParent();
this.$refs.inboundItemsRef?.calculateTotals();
}
this.locationSelectorVisible = false;
},
// 打开物料选择弹窗 // 打开物料选择弹窗
showMaterials(status) { showMaterials(status) {
this.materialSelectOpen = status; this.materialSelectOpen = status
if (status) { // 只有打开弹窗时才清空选择 if (status) { // 只有打开弹窗时才清空选择
this.selectedMaterialIds = []; // 先清空父组件数据 this.selectedMaterialIds = [] // 先清空父组件数据
this.selectedMaterials = []; this.selectedMaterials = []
this.$nextTick(() => { this.$nextTick(() => {
// 确保弹窗渲染完成后再调用子组件方法 // 确保弹窗渲染完成后再调用子组件方法
this.$refs.materialSelector?.clearSelection(); this.$refs.materialSelector?.clearSelection()
}); })
} }
}, },
// 物料选择变化回调 // 物料选择变化回调
handleMaterialChange(selectedRows) { handleMaterialChange(selectedRows) {
this.selectedMaterials = selectedRows; this.selectedMaterials = selectedRows
}, },
// 确认选择物料并添加到明细 // 确认选择物料并添加到明细
confirmMaterialSelect() { confirmMaterialSelect() {
if (this.selectedMaterials.length === 0) { if (this.selectedMaterials.length === 0) {
this.$message.warning("请选择物料"); this.$message.warning("请选择物料")
return; return
} }
// 将选中的物料添加到入库明细 // 将选中的物料添加到入库明细
this.selectedMaterials.forEach(material => { this.selectedMaterials.forEach(material => {
// 检查是否已存在该物料,避免重复添加 // 检查是否已存在该物料,避免重复添加
const exists = this.form.inboundOrderItemsList.some( const exists = this.form.inboundOrderItemsList.some(
item => item.sapNo === material.sapNo item => item.materialId === material.sapNo
); )
if (!exists) { if (!exists) {
this.form.inboundOrderItemsList.push({ this.form.inboundOrderItemsList.push({
materialId: material.sapNo, // 存储物料编码 materialId: material.sapNo, // 存储物料编码
materialName: material.materialName, // 仅用于展示 materialName: material.materialName, // 仅用于展示
// 其他需要的字段... batchCode: null,
}); warehouseId: null,
warehousesName: null,
locationId: null,
locationName: null,
plannedQuantity: 0,
actualQuantity: 0,
unitPrice: 0,
totalAmount: 0
})
} else {
this.$message.warning(`物料 ${material.materialName} 已存在,跳过添加`)
} }
}); })
this.materialSelectOpen = false; this.materialSelectOpen = false
this.$refs.inboundItemsRef.handleAddItem(this.selectedMaterials) this.$refs.inboundItemsRef.handleAddItem(this.selectedMaterials)
this.$message.success(`成功添加 ${this.selectedMaterials.length} 个物料`); this.$message.success(`成功添加 ${this.selectedMaterials.length} 个物料`)
}, },
/** 确认入库操作 */ /** 确认入库操作 */
async handleConfirm(row) { // 标记为 async 函数 async handleConfirm(row) { // 标记为 async 函数
...@@ -685,35 +879,35 @@ export default { ...@@ -685,35 +879,35 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}); })
// 第二步:等待 listInbound_items 执行完成 // 第二步:等待 listInbound_items 执行完成
const queryForm = { const queryForm = {
pageNum: 1, pageNum: 1,
pageSize: 9999, pageSize: 9999,
orderId: row.orderId orderId: row.orderId
}; }
const response = await listInbound_items(queryForm); const response = await listInbound_items(queryForm)
row.inboundOrderItemsList = response.rows; row.inboundOrderItemsList = response.rows
// 第三步:确保数据存在后调用入库接口 // 第三步:确保数据存在后调用入库接口
if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) { if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) {
this.$message.warning('暂无入库明细数据,无法确认入库'); this.$message.warning('暂无入库明细数据,无法确认入库')
return; return
} }
await batchAddInventory(row.inboundOrderItemsList); await batchAddInventory(row.inboundOrderItemsList)
// 第四步:操作成功提示 // 第四步:操作成功提示
this.$modal.msgSuccess("确认成功"); this.$modal.msgSuccess("确认成功")
this.$message.success('确认入库成功'); this.$message.success('确认入库成功')
row.orderStatus = 2 row.orderStatus = 2
updateInbound(row).then(() => { updateInbound(row).then(() => {
this.getList(); this.getList()
}) })
} catch (error) { } catch (error) {
// 捕获取消确认/接口失败的异常 // 捕获取消确认/接口失败的异常
if (error !== 'cancel') { if (error !== 'cancel') {
this.$message.error('确认入库失败:' + (error.msg || '网络异常')); this.$message.error('确认入库失败:' + (error.msg || '网络异常'))
console.log(error) console.log(error)
} }
} }
...@@ -759,10 +953,10 @@ export default { ...@@ -759,10 +953,10 @@ export default {
inboundOrderItemsList: this.form.inboundOrderItemsList.map(item => ({ inboundOrderItemsList: this.form.inboundOrderItemsList.map(item => ({
...item, ...item,
orderId: this.form.orderId, // 确保明细项有主表ID orderId: this.form.orderId, // 确保明细项有主表ID
batchId: this.form.batchId batchId: this.form.batchId,
inboundOrderId: this.form.id || null
})) }))
} }
if (this.form.id != null) { if (this.form.id != null) {
updateInbound(submitData).then(response => { updateInbound(submitData).then(response => {
this.$message.success("修改成功") this.$message.success("修改成功")
...@@ -771,7 +965,6 @@ export default { ...@@ -771,7 +965,6 @@ export default {
}) })
} else { } else {
addInbound(submitData).then(response => { addInbound(submitData).then(response => {
console.log(submitData)
this.$message.success("新增成功") this.$message.success("新增成功")
this.open = false this.open = false
this.getList() this.getList()
...@@ -783,6 +976,7 @@ export default { ...@@ -783,6 +976,7 @@ export default {
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.open = false this.open = false
this.inboundOrderId = null
this.reset() this.reset()
}, },
...@@ -794,11 +988,15 @@ export default { ...@@ -794,11 +988,15 @@ export default {
orderTypeId: null, orderTypeId: null,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
warehousesName: null,
ownerId: null, ownerId: null,
ownerName: null,
ownerCode: null,
orderStatus: 1, orderStatus: 1,
referenceNo: null, referenceNo: null,
plannedArrivalDate: null, plannedArrivalDate: null,
actualArrivalDate: null, actualArrivalDate: null,
inboundDate: null,
totalPlannedQuantity: 0, totalPlannedQuantity: 0,
totalActualQuantity: 0, totalActualQuantity: 0,
totalPackages: 0, totalPackages: 0,
...@@ -896,9 +1094,10 @@ export default { ...@@ -896,9 +1094,10 @@ export default {
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('inventory/inbound/export', { const params = { ...this.queryParams }
...this.queryParams delete params.pageNum
}, `inbound_${new Date().getTime()}.xlsx`) delete params.pageSize
this.download('inventory/inbound/export', params, `inbound_${new Date().getTime()}.xlsx`)
} }
} }
} }
...@@ -941,4 +1140,4 @@ export default { ...@@ -941,4 +1140,4 @@ export default {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
</style> </style>
\ No newline at end of file
...@@ -151,7 +151,47 @@ ...@@ -151,7 +151,47 @@
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 可编辑模式 --> <!-- 可编辑模式 -->
<template v-if="scope.row.editable && column.editable !== false"> <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 <el-select
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
size="small" size="small"
...@@ -166,6 +206,7 @@ ...@@ -166,6 +206,7 @@
/> />
</el-select> </el-select>
</template> </template>
<!-- 数字输入框 -->
<template v-else-if="column.type === 'number'"> <template v-else-if="column.type === 'number'">
<el-input-number <el-input-number
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
...@@ -177,6 +218,7 @@ ...@@ -177,6 +218,7 @@
@change="handleNumberChange(scope.row, column.prop)" @change="handleNumberChange(scope.row, column.prop)"
/> />
</template> </template>
<!-- 普通输入框 -->
<template v-else> <template v-else>
<el-input <el-input
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
...@@ -201,8 +243,15 @@ ...@@ -201,8 +243,15 @@
<template v-else-if="column.type === 'number'"> <template v-else-if="column.type === 'number'">
{{ formatNumber(scope.row[column.prop]) }} {{ formatNumber(scope.row[column.prop]) }}
</template> </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> <template v-else>
{{ scope.row[column.prop] }} {{ scope.row[column.prop] || '-' }}
</template> </template>
</template> </template>
</template> </template>
...@@ -292,13 +341,20 @@ export default { ...@@ -292,13 +341,20 @@ export default {
default: () => [ default: () => [
{ prop: 'materialId', label: '货物ID', width: '150', editable: false }, { prop: 'materialId', label: '货物ID', width: '150', editable: false },
{ prop: 'materialName', label: '货物名称', width: '150', editable: false }, { prop: 'materialName', label: '货物名称', width: '150', editable: false },
{ prop: 'warehouseId', label: '仓库ID', width: '150', editable: true, {
type: 'select', prop: 'warehousesName',
options: [{ label: '仓库A', value: 'WH001' }, { label: '仓库B', value: 'WH002' }, { label: '仓库C', value: 'WH003' }] label: '仓库',
width: '150',
editable: true,
idProp: 'warehouseId'
}, },
{ prop: 'locationId', label: '库位ID', width: '150', editable: true, {
type: 'select', prop: 'locationName',
options: [{ label: '库位A1', value: 'LOC001' }, { label: '库位A2', value: 'LOC002' }, { label: '库位B1', value: 'LOC003' }] label: '库位',
width: '150',
editable: true,
idProp: 'locationId',
codeProp: 'locationCode'
}, },
{ prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true }, { prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true },
{ prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true }, { prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true },
...@@ -320,8 +376,6 @@ export default { ...@@ -320,8 +376,6 @@ export default {
}, },
data() { data() {
return { return {
showSearch: true, showSearch: true,
loading: false, loading: false,
selectedRows: [], selectedRows: [],
...@@ -392,7 +446,7 @@ export default { ...@@ -392,7 +446,7 @@ export default {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
// 核心:过滤 null/空值,只在有效时执行逻辑 // 核心:过滤 null/空值,只在有效时执行逻辑
if (!newVal) return if (!newVal) return
this.loadRelatedData(newVal) this.loadRelatedData(newVal)
this.displayData.forEach(item => { this.displayData.forEach(item => {
if (!item.inboundOrderId) item.inboundOrderId = newVal if (!item.inboundOrderId) item.inboundOrderId = newVal
...@@ -414,11 +468,11 @@ export default { ...@@ -414,11 +468,11 @@ export default {
// 根据字典类型和值,获取对应的listClass(标签样式) // 根据字典类型和值,获取对应的listClass(标签样式)
getDictListClass(dictType, value) { getDictListClass(dictType, value) {
const dictList = this.dict.type[dictType] || [] const dictList = this.dict.type[dictType] || []
if (!value) return 'info' if (!value) return ''
const dictItem = dictList.find(item => item.value === value+"") const dictItem = dictList.find(item => item.value === value+"")
// 兼容raw和直接属性两种写法 // 兼容raw和直接属性两种写法
return dictItem?.raw?.listClass || 'info' return dictItem?.raw?.listClass
}, },
// 根据字典类型和值,获取对应的显示标签 // 根据字典类型和值,获取对应的显示标签
...@@ -443,8 +497,9 @@ export default { ...@@ -443,8 +497,9 @@ export default {
this.loading = true this.loading = true
this.queryParams.inboundOrderId = inboundOrderId this.queryParams.inboundOrderId = inboundOrderId
listInbound_itemsAndMname(this.queryParams).then(response => { listInbound_itemsAndMname(this.queryParams).then(response => {
console.log(response.rows)
this.displayData = response.rows.map(item => ({ this.displayData = response.rows.map(item => ({
...item, ...item,
materialName: item.materialName, materialName: item.materialName,
editable: false, editable: false,
...@@ -456,7 +511,7 @@ export default { ...@@ -456,7 +511,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
}).finally(() => { }).finally(() => {
}) })
}, },
...@@ -547,7 +602,9 @@ export default { ...@@ -547,7 +602,9 @@ export default {
unitPrice: 0, unitPrice: 0,
remark: null, remark: null,
editable: true, editable: true,
inboundOrderId: null,
tempId: Date.now() + Math.random() tempId: Date.now() + Math.random()
} }
this.displayData.push(newItem) this.displayData.push(newItem)
const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize) const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize)
...@@ -654,6 +711,23 @@ export default { ...@@ -654,6 +711,23 @@ export default {
this.$emit('cell-blur', { row, prop, value: row[prop] }) 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) { handleSelectionChange(selection) {
this.selectedRows = selection this.selectedRows = selection
...@@ -745,4 +819,4 @@ export default { ...@@ -745,4 +819,4 @@ export default {
:deep(.el-select .el-tag) { :deep(.el-select .el-tag) {
margin: 0; margin: 0;
} }
</style> </style>
\ No newline at end of file
...@@ -85,26 +85,26 @@ ...@@ -85,26 +85,26 @@
@search="handleQuery" @search="handleQuery"
@reset="resetQuery" @reset="resetQuery"
> >
<el-form-item label="物料编码" prop="materialCode"> <!-- <el-form-item label="物料编码" prop="materialCode">
<el-input <el-input
v-model="queryParams.materialCode" v-model="queryParams.materialCode"
placeholder="请输入物料编码" placeholder="请输入物料编码"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="物料名称" prop="materialName"> <el-form-item label="SAP物料号" prop="sapNo">
<el-input <el-input
v-model="queryParams.materialName" v-model="queryParams.sapNo"
placeholder="请输入物料名称" placeholder="请输入SAP物料号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="SAP物料号" prop="sapNo"> <el-form-item label="物料名称" prop="materialName">
<el-input <el-input
v-model="queryParams.sapNo" v-model="queryParams.materialName"
placeholder="请输入SAP物料号" placeholder="请输入物料名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
...@@ -150,7 +150,15 @@ ...@@ -150,7 +150,15 @@
{{ scope.row.displayCategory || categoryMap[scope.row.categoryCode] || scope.row.categoryCode }} {{ scope.row.displayCategory || categoryMap[scope.row.categoryCode] || scope.row.categoryCode }}
</template> </template>
</el-table-column> </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="specification" />
<el-table-column label="计量单位" align="center" prop="materialUnit" /> <el-table-column label="计量单位" align="center" prop="materialUnit" />
<el-table-column label="单位重量" align="center" prop="unitWeight" /> <el-table-column label="单位重量" align="center" prop="unitWeight" />
...@@ -177,7 +185,15 @@ ...@@ -177,7 +185,15 @@
<el-tag :type="scope.row.isActive === 1 ? 'success' : 'info'" size="mini">{{ scope.row.isActive === 1 ? '是' : '否' }}</el-tag> <el-tag :type="scope.row.isActive === 1 ? 'success' : 'info'" size="mini">{{ scope.row.isActive === 1 ? '是' : '否' }}</el-tag>
</template> </template>
</el-table-column> </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="sortNo" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -255,7 +271,15 @@ ...@@ -255,7 +271,15 @@
<el-input v-model="form.maxStockLevel" placeholder="请输入最高库存" /> <el-input v-model="form.maxStockLevel" placeholder="请输入最高库存" />
</el-form-item> </el-form-item>
<el-form-item label="风险等级" prop="riskLevel"> <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>
<el-form-item label="是否序列号管理" prop="isSerialManaged"> <el-form-item label="是否序列号管理" prop="isSerialManaged">
<el-radio-group v-model="form.isSerialManaged"> <el-radio-group v-model="form.isSerialManaged">
...@@ -285,8 +309,16 @@ ...@@ -285,8 +309,16 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="危险类别ID" prop="hazardId"> <el-form-item label="危险类别" prop="hazardId">
<el-input v-model="form.hazardId" placeholder="请输入危险类别ID" /> <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>
<el-form-item label="计量单位" prop="materialUnit"> <el-form-item label="计量单位" prop="materialUnit">
<el-input v-model="form.materialUnit" placeholder="请输入计量单位" /> <el-input v-model="form.materialUnit" placeholder="请输入计量单位" />
...@@ -312,7 +344,7 @@ ...@@ -312,7 +344,7 @@
<el-radio :label="0"></el-radio> <el-radio :label="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
...@@ -346,6 +378,7 @@ import request from '@/utils/request' ...@@ -346,6 +378,7 @@ import request from '@/utils/request'
export default { export default {
name: "Materials", name: "Materials",
dicts: ['danger_type','risk_level'],
components: { components: {
TreeComponent, TreeComponent,
Splitpanes, Splitpanes,
...@@ -455,6 +488,20 @@ export default { ...@@ -455,6 +488,20 @@ export default {
this.getList() this.getList()
}, },
methods: { 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() { async getCategoryList() {
try { try {
const response = await listMaterials_category({ const response = await listMaterials_category({
...@@ -552,7 +599,7 @@ export default { ...@@ -552,7 +599,7 @@ export default {
handleTreeClick(data) { handleTreeClick(data) {
console.log('点击树节点:', data) console.log('点击树节点:', data)
this.currentNodeId = data.sid this.currentNodeId = data.sid
// 更新查询参数,按选中的分类筛选物料 // 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data.categoryCode this.queryParams.categoryCode = data.categoryCode
this.queryParams.categoryNameInput = null // 清空名称输入 this.queryParams.categoryNameInput = null // 清空名称输入
...@@ -762,7 +809,7 @@ export default { ...@@ -762,7 +809,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids 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) return delMaterials(ids)
}).then(() => { }).then(() => {
this.getList() this.getList()
......
...@@ -49,70 +49,70 @@ ...@@ -49,70 +49,70 @@
<div class="table-container"> <div class="table-container">
<el-table v-loading="loading" :data="stocktakesList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" height="100%" :data="stocktakesList" @selection-change="handleSelectionChange">
<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="id" /> <el-table-column label="编号" align="center" prop="id" />
<!-- <el-table-column label="盘点单号 隐藏,根据id同步生成值" align="center" prop="stocktakeId" />--> <!-- <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="盘点类型1-全面盘点 2-循环盘点 3-指定物料盘点 暂无用,默认1" align="center" prop="stocktakeType" />-->
<!-- <el-table-column label="仓库ID 暂无用" align="center" prop="warehouseId" />--> <!-- <el-table-column label="仓库ID 暂无用" align="center" prop="warehouseId" />-->
<el-table-column label="计划日期" align="center" prop="plannedDate" width="180"> <el-table-column label="计划日期" align="center" prop="plannedDate" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.plannedDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.plannedDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="stocktakeStatus" label="盘点状态" width="80"> <el-table-column prop="stocktakeStatus" label="盘点状态" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.stocktake_status" :value="scope.row.stocktakeStatus"/> <dict-tag :options="dict.type.stocktake_status" :value="scope.row.stocktakeStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="盘点物料范围 暂时无用" align="center" prop="materialRange" />--> <!-- <el-table-column label="盘点物料范围 暂时无用" align="center" prop="materialRange" />-->
<!-- <el-table-column label="盘点库位范围 暂时无用" align="center" prop="locationRange" />--> <!-- <el-table-column label="盘点库位范围 暂时无用" align="center" prop="locationRange" />-->
<!-- <el-table-column label="总差异金额 暂时无用" align="center" prop="totalVarianceAmount" />--> <!-- <el-table-column label="总差异金额 暂时无用" align="center" prop="totalVarianceAmount" />-->
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="应用数据1使用0删除 删除用" align="center" prop="isUsed" />--> <!-- <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="sortNo" />-->
<el-table-column label="创建时间" align="center" prop="createTime"> <el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="排序号" align="center" prop="updateUserCode" />--> <!-- <el-table-column label="排序号" align="center" prop="updateUserCode" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handleViewInfo(scope.row)" @click="handleViewInfo(scope.row)"
v-hasPermi="['inventory:stocktakes:query']" v-hasPermi="['inventory:stocktakes:query']"
>查看</el-button> >查看</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleCheck(scope.row)" @click="handleCheck(scope.row)"
v-if="scope.row.stocktakeStatus === '1'" v-if="scope.row.stocktakeStatus === '1'"
v-hasPermi="['inventory:stocktakes:check']" v-hasPermi="['inventory:stocktakes:check']"
>盘点</el-button> >盘点</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
v-if="scope.row.stocktakeStatus === '1'" v-if="scope.row.stocktakeStatus === '1'"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['inventory:stocktakes:remove']" v-hasPermi="['inventory:stocktakes:remove']"
>删除</el-button> >删除</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-circle-check" icon="el-icon-circle-check"
@click="handleConfirm(scope.row)" @click="handleConfirm(scope.row)"
v-if="scope.row.stocktakeStatus === '2'" v-if="scope.row.stocktakeStatus === '2'"
v-hasPermi="['inventory:stocktakes:confirm']" v-hasPermi="['inventory:stocktakes:confirm']"
>盘点确认</el-button> >盘点确认</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<pagination <pagination
v-show="total>0" v-show="total>0"
......
...@@ -62,10 +62,10 @@ ...@@ -62,10 +62,10 @@
</page-wrapper-search> </page-wrapper-search>
<div class="table-container"> <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="计划日期" 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"> <template slot-scope="scope">
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') }} {{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') }}
</template> </template>
...@@ -142,12 +142,12 @@ ...@@ -142,12 +142,12 @@
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') || '无' }} {{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') || '无' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="SAP物料号" prop="sapNo" /> <el-table-column label="SAP物料号" align="center" prop="sapNo" />
<el-table-column label="仓库" prop="warehousesName" /> <el-table-column label="仓库" align="center" prop="warehousesName" />
<el-table-column label="库位" prop="locationName" /> <el-table-column label="库位" align="center" prop="locationName" />
<el-table-column label="危险类别" prop="hazardName" /> <el-table-column label="危险类别" align="center" prop="hazardName" />
<el-table-column label="差异数量" prop="varianceQuantity" /> <el-table-column label="差异数量" align="center" prop="varianceQuantity" />
<el-table-column label="差异金额" prop="varianceAmount"> <el-table-column label="差异金额" align="center" prop="varianceAmount">
<template slot-scope="scope"> <template slot-scope="scope">
{{ formatAmount(scope.row.varianceAmount) }} {{ formatAmount(scope.row.varianceAmount) }}
</template> </template>
......
...@@ -71,25 +71,25 @@ ...@@ -71,25 +71,25 @@
<!-- 表格 --> <!-- 表格 -->
<div class="table-container"> <div class="table-container">
<el-table :data="filteredItemsList" <el-table height="300px" :data="filteredItemsList"
:row-class-name="setRowIndex" :row-class-name="setRowIndex"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border border
size="small"> size="small">
<el-table-column label="子表ID" align="center" width="150px" prop="id" v-if="false" /> <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"> <template slot-scope="scope">
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;"> <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') }} {{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') }}
</div> </div>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.batchCode" placeholder="请输入批次编号" disabled /> <el-input v-model="scope.row.batchCode" placeholder="请输入批次编号" disabled />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.warehouseName" placeholder="请输入仓库" disabled /> <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;">--> <!-- <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">-->
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<!-- </div>--> <!-- </div>-->
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<!-- <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">--> <!-- <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">-->
<!-- {{ scope.row.location_name || scope.row.locationId || '未知库位' }}--> <!-- {{ scope.row.location_name || scope.row.locationId || '未知库位' }}-->
...@@ -105,12 +105,12 @@ ...@@ -105,12 +105,12 @@
<el-input v-model="scope.row.locationName" placeholder="请输入库位" disabled /> <el-input v-model="scope.row.locationName" placeholder="请输入库位" disabled />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.systemQuantity" placeholder="请输入系统数量" disabled /> <el-input v-model="scope.row.systemQuantity" placeholder="请输入系统数量" disabled />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.actualQuantity" <el-input v-model="scope.row.actualQuantity"
placeholder="请输入实际数量" placeholder="请输入实际数量"
...@@ -120,31 +120,31 @@ ...@@ -120,31 +120,31 @@
/> />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input type="number" v-model="scope.row.varianceQuantity" placeholder="请输入差异数量" disabled /> <el-input type="number" v-model="scope.row.varianceQuantity" placeholder="请输入差异数量" disabled />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;"> <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">
{{ formatAmount(scope.row.unitPrice) }} {{ formatAmount(scope.row.unitPrice) }}
</div> </div>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;"> <div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">
{{ formatAmount(scope.row.varianceAmount) }} {{ formatAmount(scope.row.varianceAmount) }}
</div> </div>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.adjusted" placeholder="请输入是否已调整0否1是" disabled /> <el-input v-model="scope.row.adjusted" placeholder="请输入是否已调整0否1是" disabled />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.adjustmentReason" v-model="scope.row.adjustmentReason"
...@@ -156,12 +156,12 @@ ...@@ -156,12 +156,12 @@
/> />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.adjustedBy" placeholder="请输入调整人" disabled /> <el-input v-model="scope.row.adjustedBy" placeholder="请输入调整人" disabled />
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.adjustedAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择调整时间" disabled /> <el-date-picker clearable v-model="scope.row.adjustedAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择调整时间" disabled />
</template> </template>
......
...@@ -141,7 +141,8 @@ public class InboundOrderItemsController extends BaseController ...@@ -141,7 +141,8 @@ public class InboundOrderItemsController extends BaseController
public TableDataInfo itemDetails(InboundDetailsVO inboundDetailsVO) throws Exception public TableDataInfo itemDetails(InboundDetailsVO inboundDetailsVO) throws Exception
{ {
startPage(); startPage();
List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo(); System.out.println(inboundDetailsVO);
List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo(inboundDetailsVO);
return getDataTable(list); return getDataTable(list);
} }
} }
...@@ -7,6 +7,7 @@ import com.ruoyi.common.utils.uuid.UUID; ...@@ -7,6 +7,7 @@ import com.ruoyi.common.utils.uuid.UUID;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.domain.vo.InboundTemplateVO; import com.ruoyi.inventory.domain.vo.InboundTemplateVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -136,4 +137,36 @@ public class InboundOrdersController extends BaseController ...@@ -136,4 +137,36 @@ public class InboundOrdersController extends BaseController
String message = inboundOrdersService.importInboundOrders(inboundOrders, updateSupport, operName); String message = inboundOrdersService.importInboundOrders(inboundOrders, updateSupport, operName);
return success(message); 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 ...@@ -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')") @PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE) @Log(title = "物料分类", businessType = BusinessType.DELETE)
......
...@@ -101,14 +101,15 @@ public class MaterialsController extends BaseController ...@@ -101,14 +101,15 @@ public class MaterialsController extends BaseController
} }
/** /**
* 删除物料 * 删除物料 (修改物料有效性)
*/ */
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')") @PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE) @Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @PutMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] 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 ...@@ -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 ...@@ -19,17 +19,15 @@ public class Materials extends BaseEntity
private String id; private String id;
/** 物料编码 检索条件 */ /** 物料编码 检索条件 */
@Excel(name = "物料编码")
private String materialCode; private String materialCode;
/** SAP物料号 检索条件 */
@Excel(name = "SAP物料号")
private String sapNo;
/** 物料名称 检索条件 */ /** 物料名称 检索条件 */
@Excel(name = "物料名称") @Excel(name = "物料名称")
private String materialName; private String materialName;
/** SAP物料号 检索条件 */
@Excel(name = "SAP物料号")
private String sapNo;
/** TS Code 检索条件 */ /** TS Code 检索条件 */
@Excel(name = "TS Code") @Excel(name = "TS Code")
private String tsCode; private String tsCode;
......
...@@ -4,18 +4,11 @@ import java.util.List; ...@@ -4,18 +4,11 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.servlet.http.HttpServletResponse; 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.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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 com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
...@@ -26,6 +19,7 @@ import com.ruoyi.inventory.domain.vo.InventorySummaryVO; ...@@ -26,6 +19,7 @@ import com.ruoyi.inventory.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.service.IInventoryService; import com.ruoyi.inventory.service.IInventoryService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 库存Controller * 库存Controller
...@@ -79,7 +73,7 @@ public class InventoryController extends BaseController ...@@ -79,7 +73,7 @@ public class InventoryController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('inventory:inventory:list')") @PreAuthorize("@ss.hasPermi('inventory:inventory:list')")
@PostMapping("/listByMaterialId") @PostMapping("/listByMaterialId")
public TableDataInfo listByMaterialId(@RequestBody OutboundOrderItems inventory) public TableDataInfo listByMaterialId(@RequestBody Inventory inventory)
{ {
startPage(); startPage();
List<Inventory> list = inventoryService.listByMatreialId(inventory); List<Inventory> list = inventoryService.listByMatreialId(inventory);
...@@ -173,4 +167,15 @@ public class InventoryController extends BaseController ...@@ -173,4 +167,15 @@ public class InventoryController extends BaseController
{ {
return toAjax(inventoryService.insertInventoryList(inventoryList)); 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 ...@@ -45,6 +45,8 @@ public class InboundOrders extends BaseEntity
@Excel(name = "货主ID") @Excel(name = "货主ID")
private String ownerId; private String ownerId;
private String ownerName;
/** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */ /** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel(name = "入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件") @Excel(name = "入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus; private Long orderStatus;
...@@ -283,6 +285,14 @@ public class InboundOrders extends BaseEntity ...@@ -283,6 +285,14 @@ public class InboundOrders extends BaseEntity
this.inboundOrderItemsList = inboundOrderItemsList; this.inboundOrderItemsList = inboundOrderItemsList;
} }
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -308,6 +318,7 @@ public class InboundOrders extends BaseEntity ...@@ -308,6 +318,7 @@ public class InboundOrders extends BaseEntity
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode()) .append("updateUserCode", getUpdateUserCode())
.append("inboundOrderItemsList", getInboundOrderItemsList()) .append("inboundOrderItemsList", getInboundOrderItemsList())
.append("ownerName", getOwnerName())
.toString(); .toString();
} }
} }
...@@ -38,10 +38,14 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -38,10 +38,14 @@ public class InboundItemsAndMaterialName extends BaseEntity
@Excel(name = "仓库ID") @Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
private String warehousesName;
/** 库位ID 检索条件 */ /** 库位ID 检索条件 */
@Excel(name = "库位ID") @Excel(name = "库位ID")
private String locationId; private String locationId;
private String locationName;
/** 计划数量 */ /** 计划数量 */
@Excel(name = "计划数量") @Excel(name = "计划数量")
private Long plannedQuantity; private Long plannedQuantity;
...@@ -330,6 +334,22 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -330,6 +334,22 @@ public class InboundItemsAndMaterialName extends BaseEntity
this.inboundOrderId = inboundOrderId; 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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -359,6 +379,8 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -359,6 +379,8 @@ public class InboundItemsAndMaterialName extends BaseEntity
.append("updateUserCode", getUpdateUserCode()) .append("updateUserCode", getUpdateUserCode())
.append("materialName", getMaterialName()) .append("materialName", getMaterialName())
.append("inboundOrderId", getInboundOrderId()) .append("inboundOrderId", getInboundOrderId())
.append("warehousesName", getWarehousesName())
.append("locationName", getLocationName())
.toString(); .toString();
} }
} }
...@@ -6,6 +6,7 @@ import java.util.Date; ...@@ -6,6 +6,7 @@ import java.util.Date;
public class InboundDetailsVO { public class InboundDetailsVO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Excel(name = "物料sapNo") @Excel(name = "物料sapNo")
private String materialId; private String materialId;
...@@ -18,12 +19,17 @@ public class InboundDetailsVO { ...@@ -18,12 +19,17 @@ public class InboundDetailsVO {
@Excel(name = "批次ID") @Excel(name = "批次ID")
private String batchId; private String batchId;
@Excel(name = "仓库ID") // @Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
@Excel(name = "库位ID") @Excel(name = "仓库名")
private String warehousesName;
// @Excel(name = "库位ID")
private String locationId; private String locationId;
private String locationName;
@Excel(name = "入库数量") @Excel(name = "入库数量")
private Long actualQuantity; private Long actualQuantity;
...@@ -149,15 +155,33 @@ public class InboundDetailsVO { ...@@ -149,15 +155,33 @@ public class InboundDetailsVO {
this.inboundDate = inboundDate; 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 @Override
public String toString() { public String toString() {
return "InboundDetailsVO{" + return "InboundDetailsVO{" +
"sapNo='" + materialId + '\'' + "materialId='" + materialId + '\'' +
", materialName='" + materialName + '\'' + ", materialName='" + materialName + '\'' +
", orderId='" + orderId + '\'' + ", orderId='" + orderId + '\'' +
", batchId='" + batchId + '\'' + ", batchId='" + batchId + '\'' +
", warehouseId='" + warehouseId + '\'' + ", warehouseId='" + warehouseId + '\'' +
", warehousesName='" + warehousesName + '\'' +
", locationId='" + locationId + '\'' + ", locationId='" + locationId + '\'' +
", locationName='" + locationName + '\'' +
", actualQuantity=" + actualQuantity + ", actualQuantity=" + actualQuantity +
", actualPackages=" + actualPackages + ", actualPackages=" + actualPackages +
", labelColor='" + labelColor + '\'' + ", labelColor='" + labelColor + '\'' +
......
...@@ -72,5 +72,5 @@ public interface InboundOrderItemsMapper ...@@ -72,5 +72,5 @@ public interface InboundOrderItemsMapper
* 统计入库单明细 * 统计入库单明细
* @return 结果 * @return 结果
*/ */
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(); public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO);
} }
...@@ -3,6 +3,7 @@ package com.ruoyi.inventory.mapper; ...@@ -3,6 +3,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.InboundOrders; import com.ruoyi.inventory.domain.InboundOrders;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
/** /**
* 入库单主Mapper接口 * 入库单主Mapper接口
...@@ -91,4 +92,25 @@ public interface InboundOrdersMapper ...@@ -91,4 +92,25 @@ public interface InboundOrdersMapper
* @return 结果 * @return 结果
*/ */
public int deleteInboundOrderItemsByOrderId(String id); 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; ...@@ -6,6 +6,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo; import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
/** /**
* 库存Mapper接口 * 库存Mapper接口
...@@ -25,7 +26,7 @@ public interface InventoryMapper ...@@ -25,7 +26,7 @@ public interface InventoryMapper
/** /**
* 查询库存 * 查询库存
* *
* @param id 库存主键 * @param inventory 实体
* @return 库存 * @return 库存
*/ */
public Inventory selectInventory(Inventory inventory); public Inventory selectInventory(Inventory inventory);
...@@ -97,4 +98,11 @@ public interface InventoryMapper ...@@ -97,4 +98,11 @@ public interface InventoryMapper
* @return 库存明细集合 * @return 库存明细集合
*/ */
public List<Inventory> selectInventoryDetailList(Inventory inventory); public List<Inventory> selectInventoryDetailList(Inventory inventory);
/**
* 统计物料库存超出预警库存数量
*
* @return 超出预警值物料信息集合
*/
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList();
} }
...@@ -50,6 +50,14 @@ public interface MaterialsCategoryMapper ...@@ -50,6 +50,14 @@ public interface MaterialsCategoryMapper
public int updateMaterialsCategory(MaterialsCategory materialsCategory); public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/** /**
* 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 删除物料分类 * 删除物料分类
* *
* @param id 物料分类主键 * @param id 物料分类主键
......
...@@ -57,28 +57,14 @@ public interface MaterialsMapper ...@@ -57,28 +57,14 @@ public interface MaterialsMapper
public int updateMaterials(Materials materials); public int updateMaterials(Materials materials);
/** /**
* 删除物料 * 批量修改物料的使用状态
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int updateMaterialsIsUsedByIds(String[] ids); public int updateMaterialsIsUsedByIds(String[] ids);
/** /**
* 批量删除,修改物料的使用状态 * 批量删除,修改物料的使用状态
* *
...@@ -96,4 +82,19 @@ public interface MaterialsMapper ...@@ -96,4 +82,19 @@ public interface MaterialsMapper
@MapKey("sap_no") @MapKey("sap_no")
public List<Map<String, Object>> getMapList(); 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 ...@@ -74,5 +74,5 @@ public interface IInboundOrderItemsService
* 统计入库单明细 * 统计入库单明细
* @return 结果 * @return 结果
*/ */
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(); public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO);
} }
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.InboundOrders; import com.ruoyi.inventory.domain.InboundOrders;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.domain.vo.InboundTemplateVO; import com.ruoyi.inventory.domain.vo.InboundTemplateVO;
/** /**
...@@ -69,4 +70,24 @@ public interface IInboundOrdersService ...@@ -69,4 +70,24 @@ public interface IInboundOrdersService
* @return 结果 * @return 结果
*/ */
public String importInboundOrders(List<InboundTemplateVO> inboundOrders, Boolean isUpdateSupport, String operName); 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; ...@@ -8,6 +8,7 @@ import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.OutboundOrderItems; import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo; import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
/** /**
* 库存Service接口 * 库存Service接口
...@@ -107,4 +108,11 @@ public interface IInventoryService ...@@ -107,4 +108,11 @@ public interface IInventoryService
*/ */
public List<Inventory> selectInventoryDetailList(Inventory inventory); public List<Inventory> selectInventoryDetailList(Inventory inventory);
/**
* 统计库存物料超出预警值
*
* @return 超出预警物料信息集合
*/
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList();
} }
...@@ -70,7 +70,15 @@ public interface IMaterialsCategoryService ...@@ -70,7 +70,15 @@ public interface IMaterialsCategoryService
public int updateMaterialsCategory(MaterialsCategory materialsCategory); public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/** /**
* 批量删除物料分类 * 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 批量删除物料分类(暂无用)
* *
* @param ids 需要删除的物料分类主键集合 * @param ids 需要删除的物料分类主键集合
* @return 结果 * @return 结果
...@@ -78,7 +86,7 @@ public interface IMaterialsCategoryService ...@@ -78,7 +86,7 @@ public interface IMaterialsCategoryService
public int deleteMaterialsCategoryByIds(String[] ids); public int deleteMaterialsCategoryByIds(String[] ids);
/** /**
* 删除物料分类信息 * 删除物料分类信息(暂无用)
* *
* @param id 物料分类主键 * @param id 物料分类主键
* @return 结果 * @return 结果
......
...@@ -46,7 +46,7 @@ public interface IMaterialsService ...@@ -46,7 +46,7 @@ public interface IMaterialsService
public int updateMaterials(Materials materials); public int updateMaterials(Materials materials);
/** /**
* 批量删除物料 * 批量删除物料 (暂时无用)
* *
* @param ids 需要删除的物料主键集合 * @param ids 需要删除的物料主键集合
* @return 结果 * @return 结果
...@@ -54,6 +54,14 @@ public interface IMaterialsService ...@@ -54,6 +54,14 @@ public interface IMaterialsService
public int deleteMaterialsByIds(String[] ids); public int deleteMaterialsByIds(String[] ids);
/** /**
* 修改物料有效状态
*
* @param ids 需要删除的物料主键集合
* @return 结果
*/
public int updateMaterialsIsUsed(String[] ids);
/**
* 删除物料信息 * 删除物料信息
* *
* @param id 物料主键 * @param id 物料主键
......
...@@ -176,7 +176,7 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService ...@@ -176,7 +176,7 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
} }
@Override @Override
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo() { public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO) {
return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo(); return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo(inboundDetailsVO);
} }
} }
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
...@@ -133,6 +137,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -133,6 +137,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
inboundOrderItems.setId(UUID.randomUUID().toString()); inboundOrderItems.setId(UUID.randomUUID().toString());
inboundOrderItems.setOrderId(orderId); inboundOrderItems.setOrderId(orderId);
inboundOrderItems.setCreateTime(DateUtils.getNowDate()); inboundOrderItems.setCreateTime(DateUtils.getNowDate());
inboundOrderItems.setInboundOrderId(inboundOrders.getId());
list.add(inboundOrderItems); list.add(inboundOrderItems);
} }
if (list.size() > 0) if (list.size() > 0)
...@@ -292,4 +297,32 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -292,4 +297,32 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
return finalSuccessMsg; 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; ...@@ -9,6 +9,7 @@ import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItems; import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderLog; import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo; 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.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper; import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper; import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
...@@ -262,4 +263,9 @@ public class InventoryServiceImpl implements IInventoryService ...@@ -262,4 +263,9 @@ public class InventoryServiceImpl implements IInventoryService
{ {
return inventoryMapper.selectInventoryDetailList(inventory); return inventoryMapper.selectInventoryDetailList(inventory);
} }
@Override
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList() {
return inventoryMapper.selectInventoryExceedWarnList();
}
} }
...@@ -168,7 +168,18 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -168,7 +168,18 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
} }
/** /**
* 批量删除物料分类 * 修改物料分类有效状态
*
* @param ids 物料分类
* @return 结果
*/
@Override
public int updateCategoryIsUsedByIds(String[] ids) {
return materialsCategoryMapper.updateCategoryIsUsedByIds(ids);
}
/**
* 批量删除物料分类(暂无用)
* *
* @param ids 需要删除的物料分类主键 * @param ids 需要删除的物料分类主键
* @return 结果 * @return 结果
...@@ -180,7 +191,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -180,7 +191,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
} }
/** /**
* 删除物料分类信息 * 删除物料分类信息(暂无用)
* *
* @param id 物料分类主键 * @param id 物料分类主键
* @return 结果 * @return 结果
......
...@@ -77,35 +77,23 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -77,35 +77,23 @@ public class MaterialsServiceImpl implements IMaterialsService
} }
/** /**
* 批量修改物料的使用状态 * 修改物料的使用状态
* *
* @param ids 需要删除的物料主键 * @param ids 需要删除的物料主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMaterialsByIds(String[] ids) public int updateMaterialsIsUsed(String[] ids) {
{
return materialsMapper.updateMaterialsIsUsedByIds(ids); return materialsMapper.updateMaterialsIsUsedByIds(ids);
} }
/** /**
* 删除物料信息 * 导入物料
* *
* @param id 物料主键 * @param materialsList 物料列表
* @return 结果 * @return 结果
*/ */
@Override @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) public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName)
{ {
if (StringUtils.isNull(materialsList) || materialsList.size() == 0) if (StringUtils.isNull(materialsList) || materialsList.size() == 0)
...@@ -176,4 +164,33 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -176,4 +164,33 @@ public class MaterialsServiceImpl implements IMaterialsService
public List<Map<String, Object>> getMapList(){ public List<Map<String, Object>> getMapList(){
return materialsMapper.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 @@ ...@@ -81,7 +81,9 @@
ii.material_id, ii.material_id,
ii.batch_id, ii.batch_id,
ii.warehouse_id, ii.warehouse_id,
w.warehouses_name,
ii.location_id, ii.location_id,
sl.location_name,
ii.planned_quantity, ii.planned_quantity,
ii.actual_quantity, ii.actual_quantity,
ii.planned_packages, ii.planned_packages,
...@@ -104,6 +106,8 @@ ...@@ -104,6 +106,8 @@
m.material_name m.material_name
FROM inbound_order_items ii FROM inbound_order_items ii
LEFT JOIN materials m ON ii.material_id = m.sap_no 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> <where>
<!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or --> <!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or -->
<if test="inboundOrderId != null and inboundOrderId != ''"> <if test="inboundOrderId != null and inboundOrderId != ''">
...@@ -279,7 +283,9 @@ ...@@ -279,7 +283,9 @@
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" /> <result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" /> <result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" /> <result property="plannedPackages" column="planned_packages" />
...@@ -309,8 +315,9 @@ ...@@ -309,8 +315,9 @@
<result column="order_id" property="orderId" jdbcType="VARCHAR" /> <result column="order_id" property="orderId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" /> <result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="warehouse_id" property="warehouseId" 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_quantity" property="actualQuantity" jdbcType="BIGINT" />
<result column="actual_packages" property="actualPackages" jdbcType="BIGINT" /> <result column="actual_packages" property="actualPackages" jdbcType="BIGINT" />
...@@ -329,14 +336,16 @@ ...@@ -329,14 +336,16 @@
<result column="inbound_date" property="inboundDate"/> <result column="inbound_date" property="inboundDate"/>
</resultMap> </resultMap>
<select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap"> <select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap" parameterType="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
SELECT SELECT
ioi.material_id, ioi.material_id,
ms.material_name, ms.material_name,
ioi.order_id, ioi.order_id,
ioi.batch_id, ioi.batch_id,
ioi.warehouse_id, ioi.warehouse_id,
w.warehouses_name,
ioi.location_id, ioi.location_id,
sl.location_name,
SUM(ioi.actual_quantity) AS actual_quantity, SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages, SUM(ioi.actual_packages) AS actual_packages,
ioi.label_color, ioi.label_color,
...@@ -347,7 +356,32 @@ ...@@ -347,7 +356,32 @@
FROM inbound_orders io FROM inbound_orders io
INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id
INNER JOIN materials ms ON ms.sap_no = ioi.material_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 GROUP BY
ioi.material_id, ioi.material_id,
ioi.batch_id, ioi.batch_id,
......
...@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="ownerId" column="owner_id" /> <result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" /> <result property="orderStatus" column="order_status" />
<result property="inboundDate" column="inbound_date" /> <result property="inboundDate" column="inbound_date" />
<result property="orderType" column="order_type" /> <result property="orderType" column="order_type" />
...@@ -32,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="inboundOrderItemsList" ofType="InboundOrderItems" column="id" select="selectInboundOrderItemsList" /> <collection property="inboundOrderItemsList" ofType="InboundOrderItems" column="id" select="selectInboundOrderItemsList" />
</resultMap> </resultMap>
<resultMap type="InboundOrderItems" id="InboundOrderItemsResult"> <resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" /> <result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" /> <result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" /> <result property="plannedPackages" column="planned_packages" />
...@@ -60,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectInboundOrdersVo"> <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> </sql>
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult"> <select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/> <include refid="selectInboundOrdersVo"/>
<where> <where>
<if test="id != null and Id != ''"> and id = #{Id}</if> <if test="id != null and Id != ''"> and id = #{Id}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if> <if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
...@@ -88,17 +95,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -88,17 +95,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult"> <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 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,
from inbound_orders io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
where id = #{id} 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>
<select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult"> <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 select ioi.id, ioi.order_id, ioi.material_id, m.material_name, ioi.batch_id, ioi.warehouse_id, w.warehouses_name,
from inbound_order_items ioi.location_id, sl.location_name, ioi.planned_quantity, ioi.actual_quantity, ioi.planned_packages,
where inbound_order_id = #{inboundOrderId} 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>
<select id="selectInboundOrdersByOrderId" resultType="InboundOrders"> <select id="selectInboundOrdersByOrderId" resultType="InboundOrders">
select id, order_id select id, order_id
from inbound_orders from inbound_orders
...@@ -210,4 +228,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -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}) ( #{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> </foreach>
</insert> </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> </mapper>
\ No newline at end of file
...@@ -317,4 +317,24 @@ and inventory_status = '1' ...@@ -317,4 +317,24 @@ and inventory_status = '1'
#{id} #{id}
</foreach> </foreach>
</delete> </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> </mapper>
\ No newline at end of file
...@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryList" parameterType="MaterialsCategory" resultMap="MaterialsCategoryResult"> <select id="selectMaterialsCategoryList" parameterType="MaterialsCategory" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/> <include refid="selectMaterialsCategoryVo"/>
<where> <where>
is_used != 0
<if test="id != null and id != ''"> and id = #{id}</if> <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="categoryCode != null and categoryCode != ''"> and category_code like concat('%', #{categoryCode}, '%')</if>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</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" ...@@ -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="createTime != null "> and create_time like concat('%', #{createTime}, '%')</if>
<if test="updateTime != null "> and update_time like concat('%', #{updateTime}, '%')</if> <if test="updateTime != null "> and update_time like concat('%', #{updateTime}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if> <if test="parentId != null "> and parent_id = #{parentId}</if>
<!-- <if test="isUsed != null "> and is_used = #{isUsed}</if>-->
</where> </where>
order by sort_no asc order by sort_no asc
</select> </select>
...@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryById" parameterType="String" resultMap="MaterialsCategoryResult"> <select id="selectMaterialsCategoryById" parameterType="String" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/> <include refid="selectMaterialsCategoryVo"/>
where id = #{id} where id = #{id}
and is_used != 0
order by sort_no asc order by sort_no asc
</select> </select>
<insert id="insertMaterialsCategory" parameterType="MaterialsCategory"> <insert id="insertMaterialsCategory" parameterType="MaterialsCategory">
...@@ -84,6 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -84,6 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </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 id="deleteMaterialsCategoryById" parameterType="String">
delete from materials_category where id = #{id} delete from materials_category where id = #{id}
</delete> </delete>
......
...@@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -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 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' left join sys_dict_data dict on ma.hazard_id = dict.dict_sort and dict.status =0 and dict.dict_type ='danger_type'
where 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="materialId != null "> and st_it.material_id = #{materialId}</if>
<if test="plannedDateArray != null and plannedDateArray.length > 0"> <if test="plannedDateArray != null and plannedDateArray.length > 0">
and date_format(st.planned_date,'%Y%m%d') in and date_format(st.planned_date,'%Y%m%d') in
......
...@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -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 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' left join sys_dict_data dict on ma.hazard_id = dict.dict_sort and dict.status =0 and dict.dict_type ='danger_type'
where 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="materialId != null "> and st_it.material_id = #{materialId}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <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') AND date_format(st.planned_date,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论