Commit b0192161 by yubin

Merge remote-tracking branch 'origin/master'

parents c7cf6243 0a922691
......@@ -28,6 +28,10 @@ export default {
chartList: {
type: Array,
default: () => []
},
unit: {
type: String,
default: ''
}
},
data() {
......@@ -78,7 +82,7 @@ export default {
this.chart.setOption({
tooltip: {
trigger: 'item',
formatter: "{b}: {c}"
formatter: "{b}: {c}" + this.unit
},
legend: {
orient: 'horizontal',
......@@ -166,7 +170,7 @@ export default {
],
label: {
normal: {
formatter: '{b}:{c}'
formatter: '{b}:{c}' + this.unit
},
},
......
......@@ -32,6 +32,10 @@ export default {
chartList: {
type: Array,
default: () => []
},
unit: {
type: String,
default: ''
}
},
data() {
......@@ -108,9 +112,13 @@ export default {
},
type: 'value',
show: true,
minInterval: 1,
axisTick: {
show: true
},
axisLabel: {
formatter: '{value} '+ this.unit
}
}],
yAxis: [{
splitLine: {
......
......@@ -9,13 +9,13 @@
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip>
</el-tooltip> -->
<screenfull id="screenfull" class="right-menu-item hover-effect" />
......
......@@ -28,7 +28,7 @@
<el-table v-loading="loading" height="100%" :data="tableList">
<el-table-column type="index" label="序号" align="center" width="100" fixed="left"/>
<el-table-column label="物料名称" align="center" prop="materialName" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="所属分类" align="center" prop="categoryName" :show-overflow-tooltip="true" min-width="200" />
<!-- <el-table-column label="所属分类" align="center" prop="categoryName" :show-overflow-tooltip="true" min-width="200" /> -->
<el-table-column label="物料编码" align="center" prop="sapNo" :show-overflow-tooltip="true" min-width="200" />
<el-table-column label="当前库存" align="center" prop="quantity" :show-overflow-tooltip="true" min-width="200" >
<template slot-scope="scope">
......@@ -47,14 +47,14 @@
<div class="card-container-flex chart-container shadow">
<div class="tip-title">
<div class="title-text">当前库存排名前10物料</div>
<div class="title-text">当前库存排名前5物料</div>
<el-radio-group class="custom" v-model="kucunQueryType" size="mini" @change="kucunQueryTypeChange">
<el-radio-button label="count">按数量</el-radio-button>
<el-radio-button label="money">按金额</el-radio-button>
</el-radio-group>
</div>
<div class="flex1">
<kucunchart :chartList="kucunList"/>
<kucunchart :chartList="kucunList" :unit="kucunUnit"/>
</div>
</div>
</div>
......@@ -70,7 +70,7 @@
</el-radio-group>
</div>
<div class="flex1">
<rukuRankChart :chartList="rukuList"/>
<rukuRankChart :chartList="rukuList" :unit="rukuUnit"/>
</div>
</div>
<div class="card-container-flex chart-container shadow flex1 two">
......@@ -82,7 +82,7 @@
</el-radio-group>
</div>
<div class="flex1">
<rukuRankChart barColor="rgba(255, 125, 0, 1)" :chartList="cukuList"/>
<rukuRankChart barColor="rgba(255, 125, 0, 1)" :chartList="cukuList" :unit="cukuUnit"/>
</div>
</div>
</div>
......@@ -142,7 +142,10 @@ export default {
cukuRankType: 'count',
kucunList:[],
cukuList:[],
rukuList:[]
rukuList:[],
rukuUnit:'件',
cukuUnit:'件',
kucunUnit:'件'
}
},
mounted() {
......@@ -186,7 +189,8 @@ export default {
this.rukuList = data.map(item =>({
value:item.totalQuantity,
name:item.materialName
})).splice(0,5).reverse()
})).reverse().splice(0,5).reverse()
this.rukuUnit = '件'
})
}
if(this.rukuRankType === 'money'){
......@@ -196,8 +200,10 @@ export default {
this.rukuList = data.map(item =>({
value:item.totalMoney,
name:item.materialName
})).splice(0,5).reverse()
})).reverse().splice(0,5).reverse()
this.rukuUnit = '元'
})
}
},
queryKucun(){
......@@ -205,16 +211,16 @@ export default {
inventoryTopTenByQuantity().then(res=>{
let data = res.rows
if(!data) return
console.log('123123',data)
this.kucunList = data
this.kucunList = data.splice(0,5)
this.kucunUnit = '件'
})
}
if(this.kucunQueryType === 'money'){
inventoryTopTenByAmount().then(res=>{
let data = res.rows
if(!data) return
this.kucunList = data
this.kucunList = data.splice(0,5)
this.kucunUnit = '元'
})
}
},
......@@ -235,6 +241,7 @@ export default {
let data = res.rows
if(!data) return
this.cukuList = data.splice(0,5).reverse()
this.cukuUnit = '件'
})
}
if(this.cukuRankType === 'money'){
......@@ -242,6 +249,7 @@ export default {
let data = res.rows
if(!data) return
this.cukuList = data.splice(0,5).reverse()
this.cukuUnit = '元'
})
}
}
......
......@@ -80,7 +80,7 @@
readonly
@focus="openLocationSelector"
:suffix-icon="''"
:disabled="!queryParams.warehouseId"
>
<template v-if="queryLocationName" #suffix>
<i
......@@ -114,10 +114,10 @@
>
<el-table-column label="物料SAPNO" align="center" prop="sapNo" 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="batchId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="所在仓库" align="center" prop="warehousesName" width="200"/>
<el-table-column label="库位ID" align="center" prop="locationName" width="200"/>
<el-table-column label="关联入库单" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="批次" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="仓库" align="center" prop="warehousesName" width="200"/>
<el-table-column label="库位" align="center" prop="locationName" 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="unitPrice" width="200"/>
......@@ -159,7 +159,7 @@
<!-- 库位选择组件 -->
<LocationSelector
v-model="locationSelectorVisible"
:warehousesId="queryParams.warehouseId"
@selected="handleLocationSelected"
/>
</div>
......@@ -303,10 +303,10 @@ export default {
/** 打开库位选择器 */
openLocationSelector() {
if (!this.queryParams.warehouseId) {
this.$message.warning("请先选择仓库")
return
}
// if (!this.queryParams.warehouseId) {
// this.$message.warning("请先选择仓库")
// return
// }
this.locationSelectorVisible = true
},
......
......@@ -77,10 +77,10 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批次ID" prop="batchId">
<el-form-item label="批次" prop="batchId">
<el-input
v-model="queryParams.batchId"
placeholder="请输入批次ID"
placeholder="请输入批次"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -146,6 +146,7 @@
>
<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="batchId" width="200"/>
<el-table-column label="系统编号" align="center" prop="systemNo" width="200"/>
<!-- 新增:表格显示货主名称 -->
<el-table-column label="货主" align="center" prop="ownerName" width="200"/>
......@@ -168,7 +169,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="批次ID" align="center" prop="batchId" width="200"/>
<el-table-column label="入库单状态" align="center" prop="orderStatus" width="200">
<!-- 状态显示 -->
<template slot-scope="scope">
......@@ -246,8 +246,8 @@
<el-form-item label="入库单号" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入入库单号" />
</el-form-item>
<el-form-item label="批次ID" prop="batchId">
<el-input v-model="form.batchId" placeholder="请输入批次ID" />
<el-form-item label="批次" prop="batchId">
<el-input v-model="form.batchId" placeholder="请输入批次" />
</el-form-item>
<el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="form.orderTypeId" placeholder="请选择入库类型" clearable>
......@@ -315,7 +315,7 @@
<el-form-item label="总件数" prop="totalPackages">
<el-input v-model="form.totalPackages" placeholder="请输入总件数" />
</el-form-item>
<el-form-item label="仓库ID" prop="warehouseId">
<el-form-item label="仓库" prop="warehouseId">
<el-input v-model="form.warehouseId" placeholder="请输入仓库ID" />
</el-form-item>
</div>
......@@ -381,7 +381,7 @@
<el-descriptions :column="2" border class="mb20">
<el-descriptions-item label="入库单号">{{ detailForm.orderId || '-' }}</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="批次">{{ detailForm.batchId || '-' }}</el-descriptions-item>
<el-descriptions-item label="货主">{{ detailForm.ownerName || detailForm.ownerId || '-' }}</el-descriptions-item>
<el-descriptions-item label="入库类型">
{{ getDictLabel('inbound_outbound_type',detailForm.orderTypeId) }}
......@@ -394,7 +394,7 @@
<!-- <el-descriptions-item label="计划量">{{ detailForm.totalPlannedQuantity || '-' }}</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="仓库ID">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> -->
<!-- <el-descriptions-item label="仓库">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="备注" :span="2">
<div class="remark-text">{{ detailForm.remark || '-' }}</div>
</el-descriptions-item>
......@@ -432,8 +432,8 @@
ref="materialSelector"
/>
<div slot="footer">
<el-button @click="materialSelectOpen = false">取消</el-button>
<el-button type="primary" @click="confirmMaterialSelect">确定</el-button>
<el-button @click="materialSelectOpen = false">取消</el-button>
</div>
</el-dialog>
......@@ -461,7 +461,6 @@
<!-- 库位选择组件 -->
<LocationSelector
v-model="locationSelectorVisible"
:warehousesId="currentEditRowWarehousesId"
@selected="handleLocationSelected"
/>
</div>
......@@ -495,11 +494,6 @@ export default {
},
data() {
return {
inBoundStatusOptions: [
{ orderStatus: 1, orderStatusName: '草稿', type: 'info' },
{ orderStatus: 2, orderStatusName: '已完成', type: 'success' },
{ orderStatus: 3, orderStatusName: '已取消', type: 'danger' }
],
// 货主选择相关(对齐退库组件)
queryOwnerName: null,
ownerSelectorVisible: false,
......@@ -598,7 +592,7 @@ export default {
{ required: true, message: "系统编号不能为空", trigger: "blur" }
],
batchId: [
{ required: true, message: "批次ID不能为空", trigger: "blur" }
{ required: true, message: "批次不能为空", trigger: "blur" }
],
ownerId: [ // 新增货主必填校验
{ required: true, message: "货主不能为空", trigger: "change" }
......@@ -617,6 +611,7 @@ export default {
getList() {
this.loading = true
listInbound(this.queryParams).then(response => {
console.log(response.rows)
this.inboundList = response.rows
this.total = response.total
this.loading = false
......@@ -817,7 +812,7 @@ export default {
// 打开库位选择器
openLocationSelector(row) {
this.currentEditRow = row
this.currentEditRowWarehousesId = row.warehouseId // 传递仓库ID给库位选择器
// this.currentEditRowWarehousesId = row.warehouseId // 传递仓库ID给库位选择器
this.locationSelectorVisible = true
},
// 库位选择回调
......@@ -879,7 +874,9 @@ export default {
plannedQuantity: 0,
actualQuantity: 0,
unitPrice: 0,
totalAmount: 0
totalAmount: 0,
actualPackages: 0,
divisor: 0
})
} else {
// this.$message.warning(`物料 ${material.materialName} 已存在,跳过添加`)
......@@ -1177,6 +1174,6 @@ export default {
/* 统一对话框底部按钮样式 */
.dialog-footer {
text-align: center;
text-align: right;
}
</style>
......@@ -157,7 +157,7 @@
v-model="scope.row.warehousesName"
size="small"
readonly
placeholder="请选择仓库"
placeholder="请选择仓库"
@focus="$emit('open-warehouse-selector', scope.row)"
:suffix-icon="''"
>
......@@ -179,7 +179,6 @@
placeholder="请选择库位"
@focus="$emit('open-location-selector', scope.row)"
:suffix-icon="''"
:disabled="!scope.row.warehouseId"
>
<template v-if="scope.row.locationName" #suffix>
<i
......@@ -266,7 +265,7 @@
v-if="isEditable"
>
<template slot-scope="scope">
<el-button
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
......@@ -279,7 +278,7 @@
icon="el-icon-check"
@click="handleRowSave(scope.row)"
v-else
>保存</el-button>
>保存</el-button> -->
<el-button
size="mini"
type="text"
......@@ -343,7 +342,7 @@ export default {
{ prop: 'materialName', label: '货物名称', width: '150', editable: false },
{
prop: 'warehousesName',
label: '仓库',
label: '仓库',
width: '150',
editable: true,
idProp: 'warehouseId'
......@@ -407,7 +406,7 @@ export default {
acc.actualQuantity += parseFloat(item.actualQuantity) || 0
acc.totalAmount += (parseFloat(item.plannedQuantity) || 0) * (parseFloat(item.unitPrice) || 0)
return acc
}, { plannedQuantity: 0, actualQuantity: 0, totalAmount: 0 })
}, { plannedQuantity: 0, actualQuantity: 0, totalAmount: 0})
}
},
watch: {
......@@ -426,7 +425,7 @@ export default {
...item,
sapNo: item.sapNo, // 确保sapNo字段被保存
materialName: item.materialName, // 确保materialName字段被保存
editable: false,
editable: true,
tempId: item.id || Date.now() + Math.random()
}))
this.total = this.displayData.length
......@@ -503,7 +502,7 @@ export default {
...item,
sapNo: item.sapNo,
materialName: item.materialName,
editable: false,
editable: true,
tempId: item.id || Date.now() + Math.random()
}))
this.total = response.total
......@@ -570,7 +569,7 @@ export default {
listInbound_itemsAndMname(this.queryParams).then(response => {
this.displayData = response.rows.map(item => ({
...item,
editable: false,
editable: true,
tempId: item.id || Date.now() + Math.random()
}))
this.total = response.total
......@@ -601,6 +600,7 @@ export default {
actualQuantity: 0,
plannedPackages: 0,
actualPackages: 0,
divisor: 0,
unitPrice: 0,
remark: null,
editable: true,
......@@ -617,22 +617,22 @@ export default {
})
},
// 行编辑
handleRowEdit(row) {
const index = this.displayData.findIndex(item => item.tempId === row.tempId)
if (index > -1) {
this.$set(this.displayData[index], 'editable', true)
}
},
// // 行编辑
// handleRowEdit(row) {
// const index = this.displayData.findIndex(item => item.tempId === row.tempId)
// if (index > -1) {
// this.$set(this.displayData[index], 'editable', true)
// }
// },
// 行保存
handleRowSave(row) {
const index = this.displayData.findIndex(item => item.tempId === row.tempId)
if (index > -1) {
this.$set(this.displayData[index], 'editable', false)
this.$emit('row-saved', row)
}
},
// // 行保存
// handleRowSave(row) {
// const index = this.displayData.findIndex(item => item.tempId === row.tempId)
// if (index > -1) {
// this.$set(this.displayData[index], 'editable', false)
// this.$emit('row-saved', row)
// }
// },
// 行删除
handleRowDelete(row, index) {
......@@ -754,8 +754,8 @@ export default {
if (!item.materialId) {
errors.push(`第${index + 1}行:货物ID不能为空`)
}
if (parseFloat(item.plannedQuantity) <= 0) {
errors.push(`第${index + 1}行:计划数量必须大于0`)
if (parseFloat(item.actualQuantity) <= 0) {
errors.push(`第${index + 1}实际数量必须大于0`)
}
})
return errors
......
......@@ -144,6 +144,7 @@
<el-table-column label="SAP物料号" align="center" prop="sapNo" width="150"/>
<!-- <el-table-column label="物料编码" align="center" prop="materialCode" width="120"/> -->
<el-table-column label="物料名称" align="center" prop="materialName" width="150"/>
<el-table-column label="物料英文名称" align="center" prop="materialEname" width="150"/>
<el-table-column label="TS Code" align="center" prop="tsCode" width="150"/>
<el-table-column label="物料分类" align="center" prop="categoryCode" >
<template slot-scope="scope">
......@@ -298,6 +299,9 @@
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="物料英文名称" prop="materialEname">
<el-input v-model="form.materialEname" placeholder="请输入物料英文名称" />
</el-form-item>
<el-form-item label="物料分类" prop="categoryCode">
<el-select v-model="form.categoryCode" placeholder="请选择物料分类" clearable>
<el-option
......@@ -444,6 +448,7 @@ export default {
id: null,
materialCode: null,
materialName: null,
materialEname: null,
sapNo: null,
tsCode: null,
categoryCode: null,
......
......@@ -23,7 +23,7 @@
<!-- 右侧物料列表(仅展示和查询) -->
<pane size="84" style="overflow: auto;">
<div style="padding: 10px; display: flex; flex-direction: column;">
<div style="padding: 10px; display: flex; flex-direction: column; height: 100%;">
<!-- 查询表单 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px">
<!-- <el-form-item label="物料编码" prop="materialCode">
......@@ -65,6 +65,7 @@
</el-form>
<!-- 物料表格(隐藏操作列,保留选择功能) -->
<div class="table-container">
<el-table
ref="materialTable"
v-loading="loading"
......@@ -72,9 +73,11 @@
@selection-change="handleSelectionChange"
:scroll-x="true"
:row-key="row => row.id"
style="height: 100%;"
@row-click="handleRowClick"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" label="序号" align="center"/>
<!-- <el-table-column label="物料编码" align="center" prop="materialCode" width="120"/> -->
<el-table-column label="SAP物料号" align="center" prop="sapNo" />
......@@ -95,7 +98,7 @@
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<pagination
v-show="total>0"
......@@ -251,7 +254,7 @@ export default {
.filter(item => item.isUsed !== 0 && item.isUsed !== '0')
.map(item => ({
...item,
displayCategory: this.categoryMap[item.categoryCode] || `${item.categoryCode}(未匹配分类)`
displayCategory: this.categoryMap[item.categoryCode] || `未匹配分类`
}));
this.total = response.total;
}).finally(() => {
......@@ -337,7 +340,24 @@ export default {
height: 100%;
min-height: 500px;
}
.custom-tree-node {
font-size: 14px;
}
/* 表格容器样式 */
.table-container {
flex: 1;
max-height: 450px; /* 关键:允许弹性项目收缩 */
overflow: auto;
margin-bottom: 10px;
}
/* 调整分页组件位置 */
::v-deep .el-pagination {
margin-top: 10px;
flex-shrink: 0; /* 防止分页被压缩 */
}
</style>
......@@ -84,29 +84,29 @@
<el-table v-loading="loading" :data="statisticsList" border height="100%">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="入库次数" align="center" prop="inboundCount" width="100" />
<el-table-column label="出库次数" align="center" prop="outboundCount" width="100" />
<el-table-column label="入库数量" align="center" prop="inboundQuantity" width="120">
<el-table-column label="入库次数" align="center" prop="inboundCount" min-width="100" />
<el-table-column label="出库次数" align="center" prop="outboundCount" min-width="100" />
<el-table-column label="入库数量" align="center" prop="inboundQuantity" min-width="120">
<template slot-scope="scope">
{{ formatNumber(scope.row.inboundQuantity) }}
</template>
</el-table-column>
<el-table-column label="出库数量" align="center" prop="outboundQuantity" width="120">
<el-table-column label="出库数量" align="center" prop="outboundQuantity" min-width="120">
<template slot-scope="scope">
{{ formatNumber(scope.row.outboundQuantity) }}
</template>
</el-table-column>
<el-table-column label="入库总额" align="center" prop="inboundAmount" width="120">
<el-table-column label="入库总额" align="center" prop="inboundAmount" min-width="120">
<template slot-scope="scope">
{{ formatAmount(scope.row.inboundAmount) }}
</template>
</el-table-column>
<el-table-column label="出库总额" align="center" prop="outboundAmount" width="120">
<el-table-column label="出库总额" align="center" prop="outboundAmount" min-width="120">
<template slot-scope="scope">
{{ formatAmount(scope.row.outboundAmount) }}
</template>
</el-table-column>
<el-table-column label="总额差" align="center" prop="amountDiff" width="120">
<el-table-column label="总额差" align="center" prop="amountDiff" min-width="120">
<template slot-scope="scope">
<span :style="{ color: (scope.row.amountDiff || 0) >= 0 ? '#67C23A' : '#F56C6C' }">
{{ formatAmount(scope.row.amountDiff || ((scope.row.inboundAmount || 0) - (scope.row.outboundAmount || 0))) }}
......
......@@ -135,27 +135,35 @@
<div class="table-container">
<el-table v-loading="loading" :data="inventoryList" border height="100%">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料名称" align="center" prop="materialName" width="150" />
<el-table-column label="SAP物料号" align="center" prop="sapNo" width="120" />
<el-table-column label="TS Code" align="center" prop="tsCode" width="120" />
<el-table-column label="危险类别" align="center" prop="hazard" width="120" />
<el-table-column label="规格型号" align="center" prop="specification" width="120" />
<el-table-column label="计量单位" align="center" prop="materialUnit" width="120" />
<el-table-column label="单位重量" align="center" prop="unitWeight" width="120" >
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" />
<el-table-column label="SAP物料号" align="center" prop="sapNo" min-width="120" />
<el-table-column label="TS Code" align="center" prop="tsCode" min-width="120" />
<el-table-column label="危险类别" align="center" prop="hazardId" min-width="120" >
<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" min-width="120" />
<el-table-column label="计量单位" align="center" prop="materialUnit" min-width="120" />
<el-table-column label="单位重量" align="center" prop="unitWeight" min-width="120" >
<template slot-scope="scope">
{{ formatAmount(scope.row.unitWeight || 0) }}
</template>
</el-table-column>
<el-table-column label="库存数量" align="center" prop="totalQuantity" width="100" />
<el-table-column label="锁定数量" align="center" prop="totalLockedQuantity" width="100" />
<el-table-column label="可用数量" align="center" width="100">
<el-table-column label="库存数量" align="center" prop="totalQuantity" min-width="100" />
<el-table-column label="锁定数量" align="center" prop="totalLockedQuantity" min-width="100" />
<el-table-column label="可用数量" align="center" min-width="100">
<template slot-scope="scope">
{{ (scope.row.totalQuantity || 0) - (scope.row.totalLockedQuantity || 0) }}
</template>
</el-table-column>
<el-table-column label="最低库存" align="center" prop="minStockLevel" width="100" />
<el-table-column label="最高库存" align="center" prop="maxStockLevel" width="100" />
<el-table-column label="预警状态" align="center" prop="alterType" width="100">
<el-table-column label="最低库存" align="center" prop="minStockLevel" min-width="100" />
<el-table-column label="最高库存" align="center" prop="maxStockLevel" min-width="100" />
<el-table-column label="预警状态" align="center" prop="alterType" min-width="100">
<template slot-scope="scope">
<el-tag
:type="getWarnStatusType(scope.row.alterType)"
......@@ -229,19 +237,27 @@
max-height="600"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料名称" align="center" prop="materialName" width="150" />
<el-table-column label="SAP物料号" align="center" prop="sapNo" width="120" />
<el-table-column label="TS Code" align="center" prop="tsCode" width="120" />
<el-table-column label="危险类别" align="center" prop="hazard" width="120" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" />
<el-table-column label="SAP物料号" align="center" prop="sapNo" min-width="120" />
<el-table-column label="TS Code" align="center" prop="tsCode" min-width="120" />
<el-table-column label="危险类别" align="center" prop="hazardId" min-width="120" >
<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" width="120" /> -->
<!-- <el-table-column label="入库单号" align="center" prop="orderId" width="150" /> -->
<el-table-column label="批次" align="center" prop="batchId" width="120" />
<el-table-column label="仓库" align="center" prop="warehousesName" width="120" />
<el-table-column label="库位" align="center" prop="locationName" width="120" />
<el-table-column label="货主" align="center" prop="ownerName" width="120" />
<el-table-column label="库存数量" align="center" prop="quantity" width="100" />
<el-table-column label="锁定数量" align="center" prop="lockedQuantity" width="100" />
<el-table-column label="可用数量" align="center" width="100">
<el-table-column label="批次" align="center" prop="batchId" min-width="120" />
<el-table-column label="仓库" align="center" prop="warehousesName" min-width="120" />
<el-table-column label="库位" align="center" prop="locationName" min-width="120" />
<el-table-column label="货主" align="center" prop="ownerName" min-width="120" />
<el-table-column label="库存数量" align="center" prop="quantity" min-width="100" />
<el-table-column label="锁定数量" align="center" prop="lockedQuantity" min-width="100" />
<el-table-column label="可用数量" align="center" min-width="100">
<template slot-scope="scope">
{{ (scope.row.quantity || 0) - (scope.row.lockedQuantity || 0) }}
</template>
......@@ -265,6 +281,7 @@ import ImportExcel from "@/components/ImportExcel"
export default {
name: "InventoryDetail",
dicts: ['danger_type'],
components: {
RightToolbar,
PageTitle,
......@@ -333,6 +350,19 @@ export default {
this.getList()
},
methods: {
//从表格中的值当作键获取字典lebel
getDictLabel(dictType, value){
if(!value || !this.dict?.type?.[dictType]) return '-'
const dictItem = this.dict.type[dictType].find(item => item.value === value)
return dictItem?.label || '-'
},
//从表格中的值当作键获取字典listClass
getDictListClass(dictType, value){
if(!value || !this.dict?.type?.[dictType]) return '-'
const dictItem = this.dict.type[dictType].find(item => item.value === value)
return dictItem?.label || '-'
},
/** 查询库存明细列表 */
getList() {
this.loading = true
......
......@@ -6,6 +6,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import com.ruoyi.common.config.WarehouseConfig;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.inventory.domain.*;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
......@@ -205,7 +206,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
.stream()
.filter(Objects::nonNull) // 过滤null的VO对象
.map(vo -> {
// 预处理:入库单号去空格,统一格式(反射调用get/setOrderId
// 预处理:对入库单号和批次号去空格,统一格式(反射调用getter/setter
try {
// 反射获取getOrderId方法
Method getOrderIdMethod = vo.getClass().getMethod("getOrderId");
......@@ -213,9 +214,19 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
.map(Object::toString)
.map(String::trim) // 去除首尾空格
.orElse("");
// 反射获取getBatchId方法
Method getBatchId = vo.getClass().getMethod("getBatchId");
String batchId = Optional.ofNullable(getBatchId.invoke(vo))
.map(Object::toString)
.map(String::trim)
.orElse("");
// 反射调用setOrderId方法回写处理后的单号
Method setOrderIdMethod = vo.getClass().getMethod("setOrderId", String.class);
setOrderIdMethod.invoke(vo, orderId);
// 反射调用setBatchId方法回写处理后的批次号
Method setBatchIdMethod = vo.getClass().getMethod("setBatchId",String.class);
setBatchIdMethod.invoke(vo,batchId);
} catch (Exception e) {
throw new ServiceException("实体类缺少orderId的getter/setter方法" + e);
}
......@@ -238,8 +249,13 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
// 反射获取分组Key:处理后的入库单号
try {
Method getOrderIdMethod = vo.getClass().getMethod("getOrderId");
Method getBatchIdMethod = vo.getClass().getMethod("getBatchId");
return Optional.ofNullable(getOrderIdMethod.invoke(vo))
.map(Object::toString)
.orElse("")
+ "--" +
Optional.ofNullable(getBatchIdMethod.invoke(vo))
.map(Object::toString)
.orElse("");
} catch (Exception e) {
throw new ServiceException("分组获取orderId失败" + e);
......@@ -255,7 +271,9 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
// 4. 遍历每个入库单分组处理
for (Map.Entry<String, List<T>> entry : orderGroupMap.entrySet()) {
String orderId = entry.getKey();
String orderKey = entry.getKey();
String orderId = orderKey.split("--")[0];
String batchId = orderKey.split("--")[1];
List<T> voList = entry.getValue();
InboundOrders mainDO = null;
List<InboundOrderItems> itemDOList = new ArrayList<>();
......@@ -264,18 +282,21 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
// 4.1 处理主表(每个入库单号只处理一次主表)
T firstVO = voList.get(0); // 取第一条VO的主表信息
// 检查入库单是否已存在
InboundOrders existMain = inboundOrdersMapper.selectInboundOrdersByOrderId(orderId);
if (existMain != null) {
InboundOrders query = new InboundOrders();
query.setOrderId(orderId);
query.setBatchId(batchId);
List<InboundOrders> existMain = inboundOrdersMapper.selectInboundOrdersList(query);
System.out.println(existMain);
if (existMain != null && !existMain.isEmpty()) {
if (isUpdateSupport == 0) {
// 不支持更新,跳过该入库单
totalMainFailure++;
failureMsg.append(String.format("入库单号【%s】已存在,且不支持更新,跳过导入;\n", orderId));
failureMsg.append(String.format("该批次的入库单号【%s】已存在,且不支持更新,跳过导入;\n", orderId));
totalItemFailure += voList.size(); // 该单的明细全部失败
continue;
}
// 支持更新,复用已有主表ID
mainDO = existMain;
mainDO = existMain.get(0);
// 反射复制VO中的主表字段到已有主表(只更新可修改的字段)
BeanUtils.copyProperties(firstVO, mainDO, "id", "createBy", "createTime"); // 排除不可更新字段
mainDO.setUpdateBy(operId);
......@@ -295,6 +316,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
"plannedPackages", "materialUnit", "materialRemark"); // 排除子表字段
// 填充主表必填字段
mainDO.setId(UUID.randomUUID().toString());
mainDO.setInboundDate(now);
mainDO.setOrderId(orderId);
mainDO.setCreateBy(operId);
mainDO.setCreateTime(now);
......@@ -348,7 +370,6 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
itemDO.setOrderId(orderId); // 关联入库单号
// 反射获取batchId并设置
String batchId = "";
try {
Method getBatchIdMethod = vo.getClass().getMethod("getBatchId");
batchId = Optional.ofNullable(getBatchIdMethod.invoke(vo))
......@@ -408,10 +429,11 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
}
String warehouseId = warehouseNameIdMap.get(warehouseName);
if (StringUtils.isBlank(warehouseId)) {
log.info("仓库【" + warehouseName + "】不存在,可能为成品入库");
}
log.info("仓库【" + warehouseName + "】不存在,可能暂无仓库或为成品入库,已使用默认仓库");
itemDO.setWarehouseId(WarehouseConfig.DEFAULT_WAREHOUSE_ID);
}else{
itemDO.setWarehouseId(warehouseId);
}
// 2. 库位名称转ID
String locationName = "";
try {
......@@ -426,10 +448,10 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
String locationId = storageLocationNameIdMap.get(locationName);
if (StringUtils.isBlank(locationId)) {
log.info("库位【" + locationName + "】不存在,可能为成品入库");
}
log.info("库位【" + locationName + "】不存在,可能暂无库位或为成品入库");
}else{
itemDO.setLocationId(locationId);
}
itemDOList.add(itemDO);
} catch (Exception e) {
// 单个明细失败:仅统计,不影响整单
......
......@@ -231,8 +231,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<!-- 统计入库次数-->
<select id="countInboundOrders" resultType="int" parameterType="String">
select count(id)
......@@ -247,19 +245,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result column="total_money" property="totalMoney" jdbcType="DECIMAL"/>
</resultMap>
<select id="countInboundMaterialQuantity" resultMap="InboundMaterialTotalResultMap" parameterType="String">
select m.material_name,
SELECT t.material_name, t.total_quantity
FROM (
SELECT m.material_name,
COALESCE(SUM(ioi.actual_quantity), 0) as total_quantity
from materials as m
left join inbound_order_items as ioi
on m.id = ioi.material_id
left join inbound_orders as io
on io.id = ioi.inbound_order_id
and io.order_status = 2
where m.is_used = 1 and m.is_active = 1
group by m.id
order by total_quantity
FROM materials as m
LEFT JOIN inbound_order_items as ioi ON m.id = ioi.material_id
LEFT JOIN inbound_orders as io ON io.id = ioi.inbound_order_id AND io.order_status = 2
WHERE m.is_used = 1 AND m.is_active = 1
GROUP BY m.id, m.material_name
ORDER BY total_quantity DESC
LIMIT 10
) t
ORDER BY t.total_quantity ASC;
</select>
<select id="countInboundMaterialMoney" resultMap="InboundMaterialTotalResultMap" parameterType="String">
select t.material_name,t.total_money
from(
select m.material_name,
COALESCE(sum(ioi.actual_quantity * ioi.unit_price), 0) as total_money
from materials as m
......@@ -270,6 +272,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and io.order_status = 2
where m.is_used = 1 and m.is_active = 1
group by m.id
order by total_money
order by total_money desc
limit 10
) t
order by total_money asc
</select>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,7 @@
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name"/>
<result property="hazardId" column="hazard_id" />
<result property="batchId" column="batch_id" />
<result property="warehousesCode" column="warehouses_code" />
<result property="warehousesName" column="warehouses_name"/>
......@@ -217,7 +218,7 @@
select tab.*, case when total_quantity &lt; min_stock_level then '2' when total_quantity &gt; max_stock_level then '1' else '3' end alterType from (
<include refid="selectInventoryCount"/>
<where>
and i.quantity > 0 and i.inventory_status = 1 and i.is_used = 1
and i.quantity != 0 and i.inventory_status = 1 and i.is_used = 1
<if test="inventoryType != null "> and i.inventory_type = #{inventoryType}</if>
<if test="materialId != null and materialId != ''"> and m.material_code like concat('%', #{materialId}, '%')</if>
<if test="batchId != null and batchId != ''"> and i.batch_id like concat('%', #{batchId}, '%')</if>
......@@ -325,7 +326,7 @@
<select id="selectInventoryDetailList" parameterType="Inventory" resultMap="InventoryResult">
<include refid="selectInventoryDetailVo"/>
<where>
and i.quantity > 0 and i.inventory_status = 1 and i.is_used = 1
and i.quantity != 0 and i.inventory_status = 1 and i.is_used = 1
<if test="inventoryType != null "> and i.inventory_type = #{inventoryType}</if>
<if test="materialId != null and materialId != ''"> and i.material_id = #{materialId}</if>
<if test="batchId != null and batchId != ''"> and i.batch_id like concat('%', #{batchId}, '%')</if>
......@@ -401,6 +402,7 @@
i.order_id,
i.material_id,
m.material_name,
m.hazard_id,
i.batch_id,
i.location_id,
sl.location_name,
......
......@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialEname" column="material_ename" />
<result property="sapNo" column="sap_no" />
<result property="tsCode" column="ts_code" />
<result property="categoryCode" column="category_code" />
......@@ -36,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectMaterialsVo">
select id, material_code, material_name, sap_no, ts_code, category_code, hazard_id, specification, material_unit, unit_weight, package_weight, total_weight, volume, shelf_life_days, storage_temperature, special_requirements, is_batch_managed, is_serial_managed, min_stock_level, max_stock_level, is_used, is_active, risk_level, sort_no, create_time, create_user_code, update_time, update_user_code from materials
select id, material_code, material_name,material_ename, sap_no, ts_code, category_code, hazard_id, specification, material_unit, unit_weight, package_weight, total_weight, volume, shelf_life_days, storage_temperature, special_requirements, is_batch_managed, is_serial_managed, min_stock_level, max_stock_level, is_used, is_active, risk_level, sort_no, create_time, create_user_code, update_time, update_user_code from materials
</sql>
<select id="selectMaterialsList" parameterType="Materials" resultMap="MaterialsResult">
......@@ -101,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="id != null">id,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="materialEname != null">material_ename,</if>
<if test="sapNo != null">sap_no,</if>
<if test="tsCode != null">ts_code,</if>
<if test="categoryCode != null">category_code,</if>
......@@ -131,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="id != null">#{id},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialEname != null">#{materialEname},</if>
<if test="sapNo != null">#{sapNo},</if>
<if test="tsCode != null">#{tsCode},</if>
<if test="categoryCode != null">#{categoryCode},</if>
......@@ -164,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialEname != null">material_ename = #{materialEname},</if>
<if test="sapNo != null">sap_no = #{sapNo},</if>
<if test="tsCode != null">ts_code = #{tsCode},</if>
<if test="categoryCode != null">category_code = #{categoryCode},</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论