refactor(biz): 优化成品库存管理功能
This commit is contained in:
parent
6ddd2b18b9
commit
3ab61e87c2
@ -31,13 +31,11 @@ public interface ProStorageInventoryMapper extends BaseMapperX<ProStorageInvento
|
|||||||
.eqIfPresent(ProStorageInventoryDO::getSpec, reqVO.getSpec())
|
.eqIfPresent(ProStorageInventoryDO::getSpec, reqVO.getSpec())
|
||||||
.eqIfPresent(ProStorageInventoryDO::getUnit, reqVO.getUnit())
|
.eqIfPresent(ProStorageInventoryDO::getUnit, reqVO.getUnit())
|
||||||
.eqIfPresent(ProStorageInventoryDO::getLotNo, reqVO.getLotNo())
|
.eqIfPresent(ProStorageInventoryDO::getLotNo, reqVO.getLotNo())
|
||||||
.betweenIfPresent(ProStorageInventoryDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.eqIfPresent(ProStorageInventoryDO::getDescription, reqVO.getDescription())
|
|
||||||
.betweenIfPresent(ProStorageInventoryDO::getEarStoreDate, reqVO.getEarStoreDate())
|
.betweenIfPresent(ProStorageInventoryDO::getEarStoreDate, reqVO.getEarStoreDate())
|
||||||
.eqIfPresent(ProStorageInventoryDO::getPlanId, reqVO.getPlanId())
|
.eqIfPresent(ProStorageInventoryDO::getPlanId, reqVO.getPlanId())
|
||||||
.eqIfPresent(ProStorageInventoryDO::getProNo, reqVO.getProNo())
|
.eqIfPresent(ProStorageInventoryDO::getProNo, reqVO.getProNo())
|
||||||
.gt(reqVO.getYardQty() != null && reqVO.getYardQty().compareTo(BigDecimal.ONE) == 0, ProStorageInventoryDO::getYardQty, 0)
|
.gt(reqVO.getYardQty() != null && reqVO.getYardQty().compareTo(BigDecimal.ONE) == 0, ProStorageInventoryDO::getYardQty, 0)
|
||||||
.orderByDesc(ProStorageInventoryDO::getId));
|
.orderByDesc(ProStorageInventoryDO::getEarStoreDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -70,6 +70,13 @@ public class ProStorageServiceImpl implements ProStorageService {
|
|||||||
List<ProStorageMatDO> proStorageMatDOS = proStorageMatMapper.selectByStockId(proStorage.getId());
|
List<ProStorageMatDO> proStorageMatDOS = proStorageMatMapper.selectByStockId(proStorage.getId());
|
||||||
for (ProStorageMatDO proStorageMatDO : proStorageMatDOS) {
|
for (ProStorageMatDO proStorageMatDO : proStorageMatDOS) {
|
||||||
ProStorageInventoryDO storageInventoryDO = proStorageInventoryService.getProStorageInventory(proStorageMatDO.getSourceId());
|
ProStorageInventoryDO storageInventoryDO = proStorageInventoryService.getProStorageInventory(proStorageMatDO.getSourceId());
|
||||||
|
if (proStorageMatDO.getOperatorQty().compareTo(storageInventoryDO.getYardQty()) > 0) { //盘库数量小于出库数量
|
||||||
|
throw exception("退库数量大于库存数量!");
|
||||||
|
}
|
||||||
|
if (proStorageMatDO.getBagQty() > storageInventoryDO.getPackQty()) { //退库箱数大于库存箱数
|
||||||
|
throw exception("退库袋数大于库存袋数!");
|
||||||
|
}
|
||||||
|
|
||||||
storageInventoryDO.setYardQty(storageInventoryDO.getYardQty().subtract(proStorageMatDO.getOperatorQty()));
|
storageInventoryDO.setYardQty(storageInventoryDO.getYardQty().subtract(proStorageMatDO.getOperatorQty()));
|
||||||
storageInventoryDO.setPackQty(storageInventoryDO.getPackQty() - proStorageMatDO.getBagQty());
|
storageInventoryDO.setPackQty(storageInventoryDO.getPackQty() - proStorageMatDO.getBagQty());
|
||||||
proStorageInventoryMapper.updateById(storageInventoryDO);
|
proStorageInventoryMapper.updateById(storageInventoryDO);
|
||||||
@ -284,7 +291,7 @@ public class ProStorageServiceImpl implements ProStorageService {
|
|||||||
// proStorageMat.setRelarionId(0);
|
// proStorageMat.setRelarionId(0);
|
||||||
// proStorageMat.setBagSpec(0);
|
// proStorageMat.setBagSpec(0);
|
||||||
proStorageMat.setBagQty(detail.getBagQty());
|
proStorageMat.setBagQty(detail.getBagQty());
|
||||||
// proStorageMat.setProNo("");
|
proStorageMat.setProNo(storageInventoryDO.getProNo());
|
||||||
proStorageMat.setInventBillNo(storageInventoryDO.getInventBillNo());
|
proStorageMat.setInventBillNo(storageInventoryDO.getInventBillNo());
|
||||||
proStorageMatMapper.insert(proStorageMat);
|
proStorageMatMapper.insert(proStorageMat);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,7 @@ declare module 'vue' {
|
|||||||
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
|
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
||||||
|
ElLink: typeof import('element-plus/es')['ElLink']
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||||
ElPopover: typeof import('element-plus/es')['ElPopover']
|
ElPopover: typeof import('element-plus/es')['ElPopover']
|
||||||
|
|||||||
@ -155,7 +155,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="单位" min-width="80px" align="center">
|
<el-table-column label="单位" min-width="80px" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.unit }}</span>
|
<span>{{ getUnitName(scope.row.unit) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="产品编码" min-width="120px" align="center">
|
<el-table-column label="产品编码" min-width="120px" align="center">
|
||||||
@ -170,7 +170,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="生产计划号" min-width="120px" align="center">
|
<el-table-column label="生产计划号" min-width="120px" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.planNo }}</span>
|
<span>{{ scope.row.proNo }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="存货账单号" min-width="120px" align="center">
|
<el-table-column label="存货账单号" min-width="120px" align="center">
|
||||||
@ -203,10 +203,10 @@
|
|||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div >
|
||||||
<el-button @click="submitForm('save')" type="primary" :disabled="formLoading">
|
<el-button @click="submitForm('save')" type="primary" :disabled="formLoading" v-if="formType === 'create' || formType === 'update'">
|
||||||
保存
|
保存
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="submitForm('confirm')" type="primary" :disabled="formLoading">
|
<el-button @click="submitForm('confirm')" type="primary" :disabled="formLoading" v-if="formType === 'create' || formType === 'update'">
|
||||||
确认
|
确认
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="dialogVisible = false">
|
<el-button @click="dialogVisible = false">
|
||||||
@ -222,6 +222,7 @@ import { ref, reactive, watch } from 'vue'
|
|||||||
import * as ProStorageApi from '@/api/biz/prostorage'
|
import * as ProStorageApi from '@/api/biz/prostorage'
|
||||||
import * as ProStorageMatApi from '@/api/biz/prostoragemat'
|
import * as ProStorageMatApi from '@/api/biz/prostoragemat'
|
||||||
import ProStorageInventorySelectDialog from '@/views/biz/prostorageinventory/ProStorageInventorySelectDialog.vue'
|
import ProStorageInventorySelectDialog from '@/views/biz/prostorageinventory/ProStorageInventorySelectDialog.vue'
|
||||||
|
import { getUnitName, getDictOptions } from '@/utils/dict'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -247,13 +248,23 @@ const inventorySelectRef = ref()
|
|||||||
|
|
||||||
/** 打开库存选择弹窗 */
|
/** 打开库存选择弹窗 */
|
||||||
const openMaterialSelect = () => {
|
const openMaterialSelect = () => {
|
||||||
|
// 获取已选择的库存sourceId列表
|
||||||
|
const selectedIds = detailList.value.map(item => item.sourceId)
|
||||||
|
// 设置已选择的ID,弹窗会自动选中这些行
|
||||||
|
inventorySelectRef.value?.setSelectedIds(selectedIds)
|
||||||
|
// 打开弹窗
|
||||||
inventorySelectRef.value?.open()
|
inventorySelectRef.value?.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 处理库存选择确认 */
|
/** 处理库存选择确认 */
|
||||||
const handleInventorySelect = (selectedInventory: any[]) => {
|
const handleInventorySelect = (selectedInventory: any[]) => {
|
||||||
if (selectedInventory && selectedInventory.length > 0) {
|
if (selectedInventory && selectedInventory.length > 0) {
|
||||||
|
// 获取已选择的库存sourceId列表
|
||||||
|
const existingSourceIds = detailList.value.map(item => item.sourceId)
|
||||||
|
|
||||||
selectedInventory.forEach(inventory => {
|
selectedInventory.forEach(inventory => {
|
||||||
|
// 只添加未选择过的库存(通过sourceId判断)
|
||||||
|
if (!existingSourceIds.includes(inventory.id)) {
|
||||||
detailList.value.push({
|
detailList.value.push({
|
||||||
id: inventory.id,
|
id: inventory.id,
|
||||||
sourceId: inventory.id, // 来源ID
|
sourceId: inventory.id, // 来源ID
|
||||||
@ -269,12 +280,13 @@ const handleInventorySelect = (selectedInventory: any[]) => {
|
|||||||
unit: inventory.unit,
|
unit: inventory.unit,
|
||||||
productCode: inventory.matCode,
|
productCode: inventory.matCode,
|
||||||
bagSpec: inventory.bagSpec,
|
bagSpec: inventory.bagSpec,
|
||||||
planNo: inventory.planNo,
|
|
||||||
inventBillNo: inventory.inventBillNo,
|
inventBillNo: inventory.inventBillNo,
|
||||||
materialId: inventory.materialId,
|
materialId: inventory.materialId,
|
||||||
storeHouseId: inventory.storeHouseId,
|
storeHouseId: inventory.storeHouseId,
|
||||||
storeAreaId: inventory.storeAreaId,
|
storeAreaId: inventory.storeAreaId,
|
||||||
|
proNo: inventory.proNo,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,7 +353,7 @@ const loadDetailList = async (stockId: number) => {
|
|||||||
storeAreaName: item.storeAreaName, // 库区名称
|
storeAreaName: item.storeAreaName, // 库区名称
|
||||||
unit: item.unit, // 单位
|
unit: item.unit, // 单位
|
||||||
bagSpec: item.bagSpec, // 单袋规格
|
bagSpec: item.bagSpec, // 单袋规格
|
||||||
planNo: item.proNo, // 生产计划号
|
proNo: item.proNo, // 生产计划号
|
||||||
materialId: item.materialId,
|
materialId: item.materialId,
|
||||||
storeHouseId: item.storeHouseId,
|
storeHouseId: item.storeHouseId,
|
||||||
storeAreaId: item.storeAreaId,
|
storeAreaId: item.storeAreaId,
|
||||||
@ -421,6 +433,22 @@ const submitForm = async (action: string) => {
|
|||||||
message.error(`第${i + 1}行退库袋数不能为空`)
|
message.error(`第${i + 1}行退库袋数不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 校验退库数量不能大于库存数量
|
||||||
|
const returnQty = parseFloat(row.operatorQty) || 0
|
||||||
|
const stockQty = parseFloat(row.yardQty) || 0
|
||||||
|
if (returnQty > stockQty) {
|
||||||
|
message.error(`第${i + 1}行退库数量不能大于库存数量`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验退库袋数不能大于库存袋数
|
||||||
|
const returnBagQty = parseInt(row.bagQty) || 0
|
||||||
|
const stockBagQty = parseInt(row.packQty) || 0
|
||||||
|
if (returnBagQty > stockBagQty) {
|
||||||
|
message.error(`第${i + 1}行退库袋数不能大于库存袋数`)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交请求
|
// 提交请求
|
||||||
|
|||||||
@ -273,6 +273,7 @@ const handleSave = () => {
|
|||||||
unit: row.unit,
|
unit: row.unit,
|
||||||
materialId: row.materialId,
|
materialId: row.materialId,
|
||||||
inventBillNo: row.inventBillNo,
|
inventBillNo: row.inventBillNo,
|
||||||
|
proNo: row.proNo,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
emit('select', selectData)
|
emit('select', selectData)
|
||||||
|
|||||||
@ -8,82 +8,41 @@
|
|||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<el-form-item label="仓储id" prop="storeHouseId">
|
<el-form-item label="仓储" prop="storeHouseId">
|
||||||
<el-input
|
<el-select
|
||||||
v-model="queryParams.storeHouseId"
|
v-model="queryParams.storeHouseId"
|
||||||
placeholder="请输入仓储id"
|
placeholder="请选择"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
|
@change="handleStoreHouseChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in storeHouseList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.storeHouseName"
|
||||||
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="库区id" prop="storeAreaId">
|
<el-form-item label="库区" prop="storeAreaId">
|
||||||
<el-input
|
<el-select
|
||||||
v-model="queryParams.storeAreaId"
|
v-model="queryParams.storeAreaId"
|
||||||
placeholder="请输入库区id"
|
placeholder="请选择"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="仓储编码" prop="storeHouseCd">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.storeHouseCd"
|
|
||||||
placeholder="请输入仓储编码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="仓储名称" prop="storeHouseName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.storeHouseName"
|
|
||||||
placeholder="请输入仓储名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库区编码" prop="storeAreCd">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.storeAreCd"
|
|
||||||
placeholder="请输入库区编码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库区名称" prop="storeAreaName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.storeAreaName"
|
|
||||||
placeholder="请输入库区名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="物料id" prop="materialId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.materialId"
|
|
||||||
placeholder="请输入物料id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in storeAreaList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.storeAreaName"
|
||||||
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产品名称" prop="matName">
|
<el-form-item label="产品名称" prop="matName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.matName"
|
v-model="queryParams.matName"
|
||||||
placeholder="请输入产品名称"
|
placeholder="请输入"
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="产品编码" prop="matCode">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.matCode"
|
|
||||||
placeholder="请输入产品编码"
|
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
@ -92,201 +51,43 @@
|
|||||||
<el-form-item label="规格型号" prop="spec">
|
<el-form-item label="规格型号" prop="spec">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.spec"
|
v-model="queryParams.spec"
|
||||||
placeholder="请输入规格型号"
|
placeholder="请输入"
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="单位" prop="unit">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.unit"
|
|
||||||
placeholder="请输入单位"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="批次号" prop="lotNo">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.lotNo"
|
|
||||||
placeholder="请输入批次号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间" prop="createTime">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="queryParams.createTime"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
type="daterange"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库存数量" prop="yardQty">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.yardQty"
|
|
||||||
placeholder="请输入库存数量"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="可用数量" prop="useQty">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.useQty"
|
|
||||||
placeholder="请输入可用数量"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="预占数量" prop="preQty">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.preQty"
|
|
||||||
placeholder="请输入预占数量"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库存单价" prop="price">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.price"
|
|
||||||
placeholder="请输入库存单价"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库存包数" prop="packQty">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.packQty"
|
|
||||||
placeholder="请输入库存包数"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="单袋规格" prop="bagSpec">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.bagSpec"
|
|
||||||
placeholder="请输入单袋规格"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="最早入库日期" prop="earStoreDate">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="queryParams.earStoreDate"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
type="daterange"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="生产计划id" prop="planId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.planId"
|
|
||||||
placeholder="请输入生产计划id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="生产计划号" prop="proNo">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.proNo"
|
|
||||||
placeholder="请输入生产计划号"
|
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button type="primary" @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
@click="openForm('create')"
|
|
||||||
v-hasPermi="['twm:pro-storage-inventory:create']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
@click="handleExport"
|
|
||||||
:loading="exportLoading"
|
|
||||||
v-hasPermi="['twm:pro-storage-inventory:export']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table
|
||||||
<el-table-column label="序号" align="center" type="index" width="60px"/>
|
v-loading="loading"
|
||||||
<el-table-column label="仓储id" align="center" prop="storeHouseId" />
|
:data="list"
|
||||||
<el-table-column label="库区id" align="center" prop="storeAreaId" />
|
:stripe="true"
|
||||||
<el-table-column label="仓储编码" align="center" prop="storeHouseCd" />
|
:show-overflow-tooltip="true"
|
||||||
<el-table-column label="仓储名称" align="center" prop="storeHouseName" />
|
show-summary
|
||||||
<el-table-column label="库区编码" align="center" prop="storeAreCd" />
|
:summary-method="getSummary"
|
||||||
<el-table-column label="库区名称" align="center" prop="storeAreaName" />
|
|
||||||
<el-table-column label="物料id" align="center" prop="materialId" />
|
|
||||||
<el-table-column label="产品名称" align="center" prop="matName" />
|
|
||||||
<el-table-column label="产品编码" align="center" prop="matCode" />
|
|
||||||
<el-table-column label="规格型号" align="center" prop="spec" />
|
|
||||||
<el-table-column label="单位" align="center" prop="unit" />
|
|
||||||
<el-table-column label="批次号" align="center" prop="lotNo" />
|
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
align="center"
|
|
||||||
prop="createTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
|
||||||
/>
|
|
||||||
<el-table-column label="备注" align="center" prop="description" />
|
|
||||||
<el-table-column label="库存数量" align="center" prop="yardQty" />
|
|
||||||
<el-table-column label="可用数量" align="center" prop="useQty" />
|
|
||||||
<el-table-column label="预占数量" align="center" prop="preQty" />
|
|
||||||
<el-table-column label="库存单价" align="center" prop="price" />
|
|
||||||
<el-table-column label="库存包数" align="center" prop="packQty" />
|
|
||||||
<el-table-column label="单袋规格" align="center" prop="bagSpec" />
|
|
||||||
<el-table-column label="最早入库日期" align="center" prop="earStoreDate" />
|
|
||||||
<el-table-column label="生产计划id" align="center" prop="planId" />
|
|
||||||
<el-table-column label="生产计划号" align="center" prop="proNo" />
|
|
||||||
<el-table-column label="操作" align="center">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
@click="openForm('update', scope.row.id)"
|
|
||||||
v-hasPermi="['twm:pro-storage-inventory:update']"
|
|
||||||
>
|
>
|
||||||
编辑
|
<el-table-column label="序号" align="center" type="index" width="60px" fixed="left" />
|
||||||
</el-button>
|
<el-table-column label="仓储" align="center" prop="storeHouseName" min-width="180px" fixed="left" />
|
||||||
<el-button
|
<el-table-column label="库区" align="center" prop="storeAreaName" min-width="180px" fixed="left" />
|
||||||
link
|
<el-table-column label="产品名称" align="center" prop="matName" min-width="180px" fixed="left" />
|
||||||
type="danger"
|
<el-table-column label="规格型号" align="center" prop="spec" min-width="130px" />
|
||||||
@click="handleDelete(scope.row.id)"
|
<el-table-column label="批次号" align="center" prop="lotNo" min-width="140px" />
|
||||||
v-hasPermi="['twm:pro-storage-inventory:delete']"
|
<el-table-column label="检验结果" align="center" prop="checkResult" min-width="100px" />
|
||||||
>
|
<el-table-column label="库存数量" align="center" prop="yardQty" min-width="100px" />
|
||||||
删除
|
<el-table-column label="库存袋数" align="center" prop="packQty" min-width="100px" />
|
||||||
</el-button>
|
<el-table-column label="单袋规格" align="center" prop="bagSpec" min-width="100px" />
|
||||||
</template>
|
<el-table-column label="生产计划号" align="center" prop="proNo" min-width="130px" />
|
||||||
</el-table-column>
|
<el-table-column label="最早入库时间" align="center" prop="earStoreDate" :formatter="dateFormatter2" min-width="150px" />
|
||||||
|
<el-table-column label="单位" align="center" prop="unit" min-width="60px" :formatter="getUnitName" />
|
||||||
|
<el-table-column label="存货账单号" align="center" prop="inventBillNo" min-width="140px" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
@ -296,16 +97,15 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
|
||||||
<ProStorageInventoryForm ref="formRef" @success="getList" @close="handleQuery"/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import download from '@/utils/download'
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
import * as ProStorageInventoryApi from '@/api/biz/prostorageinventory'
|
import * as ProStorageInventoryApi from '@/api/biz/prostorageinventory'
|
||||||
import ProStorageInventoryForm from './ProStorageInventoryForm.vue'
|
import * as StoreHouseApi from '@/api/biz/storehouse'
|
||||||
|
import * as StoreAreaApi from '@/api/biz/storearea'
|
||||||
|
import { getUnitName } from '@/utils/dict'
|
||||||
|
|
||||||
defineOptions({ name: 'ProStorageInventory' })
|
defineOptions({ name: 'ProStorageInventory' })
|
||||||
|
|
||||||
@ -315,35 +115,51 @@ const { t } = useI18n() // 国际化
|
|||||||
const loading = ref(false) // 列表的加载中(默认不加载)
|
const loading = ref(false) // 列表的加载中(默认不加载)
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
storeHouseId: undefined,
|
storeHouseId: undefined,
|
||||||
storeAreaId: undefined,
|
storeAreaId: undefined,
|
||||||
storeHouseCd: undefined,
|
|
||||||
storeHouseName: undefined,
|
|
||||||
storeAreCd: undefined,
|
|
||||||
storeAreaName: undefined,
|
|
||||||
materialId: undefined,
|
|
||||||
matName: undefined,
|
matName: undefined,
|
||||||
matCode: undefined,
|
|
||||||
spec: undefined,
|
spec: undefined,
|
||||||
unit: undefined,
|
|
||||||
lotNo: undefined,
|
|
||||||
createTime: [],
|
|
||||||
description: undefined,
|
|
||||||
yardQty: undefined,
|
|
||||||
useQty: undefined,
|
|
||||||
preQty: undefined,
|
|
||||||
price: undefined,
|
|
||||||
packQty: undefined,
|
|
||||||
bagSpec: undefined,
|
|
||||||
earStoreDate: [],
|
|
||||||
planId: undefined,
|
|
||||||
proNo: undefined,
|
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
|
||||||
|
// 仓储列表
|
||||||
|
const storeHouseList = ref([])
|
||||||
|
// 库区列表
|
||||||
|
const storeAreaList = ref([])
|
||||||
|
|
||||||
|
/** 获取仓储列表 */
|
||||||
|
const getStoreHouseList = async () => {
|
||||||
|
try {
|
||||||
|
const data = await StoreHouseApi.getStoreHouseSelect('3')
|
||||||
|
storeHouseList.value = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取仓储列表失败:', error)
|
||||||
|
storeHouseList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取库区列表 */
|
||||||
|
const getStoreAreaList = async (storeHouseId?: number) => {
|
||||||
|
storeAreaList.value = []
|
||||||
|
if (!storeHouseId) return
|
||||||
|
try {
|
||||||
|
const data = await StoreAreaApi.getStoreAreaSelect(storeHouseId)
|
||||||
|
storeAreaList.value = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取库区列表失败:', error)
|
||||||
|
storeAreaList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 仓储变更时刷新库区列表 */
|
||||||
|
const handleStoreHouseChange = (val) => {
|
||||||
|
queryParams.storeAreaId = undefined
|
||||||
|
getStoreAreaList(val)
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
@ -366,45 +182,35 @@ const handleQuery = () => {
|
|||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value.resetFields()
|
queryFormRef.value.resetFields()
|
||||||
|
queryParams.storeAreaId = undefined
|
||||||
|
storeAreaList.value = []
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 子表汇总方法 */
|
||||||
const formRef = ref()
|
const getSummary = (param) => {
|
||||||
const openForm = (type: string, id?: number) => {
|
const { columns, data } = param
|
||||||
formRef.value.open(type, id)
|
const sums: any[] = []
|
||||||
}
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
/** 删除按钮操作 */
|
sums[index] = '合计'
|
||||||
const handleDelete = async (id: number) => {
|
} else if (column.property === 'yardQty') {
|
||||||
try {
|
const values = data.map(item => Number(item.yardQty) || 0)
|
||||||
// 删除的二次确认
|
const total = values.reduce((prev, curr) => prev + curr, 0)
|
||||||
await message.delConfirm()
|
sums[index] = total.toFixed(2)
|
||||||
// 发起删除
|
} else if (column.property === 'packQty') {
|
||||||
await ProStorageInventoryApi.deleteProStorageInventory(id)
|
const values = data.map(item => Number(item.packQty) || 0)
|
||||||
message.success(t('common.delSuccess'))
|
const total = values.reduce((prev, curr) => prev + curr, 0)
|
||||||
// 刷新列表
|
sums[index] = total
|
||||||
await getList()
|
} else {
|
||||||
} catch {}
|
sums[index] = ''
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
|
||||||
// 导出的二次确认
|
|
||||||
await message.exportConfirm()
|
|
||||||
// 发起导出
|
|
||||||
exportLoading.value = true
|
|
||||||
const data = await ProStorageInventoryApi.exportProStorageInventory(queryParams)
|
|
||||||
download.excel(data, '成品库存.xls')
|
|
||||||
} catch {
|
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
return sums
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 默认不自动查询,需手动点击搜索按钮
|
getStoreHouseList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -217,7 +217,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { dateFormatter, getCurrentMonthRange } from '@/utils/formatTime'
|
import { dateFormatter, getCurrentSimMonthRange } from '@/utils/formatTime'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as PurOrderApi from '@/api/biz/purorder'
|
import * as PurOrderApi from '@/api/biz/purorder'
|
||||||
import * as PurOrderItemApi from '@/api/biz/purorderitem'
|
import * as PurOrderItemApi from '@/api/biz/purorderitem'
|
||||||
@ -241,7 +241,7 @@ const currentRow = ref<any>(null)
|
|||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
purDate: getCurrentMonthRange(),
|
purDate: getCurrentSimMonthRange(),
|
||||||
purStatus: undefined,
|
purStatus: undefined,
|
||||||
purOrdNo: undefined,
|
purOrdNo: undefined,
|
||||||
supplierName: undefined,
|
supplierName: undefined,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user