Commit b5531cfe by zhangtw

入库管理使用仓库、库位、货主组件

parent 5a3df889
...@@ -39,7 +39,7 @@ export function updateMaterials(data) { ...@@ -39,7 +39,7 @@ export function updateMaterials(data) {
export function delMaterials(id) { export function delMaterials(id) {
return request({ return request({
url: '/inventory/materials/' + id, url: '/inventory/materials/' + id,
method: 'delete' method: 'put'
}) })
} }
......
...@@ -39,7 +39,7 @@ export function updateMaterials_category(data) { ...@@ -39,7 +39,7 @@ export function updateMaterials_category(data) {
export function delMaterials_category(id) { export function delMaterials_category(id) {
return request({ return request({
url: '/inventory/materials_category/' + id, url: '/inventory/materials_category/' + id,
method: 'delete' method: 'put'
}) })
} }
...@@ -49,4 +49,4 @@ export function categoryTreeSelect() { ...@@ -49,4 +49,4 @@ export function categoryTreeSelect() {
url: '/inventory/materials_category/categoryTree', url: '/inventory/materials_category/categoryTree',
method: 'get' method: 'get'
}) })
} }
\ No newline at end of file
...@@ -23,18 +23,26 @@ ...@@ -23,18 +23,26 @@
@search="handleQuery" @search="handleQuery"
@reset="resetQuery" @reset="resetQuery"
> >
<el-form-item label="入库单号" prop="orderId"> <el-form-item label="物料SAPNO" prop="sapNo">
<el-input <el-input
v-model="queryParams.orderId" v-model="queryParams.sapNo"
placeholder="请输入入库单号" placeholder="请输入物料SAPNO"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="系统编号" prop="systemNo"> <el-form-item label="物料名称" prop="materialName">
<el-input <el-input
v-model="queryParams.systemNo" v-model="queryParams.materialName"
placeholder="请输入系统编号" placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="关联入库单单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入入库单单号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
...@@ -47,29 +55,35 @@ ...@@ -47,29 +55,35 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable> <el-form-item label="所在仓库" prop="warehouseId">
<el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable
@change="handleQuery"
filterable
>
<el-option <el-option
v-for="item in inBoundTypeOptions" v-for="item in warehouseOptions"
:key="item.orderTypeId" :key="item.value"
:label="item.orderTypeName" :label="item.label"
:value="item.orderTypeId" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="入库单状态" prop="orderStatus"> <!-- 库位ID下拉框:修正数据源 + 唯一key -->
<el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable> <el-form-item label="库位ID" prop="locationId">
<el-select v-model="queryParams.locationId" placeholder="请选择库位ID" clearable>
<!-- 替换为库位专属数据源(需补充 locationOptions 定义) -->
<el-option <el-option
v-for="item in inBoundStatusOptions" v-for="item in locationOptions"
:key="item.orderStatus" :key="item.locationId"
:label="item.orderStatusName" :label="item.locationName"
:value="item.orderStatus" :value="item.locationId"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="订单类型" prop="orderType"> <el-form-item label="标签颜色" prop="labelColor">
<el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable> <el-select v-model="queryParams.locationId" placeholder="请选择标签颜色" clearable>
<el-option <el-option
v-for="item in orderTypeOptions" v-for="item in orderTypeOptions"
:key="item.orderType" :key="item.orderType"
...@@ -87,13 +101,14 @@ ...@@ -87,13 +101,14 @@
height="100%" height="100%"
:data="inboundList" :data="inboundList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:row-key="(row) => row.materialId + '_' + row.orderId"
> >
<el-table-column label="物料SAPNO" align="center" prop="materialId" width="200"/> <el-table-column label="物料SAPNO" align="center" prop="materialId" width="200"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="200"/> <el-table-column label="物料名称" align="center" prop="materialName" width="200"/>
<el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/> <el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/> <el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="仓库ID" align="center" prop="warehouseId" width="200"/> <el-table-column label="所在仓库" align="center" prop="warehousesName" width="200"/>
<el-table-column label="库位ID" align="center" prop="locationId" width="200"/> <el-table-column label="库位ID" align="center" prop="locationName" width="200"/>
<el-table-column label="入库数量" align="center" prop="actualQuantity" width="200"/> <el-table-column label="入库数量" align="center" prop="actualQuantity" width="200"/>
<el-table-column label="件数" align="center" prop="actualPackages" width="200"/> <el-table-column label="件数" align="center" prop="actualPackages" width="200"/>
<el-table-column label="单价" align="center" prop="unitPrice" width="200"/> <el-table-column label="单价" align="center" prop="unitPrice" width="200"/>
...@@ -198,6 +213,7 @@ import { batchAddInventory } from "@/api/inventory/inventory" ...@@ -198,6 +213,7 @@ import { batchAddInventory } from "@/api/inventory/inventory"
import InboundItems from "@/views/inventory/inbound_items/index.vue" import InboundItems from "@/views/inventory/inbound_items/index.vue"
import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件 import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件
import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件 import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件
import { listWarehouses } from "@/api/inventory/warehouses"
export default { export default {
name: "Inbound", name: "Inbound",
...@@ -221,6 +237,12 @@ export default { ...@@ -221,6 +237,12 @@ export default {
{ orderType: '1', orderTypeName: '订单类型1' }, { orderType: '1', orderTypeName: '订单类型1' },
{ orderType: '2', orderTypeName: '订单类型2' } { orderType: '2', orderTypeName: '订单类型2' }
], ],
// 仓库列表
warehouseOptions: [],
// 库位列表
locationOptions: [],
loadingWarehouse: false,
// 可编辑状态
isEditable: true, isEditable: true,
// 物料组件显示 // 物料组件显示
materialSelectOpen: false, materialSelectOpen: false,
...@@ -310,8 +332,33 @@ export default { ...@@ -310,8 +332,33 @@ export default {
}, },
created() { created() {
this.getList() this.getList()
// 初始化仓库信息
this.getWarehouseOptions()
}, },
methods: { methods: {
//初始化仓库信息
getWarehouseOptions() {
this.loadingWarehouse = true
listWarehouses({ pageNum: 1, pageSize: 100 }).then(response => {
const rows = response.rows || []
this.warehouseOptions = rows.map(item => ({
label: `${item.warehousesName || item.name || '未命名仓库'} (${item.warehouseCode || item.code || item.warehousesCode || ''})`,
// 用仓库ID + 编码作为唯一key,避免空值重复
value: item.id || item.warehouseCode || item.code,
key: item.id || item.warehouseCode || Date.now() + Math.random()
})).filter(option => option.value)
this.loadingWarehouse = false
}).catch(error => {
console.error('获取仓库列表失败:', error)
this.warehouseOptions = []
this.loadingWarehouse = false
})
},
getWarehouseName(warehouseId) {
if (!warehouseId) return ''
const warehouse = this.warehouseOptions.find(item => item.value === warehouseId)
return warehouse ? warehouse.label : warehouseId
},
/** 查询入库列表 */ /** 查询入库列表 */
getList() { getList() {
this.loading = true this.loading = true
...@@ -389,7 +436,7 @@ export default { ...@@ -389,7 +436,7 @@ export default {
getInbound(id).then(response => { getInbound(id).then(response => {
this.form = response.data this.form = response.data
// 加载明细数据 // 加载明细数据
this.inboundOrderId = id this.inboundOrderId = id
this.$nextTick(() => { this.$nextTick(() => {
}) })
this.open = true this.open = true
...@@ -715,4 +762,4 @@ export default { ...@@ -715,4 +762,4 @@ export default {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
</style> </style>
\ No newline at end of file
...@@ -95,7 +95,25 @@ ...@@ -95,7 +95,25 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 新增:搜索页货主选择 -->
<el-form-item label="货主" prop="ownerId">
<el-input
v-model="queryOwnerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector('query')"
@click="openOwnerSelector('query')"
:suffix-icon="''"
>
<template v-if="queryOwnerName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryOwner"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="入库单状态" prop="orderStatus"> <el-form-item label="入库单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable> <el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable>
<el-option <el-option
...@@ -129,6 +147,8 @@ ...@@ -129,6 +147,8 @@
<el-table-column type="selection" width="55" align="center" fixed /> <el-table-column type="selection" width="55" align="center" fixed />
<el-table-column label="入库单号" align="center" prop="orderId" width="200"/> <el-table-column label="入库单号" align="center" prop="orderId" width="200"/>
<el-table-column label="系统编号" align="center" prop="systemNo" width="200"/> <el-table-column label="系统编号" align="center" prop="systemNo" width="200"/>
<!-- 新增:表格显示货主名称 -->
<el-table-column label="货主" align="center" prop="ownerName" width="200"/>
<el-table-column label="入库类型" align="center" prop="orderTypeId" :show-overflow-tooltip="true" width="200"> <el-table-column label="入库类型" align="center" prop="orderTypeId" :show-overflow-tooltip="true" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" size="small"> <el-tag type="success" size="small">
...@@ -250,8 +270,23 @@ ...@@ -250,8 +270,23 @@
<el-form-item label="系统编号" prop="systemNo"> <el-form-item label="系统编号" prop="systemNo">
<el-input v-model="form.systemNo" placeholder="请输入系统编号" /> <el-input v-model="form.systemNo" placeholder="请输入系统编号" />
</el-form-item> </el-form-item>
<el-form-item label="货主ID" prop="ownerId"> <el-form-item label="货主" prop="ownerId">
<el-input v-model="form.ownerId" placeholder="请输入货主ID" /> <el-input
v-model="form.ownerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector('form')"
@click="openOwnerSelector('form')"
:suffix-icon="''"
>
<template v-if="form.ownerName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearFormOwner"
></i>
</template>
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="订单类型" prop="orderType"> <el-form-item label="订单类型" prop="orderType">
<el-select v-model="form.orderType" placeholder="请选择订单类型" clearable> <el-select v-model="form.orderType" placeholder="请选择订单类型" clearable>
...@@ -276,9 +311,9 @@ ...@@ -276,9 +311,9 @@
<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="仓库ID" 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>
</el-col> </el-col>
...@@ -319,6 +354,8 @@ ...@@ -319,6 +354,8 @@
@batch-delete="handleBatchDelete" @batch-delete="handleBatchDelete"
@cell-change="handleCellChange" @cell-change="handleCellChange"
@show-materials="showMaterials" @show-materials="showMaterials"
@open-warehouse-selector="openWarehouseSelector"
@open-location-selector="openLocationSelector"
/> />
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -341,7 +378,7 @@ ...@@ -341,7 +378,7 @@
<el-descriptions-item label="入库单号">{{ detailForm.orderId || '-' }}</el-descriptions-item> <el-descriptions-item label="入库单号">{{ detailForm.orderId || '-' }}</el-descriptions-item>
<el-descriptions-item label="系统编号">{{ detailForm.systemNo || '-' }}</el-descriptions-item> <el-descriptions-item label="系统编号">{{ detailForm.systemNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item> <el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item>
<el-descriptions-item label="货主ID">{{ detailForm.ownerId || '-' }}</el-descriptions-item> <el-descriptions-item label="货主">{{ detailForm.ownerName || detailForm.ownerId || '-' }}</el-descriptions-item>
<el-descriptions-item label="入库类型"> <el-descriptions-item label="入库类型">
{{ getInBoundTypeName(detailForm.orderTypeId) }} {{ getInBoundTypeName(detailForm.orderTypeId) }}
</el-descriptions-item> </el-descriptions-item>
...@@ -353,7 +390,7 @@ ...@@ -353,7 +390,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="仓库ID">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="备注" :span="2"> <el-descriptions-item label="备注" :span="2">
<div class="remark-text">{{ detailForm.remark || '-' }}</div> <div class="remark-text">{{ detailForm.remark || '-' }}</div>
</el-descriptions-item> </el-descriptions-item>
...@@ -405,7 +442,22 @@ ...@@ -405,7 +442,22 @@
template-name="入库单导入模板" template-name="入库单导入模板"
@success="getList" @success="getList"
/> />
</div> <OwnerSelector
v-model="ownerSelectorVisible"
@selected="handleOwnerSelected"
/>
<!-- 仓库选择组件 -->
<WarehouseSelector
v-model="warehouseSelectorVisible"
@selected="handleWarehouseSelected"
/>
<!-- 库位选择组件 -->
<LocationSelector
v-model="locationSelectorVisible"
:warehousesId="currentEditRowWarehousesId"
@selected="handleLocationSelected"
/>
</div>
</template> </template>
<script> <script>
...@@ -417,6 +469,9 @@ import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组 ...@@ -417,6 +469,9 @@ import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组
import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件 import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件
import MaterialSelector from "@/views/inventory/materials/materialsSeletor.vue"; import MaterialSelector from "@/views/inventory/materials/materialsSeletor.vue";
import ImportExcel from "@/components/ImportExcel/index" import ImportExcel from "@/components/ImportExcel/index"
import OwnerSelector from "@/views/compononents/OwnerSelector.vue"
import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
import LocationSelector from "@/views/compononents/LocationSelector.vue"
export default { export default {
name: "Inbound", name: "Inbound",
...@@ -425,7 +480,10 @@ export default { ...@@ -425,7 +480,10 @@ export default {
PageTitle, PageTitle,
PageWrapperSearch, PageWrapperSearch,
MaterialSelector, MaterialSelector,
ImportExcel ImportExcel,
OwnerSelector,
WarehouseSelector,
LocationSelector
}, },
data() { data() {
return { return {
...@@ -442,6 +500,16 @@ export default { ...@@ -442,6 +500,16 @@ export default {
{ orderType: '1', orderTypeName: '订单类型1' }, { orderType: '1', orderTypeName: '订单类型1' },
{ orderType: '2', orderTypeName: '订单类型2' } { orderType: '2', orderTypeName: '订单类型2' }
], ],
// 货主选择相关(对齐退库组件)
queryOwnerName: null,
ownerSelectorVisible: false,
ownerSelectTarget: 'form', // 标记当前货主选择的目标:query-搜索页,form-表单页
// 仓库和库位选择相关
warehouseSelectorVisible: false,
locationSelectorVisible: false,
currentEditRow: null,
currentEditRowWarehousesId: null,
// 可编辑状态
isEditable: true, isEditable: true,
// 物料组件显示 // 物料组件显示
materialSelectOpen: false, materialSelectOpen: false,
...@@ -482,22 +550,28 @@ export default { ...@@ -482,22 +550,28 @@ export default {
systemNo: null, systemNo: null,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
ownerId: null, ownerId: null, // 货主ID(搜索用)
ownerName: null, // 货主名称(搜索用)
ownerCode: null, // 货主编码(搜索用)
orderStatus: null, orderStatus: null,
orderType: null orderType: null
}, },
// 表单参数 // 表单参数(对齐退库组件的货主字段)
form: { form: {
id: null, id: null,
orderId: null, orderId: null,
orderTypeId: null, orderTypeId: null,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
ownerId: null, warehousesName: null,
ownerId: null, // 货主ID
ownerName: null, // 货主名称
ownerCode: null, // 货主编码
orderStatus: 1, orderStatus: 1,
referenceNo: null, referenceNo: null,
plannedArrivalDate: undefined, plannedArrivalDate: undefined,
actualArrivalDate: undefined, actualArrivalDate: undefined,
inboundDate: null, // 入库日期
totalPlannedQuantity: null, totalPlannedQuantity: null,
totalActualQuantity: null, totalActualQuantity: null,
totalPackages: null, totalPackages: null,
...@@ -525,6 +599,9 @@ export default { ...@@ -525,6 +599,9 @@ export default {
], ],
batchId: [ batchId: [
{ required: true, message: "批次ID不能为空", trigger: "blur" } { required: true, message: "批次ID不能为空", trigger: "blur" }
],
ownerId: [ // 新增货主必填校验
{ required: true, message: "货主不能为空", trigger: "change" }
] ]
} }
} }
...@@ -572,7 +649,8 @@ export default { ...@@ -572,7 +649,8 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = [] this.$refs.queryForm?.resetFields()
this.queryOwnerName = null
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
...@@ -582,10 +660,11 @@ export default { ...@@ -582,10 +660,11 @@ export default {
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
ownerId: null, ownerId: null,
ownerName: null,
ownerCode: null,
orderStatus: null, orderStatus: null,
orderType: null orderType: null
} }
// this.$refs.queryForm.resetFields()
this.handleQuery() this.handleQuery()
}, },
...@@ -605,19 +684,36 @@ export default { ...@@ -605,19 +684,36 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset();
const id = row.id const id = row.id;
getInbound(id).then(response => { getInbound(id).then(response => {
this.form = response.data this.form = response.data || {};
// 加载明细数据 // 货主回显
this.inboundOrderId = id this.form.ownerName = response.data.ownerName || response.data.ownerCode || response.data.ownerId;
// 仓库回显
this.form.warehousesName = response.data.warehousesName || response.data.warehouseId || '-';
// 明细行回显(核心:同步仓库/库位名称)
if (this.form.inboundOrderItemsList && this.form.inboundOrderItemsList.length) {
this.form.inboundOrderItemsList = this.form.inboundOrderItemsList.map(item => ({
...item,
// 仓库名称兜底
warehousesName: item.warehousesName || item.warehouseId || '-',
// 库位名称/编码兜底
locationName: item.locationName || item.locationCode || item.locationId || '-',
locationCode: item.locationCode || item.locationId || '-'
}));
}
this.inboundOrderId = id;
// 强制触发子组件的 value 监听(关键)
this.$nextTick(() => { this.$nextTick(() => {
}) this.$refs.inboundItemsRef?.handlePagination();
this.open = true this.$refs.inboundItemsRef?.calculateTotals();
this.title = "修改入库单" });
}).finally(() => { this.open = true;
this.inboundOrderId = null this.title = "修改入库单";
}) });
}, },
/** 查看详情 */ /** 查看详情 */
handleDetail(row) { handleDetail(row) {
...@@ -627,55 +723,144 @@ export default { ...@@ -627,55 +723,144 @@ export default {
getInbound(id).then(response => { getInbound(id).then(response => {
// 加载明细数据到详情 // 加载明细数据到详情
this.detailForm = response.data this.detailForm = response.data
// 适配货主回显
this.detailForm.ownerName = response.data.ownerName || response.data.ownerCode || response.data.ownerId
this.detailForm.inboundOrderId = id this.detailForm.inboundOrderId = id
this.detailOpen = true this.detailOpen = true
}).finally(() => {
this.detailForm.inboundOrderId = null
}) })
}, },
// 打开货主选择器(区分搜索/表单场景)
openOwnerSelector(target = 'form') {
this.ownerSelectTarget = target
this.ownerSelectorVisible = true
},
// 货主选择回调(对齐退库组件逻辑)
handleOwnerSelected(owner) {
if (!owner) return
// 搜索页选择货主
if (this.ownerSelectTarget === 'query') {
this.queryParams.ownerId = owner.ownerId
this.queryParams.ownerCode = owner.ownerCode
this.queryOwnerName = owner.ownerName || owner.ownerCode
this.handleQuery() // 选择后立即搜索
} else {
// 表单页选择货主
this.form.ownerId = owner.ownerId
this.form.ownerCode = owner.ownerCode
this.form.ownerName = owner.ownerName
}
this.ownerSelectorVisible = false
},
// 清空搜索页货主
clearQueryOwner() {
this.queryOwnerName = null
this.queryParams.ownerId = null
this.queryParams.ownerCode = null
this.queryParams.ownerName = null
this.handleQuery() // 清空后重新搜索
},
// 清空表单页货主
clearFormOwner() {
this.form.ownerId = null
this.form.ownerCode = null
this.form.ownerName = null
// 清除货主字段校验
this.$refs.form?.clearValidate('ownerId')
},
// 打开仓库选择器
openWarehouseSelector(row) {
this.currentEditRow = row
this.warehouseSelectorVisible = true
},
// 仓库选择回调
handleWarehouseSelected(warehouse) {
if (this.currentEditRow) {
// 1. 用 $set 赋值,确保响应式
this.$set(this.currentEditRow, 'warehouseId', warehouse.warehouseId);
this.$set(this.currentEditRow, 'warehousesName', warehouse.warehousesName);
// 2. 通知子组件刷新(关键:触发 displayData 的响应式更新)
this.$refs.inboundItemsRef?.syncDataToParent();
this.$refs.inboundItemsRef?.calculateTotals();
} else {
this.form.warehouseId = warehouse.warehouseId;
this.form.warehousesName = warehouse.warehousesName;
}
this.warehouseSelectorVisible = false;
},
// 打开库位选择器
openLocationSelector(row) {
this.currentEditRow = row
this.currentEditRowWarehousesId = row.warehouseId // 传递仓库ID给库位选择器
this.locationSelectorVisible = true
},
// 库位选择回调
handleLocationSelected(location) {
if (this.currentEditRow) {
// 1. 用 $set 赋值,确保响应式
this.$set(this.currentEditRow, 'locationId', location.locationId);
this.$set(this.currentEditRow, 'locationCode', location.locationCode);
this.$set(this.currentEditRow, 'locationName', location.locationName);
// 2. 通知子组件刷新
this.$refs.inboundItemsRef?.syncDataToParent();
this.$refs.inboundItemsRef?.calculateTotals();
}
this.locationSelectorVisible = false;
},
// 打开物料选择弹窗 // 打开物料选择弹窗
showMaterials(status) { showMaterials(status) {
this.materialSelectOpen = status; this.materialSelectOpen = status
if (status) { // 只有打开弹窗时才清空选择 if (status) { // 只有打开弹窗时才清空选择
this.selectedMaterialIds = []; // 先清空父组件数据 this.selectedMaterialIds = [] // 先清空父组件数据
this.selectedMaterials = []; this.selectedMaterials = []
this.$nextTick(() => { this.$nextTick(() => {
// 确保弹窗渲染完成后再调用子组件方法 // 确保弹窗渲染完成后再调用子组件方法
this.$refs.materialSelector?.clearSelection(); this.$refs.materialSelector?.clearSelection()
}); })
} }
}, },
// 物料选择变化回调 // 物料选择变化回调
handleMaterialChange(selectedRows) { handleMaterialChange(selectedRows) {
this.selectedMaterials = selectedRows; this.selectedMaterials = selectedRows
}, },
// 确认选择物料并添加到明细 // 确认选择物料并添加到明细
confirmMaterialSelect() { confirmMaterialSelect() {
if (this.selectedMaterials.length === 0) { if (this.selectedMaterials.length === 0) {
this.$message.warning("请选择物料"); this.$message.warning("请选择物料")
return; return
} }
// 将选中的物料添加到入库明细 // 将选中的物料添加到入库明细
this.selectedMaterials.forEach(material => { this.selectedMaterials.forEach(material => {
// 检查是否已存在该物料,避免重复添加 // 检查是否已存在该物料,避免重复添加
const exists = this.form.inboundOrderItemsList.some( const exists = this.form.inboundOrderItemsList.some(
item => item.sapNo === material.sapNo item => item.materialId === material.sapNo
); )
if (!exists) { if (!exists) {
this.form.inboundOrderItemsList.push({ this.form.inboundOrderItemsList.push({
materialId: material.sapNo, // 存储物料编码 materialId: material.sapNo, // 存储物料编码
materialName: material.materialName, // 仅用于展示 materialName: material.materialName, // 仅用于展示
// 其他需要的字段... batchCode: null,
}); warehouseId: null,
warehousesName: null,
locationId: null,
locationName: null,
plannedQuantity: 0,
actualQuantity: 0,
unitPrice: 0,
totalAmount: 0
})
} else {
this.$message.warning(`物料 ${material.materialName} 已存在,跳过添加`)
} }
}); })
this.materialSelectOpen = false; this.materialSelectOpen = false
this.$refs.inboundItemsRef.handleAddItem(this.selectedMaterials) this.$refs.inboundItemsRef.handleAddItem(this.selectedMaterials)
this.$message.success(`成功添加 ${this.selectedMaterials.length} 个物料`); this.$message.success(`成功添加 ${this.selectedMaterials.length} 个物料`)
}, },
/** 确认入库操作 */ /** 确认入库操作 */
async handleConfirm(row) { // 标记为 async 函数 async handleConfirm(row) { // 标记为 async 函数
...@@ -685,35 +870,35 @@ export default { ...@@ -685,35 +870,35 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}); })
// 第二步:等待 listInbound_items 执行完成 // 第二步:等待 listInbound_items 执行完成
const queryForm = { const queryForm = {
pageNum: 1, pageNum: 1,
pageSize: 9999, pageSize: 9999,
orderId: row.orderId orderId: row.orderId
}; }
const response = await listInbound_items(queryForm); const response = await listInbound_items(queryForm)
row.inboundOrderItemsList = response.rows; row.inboundOrderItemsList = response.rows
// 第三步:确保数据存在后调用入库接口 // 第三步:确保数据存在后调用入库接口
if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) { if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) {
this.$message.warning('暂无入库明细数据,无法确认入库'); this.$message.warning('暂无入库明细数据,无法确认入库')
return; return
} }
await batchAddInventory(row.inboundOrderItemsList); await batchAddInventory(row.inboundOrderItemsList)
// 第四步:操作成功提示 // 第四步:操作成功提示
this.$modal.msgSuccess("确认成功"); this.$modal.msgSuccess("确认成功")
this.$message.success('确认入库成功'); this.$message.success('确认入库成功')
row.orderStatus = 2 row.orderStatus = 2
updateInbound(row).then(() => { updateInbound(row).then(() => {
this.getList(); this.getList()
}) })
} catch (error) { } catch (error) {
// 捕获取消确认/接口失败的异常 // 捕获取消确认/接口失败的异常
if (error !== 'cancel') { if (error !== 'cancel') {
this.$message.error('确认入库失败:' + (error.msg || '网络异常')); this.$message.error('确认入库失败:' + (error.msg || '网络异常'))
console.log(error) console.log(error)
} }
} }
...@@ -759,10 +944,11 @@ export default { ...@@ -759,10 +944,11 @@ export default {
inboundOrderItemsList: this.form.inboundOrderItemsList.map(item => ({ inboundOrderItemsList: this.form.inboundOrderItemsList.map(item => ({
...item, ...item,
orderId: this.form.orderId, // 确保明细项有主表ID orderId: this.form.orderId, // 确保明细项有主表ID
batchId: this.form.batchId batchId: this.form.batchId,
inboundOrderId: this.form.id || null
})) }))
} }
console.log(submitData)
if (this.form.id != null) { if (this.form.id != null) {
updateInbound(submitData).then(response => { updateInbound(submitData).then(response => {
this.$message.success("修改成功") this.$message.success("修改成功")
...@@ -783,6 +969,7 @@ export default { ...@@ -783,6 +969,7 @@ export default {
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.open = false this.open = false
this.inboundOrderId = null
this.reset() this.reset()
}, },
...@@ -794,11 +981,15 @@ export default { ...@@ -794,11 +981,15 @@ export default {
orderTypeId: null, orderTypeId: null,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
warehousesName: null,
ownerId: null, ownerId: null,
ownerName: null,
ownerCode: null,
orderStatus: 1, orderStatus: 1,
referenceNo: null, referenceNo: null,
plannedArrivalDate: null, plannedArrivalDate: null,
actualArrivalDate: null, actualArrivalDate: null,
inboundDate: null,
totalPlannedQuantity: 0, totalPlannedQuantity: 0,
totalActualQuantity: 0, totalActualQuantity: 0,
totalPackages: 0, totalPackages: 0,
...@@ -896,9 +1087,10 @@ export default { ...@@ -896,9 +1087,10 @@ export default {
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('inventory/inbound/export', { const params = { ...this.queryParams }
...this.queryParams delete params.pageNum
}, `inbound_${new Date().getTime()}.xlsx`) delete params.pageSize
this.download('inventory/inbound/export', params, `inbound_${new Date().getTime()}.xlsx`)
} }
} }
} }
...@@ -941,4 +1133,4 @@ export default { ...@@ -941,4 +1133,4 @@ export default {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
</style> </style>
\ No newline at end of file
...@@ -151,7 +151,47 @@ ...@@ -151,7 +151,47 @@
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 可编辑模式 --> <!-- 可编辑模式 -->
<template v-if="scope.row.editable && column.editable !== false"> <template v-if="scope.row.editable && column.editable !== false">
<template v-if="column.type === 'select'"> <!-- 仓库选择 -->
<template v-if="column.prop === 'warehousesName'">
<el-input
v-model="scope.row.warehousesName"
size="small"
readonly
placeholder="请选择仓库"
@focus="$emit('open-warehouse-selector', scope.row)"
:suffix-icon="''"
>
<template v-if="scope.row.warehousesName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearWarehouse(scope.row)"
></i>
</template>
</el-input>
</template>
<!-- 库位选择 -->
<template v-else-if="column.prop === 'locationName'">
<el-input
v-model="scope.row.locationName"
size="small"
readonly
placeholder="请选择库位"
@focus="$emit('open-location-selector', scope.row)"
:suffix-icon="''"
:disabled="!scope.row.warehouseId"
>
<template v-if="scope.row.locationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearLocation(scope.row)"
></i>
</template>
</el-input>
</template>
<!-- 其他选择框 -->
<template v-else-if="column.type === 'select'">
<el-select <el-select
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
size="small" size="small"
...@@ -166,6 +206,7 @@ ...@@ -166,6 +206,7 @@
/> />
</el-select> </el-select>
</template> </template>
<!-- 数字输入框 -->
<template v-else-if="column.type === 'number'"> <template v-else-if="column.type === 'number'">
<el-input-number <el-input-number
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
...@@ -177,6 +218,7 @@ ...@@ -177,6 +218,7 @@
@change="handleNumberChange(scope.row, column.prop)" @change="handleNumberChange(scope.row, column.prop)"
/> />
</template> </template>
<!-- 普通输入框 -->
<template v-else> <template v-else>
<el-input <el-input
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
...@@ -201,8 +243,15 @@ ...@@ -201,8 +243,15 @@
<template v-else-if="column.type === 'number'"> <template v-else-if="column.type === 'number'">
{{ formatNumber(scope.row[column.prop]) }} {{ formatNumber(scope.row[column.prop]) }}
</template> </template>
<!-- 仓库/库位兜底显示 -->
<template v-else-if="column.prop === 'warehousesName'">
{{ scope.row.warehousesName || scope.row.warehouseId || '-' }}
</template>
<template v-else-if="column.prop === 'locationName'">
{{ scope.row.locationName || scope.row.locationCode || scope.row.locationId || '-' }}
</template>
<template v-else> <template v-else>
{{ scope.row[column.prop] }} {{ scope.row[column.prop] || '-' }}
</template> </template>
</template> </template>
</template> </template>
...@@ -292,13 +341,20 @@ export default { ...@@ -292,13 +341,20 @@ export default {
default: () => [ default: () => [
{ prop: 'materialId', label: '货物ID', width: '150', editable: false }, { prop: 'materialId', label: '货物ID', width: '150', editable: false },
{ prop: 'materialName', label: '货物名称', width: '150', editable: false }, { prop: 'materialName', label: '货物名称', width: '150', editable: false },
{ prop: 'warehouseId', label: '仓库ID', width: '150', editable: true, {
type: 'select', prop: 'warehousesName',
options: [{ label: '仓库A', value: 'WH001' }, { label: '仓库B', value: 'WH002' }, { label: '仓库C', value: 'WH003' }] label: '仓库',
width: '150',
editable: true,
idProp: 'warehouseId'
}, },
{ prop: 'locationId', label: '库位ID', width: '150', editable: true, {
type: 'select', prop: 'locationName',
options: [{ label: '库位A1', value: 'LOC001' }, { label: '库位A2', value: 'LOC002' }, { label: '库位B1', value: 'LOC003' }] label: '库位',
width: '150',
editable: true,
idProp: 'locationId',
codeProp: 'locationCode'
}, },
{ prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true }, { prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true },
{ prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true }, { prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true },
...@@ -320,8 +376,6 @@ export default { ...@@ -320,8 +376,6 @@ export default {
}, },
data() { data() {
return { return {
showSearch: true, showSearch: true,
loading: false, loading: false,
selectedRows: [], selectedRows: [],
...@@ -392,7 +446,7 @@ export default { ...@@ -392,7 +446,7 @@ export default {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
// 核心:过滤 null/空值,只在有效时执行逻辑 // 核心:过滤 null/空值,只在有效时执行逻辑
if (!newVal) return if (!newVal) return
this.loadRelatedData(newVal) this.loadRelatedData(newVal)
this.displayData.forEach(item => { this.displayData.forEach(item => {
if (!item.inboundOrderId) item.inboundOrderId = newVal if (!item.inboundOrderId) item.inboundOrderId = newVal
...@@ -443,8 +497,9 @@ export default { ...@@ -443,8 +497,9 @@ export default {
this.loading = true this.loading = true
this.queryParams.inboundOrderId = inboundOrderId this.queryParams.inboundOrderId = inboundOrderId
listInbound_itemsAndMname(this.queryParams).then(response => { listInbound_itemsAndMname(this.queryParams).then(response => {
console.log(response.rows)
this.displayData = response.rows.map(item => ({ this.displayData = response.rows.map(item => ({
...item, ...item,
materialName: item.materialName, materialName: item.materialName,
editable: false, editable: false,
...@@ -456,7 +511,7 @@ export default { ...@@ -456,7 +511,7 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
}).finally(() => { }).finally(() => {
}) })
}, },
...@@ -547,7 +602,9 @@ export default { ...@@ -547,7 +602,9 @@ export default {
unitPrice: 0, unitPrice: 0,
remark: null, remark: null,
editable: true, editable: true,
inboundOrderId: null,
tempId: Date.now() + Math.random() tempId: Date.now() + Math.random()
} }
this.displayData.push(newItem) this.displayData.push(newItem)
const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize) const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize)
...@@ -654,6 +711,23 @@ export default { ...@@ -654,6 +711,23 @@ export default {
this.$emit('cell-blur', { row, prop, value: row[prop] }) this.$emit('cell-blur', { row, prop, value: row[prop] })
}, },
// 清除仓库选择
clearWarehouse(row) {
this.$set(row, 'warehouseId', null);
this.$set(row, 'warehousesName', null);
// 同时清除库位选择
this.clearLocation(row);
this.$emit('cell-change', { row, prop: 'warehouseId', value: null });
},
// 清除库位选择
clearLocation(row) {
this.$set(row, 'locationId', null);
this.$set(row, 'locationCode', null);
this.$set(row, 'locationName', null);
this.$emit('cell-change', { row, prop: 'locationId', value: null });
},
// 选择变化 // 选择变化
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedRows = selection this.selectedRows = selection
...@@ -745,4 +819,4 @@ export default { ...@@ -745,4 +819,4 @@ export default {
:deep(.el-select .el-tag) { :deep(.el-select .el-tag) {
margin: 0; margin: 0;
} }
</style> </style>
\ No newline at end of file
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
<el-radio :label="0"></el-radio> <el-radio :label="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
...@@ -552,7 +552,7 @@ export default { ...@@ -552,7 +552,7 @@ export default {
handleTreeClick(data) { handleTreeClick(data) {
console.log('点击树节点:', data) console.log('点击树节点:', data)
this.currentNodeId = data.sid this.currentNodeId = data.sid
// 更新查询参数,按选中的分类筛选物料 // 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data.categoryCode this.queryParams.categoryCode = data.categoryCode
this.queryParams.categoryNameInput = null // 清空名称输入 this.queryParams.categoryNameInput = null // 清空名称输入
...@@ -762,7 +762,7 @@ export default { ...@@ -762,7 +762,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids const ids = row.id || this.ids
this.$modal.confirm(row.id ? '是否确认删除编号为"' + row.materialCode + '"的数据项?' : '是否确认删除选中数量为"' + ids.length + '"的数据项?' ).then(() => { this.$modal.confirm(row.id ? '是否确认删除物料号为"' + row.sapNo + '"的数据项?' : '是否确认删除选中数量为"' + ids.length + '"的数据项?' ).then(() => {
return delMaterials(ids) return delMaterials(ids)
}).then(() => { }).then(() => {
this.getList() this.getList()
......
...@@ -115,7 +115,18 @@ public class MaterialsCategoryController extends BaseController ...@@ -115,7 +115,18 @@ public class MaterialsCategoryController extends BaseController
} }
/** /**
* 删除物料分类 * 修改物料分类有效状态
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE)
@PutMapping("/{ids}")
public AjaxResult updateIsUsed(@PathVariable String[] ids)
{
return toAjax(materialsCategoryService.updateCategoryIsUsedByIds(ids));
}
/**
* 删除物料分类(暂无用)
*/ */
@PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')") @PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE) @Log(title = "物料分类", businessType = BusinessType.DELETE)
......
...@@ -101,14 +101,15 @@ public class MaterialsController extends BaseController ...@@ -101,14 +101,15 @@ public class MaterialsController extends BaseController
} }
/** /**
* 删除物料 * 删除物料 (修改物料有效性)
*/ */
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')") @PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE) @Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @PutMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) public AjaxResult updateIsUsed(@PathVariable String[] ids)
{ {
return toAjax(materialsService.deleteMaterialsByIds(ids)); return toAjax(materialsService.updateMaterialsIsUsed(ids));
} }
/** /**
...@@ -155,4 +156,15 @@ public class MaterialsController extends BaseController ...@@ -155,4 +156,15 @@ public class MaterialsController extends BaseController
} }
} }
/**
* 删除物料 (暂时无用)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(materialsService.deleteMaterialsByIds(ids));
}
} }
...@@ -45,6 +45,8 @@ public class InboundOrders extends BaseEntity ...@@ -45,6 +45,8 @@ public class InboundOrders extends BaseEntity
@Excel(name = "货主ID") @Excel(name = "货主ID")
private String ownerId; private String ownerId;
private String ownerName;
/** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */ /** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel(name = "入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件") @Excel(name = "入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus; private Long orderStatus;
...@@ -283,6 +285,14 @@ public class InboundOrders extends BaseEntity ...@@ -283,6 +285,14 @@ public class InboundOrders extends BaseEntity
this.inboundOrderItemsList = inboundOrderItemsList; this.inboundOrderItemsList = inboundOrderItemsList;
} }
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -308,6 +318,7 @@ public class InboundOrders extends BaseEntity ...@@ -308,6 +318,7 @@ public class InboundOrders extends BaseEntity
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode()) .append("updateUserCode", getUpdateUserCode())
.append("inboundOrderItemsList", getInboundOrderItemsList()) .append("inboundOrderItemsList", getInboundOrderItemsList())
.append("ownerName", getOwnerName())
.toString(); .toString();
} }
} }
...@@ -38,10 +38,14 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -38,10 +38,14 @@ public class InboundItemsAndMaterialName extends BaseEntity
@Excel(name = "仓库ID") @Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
private String warehousesName;
/** 库位ID 检索条件 */ /** 库位ID 检索条件 */
@Excel(name = "库位ID") @Excel(name = "库位ID")
private String locationId; private String locationId;
private String locationName;
/** 计划数量 */ /** 计划数量 */
@Excel(name = "计划数量") @Excel(name = "计划数量")
private Long plannedQuantity; private Long plannedQuantity;
...@@ -330,6 +334,22 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -330,6 +334,22 @@ public class InboundItemsAndMaterialName extends BaseEntity
this.inboundOrderId = inboundOrderId; this.inboundOrderId = inboundOrderId;
} }
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -359,6 +379,8 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -359,6 +379,8 @@ public class InboundItemsAndMaterialName extends BaseEntity
.append("updateUserCode", getUpdateUserCode()) .append("updateUserCode", getUpdateUserCode())
.append("materialName", getMaterialName()) .append("materialName", getMaterialName())
.append("inboundOrderId", getInboundOrderId()) .append("inboundOrderId", getInboundOrderId())
.append("warehousesName", getWarehousesName())
.append("locationName", getLocationName())
.toString(); .toString();
} }
} }
...@@ -6,6 +6,7 @@ import java.util.Date; ...@@ -6,6 +6,7 @@ import java.util.Date;
public class InboundDetailsVO { public class InboundDetailsVO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Excel(name = "物料sapNo") @Excel(name = "物料sapNo")
private String materialId; private String materialId;
...@@ -18,12 +19,17 @@ public class InboundDetailsVO { ...@@ -18,12 +19,17 @@ public class InboundDetailsVO {
@Excel(name = "批次ID") @Excel(name = "批次ID")
private String batchId; private String batchId;
@Excel(name = "仓库ID") // @Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
@Excel(name = "库位ID") @Excel(name = "仓库名")
private String warehousesName;
// @Excel(name = "库位ID")
private String locationId; private String locationId;
private String locationName;
@Excel(name = "入库数量") @Excel(name = "入库数量")
private Long actualQuantity; private Long actualQuantity;
...@@ -149,15 +155,33 @@ public class InboundDetailsVO { ...@@ -149,15 +155,33 @@ public class InboundDetailsVO {
this.inboundDate = inboundDate; this.inboundDate = inboundDate;
} }
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@Override @Override
public String toString() { public String toString() {
return "InboundDetailsVO{" + return "InboundDetailsVO{" +
"sapNo='" + materialId + '\'' + "materialId='" + materialId + '\'' +
", materialName='" + materialName + '\'' + ", materialName='" + materialName + '\'' +
", orderId='" + orderId + '\'' + ", orderId='" + orderId + '\'' +
", batchId='" + batchId + '\'' + ", batchId='" + batchId + '\'' +
", warehouseId='" + warehouseId + '\'' + ", warehouseId='" + warehouseId + '\'' +
", warehousesName='" + warehousesName + '\'' +
", locationId='" + locationId + '\'' + ", locationId='" + locationId + '\'' +
", locationName='" + locationName + '\'' +
", actualQuantity=" + actualQuantity + ", actualQuantity=" + actualQuantity +
", actualPackages=" + actualPackages + ", actualPackages=" + actualPackages +
", labelColor='" + labelColor + '\'' + ", labelColor='" + labelColor + '\'' +
......
...@@ -50,6 +50,14 @@ public interface MaterialsCategoryMapper ...@@ -50,6 +50,14 @@ public interface MaterialsCategoryMapper
public int updateMaterialsCategory(MaterialsCategory materialsCategory); public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/** /**
* 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 删除物料分类 * 删除物料分类
* *
* @param id 物料分类主键 * @param id 物料分类主键
......
...@@ -57,28 +57,14 @@ public interface MaterialsMapper ...@@ -57,28 +57,14 @@ public interface MaterialsMapper
public int updateMaterials(Materials materials); public int updateMaterials(Materials materials);
/** /**
* 删除物料 * 批量修改物料的使用状态
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int updateMaterialsIsUsedByIds(String[] ids); public int updateMaterialsIsUsedByIds(String[] ids);
/** /**
* 批量删除,修改物料的使用状态 * 批量删除,修改物料的使用状态
* *
...@@ -96,4 +82,19 @@ public interface MaterialsMapper ...@@ -96,4 +82,19 @@ public interface MaterialsMapper
@MapKey("sap_no") @MapKey("sap_no")
public List<Map<String, Object>> getMapList(); public List<Map<String, Object>> getMapList();
/**
* 删除物料(暂无用)
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料(暂无用)
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
} }
...@@ -70,7 +70,15 @@ public interface IMaterialsCategoryService ...@@ -70,7 +70,15 @@ public interface IMaterialsCategoryService
public int updateMaterialsCategory(MaterialsCategory materialsCategory); public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/** /**
* 批量删除物料分类 * 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 批量删除物料分类(暂无用)
* *
* @param ids 需要删除的物料分类主键集合 * @param ids 需要删除的物料分类主键集合
* @return 结果 * @return 结果
...@@ -78,7 +86,7 @@ public interface IMaterialsCategoryService ...@@ -78,7 +86,7 @@ public interface IMaterialsCategoryService
public int deleteMaterialsCategoryByIds(String[] ids); public int deleteMaterialsCategoryByIds(String[] ids);
/** /**
* 删除物料分类信息 * 删除物料分类信息(暂无用)
* *
* @param id 物料分类主键 * @param id 物料分类主键
* @return 结果 * @return 结果
......
...@@ -46,7 +46,7 @@ public interface IMaterialsService ...@@ -46,7 +46,7 @@ public interface IMaterialsService
public int updateMaterials(Materials materials); public int updateMaterials(Materials materials);
/** /**
* 批量删除物料 * 批量删除物料 (暂时无用)
* *
* @param ids 需要删除的物料主键集合 * @param ids 需要删除的物料主键集合
* @return 结果 * @return 结果
...@@ -54,6 +54,14 @@ public interface IMaterialsService ...@@ -54,6 +54,14 @@ public interface IMaterialsService
public int deleteMaterialsByIds(String[] ids); public int deleteMaterialsByIds(String[] ids);
/** /**
* 修改物料有效状态
*
* @param ids 需要删除的物料主键集合
* @return 结果
*/
public int updateMaterialsIsUsed(String[] ids);
/**
* 删除物料信息 * 删除物料信息
* *
* @param id 物料主键 * @param id 物料主键
......
...@@ -133,6 +133,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -133,6 +133,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
inboundOrderItems.setId(UUID.randomUUID().toString()); inboundOrderItems.setId(UUID.randomUUID().toString());
inboundOrderItems.setOrderId(orderId); inboundOrderItems.setOrderId(orderId);
inboundOrderItems.setCreateTime(DateUtils.getNowDate()); inboundOrderItems.setCreateTime(DateUtils.getNowDate());
inboundOrderItems.setInboundOrderId(inboundOrders.getId());
list.add(inboundOrderItems); list.add(inboundOrderItems);
} }
if (list.size() > 0) if (list.size() > 0)
......
...@@ -168,7 +168,18 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -168,7 +168,18 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
} }
/** /**
* 批量删除物料分类 * 修改物料分类有效状态
*
* @param ids 物料分类
* @return 结果
*/
@Override
public int updateCategoryIsUsedByIds(String[] ids) {
return materialsCategoryMapper.updateCategoryIsUsedByIds(ids);
}
/**
* 批量删除物料分类(暂无用)
* *
* @param ids 需要删除的物料分类主键 * @param ids 需要删除的物料分类主键
* @return 结果 * @return 结果
...@@ -180,7 +191,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -180,7 +191,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
} }
/** /**
* 删除物料分类信息 * 删除物料分类信息(暂无用)
* *
* @param id 物料分类主键 * @param id 物料分类主键
* @return 结果 * @return 结果
......
...@@ -77,35 +77,23 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -77,35 +77,23 @@ public class MaterialsServiceImpl implements IMaterialsService
} }
/** /**
* 批量修改物料的使用状态 * 修改物料的使用状态
* *
* @param ids 需要删除的物料主键 * @param ids 需要删除的物料主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMaterialsByIds(String[] ids) public int updateMaterialsIsUsed(String[] ids) {
{
return materialsMapper.updateMaterialsIsUsedByIds(ids); return materialsMapper.updateMaterialsIsUsedByIds(ids);
} }
/** /**
* 删除物料信息 * 导入物料
* *
* @param id 物料主键 * @param materialsList 物料列表
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMaterialsById(String id)
{
return materialsMapper.deleteMaterialsById(id);
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
@Override
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName) public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName)
{ {
if (StringUtils.isNull(materialsList) || materialsList.size() == 0) if (StringUtils.isNull(materialsList) || materialsList.size() == 0)
...@@ -176,4 +164,33 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -176,4 +164,33 @@ public class MaterialsServiceImpl implements IMaterialsService
public List<Map<String, Object>> getMapList(){ public List<Map<String, Object>> getMapList(){
return materialsMapper.getMapList(); return materialsMapper.getMapList();
} }
/**
* 删除物料信息(暂时无用)
*
* @param id 物料主键
* @return 结果
*/
@Override
public int deleteMaterialsById(String id)
{
return materialsMapper.deleteMaterialsById(id);
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
/**
* 批量删除(暂时无用)
*
* @param ids 需要删除的物料主键
* @return 结果
*/
@Override
public int deleteMaterialsByIds(String[] ids)
{
return materialsMapper.deleteMaterialsByIds(ids);
}
} }
...@@ -81,7 +81,9 @@ ...@@ -81,7 +81,9 @@
ii.material_id, ii.material_id,
ii.batch_id, ii.batch_id,
ii.warehouse_id, ii.warehouse_id,
w.warehouses_name,
ii.location_id, ii.location_id,
sl.location_name,
ii.planned_quantity, ii.planned_quantity,
ii.actual_quantity, ii.actual_quantity,
ii.planned_packages, ii.planned_packages,
...@@ -104,6 +106,8 @@ ...@@ -104,6 +106,8 @@
m.material_name m.material_name
FROM inbound_order_items ii FROM inbound_order_items ii
LEFT JOIN materials m ON ii.material_id = m.sap_no LEFT JOIN materials m ON ii.material_id = m.sap_no
left join warehouses w on ii.warehouse_id = w.id
left join storage_locations sl on ii.location_id = sl.id
<where> <where>
<!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or --> <!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or -->
<if test="inboundOrderId != null and inboundOrderId != ''"> <if test="inboundOrderId != null and inboundOrderId != ''">
...@@ -279,7 +283,9 @@ ...@@ -279,7 +283,9 @@
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" /> <result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" /> <result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" /> <result property="plannedPackages" column="planned_packages" />
...@@ -309,8 +315,9 @@ ...@@ -309,8 +315,9 @@
<result column="order_id" property="orderId" jdbcType="VARCHAR" /> <result column="order_id" property="orderId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" /> <result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" /> <result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR" /> <result column="warehouses_name" property="warehousesName" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR"/>
<result column="location_name" property="locationName" jdbcType="VARCHAR" />
<!-- 数值型字段 --> <!-- 数值型字段 -->
<result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" /> <result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" />
<result column="actual_packages" property="actualPackages" jdbcType="BIGINT" /> <result column="actual_packages" property="actualPackages" jdbcType="BIGINT" />
...@@ -336,7 +343,9 @@ ...@@ -336,7 +343,9 @@
ioi.order_id, ioi.order_id,
ioi.batch_id, ioi.batch_id,
ioi.warehouse_id, ioi.warehouse_id,
w.warehouses_name,
ioi.location_id, ioi.location_id,
sl.location_name,
SUM(ioi.actual_quantity) AS actual_quantity, SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages, SUM(ioi.actual_packages) AS actual_packages,
ioi.label_color, ioi.label_color,
...@@ -347,6 +356,8 @@ ...@@ -347,6 +356,8 @@
FROM inbound_orders io FROM inbound_orders io
INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id
INNER JOIN materials ms ON ms.sap_no = ioi.material_id INNER JOIN materials ms ON ms.sap_no = ioi.material_id
inner join warehouses w on ioi.warehouse_id = w.id
inner join storage_locations sl on ioi.location_id = sl.id
WHERE io.order_status = 2 WHERE io.order_status = 2
GROUP BY GROUP BY
ioi.material_id, ioi.material_id,
......
...@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="ownerId" column="owner_id" /> <result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" /> <result property="orderStatus" column="order_status" />
<result property="inboundDate" column="inbound_date" /> <result property="inboundDate" column="inbound_date" />
<result property="orderType" column="order_type" /> <result property="orderType" column="order_type" />
...@@ -32,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="inboundOrderItemsList" ofType="InboundOrderItems" column="id" select="selectInboundOrderItemsList" /> <collection property="inboundOrderItemsList" ofType="InboundOrderItems" column="id" select="selectInboundOrderItemsList" />
</resultMap> </resultMap>
<resultMap type="InboundOrderItems" id="InboundOrderItemsResult"> <resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" /> <result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" /> <result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" /> <result property="plannedPackages" column="planned_packages" />
...@@ -60,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectInboundOrdersVo"> <sql id="selectInboundOrdersVo">
select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_orders select io.id, io.order_id, io.system_no, io.order_type_id, io.batch_id, io.warehouse_id, io.owner_id, o.owner_name,
io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
io.remark, io.op_user_name, io.is_used, io.sort_no, io.create_time, io.create_user_code, io.update_time, io.update_user_code
from inbound_orders io left join owners o on io.owner_id = o.id
</sql> </sql>
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult"> <select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/> <include refid="selectInboundOrdersVo"/>
<where> <where>
<if test="id != null and Id != ''"> and id = #{Id}</if> <if test="id != null and Id != ''"> and id = #{Id}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if> <if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
...@@ -88,17 +95,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -88,17 +95,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult"> <select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult">
select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code select io.id, io.order_id, io.system_no, io.order_type_id, io.batch_id, io.warehouse_id, io.owner_id, o.owner_name,
from inbound_orders io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
where id = #{id} io.remark, io.op_user_name, io.is_used, io.sort_no, io.create_time, io.create_user_code, io.update_time, io.update_user_code
from inbound_orders as io
left join owners as o on io.owner_id = o.id
where io.id = #{id}
</select> </select>
<select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult"> <select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult">
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code, inbound_order_id select ioi.id, ioi.order_id, ioi.material_id, m.material_name, ioi.batch_id, ioi.warehouse_id, w.warehouses_name,
from inbound_order_items ioi.location_id, sl.location_name, ioi.planned_quantity, ioi.actual_quantity, ioi.planned_packages,
where inbound_order_id = #{inboundOrderId} ioi.actual_packages, ioi.divisor, ioi.label_color, ioi.voucher_number, ioi.unit_price, ioi.item_status,
ioi.received_at, ioi.received_by, ioi.remark, ioi.is_used, ioi.sort_no, ioi.create_time, ioi.create_user_code,
ioi.update_time, ioi.update_user_code, ioi.inbound_order_id
from inbound_order_items as ioi
left join warehouses as w on ioi.warehouse_id = w.id
left join storage_locations as sl on ioi.location_id = sl.id
left join materials as m on ioi.material_id = m.sap_no
where ioi.inbound_order_id = #{id}
</select> </select>
<select id="selectInboundOrdersByOrderId" resultType="InboundOrders"> <select id="selectInboundOrdersByOrderId" resultType="InboundOrders">
select id, order_id select id, order_id
from inbound_orders from inbound_orders
......
...@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryList" parameterType="MaterialsCategory" resultMap="MaterialsCategoryResult"> <select id="selectMaterialsCategoryList" parameterType="MaterialsCategory" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/> <include refid="selectMaterialsCategoryVo"/>
<where> <where>
is_used != 0
<if test="id != null and id != ''"> and id = #{id}</if> <if test="id != null and id != ''"> and id = #{id}</if>
<if test="categoryCode != null and categoryCode != ''"> and category_code like concat('%', #{categoryCode}, '%')</if> <if test="categoryCode != null and categoryCode != ''"> and category_code like concat('%', #{categoryCode}, '%')</if>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if> <if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
...@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null "> and create_time like concat('%', #{createTime}, '%')</if> <if test="createTime != null "> and create_time like concat('%', #{createTime}, '%')</if>
<if test="updateTime != null "> and update_time like concat('%', #{updateTime}, '%')</if> <if test="updateTime != null "> and update_time like concat('%', #{updateTime}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if> <if test="parentId != null "> and parent_id = #{parentId}</if>
<!-- <if test="isUsed != null "> and is_used = #{isUsed}</if>-->
</where> </where>
order by sort_no asc order by sort_no asc
</select> </select>
...@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryById" parameterType="String" resultMap="MaterialsCategoryResult"> <select id="selectMaterialsCategoryById" parameterType="String" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/> <include refid="selectMaterialsCategoryVo"/>
where id = #{id} where id = #{id}
and is_used != 0
order by sort_no asc order by sort_no asc
</select> </select>
<insert id="insertMaterialsCategory" parameterType="MaterialsCategory"> <insert id="insertMaterialsCategory" parameterType="MaterialsCategory">
...@@ -84,6 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -84,6 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<update id="updateCategoryIsUsedByIds" parameterType="String">
update materials_category
set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteMaterialsCategoryById" parameterType="String"> <delete id="deleteMaterialsCategoryById" parameterType="String">
delete from materials_category where id = #{id} delete from materials_category where id = #{id}
</delete> </delete>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论