Commit 36733eb3 by wangchunyang

退库处理及统计

parent 59df6518
...@@ -3,7 +3,7 @@ import request from '@/utils/request' ...@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询退库单明细列表 // 查询退库单明细列表
export function listReturnOrderItems(query) { export function listReturnOrderItems(query) {
return request({ return request({
url: '/inventory/return_order_items/list', url: '/inventory/return_order_items/count_detail',
method: 'get', method: 'get',
params: query params: query
}) })
...@@ -52,3 +52,11 @@ export function exportReturnOrderItems(query) { ...@@ -52,3 +52,11 @@ export function exportReturnOrderItems(query) {
}) })
} }
// 查询退库单明细列表
export function listReturnOrderCount(query) {
return request({
url: '/inventory/return_order_items/count',
method: 'post',
params: query
})
}
<template> <template>
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="900px" width="800px"
append-to-body append-to-body
class="owner-selector-dialog" class="owner-selector-dialog"
:close-on-click-modal="false" :close-on-click-modal="false"
...@@ -35,17 +35,6 @@ ...@@ -35,17 +35,6 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="是否激活" prop="isActive">
<el-select
v-model="queryParams.isActive"
placeholder="请选择"
clearable
style="width: 180px"
>
<el-option label="是" value="1" />
<el-option label="否" value="0" />
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
...@@ -66,13 +55,6 @@ ...@@ -66,13 +55,6 @@
<el-table-column label="货主名称" prop="ownerName" min-width="220" show-overflow-tooltip /> <el-table-column label="货主名称" prop="ownerName" min-width="220" show-overflow-tooltip />
<el-table-column label="联系人" prop="contactPerson" width="150" /> <el-table-column label="联系人" prop="contactPerson" width="150" />
<el-table-column label="联系电话" prop="contactPhone" width="150" /> <el-table-column label="联系电话" prop="contactPhone" width="150" />
<el-table-column label="是否激活" prop="isActive" width="110" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.isActive === '1' || scope.row.isActive === 1 ? 'success' : 'info'" size="mini">
{{ scope.row.isActive === '1' || scope.row.isActive === 1 ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
......
...@@ -73,13 +73,6 @@ ...@@ -73,13 +73,6 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="地址" prop="address" min-width="200" show-overflow-tooltip /> <el-table-column label="地址" prop="address" min-width="200" show-overflow-tooltip />
<el-table-column label="是否启用" prop="isEnabled" width="110" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.isEnabled === '1' || scope.row.isEnabled === 1 ? 'success' : 'info'" size="mini">
{{ scope.row.isEnabled === '1' || scope.row.isEnabled === 1 ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
readonly readonly
@focus="openLocationSelector" @focus="openLocationSelector"
:suffix-icon="''" :suffix-icon="''"
:disabled="!queryParams.warehousesCode" :disabled="!queryParams.warehouseId"
> >
<template v-if="queryLocationName" #suffix> <template v-if="queryLocationName" #suffix>
<i <i
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
<!-- 库位选择组件 --> <!-- 库位选择组件 -->
<LocationSelector <LocationSelector
v-model="locationSelectorVisible" v-model="locationSelectorVisible"
:warehouses-code="queryParams.warehousesCode" :warehousesId="queryParams.warehouseId"
@selected="handleLocationSelected" @selected="handleLocationSelected"
/> />
</div> </div>
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
}, },
/** 打开库位选择器 */ /** 打开库位选择器 */
openLocationSelector() { openLocationSelector() {
if (!this.queryParams.warehousesCode) { if (!this.queryParams.warehouseId) {
this.$message.warning("请先选择仓库") this.$message.warning("请先选择仓库")
return return
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
readonly readonly
@focus="openLocationSelector" @focus="openLocationSelector"
:suffix-icon="''" :suffix-icon="''"
:disabled="!queryParams.warehousesCode" :disabled="!queryParams.warehouseId"
> >
<template v-if="queryLocationName" #suffix> <template v-if="queryLocationName" #suffix>
<i <i
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
<!-- 库位选择组件 --> <!-- 库位选择组件 -->
<LocationSelector <LocationSelector
v-model="locationSelectorVisible" v-model="locationSelectorVisible"
:warehouses-code="queryParams.warehousesCode" :warehousesId="queryParams.warehouseId"
@selected="handleLocationSelected" @selected="handleLocationSelected"
/> />
...@@ -387,6 +387,7 @@ export default { ...@@ -387,6 +387,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
warehouseId: null,
warehousesCode: null, warehousesCode: null,
locationId: null, locationId: null,
materialId: null, materialId: null,
...@@ -439,6 +440,7 @@ export default { ...@@ -439,6 +440,7 @@ export default {
this.queryWarehouseName = null this.queryWarehouseName = null
this.queryLocationName = null this.queryLocationName = null
this.queryParams.ownerId = null this.queryParams.ownerId = null
this.queryParams.warehouseId = null
this.queryParams.warehousesCode = null this.queryParams.warehousesCode = null
this.queryParams.locationId = null this.queryParams.locationId = null
this.handleQuery() this.handleQuery()
...@@ -467,6 +469,7 @@ export default { ...@@ -467,6 +469,7 @@ export default {
/** 仓库选择回调 */ /** 仓库选择回调 */
handleWarehouseSelected(warehouse) { handleWarehouseSelected(warehouse) {
if (!warehouse) return if (!warehouse) return
this.queryParams.warehouseId = warehouse.warehouseId || warehouse.id
this.queryParams.warehousesCode = warehouse.warehousesCode this.queryParams.warehousesCode = warehouse.warehousesCode
this.queryWarehouseName = warehouse.warehousesName || warehouse.warehousesCode this.queryWarehouseName = warehouse.warehousesName || warehouse.warehousesCode
// 仓库选择后,清空库位信息 // 仓库选择后,清空库位信息
...@@ -476,7 +479,7 @@ export default { ...@@ -476,7 +479,7 @@ export default {
}, },
/** 打开库位选择器 */ /** 打开库位选择器 */
openLocationSelector() { openLocationSelector() {
if (!this.queryParams.warehousesCode) { if (!this.queryParams.warehouseId) {
this.$message.warning("请先选择仓库") this.$message.warning("请先选择仓库")
return return
} }
...@@ -492,6 +495,7 @@ export default { ...@@ -492,6 +495,7 @@ export default {
/** 清空仓库选择 */ /** 清空仓库选择 */
clearQueryWarehouse() { clearQueryWarehouse() {
this.queryWarehouseName = null this.queryWarehouseName = null
this.queryParams.warehouseId = null
this.queryParams.warehousesCode = null this.queryParams.warehousesCode = null
// 清空仓库时,同时清空库位 // 清空仓库时,同时清空库位
this.queryLocationName = null this.queryLocationName = null
......
...@@ -147,11 +147,11 @@ ...@@ -147,11 +147,11 @@
</el-table-column> </el-table-column>
<el-table-column label="计划量" align="center" prop="totalPlannedQuantity" width="100" /> <el-table-column label="计划量" align="center" prop="totalPlannedQuantity" width="100" />
<el-table-column label="实际量" align="center" prop="totalActualQuantity" width="100" /> <el-table-column label="实际量" align="center" prop="totalActualQuantity" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="120"> <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
<el-date-picker <el-date-picker
v-model="form.returnDate" v-model="form.returnDate"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd"
placeholder="请选择退库日期" placeholder="请选择退库日期"
style="width: 100%" style="width: 100%"
:disabled="isDetailMode || form.orderStatus === 2" :disabled="isDetailMode || form.orderStatus === 2"
...@@ -473,6 +473,7 @@ ...@@ -473,6 +473,7 @@
<script> <script>
import { listReturnOrders, getReturnOrder, delReturnOrder, addReturnOrder, updateReturnOrder, confirmReturnOrder } from "@/api/inventory/return_orders" import { listReturnOrders, getReturnOrder, delReturnOrder, addReturnOrder, updateReturnOrder, confirmReturnOrder } from "@/api/inventory/return_orders"
import { listData } from "@/api/system/dict/data"
import RightToolbar from "@/components/RightToolbar" import RightToolbar from "@/components/RightToolbar"
import PageTitle from "@/components/PageTitle" import PageTitle from "@/components/PageTitle"
import MaterialSelector from "@/views/inventory/materials/materialsSeletor.vue" import MaterialSelector from "@/views/inventory/materials/materialsSeletor.vue"
...@@ -494,10 +495,10 @@ export default { ...@@ -494,10 +495,10 @@ export default {
return { return {
// 退库类型选项(字典:1-TRDC退料 2-质量退料 3-多出退料 4-其他,默认1) // 退库类型选项(字典:1-TRDC退料 2-质量退料 3-多出退料 4-其他,默认1)
returnTypeOptions: [ returnTypeOptions: [
{ value: '1', label: 'TRDC退料' }, // { value: '1', label: 'TRDC退料' },
{ value: '2', label: '质量退料' }, // { value: '2', label: '质量退料' },
{ value: '3', label: '多出退料' }, // { value: '3', label: '多出退料' },
{ value: '4', label: '其他' } // { value: '4', label: '其他' }
], ],
// 订单状态选项(字典:1-草稿 2-已完成) // 订单状态选项(字典:1-草稿 2-已完成)
orderStatusOptions: [ orderStatusOptions: [
...@@ -585,6 +586,7 @@ export default { ...@@ -585,6 +586,7 @@ export default {
} }
}, },
created() { created() {
this.getDictData()
this.getList() this.getList()
}, },
methods: { methods: {
...@@ -993,6 +995,15 @@ export default { ...@@ -993,6 +995,15 @@ export default {
this.download('inventory/return_order_items/export', { this.download('inventory/return_order_items/export', {
...params ...params
}, `退库物料数据_${new Date().getTime()}.xlsx`) }, `退库物料数据_${new Date().getTime()}.xlsx`)
},
/** 查询字典数据列表 */
getDictData() {
this.loading = true
listData({"dictType": "return_orders_type"}).then(response => {
this.returnTypeOptions = response.rows.map(item => {return {value: item.dictValue, label: item.dictLabel}})
this.loading = false
console.log("return_orders_type", response.rows)
})
} }
} }
} }
...@@ -1044,7 +1055,7 @@ export default { ...@@ -1044,7 +1055,7 @@ export default {
} }
.w20 { .w20 {
width: 120px; width: 150px;
} }
</style> </style>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
readonly readonly
@focus="openLocationSelector" @focus="openLocationSelector"
:suffix-icon="''" :suffix-icon="''"
:disabled="!queryParams.warehousesCode" :disabled="!queryParams.warehouseId"
> >
<template v-if="queryLocationName" #suffix> <template v-if="queryLocationName" #suffix>
<i <i
...@@ -97,6 +97,16 @@ ...@@ -97,6 +97,16 @@
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="退库单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择退库单状态" clearable class="w20">
<el-option
v-for="item in orderStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
...@@ -108,31 +118,30 @@ ...@@ -108,31 +118,30 @@
<div class="table-container"> <div class="table-container">
<el-table v-loading="loading" :data="returnOrderItemList" border height="100%" style="width: 100%"> <el-table v-loading="loading" :data="returnOrderItemList" border height="100%" style="width: 100%">
<el-table-column type="index" label="序号" width="60" align="center" fixed="left" /> <el-table-column type="index" label="序号" width="60" align="center" fixed="left" />
<el-table-column label="退库单号" align="center" prop="orderId" width="150" /> <!-- <el-table-column label="物料ID" align="center" prop="materialId" width="150" /> -->
<el-table-column label="退库日期" align="center" prop="returnDate" width="120"> <el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<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" >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.returnDate, '{y}-{m}-{d}') }}</span> {{ formatAmount(scope.row.unitWeight || 0) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="货主" align="center" prop="ownerName" width="120" />
<el-table-column label="物料ID" align="center" prop="materialId" width="150" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="批次ID" align="center" prop="batchCode" width="120" />
<el-table-column label="仓库" align="center" prop="warehouseName" width="120" />
<el-table-column label="库位" align="center" prop="locationName" width="120" />
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" /> <el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" /> <el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" />
<el-table-column label="单价" align="center" prop="unitPrice" width="100"> <el-table-column label="总额" align="center" prop="totalAmount" width="100" >
<template slot-scope="scope"> <template slot-scope="scope">
{{ formatAmount(scope.row.unitPrice) }} {{ formatAmount(scope.row.totalAmount || 0) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="金额" align="center" prop="totalAmount" width="120"> <!-- <el-table-column label="金额" align="center" prop="totalAmount" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
{{ formatAmount(scope.row.totalAmount || (scope.row.actualQuantity || 0) * (scope.row.unitPrice || 0)) }} {{ formatAmount(scope.row.totalAmount || (scope.row.actualQuantity || 0) * (scope.row.unitPrice || 0)) }}
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="备注" align="center" prop="remark" min-width="150" show-overflow-tooltip />
<el-table-column label="操作" align="center" width="100" fixed="right"> <el-table-column label="操作" align="center" width="100" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -217,7 +226,7 @@ ...@@ -217,7 +226,7 @@
readonly readonly
@focus="openDetailLocationSelector" @focus="openDetailLocationSelector"
:suffix-icon="''" :suffix-icon="''"
:disabled="!detailQueryParams.warehousesCode" :disabled="!detailQueryParams.warehouseId"
style="width: 200px;" style="width: 200px;"
> >
<template v-if="detailLocationName" #suffix> <template v-if="detailLocationName" #suffix>
...@@ -251,9 +260,8 @@ ...@@ -251,9 +260,8 @@
> >
<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="orderId" width="150" /> <el-table-column label="退库单号" align="center" prop="orderId" width="150" />
<el-table-column label="物料ID" align="center" prop="materialId" width="150" />
<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="批次ID" align="center" prop="batchCode" width="120" /> <el-table-column label="批次" align="center" prop="batchCode" width="120" />
<el-table-column label="仓库" align="center" prop="warehouseName" width="120" /> <el-table-column label="仓库" align="center" prop="warehouseName" width="120" />
<el-table-column label="库位" align="center" prop="locationName" width="120" /> <el-table-column label="库位" align="center" prop="locationName" width="120" />
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" /> <el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
...@@ -286,7 +294,7 @@ ...@@ -286,7 +294,7 @@
</template> </template>
<script> <script>
import { listReturnOrderItems } from "@/api/inventory/return_order_items" import { listReturnOrderItems, listReturnOrderCount } from "@/api/inventory/return_order_items"
import RightToolbar from "@/components/RightToolbar" import RightToolbar from "@/components/RightToolbar"
import PageTitle from "@/components/PageTitle" import PageTitle from "@/components/PageTitle"
import OwnerSelector from "@/views/compononents/OwnerSelector.vue" import OwnerSelector from "@/views/compononents/OwnerSelector.vue"
...@@ -324,7 +332,8 @@ export default { ...@@ -324,7 +332,8 @@ export default {
warehouseId: null, warehouseId: null,
warehousesCode: null, warehousesCode: null,
locationId: null, locationId: null,
dateRange: null dateRange: null,
orderStatus: 2
}, },
// 货主选择相关 // 货主选择相关
ownerSelectorVisible: false, ownerSelectorVisible: false,
...@@ -349,13 +358,19 @@ export default { ...@@ -349,13 +358,19 @@ export default {
warehouseId: null, warehouseId: null,
warehousesCode: null, warehousesCode: null,
locationId: null, locationId: null,
batchCode: null batchCode: null,
orderStatus: null
}, },
// 详情弹窗中的仓库和库位选择 // 详情弹窗中的仓库和库位选择
detailWarehouseSelectorVisible: false, detailWarehouseSelectorVisible: false,
detailLocationSelectorVisible: false, detailLocationSelectorVisible: false,
detailWarehouseName: null, detailWarehouseName: null,
detailLocationName: null detailLocationName: null,
// 订单状态选项(字典:1-草稿 2-已完成)
orderStatusOptions: [
{ value: 1, label: '草稿' },
{ value: 2, label: '已完成' }
]
} }
}, },
created() { created() {
...@@ -373,7 +388,7 @@ export default { ...@@ -373,7 +388,7 @@ export default {
} }
delete params.dateRange delete params.dateRange
listReturnOrderItems(params).then(response => { listReturnOrderCount(params).then(response => {
this.returnOrderItemList = response.rows || [] this.returnOrderItemList = response.rows || []
this.total = response.total || 0 this.total = response.total || 0
this.loading = false this.loading = false
...@@ -420,8 +435,7 @@ export default { ...@@ -420,8 +435,7 @@ export default {
/** 仓库选择回调 */ /** 仓库选择回调 */
handleWarehouseSelected(warehouse) { handleWarehouseSelected(warehouse) {
if (!warehouse) return if (!warehouse) return
this.queryParams.warehouseId = warehouse.warehouseId || warehouse.id this.queryParams.warehouseId = warehouse.warehouseId
this.queryParams.warehousesCode = warehouse.warehousesCode
this.queryWarehouseName = warehouse.warehousesName || warehouse.warehousesCode this.queryWarehouseName = warehouse.warehousesName || warehouse.warehousesCode
// 仓库选择后,清空库位信息 // 仓库选择后,清空库位信息
this.queryLocationName = null this.queryLocationName = null
...@@ -463,7 +477,7 @@ export default { ...@@ -463,7 +477,7 @@ export default {
/** 格式化金额,保留2位小数 */ /** 格式化金额,保留2位小数 */
formatAmount(amount) { formatAmount(amount) {
if (amount === null || amount === undefined || isNaN(amount)) { if (amount === null || amount === undefined || isNaN(amount)) {
return '0.00' return '0'
} }
return parseFloat(amount).toFixed(2) return parseFloat(amount).toFixed(2)
}, },
...@@ -478,9 +492,9 @@ export default { ...@@ -478,9 +492,9 @@ export default {
delete params.pageNum delete params.pageNum
delete params.pageSize delete params.pageSize
this.download('inventory/return_orders/export', { this.download('inventory/return_order_items/exportCount', {
...params ...params
}, `退库单数据_${new Date().getTime()}.xlsx`) }, `退库统计_${new Date().getTime()}.xlsx`)
}, },
/** 查看详情 */ /** 查看详情 */
handleViewDetail(row) { handleViewDetail(row) {
...@@ -495,7 +509,10 @@ export default { ...@@ -495,7 +509,10 @@ export default {
warehouseId: null, warehouseId: null,
warehousesCode: null, warehousesCode: null,
locationId: null, locationId: null,
batchCode: null startDate: row.startDate,
endDate: row.endDate,
ownerId: row.ownerId,
orderStatus: this.queryParams.orderStatus
} }
this.detailWarehouseName = null this.detailWarehouseName = null
this.detailLocationName = null this.detailLocationName = null
...@@ -507,6 +524,11 @@ export default { ...@@ -507,6 +524,11 @@ export default {
getDetailList() { getDetailList() {
this.detailLoading = true this.detailLoading = true
const params = { ...this.detailQueryParams } const params = { ...this.detailQueryParams }
params.warehouseId = params.warehouseId || this.queryParams.warehouseId
if(params.warehouseId && params.warehouseId !== '') {
}else if(this.queryParams.warehouseId && this.queryParams.warehouseId !== '') {
params.locationId = params.locationId || this.queryParams.locationId
}
listReturnOrderItems(params).then(response => { listReturnOrderItems(params).then(response => {
this.detailList = response.rows || [] this.detailList = response.rows || []
this.detailTotal = response.total || 0 this.detailTotal = response.total || 0
...@@ -538,8 +560,8 @@ export default { ...@@ -538,8 +560,8 @@ export default {
/** 详情弹窗中仓库选择回调 */ /** 详情弹窗中仓库选择回调 */
handleDetailWarehouseSelected(warehouse) { handleDetailWarehouseSelected(warehouse) {
if (!warehouse) return if (!warehouse) return
this.detailQueryParams.warehouseId = warehouse.warehouseId || warehouse.id this.detailQueryParams.warehouseId = warehouse.warehouseId
this.detailQueryParams.warehousesCode = warehouse.warehousesCode // this.detailQueryParams.warehousesCode = warehouse.warehousesCode
this.detailWarehouseName = warehouse.warehousesName || warehouse.warehousesCode this.detailWarehouseName = warehouse.warehousesName || warehouse.warehousesCode
// 仓库选择后,清空库位信息 // 仓库选择后,清空库位信息
this.detailLocationName = null this.detailLocationName = null
...@@ -603,5 +625,9 @@ export default { ...@@ -603,5 +625,9 @@ export default {
.mb8 { .mb8 {
margin-bottom: 8px; margin-bottom: 8px;
} }
.w20 {
width: 150px;
}
</style> </style>
package com.ruoyi.inventory.controller; package com.ruoyi.inventory.controller;
import java.io.IOException;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.excel.EasyExcel;
import com.ruoyi.inventory.domain.ReturnOrders;
import com.ruoyi.inventory.domain.vo.ReturnOrdersSummaryVO;
import com.ruoyi.inventory.utils.CustomHeaderStyleStrategy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -37,8 +43,8 @@ public class ReturnOrderItemsController extends BaseController ...@@ -37,8 +43,8 @@ public class ReturnOrderItemsController extends BaseController
/** /**
* 查询退库单明细列表 * 查询退库单明细列表
*/ */
@PreAuthorize("@ss.hasPermi('inventory:return_order_items:list')") @PreAuthorize("@ss.hasPermi('inventory:return_order_items:count_detail')")
@GetMapping("/list") @GetMapping("/count_detail")
public TableDataInfo list(ReturnOrderItems returnOrderItems) public TableDataInfo list(ReturnOrderItems returnOrderItems)
{ {
startPage(); startPage();
...@@ -54,6 +60,7 @@ public class ReturnOrderItemsController extends BaseController ...@@ -54,6 +60,7 @@ public class ReturnOrderItemsController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, ReturnOrderItems returnOrderItems) public void export(HttpServletResponse response, ReturnOrderItems returnOrderItems)
{ {
startPage();
List<ReturnOrderItems> list = returnOrderItemsService.selectReturnOrderItemsList(returnOrderItems); List<ReturnOrderItems> list = returnOrderItemsService.selectReturnOrderItemsList(returnOrderItems);
ExcelUtil<ReturnOrderItems> util = new ExcelUtil<ReturnOrderItems>(ReturnOrderItems.class); ExcelUtil<ReturnOrderItems> util = new ExcelUtil<ReturnOrderItems>(ReturnOrderItems.class);
util.exportExcel(response, list, "退库单明细数据"); util.exportExcel(response, list, "退库单明细数据");
...@@ -101,5 +108,39 @@ public class ReturnOrderItemsController extends BaseController ...@@ -101,5 +108,39 @@ public class ReturnOrderItemsController extends BaseController
{ {
return toAjax(returnOrderItemsService.deleteReturnOrderItemsByIds(ids)); return toAjax(returnOrderItemsService.deleteReturnOrderItemsByIds(ids));
} }
/**
* 查询退库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:return_order_items:count')")
@PostMapping("/count")
public TableDataInfo count(ReturnOrderItems returnOrderItems)
{
startPage();
List<ReturnOrdersSummaryVO> list = returnOrderItemsService.selectReturnOrderCount(returnOrderItems);
return getDataTable(list);
}
/**
* 导出退库统计表
*/
// @PreAuthorize("@ss.hasPermi('inventory:return_order_items:export')")
@Log(title = "退库统计", businessType = BusinessType.EXPORT)
@PostMapping("/exportCount")
public void exportCount(HttpServletResponse response, ReturnOrderItems returnOrderItems)
{
startPage();
List<ReturnOrdersSummaryVO> list = returnOrderItemsService.selectReturnOrderCount(returnOrderItems);
ExcelUtil<ReturnOrdersSummaryVO> util = new ExcelUtil<ReturnOrdersSummaryVO>(ReturnOrdersSummaryVO.class);
util.exportExcel(response, list, "退库统计数据");
// try {
// EasyExcel.write(response.getOutputStream(), ReturnOrdersSummaryVO.class)
// .registerWriteHandler(new CustomHeaderStyleStrategy()) // 注册样式
// .sheet("退库统计数据")
// .doWrite(list);
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
}
} }
...@@ -106,7 +106,7 @@ public class ReturnOrdersController extends BaseController ...@@ -106,7 +106,7 @@ public class ReturnOrdersController extends BaseController
} }
/** /**
* 删除退库单主 * 确认退库单
*/ */
@PreAuthorize("@ss.hasPermi('inventory:return_orders:confirm')") @PreAuthorize("@ss.hasPermi('inventory:return_orders:confirm')")
@Log(title = "退库确认", businessType = BusinessType.UPDATE) @Log(title = "退库确认", businessType = BusinessType.UPDATE)
......
...@@ -37,12 +37,16 @@ public class ReturnOrderItems extends BaseEntity ...@@ -37,12 +37,16 @@ public class ReturnOrderItems extends BaseEntity
@Excel(name = "批次") @Excel(name = "批次")
private String batchCode; private String batchCode;
/** 仓库名称(关联查询) */
@Excel(name = "仓库")
private String warehouseName;
/** 仓库ID 检索条件 */ /** 仓库ID 检索条件 */
@Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
/** 库位名称(关联查询) */
@Excel(name = "库位")
private String locationName;
/** 库位ID 检索条件 */ /** 库位ID 检索条件 */
@Excel(name = "库位ID")
private String locationId; private String locationId;
/** 计划数量 */ /** 计划数量 */
...@@ -106,12 +110,6 @@ public class ReturnOrderItems extends BaseEntity ...@@ -106,12 +110,6 @@ public class ReturnOrderItems extends BaseEntity
/** 货物ID 字典,检索条件 */ /** 货物ID 字典,检索条件 */
private String materialId; private String materialId;
/** 仓库名称(关联查询) */
private String warehouseName;
/** 库位名称(关联查询) */
private String locationName;
/** 开始日期(查询条件) */ /** 开始日期(查询条件) */
private String startDate; private String startDate;
...@@ -124,283 +122,7 @@ public class ReturnOrderItems extends BaseEntity ...@@ -124,283 +122,7 @@ public class ReturnOrderItems extends BaseEntity
/** 退库单ID */ /** 退库单ID */
private String returnOrderId; private String returnOrderId;
public void setId(String id) private Integer orderStatus;
{
this.id = id;
}
public String getId()
{
return id;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatchCode(String batchCode)
{
this.batchCode = batchCode;
}
public String getBatchCode()
{
return batchCode;
}
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setLocationId(String locationId)
{
this.locationId = locationId;
}
public String getLocationId()
{
return locationId;
}
public void setPlannedQuantity(Integer plannedQuantity)
{
this.plannedQuantity = plannedQuantity;
}
public Integer getPlannedQuantity()
{
return plannedQuantity;
}
public void setActualQuantity(Integer actualQuantity)
{
this.actualQuantity = actualQuantity;
}
public Integer getActualQuantity()
{
return actualQuantity;
}
public void setPlannedPackages(Integer plannedPackages)
{
this.plannedPackages = plannedPackages;
}
public Integer getPlannedPackages()
{
return plannedPackages;
}
public void setActualPackages(Integer actualPackages)
{
this.actualPackages = actualPackages;
}
public Integer getActualPackages()
{
return actualPackages;
}
public void setDivisor(Double divisor)
{
this.divisor = divisor;
}
public Double getDivisor()
{
return divisor;
}
public void setLabelColor(Integer labelColor)
{
this.labelColor = labelColor;
}
public Integer getLabelColor()
{
return labelColor;
}
public void setVoucherNumber(String voucherNumber)
{
this.voucherNumber = voucherNumber;
}
public String getVoucherNumber()
{
return voucherNumber;
}
public void setUnitPrice(Double unitPrice)
{
this.unitPrice = unitPrice;
}
public Double getUnitPrice()
{
return unitPrice;
}
public void setTotalAmount(Double totalAmount)
{
this.totalAmount = totalAmount;
}
public Double getTotalAmount()
{
return totalAmount;
}
public void setIsUsed(Integer isUsed)
{
this.isUsed = isUsed;
}
public Integer getIsUsed()
{
return isUsed;
}
public void setSortNo(Integer sortNo)
{
this.sortNo = sortNo;
}
public Integer getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
public void setReturnDate(java.util.Date returnDate)
{
this.returnDate = returnDate;
}
public java.util.Date getReturnDate()
{
return returnDate;
}
public void setOwnerName(String ownerName)
{
this.ownerName = ownerName;
}
public String getOwnerName()
{
return ownerName;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setWarehouseName(String warehouseName)
{
this.warehouseName = warehouseName;
}
public String getWarehouseName()
{
return warehouseName;
}
public void setLocationName(String locationName)
{
this.locationName = locationName;
}
public String getLocationName()
{
return locationName;
}
public void setStartDate(String startDate)
{
this.startDate = startDate;
}
public String getStartDate()
{
return startDate;
}
public void setEndDate(String endDate)
{
this.endDate = endDate;
}
public String getEndDate()
{
return endDate;
}
public void setOwnerId(String ownerId)
{
this.ownerId = ownerId;
}
public String getOwnerId()
{
return ownerId;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
@Override @Override
public String toString() { public String toString() {
......
...@@ -29,8 +29,8 @@ public class ReturnOrders extends BaseEntity ...@@ -29,8 +29,8 @@ public class ReturnOrders extends BaseEntity
private String orderId; private String orderId;
/** 退库日期 */ /** 退库日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "退库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "退库日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date returnDate; private Date returnDate;
/** 退库类型1-TRDC退料 2-质量退料 3-多出退料 4-其他 不显示,默认1字典 */ /** 退库类型1-TRDC退料 2-质量退料 3-多出退料 4-其他 不显示,默认1字典 */
......
...@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; ...@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle; import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle; import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum; import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import lombok.Data;
//import org.apache.poi.ss.usermodel.FillPatternType; //import org.apache.poi.ss.usermodel.FillPatternType;
import java.io.Serializable; import java.io.Serializable;
...@@ -12,12 +13,13 @@ import java.io.Serializable; ...@@ -12,12 +13,13 @@ import java.io.Serializable;
/** /**
* 库存汇总统计VO * 库存汇总统计VO
* *
* @author ruoyi * @author cy
* @date 2025-12-03 * @date 2025-12-03
*/ */
@HeadStyle(fillPatternType = FillPatternTypeEnum.NO_FILL, fillForegroundColor = 10) @HeadStyle(fillPatternType = FillPatternTypeEnum.NO_FILL, fillForegroundColor = 10)
@HeadFontStyle(fontHeightInPoints = 12) @HeadFontStyle(fontHeightInPoints = 12)
@ColumnWidth(15) @ColumnWidth(15)
@Data
public class InventorySummaryVO implements Serializable public class InventorySummaryVO implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.ruoyi.inventory.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.io.Serializable;
/**
* 库存汇总统计VO
*
* @author cy
* @date 2025-12-08
*/
//@HeadStyle(fillPatternType = FillPatternTypeEnum.NO_FILL, fillForegroundColor = 10)
//@HeadFontStyle(fontHeightInPoints = 12)
//@ColumnWidth(15)
@Data
public class ReturnOrdersSummaryVO extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 物料ID */
private String materialId;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** SAP物料号 */
@Excel(name = "SAP物料号")
private String sapNo;
/** TS Code */
@Excel(name = "TS Code")
private String tsCode;
/** 危险类别 */
private String hazardId;
/** 危险类别 */
@Excel(name = "危险类别")
private String hazard;
/** 规格型号 */
@Excel(name = "规格型号")
private String specification;
/** 计量单位 */
@Excel(name = "计量单位")
private String materialUnit;
/** 单位重量 */
@Excel(name = "单位重量")
private Double unitWeight;
/** 包装重量 */
// @Excel(name = "包装重量")
private Double packageWeight;
/** 总重量 */
private Double totalWeight;
/** 体积 */
private Double volume;
/** 保质期天数 */
private Integer shelfLifeDays;
/** 总重量 */
// @Excel(name = "总重量")
private Double totalQuantity;
/** 体积 */
// @Excel(name = "体积")
private Double totalLockedQuantity;
/** 保质期天数 */
// @Excel(name = "保质期天数")
private Integer totalAvailableQuantity;
/** 存储温度要求 */
// @Excel(name = "存储温度要求")
private String storageTemperature;
/** 特殊存储要求 */
// @Excel(name = "特殊存储要求")
private String specialRequirements;
/** 计划数量 */
@Excel(name = "计划数量")
private Integer plannedQuantity;
/** 实际数量 */
@Excel(name = "实际数量")
private Integer actualQuantity;
/** 总量 */
@Excel(name = "总量")
private Double totalAmount;
}
...@@ -2,6 +2,8 @@ package com.ruoyi.inventory.mapper; ...@@ -2,6 +2,8 @@ package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.ReturnOrderItems; import com.ruoyi.inventory.domain.ReturnOrderItems;
import com.ruoyi.inventory.domain.ReturnOrders;
import com.ruoyi.inventory.domain.vo.ReturnOrdersSummaryVO;
/** /**
* 退库单明细Mapper接口 * 退库单明细Mapper接口
...@@ -66,5 +68,14 @@ public interface ReturnOrderItemsMapper ...@@ -66,5 +68,14 @@ public interface ReturnOrderItemsMapper
* @return 结果 * @return 结果
*/ */
public int deleteReturnOrderItemsByOrderId(String orderId); public int deleteReturnOrderItemsByOrderId(String orderId);
/**
* 查询退库单明细列表
*
* @param returnOrderItems 退库单
* @return 退库单明细集合
*/
public List<ReturnOrdersSummaryVO> selectReturnOrderCount(ReturnOrderItems returnOrderItems);
} }
...@@ -7,7 +7,7 @@ import com.ruoyi.inventory.domain.ReturnOrderItems; ...@@ -7,7 +7,7 @@ import com.ruoyi.inventory.domain.ReturnOrderItems;
/** /**
* 退库单主Mapper接口 * 退库单主Mapper接口
* *
* @author ruoyi * @author cy
* @date 2025-12-03 * @date 2025-12-03
*/ */
public interface ReturnOrdersMapper public interface ReturnOrdersMapper
......
package com.ruoyi.inventory.service; package com.ruoyi.inventory.service;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.ReturnOrderItems; import com.ruoyi.inventory.domain.ReturnOrderItems;
import com.ruoyi.inventory.domain.ReturnOrders;
import com.ruoyi.inventory.domain.vo.ReturnOrdersSummaryVO;
/** /**
* 退库单明细Service接口 * 退库单明细Service接口
...@@ -58,5 +62,13 @@ public interface IReturnOrderItemsService ...@@ -58,5 +62,13 @@ public interface IReturnOrderItemsService
* @return 结果 * @return 结果
*/ */
public int deleteReturnOrderItemsById(String id); public int deleteReturnOrderItemsById(String id);
/**
* 查询退库单统计结果
*
* @param returnOrderItems 查询条件
* @return 退库单统计信息
*/
public List<ReturnOrdersSummaryVO> selectReturnOrderCount(ReturnOrderItems returnOrderItems);
} }
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.Collections;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.ReturnOrders;
import com.ruoyi.inventory.domain.vo.ReturnOrdersSummaryVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.UUID; import java.util.UUID;
...@@ -110,5 +113,10 @@ public class ReturnOrderItemsServiceImpl implements IReturnOrderItemsService ...@@ -110,5 +113,10 @@ public class ReturnOrderItemsServiceImpl implements IReturnOrderItemsService
{ {
return returnOrderItemsMapper.deleteReturnOrderItemsById(id); return returnOrderItemsMapper.deleteReturnOrderItemsById(id);
} }
@Override
public List<ReturnOrdersSummaryVO> selectReturnOrderCount(ReturnOrderItems returnOrderItems) {
return returnOrderItemsMapper.selectReturnOrderCount(returnOrderItems);
}
} }
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.Collections; import java.util.*;
import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.service.IInventoryService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.UUID;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -26,6 +26,8 @@ public class ReturnOrdersServiceImpl implements IReturnOrdersService ...@@ -26,6 +26,8 @@ public class ReturnOrdersServiceImpl implements IReturnOrdersService
{ {
@Autowired @Autowired
private ReturnOrdersMapper returnOrdersMapper; private ReturnOrdersMapper returnOrdersMapper;
@Autowired
private IInventoryService inventoryService;
/** /**
* 查询退库单主 * 查询退库单主
...@@ -127,8 +129,58 @@ public class ReturnOrdersServiceImpl implements IReturnOrdersService ...@@ -127,8 +129,58 @@ public class ReturnOrdersServiceImpl implements IReturnOrdersService
@Override @Override
public int confirmReturnOrdersByIds(String[] ids) { public int confirmReturnOrdersByIds(String[] ids) {
// todo 调用库存插入方法 // 调用库存插入方法
return returnOrdersMapper.confirmReturnOrdersByIds(ids); int count = 0;
if(ids.length > 0){
//库存变更
for (int i = 0; i < ids.length; i++) {
String id = ids[i].trim();
ReturnOrders returnOrders = returnOrdersMapper.selectReturnOrdersById(id);
List<Inventory> inventoryList = trans(returnOrders);
count = inventoryService.insertInventoryList(inventoryList);
}
//库存更新后,退库确认,更新退库状态
count = returnOrdersMapper.confirmReturnOrdersByIds(ids);
}
return count;
}
private List<Inventory> trans(ReturnOrders returnOrders) {
List<Inventory> inventoryList = new ArrayList<>();
List<ReturnOrderItems> items = returnOrders.getReturnOrderItemsList();
long i = 1L;
Date now = DateUtils.getNowDate();
for (ReturnOrderItems item : items) {
Inventory inventory = new Inventory();
inventory.setId(UUID.randomUUID().toString());
inventory.setInventoryType(2L);//退库
inventory.setOrderId(returnOrders.getOrderId());
inventory.setMaterialId(item.getMaterialId());
inventory.setBatchId(item.getBatchCode());
inventory.setWarehousesCode(item.getWarehouseId());
inventory.setLocationId(item.getLocationId());
inventory.setOwnerId(returnOrders.getOwnerId());
inventory.setQuantity(item.getActualQuantity().longValue());
inventory.setLockedQuantity(0L);
// inventory.setUnitWeight();
// inventory.setUnitPrice(item.getUnitPrice());
// inventory.setTotalWeight();
// inventory.setTotalVolume();
inventory.setProductionDate(returnOrders.getCreateTime());
inventory.setExpirationDate(returnOrders.getCreateTime());
inventory.setInventoryStatus(1L);
inventory.setLastInboundTime(returnOrders.getCreateTime());
// inventory.setLastOutboundTime(returnOrders.getCreateTime());
inventory.setIsUsed(1L);
inventory.setSortNo(i++);
inventory.setCreateTime(now);
inventory.setCreateUserCode(returnOrders.getOwnerId());
inventoryList.add(inventory);
}
return inventoryList;
} }
/** /**
......
package com.ruoyi.inventory.utils;
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.AbstractVerticalCellStyleStrategy;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.VerticalAlignment;
public class CustomHeaderStyleStrategy extends AbstractVerticalCellStyleStrategy {
@Override
protected WriteCellStyle headCellStyle(CellWriteHandlerContext context) {
WriteCellStyle headStyle = new WriteCellStyle();
// 设置表头字体
WriteFont headFont = new WriteFont();
headFont.setBold(true); // 加粗
headFont.setFontHeightInPoints((short)12); // 字号
headFont.setFontName("微软雅黑"); // 字体
headStyle.setWriteFont(headFont);
// 设置表头背景色(如浅灰色)
headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
// 设置水平居中
headStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
// 设置垂直居中
headStyle.setVerticalAlignment(VerticalAlignment.CENTER);
return headStyle;
}
// 如果需要,也可以重写 contentCellStyle 方法来定义数据行的样式
@Override
protected WriteCellStyle contentCellStyle(CellWriteHandlerContext context) {
return super.contentCellStyle(context);
}
}
...@@ -64,16 +64,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -64,16 +64,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
w.warehouses_name as warehouse_name, w.warehouses_name as warehouse_name,
sl.location_name sl.location_name
from return_order_items roi from return_order_items roi
left join return_orders ro on roi.order_id = ro.order_id left join return_orders ro on roi.return_order_id = ro.id
left join owners o on ro.owner_id = o.owner_code left join owners o on ro.owner_id = o.id
left join materials m on roi.material_id = m.material_code left join materials m on roi.material_id = m.id
left join warehouses w on roi.warehouse_id = w.warehouses_code left join warehouses w on roi.warehouse_id = w.id
left join storage_locations sl on roi.location_id = sl.location_code left join storage_locations sl on roi.location_id = sl.id
</sql> </sql>
<select id="selectReturnOrderItemsList" parameterType="ReturnOrderItems" resultMap="ReturnOrderItemsResult"> <select id="selectReturnOrderItemsList" parameterType="ReturnOrderItems" resultMap="ReturnOrderItemsResult">
<include refid="selectReturnOrderItemsVo"/> <include refid="selectReturnOrderItemsVo"/>
<where> <where>
and roi.is_used = 1 and ro.is_used = 1
<if test="id != null and id != ''"> and roi.id = #{id}</if> <if test="id != null and id != ''"> and roi.id = #{id}</if>
<if test="orderId != null and orderId != ''"> and roi.order_id like concat('%', #{orderId}, '%')</if> <if test="orderId != null and orderId != ''"> and roi.order_id like concat('%', #{orderId}, '%')</if>
<if test="materialId != null and materialId != ''"> and (roi.material_id like concat('%', #{materialId}, '%') or m.material_code like concat('%', #{materialId}, '%'))</if> <if test="materialId != null and materialId != ''"> and (roi.material_id like concat('%', #{materialId}, '%') or m.material_code like concat('%', #{materialId}, '%'))</if>
...@@ -83,19 +84,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -83,19 +84,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerId != null and ownerId != ''"> and ro.owner_id = #{ownerId}</if> <if test="ownerId != null and ownerId != ''"> and ro.owner_id = #{ownerId}</if>
<if test="startDate != null and startDate != ''"> and date_format(ro.return_date,'%Y-%m-%d') &gt;= #{startDate}</if> <if test="startDate != null and startDate != ''"> and date_format(ro.return_date,'%Y-%m-%d') &gt;= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(ro.return_date,'%Y-%m-%d') &lt;= #{endDate}</if> <if test="endDate != null and endDate != ''"> and date_format(ro.return_date,'%Y-%m-%d') &lt;= #{endDate}</if>
<if test="plannedQuantity != null "> and roi.planned_quantity = #{plannedQuantity}</if> <if test="orderStatus != null and orderStatus != ''"> and ro.order_status = #{orderStatus}</if>
<if test="actualQuantity != null "> and roi.actual_quantity = #{actualQuantity}</if> <!-- <if test="plannedQuantity != null "> and roi.planned_quantity = #{plannedQuantity}</if>-->
<if test="plannedPackages != null "> and roi.planned_packages = #{plannedPackages}</if> <!-- <if test="actualQuantity != null "> and roi.actual_quantity = #{actualQuantity}</if>-->
<if test="actualPackages != null "> and roi.actual_packages = #{actualPackages}</if> <!-- <if test="plannedPackages != null "> and roi.planned_packages = #{plannedPackages}</if>-->
<if test="divisor != null "> and roi.divisor = #{divisor}</if> <!-- <if test="actualPackages != null "> and roi.actual_packages = #{actualPackages}</if>-->
<if test="labelColor != null "> and roi.label_color = #{labelColor}</if> <!-- <if test="divisor != null "> and roi.divisor = #{divisor}</if>-->
<if test="voucherNumber != null and voucherNumber != ''"> and roi.voucher_number = #{voucherNumber}</if> <!-- <if test="labelColor != null "> and roi.label_color = #{labelColor}</if>-->
<if test="unitPrice != null "> and roi.unit_price = #{unitPrice}</if> <!-- <if test="voucherNumber != null and voucherNumber != ''"> and roi.voucher_number = #{voucherNumber}</if>-->
<if test="totalAmount != null "> and roi.total_amount = #{totalAmount}</if> <!-- <if test="unitPrice != null "> and roi.unit_price = #{unitPrice}</if>-->
<if test="isUsed != null "> and roi.is_used = #{isUsed}</if> <!-- <if test="totalAmount != null "> and roi.total_amount = #{totalAmount}</if>-->
<if test="sortNo != null "> and roi.sort_no = #{sortNo}</if> <!-- <if test="isUsed != null "> and roi.is_used = #{isUsed}</if>-->
<if test="createUserCode != null and createUserCode != ''"> and roi.create_user_code = #{createUserCode}</if> <!-- <if test="sortNo != null "> and roi.sort_no = #{sortNo}</if>-->
<if test="updateUserCode != null and updateUserCode != ''"> and roi.update_user_code = #{updateUserCode}</if> <!-- <if test="createUserCode != null and createUserCode != ''"> and roi.create_user_code = #{createUserCode}</if>-->
<!-- <if test="updateUserCode != null and updateUserCode != ''"> and roi.update_user_code = #{updateUserCode}</if>-->
</where> </where>
order by ro.return_date desc, roi.sort_no, roi.create_time order by ro.return_date desc, roi.sort_no, roi.create_time
</select> </select>
...@@ -199,5 +201,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -199,5 +201,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteReturnOrderItemsByOrderId" parameterType="String"> <delete id="deleteReturnOrderItemsByOrderId" parameterType="String">
delete from return_order_items where order_id = #{orderId} delete from return_order_items where order_id = #{orderId}
</delete> </delete>
<resultMap type="ReturnOrdersSummaryVO" id="ReturnOrderCountResult">
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="sapNo" column="sap_no" />
<result property="tsCode" column="ts_code" />
<result property="hazardId" column="hazard_id" />
<result property="specification" column="specification" />
<result property="materialUnit" column="material_unit" />
<result property="unitWeight" column="unit_weight" />
<result property="packageWeight" column="package_weight" />
<result property="totalWeight" column="total_weight" />
<result property="volume" column="volume" />
<result property="shelfLifeDays" column="shelf_life_days" />
<result property="storageTemperature" column="storage_temperature" />
<result property="specialRequirements" column="special_requirements" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="totalAmount" column="total_amount" />
</resultMap>
<!-- 退库统计-->
<select id="selectReturnOrderCount" parameterType="ReturnOrderItems" resultMap="ReturnOrderCountResult">
select roi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no,
sum(roi.planned_quantity) as planned_quantity,
sum(roi.actual_quantity) as actual_quantity,
sum(roi.total_amount) as total_amount
from return_order_items roi
left join return_orders ro on roi.return_order_id = ro.id
left join materials m on roi.material_id = m.id
<where>
roi.is_used = 1 and ro.is_used = 1
<if test="orderId != null and orderId != ''"> and roi.order_id like concat('%', #{orderId}, '%')</if>
<if test="materialId != null and materialId != ''"> and roi.material_id = #{materialId}</if>
<if test="batchCode != null and batchCode != ''"> and roi.batch_code = #{batchCode}</if>
<if test="startDate != null and startDate != ''"> and date_format(ro.return_date,'%Y-%m-%d') &gt;= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(ro.return_date,'%Y-%m-%d') &lt;= #{endDate}</if>
<if test="warehouseId != null and warehouseId != ''"> and roi.warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and roi.location_id = #{locationId}</if>
<if test="orderStatus != null "> and ro.order_status = #{orderStatus}</if>
</where>
group by roi.material_id, m.material_name, m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no
order by sum(roi.total_amount) desc,m.sap_no, m.sort_no
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论