🆕 扫码盘点

This commit is contained in:
my_ong 2024-12-08 18:25:26 +08:00
parent d18fbd21e9
commit 6fd544fc02
9 changed files with 403 additions and 71 deletions

View File

@ -3652,20 +3652,30 @@
"description": "审核状态",
"required": false,
"in": "query",
"name": "reviewResult",
"name": "reviewResults",
"dataType": {
"typeArgs": [],
"typeName": "",
"typeArgs": [
{
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'WAIT_SCAN'",
"'WAIT_SUBMIT'",
"'WAIT_REVIEW'",
"'PASS'",
"'REJECT'"
],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'PASS'",
"'UN_PASS'",
"'WAIT_AUDIT'",
"'REJECT'",
"'WAIT_CHECK'"
],
"enum": [],
"typeProperties": []
}
}
@ -3701,6 +3711,62 @@
}
}
]
},
{
"description": "提交盘点扫码数据",
"name": "saveScanData",
"method": "post",
"path": "/scan-data/{applyId}",
"response": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": [
{
"description": "申请单ID",
"required": true,
"in": "path",
"name": "applyId",
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
},
{
"required": true,
"in": "body",
"name": "requestBody",
"dataType": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "StocktakingScanDetail",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
}
]
}
]
},
@ -4274,20 +4340,15 @@
{
"dataType": {
"typeArgs": [],
"typeName": "",
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'NO_ACTION'",
"'IGNORE_AND_SAVE'",
"'REPLENISH'",
"'OTHER'"
],
"enum": [],
"typeProperties": []
},
"name": "handle",
"description": "处理方式(1-无需处理 2-忽略并修改库存 3-补充库存 4-其他)",
"description": "处理摘要",
"required": false
},
{
@ -4339,16 +4400,16 @@
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'WAIT_SCAN'",
"'WAIT_SUBMIT'",
"'WAIT_REVIEW'",
"'PASS'",
"'UN_PASS'",
"'WAIT_AUDIT'",
"'REJECT'",
"'WAIT_CHECK'"
"'REJECT'"
],
"typeProperties": []
},
"name": "reviewResult",
"description": "审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点)",
"description": "审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)",
"required": false
},
{
@ -4561,20 +4622,15 @@
{
"dataType": {
"typeArgs": [],
"typeName": "",
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'NO_ACTION'",
"'IGNORE_AND_SAVE'",
"'REPLENISH'",
"'OTHER'"
],
"enum": [],
"typeProperties": []
},
"name": "handle",
"description": "处理方式(1-无需处理 2-忽略并修改库存 3-补充库存 4-其他)",
"description": "处理摘要",
"required": false
},
{
@ -4650,16 +4706,16 @@
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'WAIT_SCAN'",
"'WAIT_SUBMIT'",
"'WAIT_REVIEW'",
"'PASS'",
"'UN_PASS'",
"'WAIT_AUDIT'",
"'REJECT'",
"'WAIT_CHECK'"
"'REJECT'"
],
"typeProperties": []
},
"name": "reviewResult",
"description": "审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点)",
"description": "审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)",
"required": false
},
{
@ -5232,7 +5288,8 @@
"enum": [
"'IN'",
"'OUT'",
"'OFF'"
"'OFF'",
"'LOST'"
],
"typeProperties": []
},
@ -5254,6 +5311,94 @@
"required": false
}
]
},
{
"description": "扫码盘点明细表(记录历次盘点扫码的数据)",
"name": "StocktakingScanDetail",
"templateArgs": [],
"properties": [
{
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "applyId",
"description": "申请单id",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "barcode",
"description": "条码",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "createdTime",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "id",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "materialId",
"description": "物料ID",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "updatedTime",
"required": false
}
]
}
]
}

View File

@ -85,8 +85,8 @@ declare namespace material {
/** 异常原因 */
exception?: string;
/** 处理方式(1-无需处理 2-忽略并修改库存 3-补充库存 4-其他) */
handle?: 'NO_ACTION' | 'IGNORE_AND_SAVE' | 'REPLENISH' | 'OTHER';
/** 处理摘要 */
handle?: string;
/** id */
id?: number;
@ -97,8 +97,13 @@ declare namespace material {
/** 结果(系统自动生成) */
result?: string;
/** 审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点) */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT_AUDIT' | 'REJECT' | 'WAIT_CHECK';
/** 审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回) */
reviewResult?:
| 'WAIT_SCAN'
| 'WAIT_SUBMIT'
| 'WAIT_REVIEW'
| 'PASS'
| 'REJECT';
/** 盘点审核人 */
reviewer?: string;
@ -146,8 +151,8 @@ declare namespace material {
/** 异常原因 */
exception?: string;
/** 处理方式(1-无需处理 2-忽略并修改库存 3-补充库存 4-其他) */
handle?: 'NO_ACTION' | 'IGNORE_AND_SAVE' | 'REPLENISH' | 'OTHER';
/** 处理摘要 */
handle?: string;
/** id */
id?: number;
@ -161,8 +166,13 @@ declare namespace material {
/** 结果(系统自动生成) */
result?: string;
/** 审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点) */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT_AUDIT' | 'REJECT' | 'WAIT_CHECK';
/** 审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回) */
reviewResult?:
| 'WAIT_SCAN'
| 'WAIT_SUBMIT'
| 'WAIT_REVIEW'
| 'PASS'
| 'REJECT';
/** 盘点审核人 */
reviewer?: string;
@ -232,7 +242,30 @@ declare namespace material {
materialId?: number;
/** 状态 */
status?: 'IN' | 'OUT' | 'OFF';
status?: 'IN' | 'OUT' | 'OFF' | 'LOST';
/** updatedTime */
updatedTime?: string;
}
/**
* ()
*/
export interface StocktakingScanDetail {
/** 申请单id */
applyId?: number;
/** 条码 */
barcode?: string;
/** createdTime */
createdTime?: string;
/** id */
id?: number;
/** 物料ID */
materialId?: number;
/** updatedTime */
updatedTime?: string;

View File

@ -7,6 +7,7 @@ import saveApply from './saveApply';
import detail from './detail';
import searchAuditPage from './searchAuditPage';
import auditApply from './auditApply';
import saveScanData from './saveScanData';
export default {
searchPage,
@ -14,4 +15,5 @@ export default {
detail,
searchAuditPage,
auditApply,
saveScanData,
};

View File

@ -0,0 +1,25 @@
/**
* @desc
*/
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
/** 申请单ID */
applyId: number,
/** 请求体 */
requestBody: Array<material.StocktakingScanDetail>,
success: (data: void) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
return http({
method: 'post',
url: `/scan-data/${applyId}`,
data: requestBody,
})
.then((data: AxiosResponse<void, unknown>) => {
success(data.data);
})
.catch((error: { code: string; error?: string }) => fail(error));
}

View File

@ -16,7 +16,9 @@ export interface Params {
/** 创建日期 */
createDate?: string;
/** 审核状态 */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT_AUDIT' | 'REJECT' | 'WAIT_CHECK';
reviewResults?: Array<
'WAIT_SCAN' | 'WAIT_SUBMIT' | 'WAIT_REVIEW' | 'PASS' | 'REJECT'
>;
}
export default async function (

View File

@ -0,0 +1,27 @@
<template>
<a-row bordered>
<a-col :span="8">
<a-button type="primary" width="90%">开始扫码</a-button>
</a-col>
<a-col :span="8">
</a-col>
<a-col :span="8">
<a-input bordered size="large" ref="snInput" placeholder="输入条形码" style="width: 90%" />
</a-col>
</a-row>
<vxe-table border stripe show-overflow ref="applyDetailTableRef" max-height="500" :column-config="{ resizable: true }"
:keyboard-config="{ isEsc: true }" size="medium">
<vxe-column type="seq" title="序号" width="60"></vxe-column>
<vxe-column field="id" title="物料id" :visible="false"></vxe-column>
<vxe-column field="name" title="物料名称" />
<vxe-column field="code" title="编码" />
<vxe-column field="spec" title="规格" />
<vxe-column field="type" title="类型" />
<vxe-column field="times" title="库存数量" />
<vxe-column field="oprator" title="盘点数量" />
</vxe-table>
</template>
<script setup lang="ts">
</script>

View File

@ -18,7 +18,7 @@
<vxe-column type="seq" title="序号" width="60"></vxe-column>
<vxe-column field="id" title="物料id" :visible="false"></vxe-column>
<vxe-column field="barcode" title="物料条码" :edit-render="{ name: 'input', autoFocus: true, immediate: true }" />
<vxe-column field="barcode" title="物料条码" />
<vxe-column field="name" title="物料名称" />
<vxe-column field="code" title="编码" />
<vxe-column field="spec" title="规格" />
@ -40,14 +40,19 @@ import { api } from '@/api'
import { message } from 'ant-design-vue';
//
defineProps(
const props = defineProps(
{
totalValue: {
type: Number,
default: 0
},
applyId: {
type: Number,
required: false
}
}
)
//
const getTableData = () => {
const $table = applyDetailTableRef.value
@ -61,7 +66,21 @@ const getTableData = () => {
}))
}
}
defineExpose({ getTableData })
//
const getApplyData = () => {
const $table = applyDetailTableRef.value
if ($table) {
return $table.getTableData().fullData.map(item => ({
applyId: props.applyId,
materialId: item.id,
barcode: item.barcode
}))
}}
defineExpose({ getTableData,getApplyData })

View File

@ -53,8 +53,7 @@ const loadData = async (page = 1, size = 10) => {
{
page: page,
size: size,
taker: userStore.userName,
reviewResult: 'WAIT_CHECK',
taker: userStore.userName
}, (data) => {
auditPage.value = data
loading.value = false

View File

@ -12,8 +12,9 @@
<template #icon>
<icon-font type="icon-plus" />
</template>
盘点申请
申请扫码
</a-button>
</a-col>
</a-row>
</template>
@ -27,18 +28,31 @@
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
</template>
<template v-if="column.dataIndex === 'reviewResult'">
<template v-if="record.reviewResult === 'WAIT_CHECK'"> 待盘点</template>
<template v-if="record.reviewResult === 'PASS'"> 通过</template>
<template v-if="record.reviewResult === 'REJECT'"> 拒绝 </template>
<template v-if="record.reviewResult === 'UN_PASS'"> 通过</template>
<template v-if="record.reviewResult === 'WAIT_AUDIT'"> 待审核</template>
<template v-if="record.reviewResult === 'WAIT_SCAN'"> 待扫码</template>
<template v-if="record.reviewResult === 'WAIT_SUBMIT'"> 待提交</template>
<template v-if="record.reviewResult === 'WAIT_REVIEW'"> 待审核 </template>
<template v-if="record.reviewResult === 'PASS'"> 审核通过</template>
<template v-if="record.reviewResult === 'REJECT'"> 退回</template>
</template>
<template v-if="column.dataIndex === 'operation'">
<a-button type="link">
<template #icon>
<a-button type="link" @click="showModal(record.id)" v-if="record.reviewResult === 'WAIT_SCAN'
|| record.reviewResult === 'REJECT'">
<template #icon >
<icon-font type="icon-edit" />
</template>
盘点作业
开始扫码
</a-button>
<a-button type="link" style="margin-left: 10px" v-if="record.reviewResult === 'WAIT_SUBMIT'">
<template #icon>
<icon-font type="icon-plus" />
</template>
生成结果
</a-button>
<a-button type="link" style="margin-left: 10px" v-if="record.reviewResult === 'WAIT_REVIEW'">
<template #icon>
<icon-font type="icon-plus" />
</template>
审核
</a-button>
</template>
</template>
@ -47,8 +61,14 @@
</div>
</page-container>
<!-- 新增申请抽屉 -->
<form-drawer ref="formDrawer" v-model="applyForm" :form-items="items" :config="formConfig"
:disabled-fields=disabledFields @ok="doSave" title="盘点申请" />
:disabled-fields=disabledFields @ok="doSave" title="扫码盘点" />
<!-- 盘点作业弹窗 -->
<a-modal v-model:open="open" title="盘点作业" width="100%" wrap-class-name="full-modal" @ok="handleOk" :confirm-loading="confirmLoading">
<scan-form ref="scanFormRef" :apply-id="applyIdRef" :total-value="88"></scan-form>
</a-modal>
</template>
@ -60,26 +80,32 @@ import { config, formItems } from './form'
import { notification } from 'ant-design-vue'
import dayjs from 'dayjs';
import { useUserStore } from '@/stores/user'
import scanForm from '../component/scanForm.vue'
const searchKey = ref('')
const userStore = useUserStore()
const scanFormRef = ref(); //
const confirmLoading = ref(false) // loading
//
const applyForm = ref<Partial<material.AuditApplyInfo>>({
auditType: 'ALL',
applicant: userStore.userName,
type: 'AUDIT',
applyDate: dayjs()+'',
isConfirm : false,
reviewResult: 'WAIT_CHECK'
applyDate: dayjs() + '',
isConfirm: false,
reviewResult: 'WAIT_SCAN'
})
//
const auditPage = ref<IPage<material.ApplyForm>>()
const loading = ref(false)
//
const materialList = ref<Array<{ value: string | undefined, label: string | undefined }>>([])
const personList = ref<Array<{ value: string | undefined, label: string | undefined }>>([])
const required = ref(false)
//
api.materialApi.material.all((data) => {
materialList.value = data.map(item => {
return {
@ -97,8 +123,7 @@ api.aclApi.user.all((data) => {
})
})
//
const disabledFields = computed(() => {
if (applyForm.value?.auditType !== 'ALL') {
required.value = true
@ -106,7 +131,7 @@ const disabledFields = computed(() => {
return applyForm.value?.auditType === 'ALL' ? ['materials'] : []
})
//
//
const formDrawer = ref<typeof FormDrawer>()
const formConfig = computed(() => {
return config
@ -123,8 +148,7 @@ const loadData = async (page = 1, size = 10) => {
{
page: page,
size: size,
taker: userStore.userName,
reviewResult: 'WAIT_CHECK',
reviewResults: [ 'WAIT_SUBMIT', 'WAIT_SCAN', 'WAIT_REVIEW', 'PASS'],
}, (data) => {
auditPage.value = data
loading.value = false
@ -135,6 +159,11 @@ loadData()
//
const columns = [
{
title: '申请id',
dataIndex: 'id',
visible: false,
},
{
title: '盘点类型',
dataIndex: 'auditType',
@ -179,6 +208,7 @@ const pagination = computed(() => {
}
})
//
const doSave = (_data: material.AuditApplyInfo) => {
api.materialApi.apply.auditApply(_data, () => {
formDrawer.value?.close()
@ -193,4 +223,54 @@ const doSave = (_data: material.AuditApplyInfo) => {
}
//
const open = ref<boolean>(false);
const applyIdRef = ref();
const showModal = (applyId: number) => {
open.value = true;
applyIdRef.value = applyId;
};
//
//
const handleOk = (e: MouseEvent) => {
confirmLoading.value = true;
if(scanFormRef.value){
const data = scanFormRef.value.getApplyData();
api.materialApi.apply.saveScanData(applyIdRef.value, data, () => {
open.value = false;
confirmLoading.value = false;
loadData(1)
})
}
};
</script>
<style lang="less">
.full-modal {
.ant-modal {
max-width: 100%;
top: 0;
padding-bottom: 0;
margin: 0;
}
.ant-modal-content {
display: flex;
flex-direction: column;
height: calc(100vh);
}
.ant-modal-body {
flex: 1;
}
}
</style>