feat(inventory): 新增待审批出入库记录删除及审批状态优化
| | |
| | | }); |
| | | }; |
| | | |
| | | export const batchDeletePendingStockInRecords = (ids) => { |
| | | return request({ |
| | | url: "/stockInRecord/pending", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | }; |
| | | |
| | | // 批量审批入库记录(approvalStatus: approved/rejected) |
| | | export const batchApproveStockInRecords = (data) => { |
| | | return request({ |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 新增入库记录(仅创建记录,不调整库存) |
| | | export const addStockInRecordOnly = (params) => { |
| | | return request({ |
| | | url: "/stockInventory/addStockInRecordOnly", |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | }; |
| | | |
| | | // 新增出库记录(仅创建记录,不调整库存) |
| | | export const addStockOutRecordOnly = (params) => { |
| | | return request({ |
| | | url: "/stockInventory/addStockOutRecordOnly", |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | }; |
| | | |
| | | export const getStockInventoryReportList = (params) => { |
| | | return request({ |
| | | url: "/stockInventory/stockInventoryPage", |
| | |
| | | }); |
| | | } |
| | | |
| | | //删除待审批出库信息 |
| | | export const delPendingStockOut = (ids) => { |
| | | return request({ |
| | | url: "/stockOutRecord/pending", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // 批量审批出库记录(approvalStatus: approved/rejected) |
| | | export const batchApproveStockOutRecords = (data) => { |
| | | return request({ |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 新增入库记录(仅创建记录,不调整库存) |
| | | export const addUnqualifiedStockInRecordOnly = (params) => { |
| | | return request({ |
| | | url: "/stockUninventory/addStockInRecordOnly", |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | }; |
| | | |
| | | // 新增出库记录(仅创建记录,不调整库存) |
| | | export const addUnqualifiedStockOutRecordOnly = (params) => { |
| | | return request({ |
| | | url: "/stockUninventory/addStockOutRecordOnly", |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | }; |
| | | |
| | | // 冻结库存记录 |
| | | export const frozenStockUninventory = (params) => { |
| | | return request({ |
| | |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { |
| | | getStockOutPage, |
| | | delStockOut, |
| | | delPendingStockOut, |
| | | batchApproveStockOutRecords, |
| | | } from "@/api/inventoryManagement/stockOut.js"; |
| | | import { |
| | |
| | | distinguishCancelAndClose: true, |
| | | }) |
| | | .then(() => { |
| | | batchApproveStockOutRecords({ ids, approvalStatus: "通过" }) |
| | | batchApproveStockOutRecords({ ids, approvalStatus: 1 }) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("审批通过成功"); |
| | | getList(); |
| | |
| | | }) |
| | | .catch((action) => { |
| | | if (action === "cancel") { |
| | | batchApproveStockOutRecords({ ids, approvalStatus: "驳回" }) |
| | | batchApproveStockOutRecords({ ids, approvalStatus: 2 }) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("审批驳回成功"); |
| | | getList(); |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delStockOut(ids).then((res) => { |
| | | delPendingStockOut(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }); |
| | |
| | | import {ElMessageBox} from "element-plus"; |
| | | import { |
| | | getStockInRecordListPage, |
| | | batchDeleteStockInRecords, |
| | | batchDeletePendingStockInRecords, |
| | | batchApproveStockInRecords, |
| | | } from "@/api/inventoryManagement/stockInRecord.js"; |
| | | import { |
| | |
| | | distinguishCancelAndClose: true, |
| | | }) |
| | | .then(() => { |
| | | batchApproveStockInRecords({ids, approvalStatus: "通过"}) |
| | | batchApproveStockInRecords({ids, approvalStatus: 1}) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("审批通过成功"); |
| | | getList(); |
| | |
| | | }) |
| | | .catch((action) => { |
| | | if (action === "cancel") { |
| | | batchApproveStockInRecords({ids, approvalStatus: "驳回"}) |
| | | batchApproveStockInRecords({ids, approvalStatus: 2}) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("审批驳回成功"); |
| | | getList(); |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | batchDeleteStockInRecords(ids) |
| | | batchDeletePendingStockInRecords(ids) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | |
| | | <script setup> |
| | | import {ref, computed, watch, getCurrentInstance} from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import {createStockInventory} from "@/api/inventoryManagement/stockInventory.js"; |
| | | import {addStockInRecordOnly} from "@/api/inventoryManagement/stockInventory.js"; |
| | | import {createStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js"; |
| | | |
| | | const props = defineProps({ |
| | |
| | | return; |
| | | } |
| | | if (formState.value.type === 'qualified') { |
| | | createStockInventory(formState.value).then(res => { |
| | | addStockInRecordOnly(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |
| | |
| | | <el-table-column label="最近更新时间" prop="updateTime" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="操作" min-width="90" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="scope.row.unQualifiedUnLockedQuantity === 0 && scope.row.qualifiedUnLockedQuantity === 0">领用</el-button> |
| | | <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="((scope.row.qualifiedUnLockedQuantity || 0) + (scope.row.qualifiedPendingOutQuantity || 0) <= 0) && ((scope.row.unQualifiedUnLockedQuantity || 0) + (scope.row.unQualifiedPendingOutQuantity || 0) <= 0)">领用</el-button> |
| | | <el-button link type="primary" v-if="scope.row.unQualifiedUnLockedQuantity > 0 || scope.row.qualifiedUnLockedQuantity > 0" @click="showFrozenModal(scope.row)">冻结</el-button> |
| | | <el-button link type="primary" v-if="scope.row.qualifiedLockedQuantity > 0 || scope.row.unQualifiedLockedQuantity > 0" @click="showThawModal(scope.row)">解冻</el-button> |
| | | </template> |
| | |
| | | ]" |
| | | > |
| | | <el-select v-model="formState.type" placeholder="请选择库存类型" @change="handleTypeChange"> |
| | | <el-option label="合格库存" value="qualified" :disabled="props.record.qualifiedUnLockedQuantity <= 0" /> |
| | | <el-option label="不合格库存" value="unqualified" :disabled="props.record.unQualifiedUnLockedQuantity <= 0" /> |
| | | <el-option label="合格库存" value="qualified" :disabled="(props.record.qualifiedUnLockedQuantity || 0) + (props.record.qualifiedPendingOutQuantity || 0) <= 0" /> |
| | | <el-option label="不合格库存" value="unqualified" :disabled="(props.record.unQualifiedUnLockedQuantity || 0) + (props.record.unQualifiedPendingOutQuantity || 0) <= 0" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | |
| | | <script setup> |
| | | import {ref, computed, getCurrentInstance} from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import {subtractStockInventory} from "@/api/inventoryManagement/stockInventory.js"; |
| | | import {subtractStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js"; |
| | | import {addStockOutRecordOnly} from "@/api/inventoryManagement/stockInventory.js"; |
| | | import {addUnqualifiedStockOutRecordOnly} from "@/api/inventoryManagement/stockUninventory.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | |
| | | }) |
| | | |
| | | const maxQuality = computed(() => { |
| | | let max = 0; |
| | | if (formState.value.type === 'qualified') { |
| | | max = props.record.qualifiedUnLockedQuantity ? props.record.qualifiedUnLockedQuantity : 0; |
| | | // 合格可出 = 未冻结量 + 待审核出库量(即已申请但尚未审批的数量) |
| | | return Math.max(1, Number(props.record.qualifiedUnLockedQuantity || 0) + Number(props.record.qualifiedPendingOutQuantity || 0)); |
| | | } else { |
| | | max = props.record.unQualifiedUnLockedQuantity ? props.record.unQualifiedUnLockedQuantity : 0; |
| | | return Math.max(1, Number(props.record.unQualifiedUnLockedQuantity || 0) + Number(props.record.unQualifiedPendingOutQuantity || 0)); |
| | | } |
| | | // 确保 max 至少为 1,避免 min > max 的错误 |
| | | return Math.max(max, 1); |
| | | }) |
| | | |
| | | const handleTypeChange = () => { |
| | |
| | | return; |
| | | } |
| | | if (formState.value.type === 'qualified') { |
| | | subtractStockInventory(formState.value).then(res => { |
| | | addStockOutRecordOnly(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |
| | |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | }) |
| | | } else { |
| | | subtractStockUnInventory(formState.value).then(res => { |
| | | addUnqualifiedStockOutRecordOnly(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |