diff --git a/src/api/api-lock.json b/src/api/api-lock.json index 9dcbb00..165ebf6 100644 --- a/src/api/api-lock.json +++ b/src/api/api-lock.json @@ -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 + } + ] } ] } diff --git a/src/api/material/api.d.ts b/src/api/material/api.d.ts index 3b9584f..24e6443 100644 --- a/src/api/material/api.d.ts +++ b/src/api/material/api.d.ts @@ -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; diff --git a/src/api/material/mods/apply/index.ts b/src/api/material/mods/apply/index.ts index ec97d65..78d2c14 100644 --- a/src/api/material/mods/apply/index.ts +++ b/src/api/material/mods/apply/index.ts @@ -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, }; diff --git a/src/api/material/mods/apply/saveScanData.ts b/src/api/material/mods/apply/saveScanData.ts new file mode 100644 index 0000000..d9a3b3d --- /dev/null +++ b/src/api/material/mods/apply/saveScanData.ts @@ -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, + + success: (data: void) => void = defaultSuccess, + fail: (error: { code: string; error?: string }) => void = defaultError, +): Promise { + return http({ + method: 'post', + url: `/scan-data/${applyId}`, + data: requestBody, + }) + .then((data: AxiosResponse) => { + success(data.data); + }) + .catch((error: { code: string; error?: string }) => fail(error)); +} diff --git a/src/api/material/mods/apply/searchAuditPage.ts b/src/api/material/mods/apply/searchAuditPage.ts index dbedfe2..0d23bc3 100644 --- a/src/api/material/mods/apply/searchAuditPage.ts +++ b/src/api/material/mods/apply/searchAuditPage.ts @@ -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 ( diff --git a/src/views/stock/component/Stocktaking.vue b/src/views/stock/component/Stocktaking.vue new file mode 100644 index 0000000..0c8b3f2 --- /dev/null +++ b/src/views/stock/component/Stocktaking.vue @@ -0,0 +1,27 @@ + + diff --git a/src/views/stock/component/scanForm.vue b/src/views/stock/component/scanForm.vue index 39e076d..5cd0d0c 100644 --- a/src/views/stock/component/scanForm.vue +++ b/src/views/stock/component/scanForm.vue @@ -18,7 +18,7 @@ - + @@ -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 }) diff --git a/src/views/stock/report/stocktakingReport-page.vue b/src/views/stock/report/stocktakingReport-page.vue index 5c377cb..33adfc4 100644 --- a/src/views/stock/report/stocktakingReport-page.vue +++ b/src/views/stock/report/stocktakingReport-page.vue @@ -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 diff --git a/src/views/stock/stocktaking/stocktaking-page.vue b/src/views/stock/stocktaking/stocktaking-page.vue index 8d14056..0cd01a2 100644 --- a/src/views/stock/stocktaking/stocktaking-page.vue +++ b/src/views/stock/stocktaking/stocktaking-page.vue @@ -12,8 +12,9 @@ - 盘点申请 + 申请扫码 + @@ -27,18 +28,31 @@ {{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }} @@ -47,8 +61,14 @@ + + :disabled-fields=disabledFields @ok="doSave" title="扫码盘点" /> + + + + + @@ -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>({ auditType: 'ALL', applicant: userStore.userName, type: 'AUDIT', - applyDate: dayjs()+'', - isConfirm : false, - reviewResult: 'WAIT_CHECK' + applyDate: dayjs() + '', + isConfirm: false, + reviewResult: 'WAIT_SCAN' }) + +//列表数据 const auditPage = ref>() const loading = ref(false) +//新增申请的下拉框选择对象 const materialList = ref>([]) const personList = ref>([]) 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() 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(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) + }) + } + +}; + + + + + + +