Commit b0192161 by yubin

Merge remote-tracking branch 'origin/master'

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